调用OpenCV内部的Gstreamer [英] Calling Gstreamer inside openCV

查看:230
本文介绍了调用OpenCV内部的Gstreamer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在openCV代码中调用Gstremaer(基本上打开摄像机)。
当我查看源代码时, modules / highgui / src / cap_gstreamer.cpp 似乎是我正在寻找的文件。



我用Gstreamer标志编译OpenCV。

  GStreamer:
- base :YES(ver 1.2.3)
- video:YES(ver 1.2.3)
- app:YES(ver 1.2.3)
- riff:YES .3)
- pbutils:YES(ver 1.2.3)



< m不能调用Gstreamer相关函数(例如 cap_gstreamer.cpp 中定义的 cvCreateCapture_GStreamer
cap_gstreamer.cpp 已成功建立为opencv安装日志建议:

  [17%]构建CXX对象模块/ highgui / CMakeFiles / opencv_highgui.dir / src / cap_gstreamer.cpp.o 


$ b b

cvCreateCapture_GStreamer 也出现在 /usr/local/lib/libopencv_highgui.so.3.0.0 建立openCV
(发现使用 grep



我使用 #include < opencv / highgui.h> 但调用 cvCreateCapture_GStreamer 失败( -lopencv_highgui 设置在Makefile中):

 错误:'cvCapture_GStreamer'未在此范围内声明


非常感谢!


解决方案

实际上,您不能通过OpenCV使用GStreamer API 。什么OpenCV有一系列包装函数(例如 cvCaptureFromCam ),通过外部多媒体库实现它们的功能。例如,除了GStreamer,OpenCV可能使用其他库,如ffmpeg,v4l ..事实上,如果您通过不同的外部库检查与多媒体捕获相关的文件的完整列表,你会发现:

 (在opencv / modules / highgui / src中)
cap_cmu.cpp
cap_dc1394.cpp
cap_ffmpeg.cpp
cap_gstreamer.cpp
...



因此,如果您使用GStreamer支持编译OpenCV,你将调用相同的highgui函数( cvCaptureFromCam ),但是在低级别将调用 cvCreateCapture_GStreamer 它实现对GStreamer API的调用。但这并不意味着你可以调用自己的那些低级函数(因此没有在这个范围内声明错误)。



希望它有帮助!



已完成:
查看 cap.cpp 文件。请注意 CvCreateCameraCapture_XXX 的不同选项。它让我认为你应该能够打开你的相机没有一些依赖(通过使用别人)。


I need to call Gstremaer inside an openCV code (opening a video camera essentially). As I looked through the source code, modules/highgui/src/cap_gstreamer.cpp seems to be the file I'm looking for.

I compiled OpenCV with Gstreamer flag.

 GStreamer:
--       base:                      YES (ver 1.2.3)
--       video:                     YES (ver 1.2.3)
--       app:                       YES (ver 1.2.3)
--       riff:                      YES (ver 1.2.3)
--       pbutils:                   YES (ver 1.2.3)

but I'm not able to call a Gstreamer-related functions (e.g. cvCreateCapture_GStreamer which is defined inside cap_gstreamer.cpp) cap_gstreamer.cpp was built successfully as the opencv install log suggested:

[ 17%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_gstreamer.cpp.o

cvCreateCapture_GStreamer is also present inside /usr/local/lib/libopencv_highgui.so.3.0.0 after building openCV (found that using grep)

I use #include <opencv/highgui.h> but calling cvCreateCapture_GStreamerfails(-lopencv_highgui flag is set inside the Makefile):

error: ‘cvCapture_GStreamer’ was not declared in this scope

Any suggestions would be helpful and greatly appreciated.

Thanks!

解决方案

Actually, you can't use GStreamer API through OpenCV. What OpenCV has is a series of wrapper functions (as, for instance, cvCaptureFromCam) which implement their functionalities through external multimedia libraries. For instance, aside from GStreamer, OpenCV might use other libraries such as ffmpeg, v4l.. in fact, if you check the complete list of files related with multimedia capture through different external libraries you will find:

(in opencv/modules/highgui/src)
cap_cmu.cpp    
cap_dc1394.cpp    
cap_ffmpeg.cpp    
cap_gstreamer.cpp
...

So, if you compile OpenCV with GStreamer support, you will call the same highgui functions (as cvCaptureFromCam) but, at a low level it will be calling functions like cvCreateCapture_GStreamer which implement the calls to the GStreamer API. But it does not mean that you can call yourself to those low-level functions (hence the "was not declared in this scope" error).

Hope that it helps!

EDITED: take a look to the cap.cpp file in the opencv source. Notice the different options for CvCreateCameraCapture_XXX. It makes me think that you should be able to open your camera without some of the dependencies (by using others instead).

这篇关于调用OpenCV内部的Gstreamer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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