gstreamer-devel Digest, Vol 2, Issue 61

wally bkg wb666greene at gmail.com
Thu Apr 7 13:56:09 PDT 2011


On Sat, Mar 26, 2011 at 4:44 AM, <
gstreamer-devel-request at lists.freedesktop.org> wrote:

>
> From: Tiago Katcipis <katcipis at inf.ufsc.br>
> To: Discussion of the development of and with GStreamer <
> gstreamer-devel at lists.freedesktop.org>
> Date: Sat, 26 Mar 2011 01:57:05 -0300
> Subject: Re: Streaming ... images getting with OpenCV
>
> Don't know if it will help you, but i worked together with a friend of mine
> on a simple code that captures video using gstreamer, process the data on
> OpenCV (actually it detects faces and draw an rectangle around them using
> OpenCV Haar features)  and them pushes the processed OpenCV data on another
> pipeline, using appsrc. The code was just a test of how OpenCV Haar works
> and how to integrate it with Gstreamer, so it is a mess (lots of commented
> code and even some commentaries on portuguese)...but maybe it will help you
> :-).
>
>
> http://gitorious.org/ufscwork/works/blobs/master/c++/opencv-haar/opencv-test.cpp
>
> The new_buffer callback should interest you, it basically process a buffer
> coming from a appsink (pipeline1) and them pushes it on appsrc (pipeline2).
>
> Best regards,
> Tiago Katcipis
>
>

Thank you for posting this example.   I'm more interested in the gstreamer
aspects of it than the openCV parts.

To compile it on Ubuntu 10.04 with openCV 2.1 built from a downloaded
tarball (the Ubuntu repos only have openCV-2.0 and it seems broken when
running some examples form the Learning OpenCV book) I had to change the
build command from what you list in the comments to:

g++ -ggdb -Wall $(pkg-config --cflags opencv gstreamer-0.10
gstreamer-app-0.10) -o gst-openCV  gst-openCV.cpp  $(pkg-config --libs
opencv gstreamer-0.10 gstreamer-app-0.10)

Other than a few warnings about guint64 variables not being unsigned long
long types it builds fine.  However, I can't actually run it without the xml
files for the Harr classifer.

Is there some place I can grab them?  (Emailing them to me would also
work).  If this is not possible or practical, could you suggest a simple
openCV image operation with visible effect I could quickly substitute in
your detectAndDraw function?


As I said, I'm not particularly interested in diving into openCV at this
time.  But I installed openCV and bought the book when I learned about its
cvCreateCameraCapture(), cvQueryFrame(), and cvShowImage() functions as a
possible alternate infrastructure during some serious frustrations with
gstreamer and video capture.  Unfortunately performance of the simple
ch2_ex2_9.cpp program from the OpenCV book was horrible so I quickly gave
up.  Curiously, revisiting it to figure out why your build command wasn't
working, I find it runs fine now.  Although ~20% cpu seems pretty high for
what it accomplishes compared to gstreamer's  gst-launch v4l2src !
xvimagesink ~6% . Been a boatload of Ubuntu updates since then!


Might I suggest that putting examples such as this on Google Code or Github
or SourceForge and getting the real gstreamer experts to improve them and
point out potential pitfalls,  would go a long way to making gstreamer much
easier to learn.



If I comment out the call to your detectAndDraw() and the error returns for
the missing xml files, I expected more or less a resized copy of my input
file, but what I got was and empty output file and a bunch of gstreamer
DEBUG messages:

Running...
** (gst-openCV:32262): DEBUG: pipeline:pipeline0 old:NULL new:READY
pending:VOID_PENDING
** (gst-openCV:32262): DEBUG: pipeline:pipeline1 old:NULL new:READY
pending:VOID_PENDING


I assume these are from my test files not being the correct avi format.  I'm
playing around now with changing your pipeline1_str to match one of my
sample files or use playbin2 to try and make it as automatic as possible.


As a practical matter I find the videoscale plug-in to be a real resource
hog (at least when dealing with YUV video) and thus try to avoid it if at
all possible.

If there is interest in setting this up as a "community" sample code I'll
gladly contribute back what I end up with from playing with this sample.

--wally.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110407/716b8c3e/attachment.html>


More information about the gstreamer-devel mailing list