Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Error connecting camera via OpenCV

Error connecting camera via OpenCV

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
6 Posts 3 Posters 1.8k 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.
  • M Offline
    M Offline
    mtalha2621
    wrote on last edited by
    #1

    Hi, I am developing a Qt Application on a customized yocto-build OS. The Qt Application is expected to stream live camera feed on to the HDMI connected LCD. Here are some further details of the device and error.

    OS: Linux imx8mminvsom 5.4.47-1.00-inventron-som+gd8c10bbcd #1 SMP PREEMPT Thu May 11 12:56:07 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

    I am reading the image using:
    ```

    VideoCapture cap(0);
    Mat frame = imread("/opt/DSv2/bin/Lab.png");
    
    //    Check if the camera opened successfully
    if (!cap.isOpened()) {
            qDebug() << "Error: Could not open camera";
            cap.release();
    }
    

    ERROR:

    [ WARN:0] global /usr/src/debug/opencv/4.4.0.imx-r0/git/modules/videoio/src/cap_gstreamer.cpp (1760) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Internal data stream error.
    [ WARN:0] global /usr/src/debug/opencv/4.4.0.imx-r0/git/modules/videoio/src/cap_gstreamer.cpp (888) open OpenCV | GStreamer warning: unable to start pipeline
    [ WARN:0] global /usr/src/debug/opencv/4.4.0.imx-r0/git/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
    Error: Could not open camera
    

    Any help regarding solving this issue would be appreciated.

    V 1 Reply Last reply
    0
    • M mtalha2621

      Hi, I am developing a Qt Application on a customized yocto-build OS. The Qt Application is expected to stream live camera feed on to the HDMI connected LCD. Here are some further details of the device and error.

      OS: Linux imx8mminvsom 5.4.47-1.00-inventron-som+gd8c10bbcd #1 SMP PREEMPT Thu May 11 12:56:07 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux

      I am reading the image using:
      ```

      VideoCapture cap(0);
      Mat frame = imread("/opt/DSv2/bin/Lab.png");
      
      //    Check if the camera opened successfully
      if (!cap.isOpened()) {
              qDebug() << "Error: Could not open camera";
              cap.release();
      }
      

      ERROR:

      [ WARN:0] global /usr/src/debug/opencv/4.4.0.imx-r0/git/modules/videoio/src/cap_gstreamer.cpp (1760) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Internal data stream error.
      [ WARN:0] global /usr/src/debug/opencv/4.4.0.imx-r0/git/modules/videoio/src/cap_gstreamer.cpp (888) open OpenCV | GStreamer warning: unable to start pipeline
      [ WARN:0] global /usr/src/debug/opencv/4.4.0.imx-r0/git/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
      Error: Could not open camera
      

      Any help regarding solving this issue would be appreciated.

      V Offline
      V Offline
      Vijaykarthikeyan
      wrote on last edited by
      #2

      @mtalha2621 check the webcam whether it is accessible

      M 1 Reply Last reply
      0
      • V Vijaykarthikeyan

        @mtalha2621 check the webcam whether it is accessible

        M Offline
        M Offline
        mtalha2621
        wrote on last edited by
        #3

        @Vijaykarthikeyan it is not a webcam. It is a MIPI CSI Camera ov5645_mipi

        I have verified the connection of camera via
        timeout -s INT 10s gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1920,height=1080,framerate=30/1' ! waylandsink

        It is working. But I am getting error in capturing via OpenCV in Qt Application

        SGaistS 1 Reply Last reply
        0
        • M mtalha2621

          @Vijaykarthikeyan it is not a webcam. It is a MIPI CSI Camera ov5645_mipi

          I have verified the connection of camera via
          timeout -s INT 10s gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw,width=1920,height=1080,framerate=30/1' ! waylandsink

          It is working. But I am getting error in capturing via OpenCV in Qt Application

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @mtalha2621 you can tell OpenCV to use GStreamer (if the support has been built).

          See this thread on the OpenCV forum.

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

          M 1 Reply Last reply
          0
          • SGaistS SGaist

            @mtalha2621 you can tell OpenCV to use GStreamer (if the support has been built).

            See this thread on the OpenCV forum.

            M Offline
            M Offline
            mtalha2621
            wrote on last edited by
            #5

            @SGaist OpenCV is using GStreamer. As you can see in my question, OpenCV is returning GStreamer error. I have tried multiple pipelines but same result has been found.

            SGaistS 1 Reply Last reply
            0
            • M mtalha2621

              @SGaist OpenCV is using GStreamer. As you can see in my question, OpenCV is returning GStreamer error. I have tried multiple pipelines but same result has been found.

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @mtalha2621 My bad, I misread the error messages. What I had in mind when answering is for you to use your custom pipeline with OpenCV.

              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