Qt_Camera crash on Jetson Nano
-
Hi @SGaist ,
Thanks for you quick reply on this issue .
Here is my observations please kindly check.
Suggested example is working fine on x86 machine, but it comes to hardware platform I still see a segfault and first frame itself the application crash.
Thread 11 "queue5:src" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fa8d74130 (LWP 16081)]
0x0000007fb0170cbc in gst_memory_unmap () from /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
(gdb) bt
#0 0x0000007fb0170cbc in gst_memory_unmap () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#1 0x0000007fa98dc0b8 in () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvjpeg.so
#2 0x0000000000a13910 in ()Example:
mainwindow.cpp:
#include "ui_mainwindow.h"
#include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);QCamera *cam = new QCamera; cam->setCaptureMode(QCamera::CaptureStillImage); QCameraViewfinder *viewfinder = new QCameraViewfinder; viewfinder->show(); QCameraImageCapture *cap = new QCameraImageCapture(cam); cap->setCaptureDestination(QCameraImageCapture::CaptureToBuffer); cam->setViewfinder(viewfinder); QObject::connect(cap, &QCameraImageCapture::imageCaptured, [=] (int id, QImage img) { QByteArray buf; QBuffer buffer(&buf); buffer.open(QIODevice::WriteOnly); img.save(&buffer, "PNG"); }); QObject::connect(cap, &QCameraImageCapture::readyForCaptureChanged, [=] (bool state) { if(state == true) { cam->searchAndLock(); cap->capture(); cam->unlock(); } }); cam->start();
}
MainWindow::~MainWindow()
{
delete ui;
}main.cpp:
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
//w.show();
return a.exec();
} -
Which Linux distribution are your running on your target ?
-
Hi @SGaist ,
I am not sure how to get that details, but from dmesg command I could see below message
Here is my Linux details ,
Linux version 4.9.140-tegra (buildbrain@mobile-u64-2713) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05) ) #1 SMP PREEMPT Mon Dec 9 22:47:42 PST 2019
Thanks in Advance,
-
What does "uname -a" return ?
-
@SGaist ,
One more quick update from end is, now I am able to run the above example without crash. But again I stuck with same core problem where I want to read continuous frames from camera and do process on it.
The crash is happening due to below issue:
https://forums.developer.nvidia.com/t/mjpeg-patch-makes-jpegdec-segfault/119810The example which you pointed here, with that also image file has creating every capture call
Thanks in Advance,
-
Hi @SGaist ,
As per my understanding right, reading frame from camera is very basic operation any one can expect from QT camera API.
From one week I am working on this and I feel so difficult for reading frame using QCamera API.
I have been working with OpenCV its so straightforward
Looks like am I missing something ? Please kindly help on this.Thanks in Advance,
-
Qt uses GStreamer on Linux. If GStreamer has an issue, Qt can't do miracles.
-
@SGaist ,
Thanks for the information, is there any API by which I can access the Qimage other than capture API?
Because capture is doing both the things in my case, file saving and filling same data into Qimage object.
As we know right performance and memory consumption will affect due to file writes.Thanks in advance,
-
You said that you had it working the way you wanted with OpenCV. You can easily use it from Qt.