Mah*_*yar 9 c c++ camera opencv gstreamer
我正在使用Nitrogen6x板和ov5640相机(mipi).
相机没有使用标准v4l/v4l,但我们可以使用GStreamer为其驱动程序(mfw_v4l)流式传输视频:
gst-launch mfw_v4lsrc ! autovideosink
Run Code Online (Sandbox Code Playgroud)
我想通过GStreamer(OpenCV内部的GStreamer)调用OpenCV中的相机.我在这里问了一个关于在OpenCV中调用GStreamer的问题,这是后续的.
如果我启用了GStreamer支持,则会在源代码中检查它,但OpenCV会尝试使用标准V4L/V4L2作为GStreamer,我想要更改它.有关调用GStreamer的部分位于cap_gstreamer.cpp中:
CvCapture* cvCreateCapture_GStreamer(int type, const char* filename )
{
CvCapture_GStreamer* capture = new CvCapture_GStreamer;
if( capture->open( type, filename ))
return capture;
delete capture;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我想这是我应该以某种方式指向相机驱动程序的部分.("type"这里可能是一个与驱动程序相关的数字(在precomp.hpp中定义),但是什么是"文件名"?)
有关如何通过GStreamer访问相机的任何建议都会有所帮助和赞赏.谢谢!
看起来我们可以使用适当的GStreamer管道调用相机,如下所示:
VideoCapture cap("mfw_v4lsrc ! ffmpegcolorspace ! video/x-raw-rgb ! appsink")
Run Code Online (Sandbox Code Playgroud)
由于摄像机输出为YUV,我们需要将其转换为RGB以将帧传递给OpenCV. 这是OpenCV确保它获得RGB色彩空间的地方.
| 归档时间: |
|
| 查看次数: |
17166 次 |
| 最近记录: |