Quantcast

On writing GStreamer plugins for OpenCV video surveillance facility

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

On writing GStreamer plugins for OpenCV video surveillance facility

Giorgio Buffa-2
Hello all,
I'd like to write a detection pipeline, i.e. a pipeline which does automated video-surveillance (motion detection, object classification, tracking, and so on).
 
I think GStreamer could help me a lot: I need only to write some plugins that encapsulate the algorithms for automated video-surveillance.

I've already read several documents:
    * GStreamer Application Development Manual
    * GStreamer Plugins Writer's Guide
    * Gstreamer Core Design Documentation
    * GObject Reference Manual
and I've made some test.

Now my problem: I would like to use the video-surveillance algorithms provided by OpenCV, which is a library for Computer Vision. The library is mostly written in C, except for the part I need for, which is in C++.

OpenCV defines several C++ classes which do the job I need, but I don't know how to use them in my plugin: for my understanding, the plugin has to be written in the C programming language. Can I write a C++ plugin? How?

I read I can use some sort of wrapping techniques to use C++ classes in C code (newer tried), but the C++ classes I need for use hierarchy and virtual methods (I think it is a problem, isn't it? Maybe I can do the magic whit GObject).

Can anybody help me? Do you have some hint / useful link?

Thanks a lot.
Best regards,
Giorgio Buffa

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: On writing GStreamer plugins for OpenCV video surveillance facility

Andrey Nechypurenko-2
Hi,

> Can anybody help me? Do you have some hint / useful link?

The following link could be found on the first page google gives for
"opncv gstreamer plugin" search:
http://github.com/Elleo/gst-opencv

HTH,
Andrey.

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: On writing GStreamer plugins for OpenCV video surveillance facility

Andrey Nechypurenko-2
In reply to this post by Giorgio Buffa-2
Hi,

> Can anybody help me? Do you have some hint / useful link?

The following link could be found on the first page google gives for
"opncv gstreamer plugin" search:
http://github.com/Elleo/gst-opencv

HTH,
Andrey.

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: On writing GStreamer plugins for OpenCV video surveillance facility

Giorgio Buffa-2
Hi Andrey.
Thanks for your support, but it doesn't solve my problem  :(

I've already worked with gst-opencv project. Plugins defined in gst-opencv wraps some of the C APIs of OpenCV. I need to work with some OpenCV's C++ APIs and classes that do not have a C correspondence (and are documented at all, but this is a different problem).

Kind regards,
Giorgio Buffa

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: On writing GStreamer plugins for OpenCV video surveillance facility

Andrey Nechypurenko-2
Hi Giorgio,

> I've already worked with gst-opencv project. Plugins defined in gst-opencv
> wraps some of the C APIs of OpenCV. I need to work with some OpenCV's C++
> APIs and classes that do not have a C correspondence (and are documented at
> all, but this is a different problem).

AFAIK, there should not be any problems mixing C/C++ with gstreamer.
It just a matter of adding ' extern "C" ' in the proper places :-) .

I did not try it myself but I think it should be possible to compile
whole plugin with C++ but declare functions expected by gstreamer
infrastructure as extern "C". As alternative (and I preffere this
way), it should be possible to define C-style interface to your C++
algorithms and invoke it where appropriate. For example:

extern "C" void MyMegaProcessingFunction(...)
{
  OpenCVClassA a;
  a.doSomething();
}

and compile it with C++. Then, for in other file compiled with C:

gst_your_plugin_chain(GstPad * pad, GstBuffer * buf)
{
  MyMegaProcessingFunction(buf)
}

Once again, this is just my thoughs and I did not test it. Maybe there
are some other problems which I did not realize. You are welcome to
try it and tell whether it works ;-) .


Regards,
Andrey.

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: On writing GStreamer plugins for OpenCV video surveillance facility

Giorgio Buffa-2
Hi Andrey, your suggestion solved my problem, thanks!!! :) I've renamed my plugin to "gstmyplugin.cc" and I've added the following lines to Makefile.am:
libgstmyplugin_la_CXXFLAGS = $(GST_CFLAGS) `pkg-config --cflags opencv`
libgstmyplugin_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(GSTCTRL_LIBS)
libgstmyplugin_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) `pkg-config --libs opencv`
libgstmyplugin_la_LIBTOOLFLAGS = --tag=disable-static

# headers we need but don't want installed
noinst_HEADERS =
I didn't need for any extern "C" declaration (that's a surprise). Best regards, Giorgio Buffa
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: On writing GStreamer plugins for OpenCV video surveillance facility

Andrey Nechypurenko-2
Hi Giorgio,

> I didn't need for any extern "C" declaration (that's a surprise).

It surprises me too. Did you already try your plugin in the pipleline?

Regards,
Andrey.

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: On writing GStreamer plugins for OpenCV video surveillance facility

Giorgio Buffa-2
Hi Andrey,
Yes, I've already tried the plugin in the pipeline.

It is very simple, but it works.

Regards,
Giorgio
Loading...