Reduce to 2 colors only (black+white) based on threshhold (x-raw GRAY8 format)?

Nicolas Dufresne nicolas at ndufresne.ca
Mon Nov 20 19:06:37 UTC 2017


Le samedi 18 novembre 2017 à 13:52 -0700, HermannSW a écrit :
> I get GRAY8 format by either of these lines on my Pi Zero:
> $ gst-launch-1.0 rpicamsrc ! video/x-raw,format=GRAY8,width=640,height=480 !
> videoconvert ! ...
> $ gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert !
> video/x-raw,format=GRAY8,width=640,height=480 ! ...
> 
> I need to convert GRAY8 format image to a black+white only (still GRAY8
> format) for a specified threshold and searched on google for a long time.
> 
> https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good/html/gst-plugins-good-plugins-videobalance.html
> says "This pipeline converts the image to black and white by setting the
> saturation to 0.0.".
> But it only converts to GRAY which I already have with GRAY8 format.
> 
> Is there is a plugin for allowing black+white(threshold) conversion, or do I
> need to code a new plugin for that?

There is frei0r-filter-threshold0r that can do that, but the element
only inputs RGBA, which forces double color conversion. It's a bit
inconvenient. I wonder if it's a Frei0r limitation, or GStreamer here.

gst-launch-1.0 videotestsrc ! video/x-raw,format=GRAY8 ! videoconvert ! frei0r-filter-threshold0r threshold=0.2 ! glimagesink

> 
> Hermann.
> 
> 
> 
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20171120/683a04cb/attachment-0001.sig>


More information about the gstreamer-devel mailing list