在OpenCV中使用自定义相机(通过GStreamer的) [英] Using custom camera in OpenCV (via GStreamer)

查看:5085
本文介绍了在OpenCV中使用自定义相机(通过GStreamer的)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Nitrogen6x板ov5640摄像头(MIPI)。

I'm using Nitrogen6x board with ov5640 camera(mipi).

相机没有使用标准的V4L / V4L,但我们可以利用的GStreamer其驱动程序(mfw_v4l)视频流:

The camera is not using standard v4l/v4l, but we can stream video using GStreamer for its driver (mfw_v4l):

gst-launch mfw_v4lsrc ! autovideosink

我想通过通过的GStreamer(GStreamer的内部OpenCV的)调用它使用在OpenCV的摄像头。
我问一个问题有关调用的GStreamer OpenCV的里面这里,这就是跟进。

如果启用GStreamer的支持,它的检查源code ,但OpenCV的尝试使用标准的V4L / V4L2的GStreamer的,我要改变。
有关调用的GStreamer的部分是<一个href=\"https://github.com/Itseez/opencv/blob/2.4/modules/highgui/src/cap_gstreamer.cpp#L768\">cap_gstreamer.cpp:

If I enable GStreamer support, it's checked in the source code, but OpenCV tries to use standard V4L/V4L2 for GStreamer which I want to change. The section about calling GStreamer is in 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;
}

我想这是我应该努力以某种方式指向相机的驱动程序部分。 (式这里可能是(与驱动器作为precomp.hpp定义一个数字),但什么是文件名?)

I guess this is the section I should work on to somehow point to the camera's driver. ("type" here probably is a number related to the driver(as defined in precomp.hpp), but what's the "filename"?)

有关如何通过GStreamer的访问摄像头将是有益的和AP preciated任何建议。
谢谢!

Any suggestions about how to access the camera via GStreamer would be helpful and appreciated. Thanks!

推荐答案

看起来我们可以通过适当的管道的GStreamer像下面调用摄像头:

Looks like we can call the camera using a proper GStreamer pipeline like below:

VideoCapture cap("mfw_v4lsrc ! ffmpegcolorspace ! video/x-raw-rgb ! appsink")

作为摄像机输出是YUV,我们需要将其转换成RGB到帧传递给OpenCV的。
是哪里的OpenCV确保它得到RGB色彩。

as the camera output is in YUV, we need to convert that to RGB to pass the frames to OpenCV. This is where OpenCV makes sure it gets RGB colorspace.

这篇关于在OpenCV中使用自定义相机(通过GStreamer的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆