List Info

Thread: video analysis tool




video analysis tool
user name
2006-08-23 17:42:33
hello

I'm working on a computer vision project and I need to
build a video
analysis tool. For the moment, I will have to to a simple
mean-shift
tracker, however it's going to expand a lot.

Anyway, I decided to use gstreamer (both because it looks
the right tool
and because I was advised so by people from vlc-devel!).
Basically, what
I need to do is open an avi or mpeg file (for now, but
possibly a live
stream in the future), step through each frame, do my
analysis on the
image and paint the output over the frame.

My first attempt was to use playbin to do all the dirty
stuff, and then
send "seek" events to step frame by frame:

void MainWindow::on_button_next_frame_clicked()
{
    ...
    gst_element_seek(play, 1.0, GST_FORMAT_DEFAULT, 
                 GstSeekFlags(GST_SEEK_FLAG_FLUSH|
GST_SEEK_FLAG_ACCURATE),
                 GST_SEEK_TYPE_SET, pos+1,
                 GST_SEEK_TYPE_NONE, -1 );
}

However, this code doesn't work: the video position does
not change. So
I tried with

void MainWindow::on_button_next_frame_clicked()
{
    ...
    gst_element_seek(play, 1.0, GST_FORMAT_TIME, 
                     GstSeekFlags(GST_SEEK_FLAG_FLUSH|
GST_SEEK_FLAG_ACCURATE),
                     GST_SEEK_TYPE_SET,
pos+1000*1000*1000/25,
                     GST_SEEK_TYPE_NONE, -1 );
}

But it seeks too fast: every click advances by about 1/12
seconds,
instead of 1/25. (By the way, doing a non-flushing seek
hangs the
application, looks like a deadlock because the CPU is 0%).

Can anyone explain why? Most important, is this the right
approach to
the problem, or shall I write a plugin and put it somewhere
between the
decoding and the displaying elements?

Thank you very much
alberto
-- 
ICQ#: 319420338


------------------------------------------------------------
-------------
Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
gstreamer-devel mailing list
gstreamer-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstream
er-devel
video analysis tool
user name
2006-08-23 18:50:33
Alberto,

I'm also using gstreamer to develop some computer vision routines and my approach is to develop one plugin for each algorithm that I need: background subtraction, edge detection, convolution, morphological operators, etc.

This way I can easily prototype an application using gst-launch and test my plugins.

To create these plugins I've just followed the effectv plugins examples (gst-plugins-good).

---
Fábio Sato


2006/8/23, alberto colombo <gmail.com">albx79gmail.com>:
hello

I'm working on a computer vision project and I need to build a video
analysis tool. For the moment, I will have to to a simple mean-shift
tracker, however it's going to expand a lot.

Anyway, I decided to use gstreamer (both because it looks the right tool
and because I was advised so by people from vlc-devel!). Basically, what
I need to do is open an avi or mpeg file (for now, but possibly a live
stream in the future), step through each frame, do my analysis on the
image and paint the output over the frame.

My first attempt was to use playbin to do all the dirty stuff, and then
send "seek" events to step frame by frame:

void MainWindow::on_button_next_frame_clicked()
{
 &nbsp; &nbsp;...
&nbsp; &nbsp; gst_element_seek(play, 1.0, GST_FORMAT_DEFAULT,
&nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  GstSeekFlags(GST_SEEK_FLAG_FLUSH|
GST_SEEK_FLAG_ACCURATE),
   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; GST_SEEK_TYPE_SET, pos+1,
&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; GST_SEEK_TYPE_NONE, -1 );
}

However, this code doesn't work: the video position does not change. So
I tried with

void MainWindow::on_button_next_frame_clicked()
{
 &nbsp; &nbsp;...
&nbsp; &nbsp; gst_element_seek(play, 1.0, GST_FORMAT_TIME,
&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  GstSeekFlags(GST_SEEK_FLAG_FLUSH|
GST_SEEK_FLAG_ACCURATE),
   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; GST_SEEK_TYPE_SET, pos+1000*1000*1000/25,
 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; GST_SEEK_TYPE_NONE, -1 );
}

But it seeks too fast: every click advances by about 1/12 seconds,
instead of 1/25. (By the way, doing a non-flushing seek hangs the
application, looks like a deadlock because the CPU is 0%).

Can anyone explain why? Most important, is this the right approach to
the problem, or shall I write a plugin and put it somewhere between the
decoding and the displaying elements?

Thank you very much
alberto
--
ICQ#: 319420338


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&amp;kid=120709&bid=263057&dat=121642
_______________________________________________
gstreamer-devel mailing list
lists.sourceforge.net"> gstreamer-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



--
Fábio Sato
video analysis tool
user name
2006-08-24 13:47:18
Fàbio,

I keep having more problems than solutions...

I've done my GstKuTest plugin (attached), using
element_make from
gst-plugin-template, registered it statically, but
gst_element_factory("kutest",
"my_test") returns NULL.

As if it was not enough, I can't get the video-sink:

     GstElement *videosink;
     g_object_get(G_OBJECT(play), "video-sink",
&videosink, NULL);

videosink will always be NULL, no matter the state of play
(which is my
playbin).

As an aside, I'm not receiving GST_MESSAGE_DURATION, but I
solvedby
querying the duration when the pipeline goes into PAUSED
state. 

Can you, or anyone else, help me out?
Thank you very very much
alb

On Wed, 2006-08-23 at 15:50 -0300, Fábio Sato wrote:
> Alberto,
> 
> I'm also using gstreamer to develop some computer
vision routines and
> my approach is to develop one plugin for each algorithm
that I need:
> background subtraction, edge detection, convolution,
morphological
> operators, etc. 
> 
> This way I can easily prototype an application using
gst-launch and
> test my plugins.
> 
> To create these plugins I've just followed the effectv
plugins
> examples (gst-plugins-good).
> 
> ---
> Fábio Sato
> 
> 
> 2006/8/23, alberto colombo <albx79gmail.com>:
>         hello
>         
>         I'm working on a computer vision project and I
need to build a
>         video
>         analysis tool. For the moment, I will have to
to a simple
>         mean-shift
>         tracker, however it's going to expand a lot.
>         
>         Anyway, I decided to use gstreamer (both
because it looks the
>         right tool 
>         and because I was advised so by people from
vlc-devel!).
>         Basically, what
>         I need to do is open an avi or mpeg file (for
now, but
>         possibly a live
>         stream in the future), step through each frame,
do my analysis
>         on the 
>         image and paint the output over the frame.
>         
>         My first attempt was to use playbin to do all
the dirty stuff,
>         and then
>         send "seek" events to step frame by
frame:
>         
>         void MainWindow::on_button_next_frame_clicked()

>         {
>             ...
>             gst_element_seek(play, 1.0,
GST_FORMAT_DEFAULT,
>                         
GstSeekFlags(GST_SEEK_FLAG_FLUSH|
>         GST_SEEK_FLAG_ACCURATE),
>                          GST_SEEK_TYPE_SET, pos+1,
>                          GST_SEEK_TYPE_NONE, -1 ); 
>         }
>         
>         However, this code doesn't work: the video
position does not
>         change. So
>         I tried with
>         
>         void MainWindow::on_button_next_frame_clicked()
>         {
>             ...
>             gst_element_seek(play, 1.0,
GST_FORMAT_TIME, 
>                             
GstSeekFlags(GST_SEEK_FLAG_FLUSH|
>         GST_SEEK_FLAG_ACCURATE),
>                              GST_SEEK_TYPE_SET,
pos+1000*1000*1000/25,
>                              GST_SEEK_TYPE_NONE, -1 );
>         }
>         
>         But it seeks too fast: every click advances by
about 1/12
>         seconds, 
>         instead of 1/25. (By the way, doing a
non-flushing seek hangs
>         the
>         application, looks like a deadlock because the
CPU is 0%).
>         
>         Can anyone explain why? Most important, is this
the right
>         approach to
>         the problem, or shall I write a plugin and put
it somewhere
>         between the 
>         decoding and the displaying elements?
>         
>         Thank you very much
>         alberto
>         --
>         ICQ#: 319420338
>         
>         
>        
------------------------------------------------------------
-------------
>         Using Tomcat but need to do more? Need to
support web
>         services, security? 
>         Get stuff done quickly with pre-integrated
technology to make
>         your job easier
>         Download IBM WebSphere Application Server
v.1.0.1 based on
>         Apache Geronimo
>         http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>         _______________________________________________
>         gstreamer-devel mailing list
>         gstreamer-devellists.sourceforge.net
>         https://lists.sourceforge.net/lists/listinfo/gstream
er-devel
> 
> 
> 
> -- 
> Fábio Sato 
>
------------------------------------------------------------
-------------
> Using Tomcat but need to do more? Need to support web
services, security?
> Get stuff done quickly with pre-integrated technology
to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based
on Apache Geronimo
> http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
gstreamer-devel mailing list gstreamer-devellists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gstream
er-devel
-- 
ICQ#: 319420338
------------------------------------------------------------
-------------
Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&a
mp;kid=120709&bid=263057&dat=121642_________________
______________________________
gstreamer-devel mailing list
gstreamer-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstream
er-devel
video analysis tool
user name
2006-08-25 10:14:54
alberto colombo <albx79gmail.com> (on Thu, 24
Aug 2006 14:47:18 +0100):

  >      GstElement *videosink;
  >      g_object_get(G_OBJECT(play),
"video-sink", &videosink, NULL);
  > 
  > videosink will always be NULL, no matter the state of
play (which is my
  > playbin).

i assume "play" is the pipeline which you have
constructed with parse_launch? you'll need to use
gst_bin_get_by_name, like this (untested):

GstElement *play = gst_parse_launch("fakesrc !
fakesink name=video-sink");
GstElement *videosink = gst_bin_get_by_name( GST_BIN(play),
"video-sink");


apart from that, i'm also doing some computer vision, and
use single elements (plugins) for individual tasks- after
all, the ability to recombine them in different pipelines is
what the beauty of gstreamer is all about.

i invite you to have a look at libwarsaw and warsaw
( http://iterative.org/war
saw/ ), where i've integrated quite some algorithms
from OpenCV. I do the visualization of analysis data with
cairo usually, because it looks nicer, but OpenCV also
provides some drawing routines.

-dan

-- 
http://0xDF.com/
http://iterative.org/

------------------------------------------------------------
-------------
Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
gstreamer-devel mailing list
gstreamer-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstream
er-devel
video analysis tool
user name
2006-08-25 10:14:54
alberto colombo <albx79gmail.com> (on Thu, 24
Aug 2006 14:47:18 +0100):

  >      GstElement *videosink;
  >      g_object_get(G_OBJECT(play),
"video-sink", &videosink, NULL);
  > 
  > videosink will always be NULL, no matter the state of
play (which is my
  > playbin).

i assume "play" is the pipeline which you have
constructed with parse_launch? you'll need to use
gst_bin_get_by_name, like this (untested):

GstElement *play = gst_parse_launch("fakesrc !
fakesink name=video-sink");
GstElement *videosink = gst_bin_get_by_name( GST_BIN(play),
"video-sink");


apart from that, i'm also doing some computer vision, and
use single elements (plugins) for individual tasks- after
all, the ability to recombine them in different pipelines is
what the beauty of gstreamer is all about.

i invite you to have a look at libwarsaw and warsaw
( http://iterative.org/war
saw/ ), where i've integrated quite some algorithms
from OpenCV. I do the visualization of analysis data with
cairo usually, because it looks nicer, but OpenCV also
provides some drawing routines.

-dan

-- 
http://0xDF.com/
http://iterative.org/

------------------------------------------------------------
-------------
Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
gstreamer-devel mailing list
gstreamer-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstream
er-devel
[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )