How to write video frames from VisionWorks to gstreamer pipe

Hello Everybody,

In my project I need to push video frames generated with VisionWorks to a gStreamer pipe. After long reserach I did not find any direct support for it in VisionWorks. I tried to pass via openCV but it fails on error:

— code fragment ---- (I left only relevant lines)

// initialise writer with gstreamer pipeline
cv::VideoWriter writer("appsrc ! … ", 0, (double)30, cv::Size(config.frameWidth, 2*config.frameHeight), true);

// create vx_frame
vx_image bigFrame = vxCreateImage(context,config.frameWidth, config.frameHeight, config.format);

// frame calculation/manipulation

// frame conversion to openCV Mat
cv::Mat bigframe_cv = nvx_cv::VXImageToCVMatMapper(
bigFrame, 0, NULL, VX_READ_AND_WRITE, VX_MEMORY_TYPE_HOST).getMat();

imwrite(“bigframe.png”,bigframe_cv);

writer << bigframe_cv;

— END code fragment ----

this code fails wit a Runtime error:
OpenCV Error: Unsupported format or combination of formats (cvWriteFrame() needs images with depth = IPL_DEPTH_8U and nChannels = 3.) in CvVideoWriter_GStreamer::writerFrame, file /opt/opencv-2.4.13/modules/highgui/src/cap_gstreamer.cpp, line 1564
terminate called after throwing an instance of ‘cv::Exception’
what(): /opt/opencv-2.4.13/modules/highgui/src/cap_gstreamer.cpp:1564: error: (-210) cvWriteFrame() needs images with depth = IPL_DEPTH_8U and nChannels = 3. in function CvVideoWriter_GStreamer::writerFrame

The output through imwrite command is correct.

Can somebody advise how I can push frames to gstreamer pipe ? Ideally that works directly from VisionWorks, but also a fix using openCV will be very appreciated.

I use Tegra TX1 with latest L4T
VisionWorks library info:
VisionWorks version : 1.5.3
OpenVX Standard version : 1.1.0
OpenCV opencv-2.4.13 compiled with gstreamer support

Great thanks for ideas

Robert

Hi,

I bumped into the same issue. Got it working when I converted cv::Mat color space from RGB to BGR.

Instead of:

writer << bigframe_cv;

Try using:

cv::Mat bigframe_cvBGR;
cv::cvtColor(bigframe_cv,bigframe_cvBGR,cv::COLOR_RGB2BGR);
writer << bigframe_cvBGR;

If this does not work, you might want to try different color conversions.

My setup:
Tegra TK1 with latest L4T
VisionWorks version : 1.4.3
OpenVX Standard version : 1.0.1
OpenCV opencv-3.1 compiled with gstreamer support

Hope this helps.

Hi,
Thank you for your help, yes, the color conversion has helped.
Robert

Hello,
I need to push video frames which are produced from visionworks to gstreamer pipeline.

Is there any direct way of the pushing frames to gstreamer pipeline ?
or
has visionworks got a direct relation with gstreamer like cv::VideoWriter ?

I use Tegra Tk1 with latest L4T

VisionWorks version : 1.4 release
OpenVX Standard version : 1.0.1

any help are great!
Thanks,
Oguzhan