gpt4 book ai didi

c++ - 使用 OpenCV 访问相机(通过 GStreamer)

转载 作者:太空狗 更新时间:2023-10-29 20:53:06 27 4
gpt4 key购买 nike

我正在尝试开发一个应用程序来分析来自 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.0OpenCV版本:3.2

我在这里缺少的是什么?还是我的做法不对?

最佳答案

这是我的问题的答案(在@Alper Kucukkomurler 的帮助下)

您可以通过 OpenCV(使用 GStreamer)使用

VideoCapture cap("imxv4l2videosrc device=\"/dev/video0\" ! videoconvert ! appsink");

此外,如果您想更改输入的分辨率,可以使用 imx-capture-mode 参数,该参数属于 imxv4l2videosrc 元素。例如,

imxv4l2videosrc imx-capture-mode=5 ! <other elements>

关于c++ - 使用 OpenCV 访问相机(通过 GStreamer),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43803512/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com