plugin writing: base class for format conversion

Guennadi Liakhovetski g.liakhovetski at gmx.de
Sun Jul 18 11:09:55 UTC 2021


On Sat, 17 Jul 2021, Michael Gruner wrote:

> The default is to only allow the same format. You need to reimplement
> the transform_caps virtual method in order to change the format. (note
> that transform_caps is a basetransform method).

Great, this works! Thanks very much! I've got a colour-coded image now.
Ideally - if not too much work - I'd also like to get numeric temperature
information like on the side bar in the GIF on
https://github.com/makerportal/raspi-thermal-cam or maybe in an additional
in-frame metadata channel. I found a discussion here
https://developer.ridgerun.com/wiki/index.php/GStreamer_and_in-band_metadata
but that doesn't seem to have made it to the mainline. I guess the most
user-friendly would be adding a side bar like in the former link. It
should be possible to extend the width of the image and overlay that kind
of information, right?

Thanks
Guennadi

> > On 17 Jul 2021, at 13:50, Guennadi Liakhovetski <g.liakhovetski at gmx.de> wrote:
> >
> > Hi Michael,
> >
> >> On Sat, 17 Jul 2021, Michael Gruner wrote:
> >>
> >> Hi Guennadi
> >>
> >> The videoconvert element can already handle this conversion for you:
> >>
> >> gst-launch-1.0 v4l2src ! videoconvert ! video/x-raw,format=RGB ! …
> >
> > Yes, I know about videoconvert, but I need to do some special processing
> > of thermal data. For the algorithms to work I have to access the raw data,
> > which is output by the v4l2 driver in GRAY16_BE format (1-to-1 from the
> > camera), and I want to transform that to a colour gradient similar to well
> > known thermal images, so my plugin cannot just stay within GRAY16_BE and
> > use videoconvert to convert that to RGB - you'd just get a gray image of
> > course.
> >
> >> If you, for other reason, need to write your own element, you probably
> >> want to use the videofilter base class. It’s a specialization of the
> >> basetransform class for video. The important virtual method for you to
> >> implement is “transform_caps”, that will allow you to specify the input
> >> and output caps respectively.
> >
> > The videofilter class is "allowed" to convert between formats? I thought
> > it would be, so I actually tried it. But I was unable to get it to input
> > and output different formats. I was only able to get it to work with the
> > same format. Are you sure that is supposed to work?
> >
> > Thanks
> > Guennadi
> >
> >> Michael
> >>
> >>>> On 17 Jul 2021, at 05:05, Guennadi Liakhovetski via gstreamer-devel <gstreamer-devel at lists.freedesktop.org> wrote:
> >>>
> >>> Hi,
> >>>
> >>> I'm trying to write a plugin to convert data from a thermal camera. It
> >>> should take data from the v4l2src source in GRAY16_BE format and convert
> >>> it to an RGB video output. I'm looking at gst-element-maker but I'm not
> >>> finding any suitable base class that would take video/x-raw as input and
> >>> generate the same as output and would convert between format. Do I have to
> >>> write a plugin from scratch? Or should I use basetransform? Any tutorials
> >>> for that?
> >>>
> >>> Thanks
> >>> Guennadi
> >>> _______________________________________________
> >>> gstreamer-devel mailing list
> >>> gstreamer-devel at lists.freedesktop.org
> >>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> >>
>


More information about the gstreamer-devel mailing list