Error connecting camera via OpenCV
-
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.
-
@mtalha2621 check the webcam whether it is accessible
-
@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' ! waylandsinkIt is working. But I am getting error in capturing via OpenCV in Qt Application
-
@mtalha2621 you can tell OpenCV to use GStreamer (if the support has been built).
See this thread on the OpenCV forum.
-
@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.