<div dir="ltr">You probably want an opencv filter similar to <a href="https://github.com/tripzero/opencvfilter/blob/master/opencvfilter.py">https://github.com/tripzero/opencvfilter/blob/master/opencvfilter.py</a></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jan 13, 2016 at 8:35 PM Zheng <<a href="mailto:superxingzheng@gmail.com">superxingzheng@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I want to stream video which is processed by opencv through network. I have<br>
working codes capturing frames from gstreamer appsink using opencv's<br>
VideoCapture with Gstreamer enabled when building opencv.<br>
But writing opencv Mat frames into gst pipeline seems to be tricky.<br>
Here is a piece of code to show you what I want to do. I hope some one who<br>
has similar experiences can give me some hint. Thanks in advance!<br>
<br>
#include <iostream><br>
#include <iomanip><br>
#include <opencv2/opencv.hpp><br>
<br>
using namespace std;<br>
using namespace cv;<br>
<br>
int main(int argc, char** argv) {<br>
/*<br>
* TODO: figure out a working pipeline.<br>
*/<br>
string test_pipe = "appsrc ! autovideosink";<br>
<br>
VideoCapture cap(0);<br>
if (!cap.isOpened())<br>
return -1;<br>
Mat frame;<br>
<br>
VideoWriter writer(test_pipe, VideoWriter::fourcc('Y', 'U', 'Y', 'V'),<br>
30.0, Size(640, 480), true);<br>
if (!writer.isOpened())<br>
return -1;<br>
<br>
//namedWindow("test", 1);<br>
double t = 0.0;<br>
while(1) {<br>
t = (double)getTickCount();<br>
cap >> frame;<br>
<br>
// TODO: do some process here<br>
<br>
writer << frame;<br>
//imshow("test", frame);<br>
if (waitKey(1) == 27)<br>
break;<br>
t = ((double)getTickCount() - t) / getTickFrequency(); // in millisecond.<br>
cout << "Frame Rate = " << setw(8) << 1.0 / t << " fps" << '\r';<br>
}<br>
return 0;<br>
}<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://gstreamer-devel.966125.n4.nabble.com/How-to-write-OpenCV-frames-into-Gstreamer-pipeline-tp4675258.html" rel="noreferrer" target="_blank">http://gstreamer-devel.966125.n4.nabble.com/How-to-write-OpenCV-frames-into-Gstreamer-pipeline-tp4675258.html</a><br>
Sent from the GStreamer-devel mailing list archive at Nabble.com.<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div>