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. QGraphicsView ImageCapture and Video Record Start Hangs Camera Stream
Forum Updated to NodeBB v4.3 + New Features

QGraphicsView ImageCapture and Video Record Start Hangs Camera Stream

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
6 Posts 2 Posters 1.1k 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.
  • N Offline
    N Offline
    nikita.panchal09
    wrote on last edited by
    #1

    Hi,

    I am having iMX6 development kit with CMOS-MIPI-OV5640. The kit is having Debian Stretch 9.5.

    At present, I am trying to Capture Image and Record Video using QT (QCamera with QGraphicsView). I have developed sample code for that and it is working fine with the laptop(ubuntu 16.04) and it's webcam.
    But on IMX6 development kit, It hangs the live stream and crashes with below cases.

    1. While ImageCapture, It hangs after capturing Image
    2. While Record Start, It hangs with mediarecorder->record().

    Please find code related to camera:

    QGraphicsVideoItem *recVideoItem = new QGraphicsVideoItem();
    QGraphicsScene *scene = new QGraphicsScene(this);
    scene->addItem(recVideoItem);
    ui->graphicsView->setScene(scene);

    QCamera *camera = new QCamera(this);
    camera->setViewfinder(recVideoItem);
    camera->setCaptureMode(QCamera::CaptureVideo);

    //Image Capture Initialize
    QCameraImageCapture *imageCapture = new QCameraImageCapture(camera);

    //MediaRecorder Initialize
    QMediaRecorder* mediaRecorder = new QMediaRecorder(camera);
    connect(mediaRecorder, SIGNAL(durationChanged(qint64)),this, SLOT(updateRecordTime()));

    //Start Camera
    ui->graphicsView->show();
    camera->start();

    //Capture Image
    void MainWindow::on_captureImage_clicked() {
    static int count = 0;
    scene->clearSelection();
    scene->setSceneRect(scene->itemsBoundingRect());
    QImage image(scene->sceneRect().size().toSize(), QImage::Format_ARGB32); // Create the image with the exact size of the shrunk scene
    image.fill(Qt::transparent); // Start all pixels transparent

    QPainter painter(&image);
    scene->render(&painter);
    image.save(DATA_STORE_LOCATION"SNAP_"+ QString::number(count) + ".png");
    count++;							 	      //Stops working after this Line
    

    }

    //Start Record
    void MainWindow::StartRecord()
    {
    static int iVideoCount = 0;
    mediaRecorder->setOutputLocation(QUrl::fromLocalFile(DATA_STORE_LOCATION"CLIP_"+ QString::number(iVideoCount)));
    mediaRecorder->record();
    iVideoCount++;
    }

    Looking forward to hearing from you.

    Thank You,
    Nikita Panchal

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

      Hi,

      Where exactly do you write these files on your iMX6 device ?

      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
      • N Offline
        N Offline
        nikita.panchal09
        wrote on last edited by
        #3

        Thanks for your response.

        Yes, I am running an application on the imx6 platform using the root user.
        Location of application is : /home/user/CameraApp
        Location of capturing files is : /root/Pictures

        [FYI]
        I printed the error and I found that on clicking "capture Image (on_captureImage_clicked())", It gives "CameraBin error: Internal data stream error."

        Thanks,
        Nikita

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

          Can you run your capture successfully using GStreamer on your board ?

          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
          • N Offline
            N Offline
            nikita.panchal09
            wrote on last edited by
            #5

            Hi,

            First of all thanks for looking in the issue.

            Yes, I can run capture successfully using below GStreamer command:
            gst-launch-1.0 imxv4l2videosrc num-buffers=1 ! jpegenc ! filesink location=test.jpg

            While looking in issue, I found that capture and record are working fine with QVideoWidget and QCameraViewfinder but hangs with QGraphicsView.

            Thanks,
            Nikita

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

              Out of curiosity, any particular reason to use QGraphicsView ?

              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