Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt_Camera crash on Jetson Nano
Qt 6.11 is out! See what's new in the release blog

Qt_Camera crash on Jetson Nano

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
21 Posts 2 Posters 10.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pranav_nc
    wrote on last edited by
    #12

    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();
    }

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #13

      Which Linux distribution are your running on your target ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Pranav_nc
        wrote on last edited by
        #14

        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,

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #15

          What does "uname -a" return ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • P Offline
            P Offline
            Pranav_nc
            wrote on last edited by
            #16

            @SGaist said in Qt_Camera crash on Jetson Nano:

            uname -a
            Linux nanoboard-1 4.9.140-tegra #1 SMP PREEMPT Mon Dec 9 22:47:42 PST 2019 aarch64 aarch64 aarch64 GNU/Linux

            1 Reply Last reply
            0
            • P Offline
              P Offline
              Pranav_nc
              wrote on last edited by Pranav_nc
              #17

              @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/119810

              The example which you pointed here, with that also image file has creating every capture call

              Thanks in Advance,

              1 Reply Last reply
              0
              • P Offline
                P Offline
                Pranav_nc
                wrote on last edited by Pranav_nc
                #18

                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,

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #19

                  Qt uses GStreamer on Linux. If GStreamer has an issue, Qt can't do miracles.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    Pranav_nc
                    wrote on last edited by
                    #20

                    @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,

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #21

                      You said that you had it working the way you wanted with OpenCV. You can easily use it from Qt.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved