c++ - GstBuffer to color Mat -
gstbuffer *gstimagebuffer = gst_app_sink_pull_buffer((gstappsink*)app_data.gst_data.sink); mat matleft = mat(size(width, height),cv_8u, (char*)gst_buffer_data(gstimagebuffer));
i can pull buffer , convert opencv mat object, in grayscale. want pull buffer in color. know stream in color creating same pipeline in terminal. i've searched solution without success. using gstreamer-0.10 , opencv-2.4.10.
finally of post changing cv::mat image copied buffer affects original image can pull buffer in color. size of buffer make sense, 640*360*3.
i had link in different way appsink ffmpegcolorspace element:
gst_element_link_filtered(data->gst_data.converter, data->gst_data.sink, gst_caps_new_simple("video/x-raw-rgb", null))
and when pulling buffer:
gstimagebuffer = gst_app_sink_pull_buffer((gstappsink*)app_data.gst_data.sink); matleft = mat(size(width, height), cv_8uc3, (char*)gst_buffer_data(gstimagebuffer)); cvtcolor(matleft, matleft, cv_rgb2bgr);
Comments
Post a Comment