GStreamer Color Transfer PC Pipelines
GStreamer Color Transfer |
---|
GStreamer Color Transfer Basics |
Evaluating GstColorTransfer |
Building GStreamer Color Transfer |
PC Pipelines |
Tegra Pipelines |
Troubleshooting |
Releases |
Contact Us |
This page provides GStreamer example pipelines to test GstColorTransfer features on a PC. These pipelines were tested in Ubuntu 16.04.
|
GStreamer pipelines
Each pipeline consist on a reference stream "ref", target stream "tar", color transfer element "mix" and displays for the reference and target streams "refsink, tarsink". The sinks forthe target and reference image are completely optional and should be removed for better performance.
"image-overlap" determines the overlap between reference and target image. It assumes reference image is on the left and target on the right. It is a normalized value where 1 indicates 100% (reference and target images are completely overlapped) and 0 turns off the color mapping completely.
videotestsrc -> ball
This pipeline transfer the color distribution from the default video test source to the ball video test source. When the value "image-overlap" is changed to 0 the output image is just the regular ball video test source. For any other value of "image-overlap" the ball represents the only change on the target color distribution, so when the ball is inside the overlap region the mapping is performed, but when it is outside all the color get mapped to black.
gst-launch-1.0 \ videotestsrc ! "video/x-raw,width=640,height=480" ! tee name=ref \ videotestsrc pattern=ball ! "video/x-raw,width=640,height=480" ! tee name=tar \ colortransfer name=mix image-overlap=1 ! videoconvert ! xvimagesink \ ref. ! queue ! autovideosink name=refsink \ tar. ! queue ! autovideosink name=tarsink \ ref. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix. \ tar. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix.
videotestsrc -> ball (without visual feedback)
gst-launch-1.0 \ videotestsrc ! "video/x-raw,width=640,height=480" ! tee name=ref \ videotestsrc pattern=ball ! "video/x-raw,width=640,height=480" ! tee name=tar \ colortransfer name=mix image-overlap=1 ! videoconvert ! xvimagesink \ ref. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix. \ tar. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix.
zone-plate -> ball
This pipeline transfer the color distribution from the zone-plate video test source to the ball video test source. It behaves similar to the first example, but the reference colors can be changed with the foreground-color property on the zone-plate videotestsrc.
gst-launch-1.0 \ videotestsrc pattern=zone-plate kx2=20 ky2=20 kt=1 foreground-color=0x00ff88 ! "video/x-raw,width=640,height=480" ! tee name=ref \ videotestsrc pattern=ball ! "video/x-raw,width=640,height=480" ! tee name=tar \ colortransfer name=mix image-overlap=1 ! videoconvert ! xvimagesink \ ref. ! queue ! autovideosink name=refsink \ tar. ! queue ! autovideosink name=tarsink \ ref. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix. \ tar. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix.
zone-plate -> ball (without visual feedback)
gst-launch-1.0 \ videotestsrc pattern=zone-plate kx2=20 ky2=20 kt=1 foreground-color=0x00ff88 ! "video/x-raw,width=640,height=480" ! tee name=ref \ videotestsrc pattern=ball ! "video/x-raw,width=640,height=480" ! tee name=tar \ colortransfer name=mix image-overlap=1 ! videoconvert ! xvimagesink \ ref. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix. \ tar. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix.
v4l2src0 -> v4l2src1
This pipeline uses one camera source as a reference and another one as the target.
gst-launch-1.0 \ v4l2src device=/dev/video0 ! "video/x-raw,width=640,height=480" ! tee name=ref \ v4l2src device=/dev/video1 ! "video/x-raw,width=640,height=480" ! tee name=tar \ colortransfer name=mix image-overlap=1 ! videoconvert ! xvimagesink \ ref. ! queue ! autovideosink name=refsink \ tar. ! queue ! autovideosink name=tarsink \ ref. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix. \ tar. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix.
v4l2src0 -> v4l2src1 (without visual feedback)
gst-launch-1.0 \ v4l2src device=/dev/video0 ! "video/x-raw,width=640,height=480" ! tee name=ref \ v4l2src device=/dev/video1 ! "video/x-raw,width=640,height=480" ! tee name=tar \ colortransfer name=mix image-overlap=1 ! videoconvert ! xvimagesink \ ref. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix. \ tar. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix.
videotestsrc -> v4l2src0
This pipeline uses the default video test source as the reference and a camera source as target.
gst-launch-1.0 \ videotestsrc ! "video/x-raw,width=640,height=480" ! tee name=ref \ v4l2src device=/dev/video0 ! "video/x-raw,width=640,height=480" ! tee name=tar \ colortransfer name=mix image-overlap=1 ! videoconvert ! xvimagesink \ ref. ! queue ! autovideosink name=refsink \ tar. ! queue ! autovideosink name=tarsink \ ref. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix. \ tar. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix.
videotestsrc -> v4l2src0 (without visual feedback)
gst-launch-1.0 \ videotestsrc ! "video/x-raw,width=640,height=480" ! tee name=ref \ v4l2src device=/dev/video0 ! "video/x-raw,width=640,height=480" ! tee name=tar \ colortransfer name=mix image-overlap=1 ! videoconvert ! xvimagesink \ ref. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix. \ tar. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix.
imagefile0 -> imagefile1
The following example is a real use case where two consecutive images where taken with the same camera but with different capture parameters. To test this example you will need the images provided below. One is used as the reference and the other as target. The result is a corrected image that enables a more natural stitching between the two images.
-
J01_right_400.JPG
-
J01_left_400.JPG
gst-launch-1.0 \ multifilesrc location=J01_left_400.JPG start-index=0 stop-index=0 loop=true ! jpegparse ! jpegdec ! videoconvert ! videoscale ! videorate ! "video/x-raw,width=400,height=400" ! tee name=ref \ multifilesrc location=J01_right_400.JPG start-index=0 stop-index=0 loop=true ! jpegparse ! jpegdec ! videoconvert ! videoscale ! videorate ! "video/x-raw,width=400,height=400" ! tee name=tar \ colortransfer name=mix image-overlap=0.65 ! videoconvert ! xvimagesink \ ref. ! queue ! autovideosink name=refsink \ tar. ! queue ! autovideosink name=tarsink \ ref. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix. \ tar. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix.
imagefile0 -> imagefile1 (without visual feedback)
gst-launch-1.0 \ multifilesrc location=J01_left_400.JPG start-index=0 stop-index=0 loop=true ! jpegparse ! jpegdec ! videoconvert ! videoscale ! videorate ! "video/x-raw,width=400,height=400" ! tee name=ref \ multifilesrc location=J01_right_400.JPG start-index=0 stop-index=0 loop=true ! jpegparse ! jpegdec ! videoconvert ! videoscale ! videorate ! "video/x-raw,width=400,height=400" ! tee name=tar \ colortransfer name=mix image-overlap=0.65 ! videoconvert ! xvimagesink \ ref. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix. \ tar. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix.
Gstd pipelines
Run any of the pipelines above with gstd to change the image overlap dynamically:
gstd& gstd-client pipeline_create p0 videotestsrc ! "video/x-raw,width=640,height=480" ! tee name=ref videotestsrc pattern=ball ! "video/x-raw,width=640,height=480" ! tee name=tar colortransfer name=mix image-overlap=1 ! videoconvert ! xvimagesink ref. ! queue ! autovideosink tar. ! queue ! autovideosink ref. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix. tar. ! queue ! videoconvert ! "video/x-raw,format=RGBA" ! mix. gstd-client pipeline_play p0
Change image-overlap:
gstd-client element_set p0 "mix image-overlap 0.0" gstd-client element_set p0 "mix image-overlap 0.5"
Stop the pipeline:
gstd-client pipeline_stop p0 gstd-client pipeline_delete p0
Enable debugging:
gstd-client debug_enable true gstd-client debug_threshold 2,*colortransfer*:7