开发者

Add some OpenCV processing to a gstreamer video stream

开发者 https://www.devze.com 2023-02-03 23:14 出处:网络
I\'m trying to have OpenCV process a frame in the middle of a gstreamer pipe. I have one gstreamer pipe generating the stream, sending it to appsink for OpenCV code to receive:

I'm trying to have OpenCV process a frame in the middle of a gstreamer pipe.

I have one gstreamer pipe generating the stream, sending it to appsink for OpenCV code to receive:

v4l2src ! ffmpegcolorspace ! jpegenc ! appsink name=sink

And another pipe getting it from appsrc (to which OpenCV sends data) and outputting it on the screen:

appsrc name=src ! jpegdec ! xvimagesink

I open every frame with a pull-buffer 开发者_StackOverflowrequest on sink and process it with OpenCV, then use push-buffer on src. I am doing all that in Python.

For some reason, that does not seem to work (segmentation fault).

But I'm not really trying to fix it; it's terribly inefficient anyway. I am just wondering whether there any better way to have OpenCV process the frame before it reaches an output sink?


Did you try gst-opencv? It supplies several opencv primitives as gstreamer plugins.

EDIT: Seems like it's merged into gst-plugins-bad, and the link above is outdated.


I know some years have passed since your original question, but just for the record, OpenCv can open Gstreamer pipelines directly. See the (self-)answer in Using custom camera in OpenCV (via GStreamer) for an example.

And, by the way, OpenCv 3.0 (master branch) actually integrates gstreamer 1.0 support.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号