我正在尝试开发一个应用程序来分析来自MIPI摄像机(5MP)的视频流。所以我正在使用gstreamer来使用OpenCV来获取视频供稿。我尝试了以下管道,它正在运行:
imxv4l2videosrc device="/dev/video0" ! autovideosink
但是当我尝试将它与OpenCV一起使用时,它会产生一些错误。
VideoCapture cap("imxv4l2videosrc device=\"/dev/video0\" ! autovideosink");
OpenCV Error: Unspecified error (GStreamer: cannot find appsink in manual pipeline
) in cvCaptureFromCAM_GStreamer, file /root/OpenCV/opencv/modules/videoio/src/cap_gstreamer.cpp, line 759
VIDEOIO(cvCreateCapture_GStreamer (CV_CAP_GSTREAMER_FILE, filename)): raised OpenCV exception:
/root/OpenCV/opencv/modules/videoio/src/cap_gstreamer.cpp:759: error: (-2) GStreamer: cannot find appsink in manual pipeline
in function cvCaptureFromCAM_GStreamer
然后我尝试使用以下管道,它也不能正常工作:
VideoCapture cap("imxv4l2videosrc device=\"/dev/video0\" ! appsink");
ERROR: unrecognized std! 0 (PAL=ff, NTSC=b000
ERROR: v4l2 capture: unsupported ioctrl!
GStreamer Plugin: Embedded video playback halted; module imxv4l2videosrc0 reported: Internal data flow error.
ERROR: v4l2 capture: unsupported ioctrl!
OpenCV Error: Unspecified error (GStreamer: unable to start pipeline
) in cvCaptureFromCAM_GStreamer, file /root/OpenCV/opencv/modules/videoio/src/cap_gstreamer.cpp, line 832
VIDEOIO(cvCreateCapture_GStreamer (CV_CAP_GSTREAMER_FILE, filename)): raised OpenCV exception:
/root/OpenCV/opencv/modules/videoio/src/cap_gstreamer.cpp:832: error: (-2) GStreamer: unable to start pipeline
in function cvCaptureFromCAM_GStreamer
GStreamer版本:1.0 OpenCV版本:3.2
我在这里失踪的是什么? 或者我的方法是错的?
答案 0 :(得分:4)
以下是我的问题的答案(使用@Alper Kucukkomurler的帮助)
您可以通过OpenCV(使用GStreamer)和
访问MIPI相机VideoCapture cap("imxv4l2videosrc device=\"/dev/video0\" ! videoconvert ! appsink");
此外,如果要更改输入的分辨率,可以使用imx-capture-mode
参数,该参数为imxv4l2videosrc
元素。
例如,
imxv4l2videosrc imx-capture-mode=5 ! <other elements>