Skip to content

WIP: Modify GstVideoFilter to filter a ROI

Fabián Orccón requested to merge cfoch/gst-plugins-base:roieffect into master

For now this is a WIP branch for #739 DO NOT MERGE. I would like someone can put an eye on it and give feedback, that is always helpful to at least know if I am going on the right way.

I have added a function gst_video_frame_cropped_map that given left, right, top, bottom values it maps a GstVideoFrame to just a section of the image.

For now, I am only supporting:

  • AYUV, RGB and GRAY colorspaces.
  • Buffers with GstVideoMeta in there.
  • base_transform->transform_ip (+)
  • base_transform->transform (but I think here there is something odd in my implementation) (++)

(+) base_transform->transform_ip vmethod support

Here an example applying a videobalance filter to gray out the detected face:

./cerbero-uninstalled run gst-launch-1.0 v4l2src ! videoconvert ! facedetect mouth-profile=haarcascade_mcs_mouth.xml eyes-profile=haarcascade_mcs_mouth-profile=haarcascade_mcs_mouth.xml display=false ! videoconvert ! videobalance saturation=0 only-roi=true ! videoconvert ! xvimagesink

Screenshot_from_2020-04-01_20-03-03

(++) base_transform->transform vmethod support

Here an example applying a videobalance filter to the detected face:

./cerbero-uninstalled run gst-launch-1.0 v4l2src ! videoconvert ! facedetect mouth-profile=haarcascade_mcs_mouth.xml eyes-profile=haarcascade_mcs_mouth-profile=haarcascade_mcs_mouth.xml display=false ! videoconvert ! videobalance warptv only-roi=true ! videoconvert ! xvimagesink

I think the filter in this case is not properly applied. While I am still not totally sure, I am more convinced that is wrongly applied.

Screenshot_from_2020-04-01_20-03-29

To get the xml files if you distribution of the opencv-contrib does not include it (in my case Fedora didn't include it) you can download the files from this link.

Edited by Tim-Philipp Müller

Merge request reports

Loading