Frei0r perspective filter usage

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Frei0r perspective filter usage

josvanr
Hello!

I'm trying to de-perspective the images from my webcam with the frei0r perspective filter. I'm
trying this:

gst-launch -v v4l2src device=/dev/webcam1 ! video/x-raw-yuv,width=1600,height=1200 !  ffmpegcolorspace !  frei0r-filter-perspective, top-left-X=0, top-left-Y=0, top-right-X=0.1, top-right-Y=0.1, bottom-left-X=0.2, bottom-left-Y=1, bottom-right-X=0.8, bottom-right-Y=1 ! ffmpegcolorspace ! xvimagesink

There are no error massages, but there doesn't seem to be any perspectiving going on. I'm not
sure this is the way to invoke the filter. How do I find out how to do that? I can remember
looking at the sources a couple of years ago and thats how i came up with these parameters.
But not sure if this is correct.....

Jos

Reply | Threaded
Open this post in threaded view
|

Re: Frei0r perspective filter usage

Antonio Ospite-2
On Wed, 1 Feb 2017 14:27:54 -0800 (PST)
josvanr <[hidden email]> wrote:

> Hello!
>

Hi,

> I'm trying to de-perspective the images from my webcam with the frei0r
> perspective filter. I'm trying this:
>
> gst-launch -v v4l2src device=/dev/webcam1
> !  video/x-raw-yuv,width=1600,height=1200 !  ffmpegcolorspace
> !  frei0r-filter-perspective, top-left-X=0, top-left-Y=0,
> top-right-X=0.1, top-right-Y=0.1, bottom-left-X=0.2, bottom-left-Y=1,
> bottom-right-X=0.8, bottom-right-Y=1 ! ffmpegcolorspace ! xvimagesink
>

Apart from the fact that you should really update to GStreamer 1.x,
there are a couple of issues in the pipeline:

 1. extra commas in the part referring to the frei0r-filter-perspective
    element and its properties, remove them;

 2. the X properties apparently need to be spelled with a lower case 'x'
    (e.g. top-left-x instead of top-left-X and so on), not sure why this
    is tho.

> There are no error massages, but there doesn't seem to be any
> perspectiving going on.

gst-launch-1.0 does give errors, update if you can.

> I'm not sure this is the way to invoke the filter. How do I find out
> how to do that?

gst-inspect-1.0 frei0r-filter-perspective

> I can remember looking at the sources a couple of years ago and thats
> how i came up with these parameters.  But not sure if this is
> correct.....

This pipeline seems to work here:

  gst-launch-1.0 -v \
    videotestsrc ! \
    videoconvert ! \
    frei0r-filter-perspective \
      top-left-x=0 \
      top-left-Y=0 \
      top-right-x=0.1 \
      top-right-Y=0.1 \
      bottom-left-x=0.2 \
      bottom-left-Y=1 \
      bottom-right-x=0.8 \
      bottom-right-Y=1 ! \
    videoconvert ! \
    autovideosink

and BTW there is also a standard "perspective" element in GStreamer 1.x
which accepts a "matrix" property, IIRC it can only be set via source
code and not via gst-launch-1.0 but it's a more convenient form if you
are reusing a perspective matrix created by some other means (e.g.
OpenCV), check out "gst-inspect-1.0 perspective", and
https://git.ao2.it/experiments/gstreamer.git/blob/HEAD:/c/gst-perspective-example/gst-perspective-example.c

Ciao ciao,
   Antonio

--
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Frei0r perspective filter usage

Jos van Riswick
Thnx! these were the eye openers I was looking for :)

I updated gstreamer and found the wonky use of capitals and lowercase
x-es and Y-s with gst-inspect-1.0 and it works ! Oh and you even
quoted the entire working chain haha I should read ahead next time :)

Ok I'll check out this standard perspective, but it doesn't seem to pop up:

gst-inspect-1.0 perspective
No such element or plugin 'perspective'


or you meant one has to turn this on manually when compiling?

Jos

On Thu, Feb 2, 2017 at 8:47 AM, Antonio Ospite <[hidden email]> wrote:
On Wed, 1 Feb 2017 14:27:54 -0800 (PST)
josvanr <[hidden email]> wrote:

> Hello!
>

Hi,

> I'm trying to de-perspective the images from my webcam with the frei0r
> perspective filter. I'm trying this:
>
> gst-launch -v v4l2src device=/dev/webcam1
> !  video/x-raw-yuv,width=1600,height=1200 !  ffmpegcolorspace
> !  frei0r-filter-perspective, top-left-X=0, top-left-Y=0,
> top-right-X=0.1, top-right-Y=0.1, bottom-left-X=0.2, bottom-left-Y=1,
> bottom-right-X=0.8, bottom-right-Y=1 ! ffmpegcolorspace ! xvimagesink
>

Apart from the fact that you should really update to GStreamer 1.x,
there are a couple of issues in the pipeline:

 1. extra commas in the part referring to the frei0r-filter-perspective
    element and its properties, remove them;

 2. the X properties apparently need to be spelled with a lower case 'x'
    (e.g. top-left-x instead of top-left-X and so on), not sure why this
    is tho.

> There are no error massages, but there doesn't seem to be any
> perspectiving going on.

gst-launch-1.0 does give errors, update if you can.

> I'm not sure this is the way to invoke the filter. How do I find out
> how to do that?

gst-inspect-1.0 frei0r-filter-perspective

> I can remember looking at the sources a couple of years ago and thats
> how i came up with these parameters.  But not sure if this is
> correct.....

This pipeline seems to work here:

  gst-launch-1.0 -v \
    videotestsrc ! \
    videoconvert ! \
    frei0r-filter-perspective \
      top-left-x=0 \
      top-left-Y=0 \
      top-right-x=0.1 \
      top-right-Y=0.1 \
      bottom-left-x=0.2 \
      bottom-left-Y=1 \
      bottom-right-x=0.8 \
      bottom-right-Y=1 ! \
    videoconvert ! \
    autovideosink

and BTW there is also a standard "perspective" element in GStreamer 1.x
which accepts a "matrix" property, IIRC it can only be set via source
code and not via gst-launch-1.0 but it's a more convenient form if you
are reusing a perspective matrix created by some other means (e.g.
OpenCV), check out "gst-inspect-1.0 perspective", and
https://git.ao2.it/experiments/gstreamer.git/blob/HEAD:/c/gst-perspective-example/gst-perspective-example.c

Ciao ciao,
   Antonio

--
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Frei0r perspective filter usage

Antonio Ospite-2
On Thu, 2 Feb 2017 11:04:10 +0100
Jos van Riswick <[hidden email]> wrote:

> Thnx! these were the eye openers I was looking for :)
>
> I updated gstreamer and found the wonky use of capitals and lowercase
> x-es and Y-s with gst-inspect-1.0 and it works ! Oh and you even
> quoted the entire working chain haha I should read ahead next time :)
>

And try to avoid top-posting? :)

> Ok I'll check out this standard perspective, but it doesn't seem to pop up:
>
> gst-inspect-1.0 perspective
> No such element or plugin 'perspective'
>

It's in gst-plugins-bad in recent 1.x versions, as part of
geometrictransform; what GStreamer 1.x version do you have?

> or you meant one has to turn this on manually when compiling?

Not sure, and you should already have gst-plugins-bad, the frei0r
filters are there too.

Ciao ciao,
   Antonio

P.S. I like your paintings, especially the ones with the twirling
clementine peels.

--
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel