Quantcast

Adding a second sink and source pad to GstOpenCVVideoFilter/GstBaseTransform

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Adding a second sink and source pad to GstOpenCVVideoFilter/GstBaseTransform

Ryan Talbot
Hi list,

I'm in the process of writing a plugin to wrap OpenCV's stereo rectification functionality.  Right now, it works by loading camera intrinsic/extrinsic files specified as plugin properties, and setting up the undistortion maps from stereoRectify() and initUndistortRectifyMap() on the GST_EVENT_CAPS event.  The transform function then calls remap() with the appropriate matrices to perform the rectification on the incoming buffer and sending it on down the pipeline. 

To handle the two camera channels, I have another plugin parameter called cameraIndex that determines which set of maps are used for the remap() call.  So, roughly, the pipeline looks like this:

gst-launch-1.0 -vvv videomixer name=mix sink_0::xpos=0 sink_1::xpos=320 ! queue ! videoconvert ! x264enc speed-preset=superfast ! mp4mux ! filesink location=stereo-cams-rectified.mp4 v4l2src num-buffers=100 device=/dev/video0 ! video/x-raw,format=YUY2,width=320,height=240,framerate=30/1 ! videoconvert ! cvstereorectify intrinsics-file=intrinsics.yml extrinsics-file=extrinsics.yml camera-index=2 ! mix.sink_0 v4l2src num-buffers=100 device=/dev/video1 ! video/x-raw,format=YUY2,width=320,height=240,framerate=30/1 ! videoconvert ! cvstereorectify intrinsics-file=intrinsics.yml extrinsics-file=extrinsics.yml camera-index=1 ! mix.sink_1

Ideally, though, I feel like the cvstereorectify plugin should have a left and right sink pad, as well as left and right source pads, so that there would only be one in the pipeline.  GstOpenCVVideoFilter/GstBaseTransform seem fairly solidly geared to only support one source and sink, though.  Any advice on the least-hack-y route to take to integrate the extra pads?

Thanks!
Ryan

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Loading...