After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 722158 - facedetect: element non-functional because of unreasonable, hardcoded max-size setting
facedetect: element non-functional because of unreasonable, hardcoded max-siz...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
1.2.2
Other Linux
: Normal normal
: 1.2.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-01-14 06:23 UTC by Kipp
Modified: 2014-01-14 12:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
disable maximum object size restriction (1.14 KB, patch)
2014-01-14 06:23 UTC, Kipp
committed Details | Review

Description Kipp 2014-01-14 06:23:35 UTC
Created attachment 266229 [details] [review]
disable maximum object size restriction

Some time ago I found that the facedetect element had stopped finding faces in my videos.  I don't know when, exactly, this happened, but the problem hasn't resolved itself and I was finally motivated to see if I could figure out why.  I think I've identified the cause, or at least I have a patch that fixes it for me locally.

The gst_face_detect_run_detector() function includes an #if/#endif block that adds an extra argument to the cvHaarDetectObjects() call if the libopencv version is >= 2.2.  Checking the documentation at http://docs.opencv.org/modules/objdetect/doc/cascade_classification.html that final argument is described as "maxSize – Maximum possible object size. Objects larger than that are ignored".  The gstreamer facedetect element sets this argument to

cvSize (min_size_width + 2, min_size_height + 2)

i.e., it hard-codes it to 2 pixels larger in width and height than the minimum object size.  This seems to explain why the element can't find faces:  unless the user sets the minimum object size to within a few pixels of the actual size of the faces in the video they will not be found.

I have experimented and found that setting this parameter (0,0) seems to disable the max object size restriction, allowing faces to be detected once again.  This is not documented in the libopencv documentation, so who knows, but I've attached a patch that makes this change.

Note that faceblur hard-codes the maximum object size to 32x32 and also fails to find faces in my videos (which are recorded at 640x480).  I recommend setting the parameter to 0x0 in that element as well.
Comment 1 Sebastian Dröge (slomo) 2014-01-14 09:40:12 UTC
commit e8d569f54de1af7f788a7ecb33fbb91e01a2f098
Author: Sebastian Dröge <sebastian@centricular.com>
Date:   Tue Jan 14 10:38:37 2014 +0100

    faceblur: set maximum feature size to 0x0
    
    Previously faces would only be detected if they were at least 30x30 pixels
    large and at most 32x32 pixels. We keep the minimum setting (maybe needs
    a property as in facedetect) but disable the maximum feature size.
    
    See https://bugzilla.gnome.org/show_bug.cgi?id=722158

commit b33b1390cc0d8fa242b739d5bcde1320ad6d50ff
Author: Kipp Cannon <kcannon@cita.utoronto.ca>
Date:   Tue Jan 14 01:06:02 2014 -0500

    facedetect: set maximum feature size to 0x0
    
    This disables the "max feature size" feature. The current configuration
    is totally busted: The max feature size is hard-coded to 2 pixels more
    than the user-supplied min feature size which pretty much means you need
    to guess the size of the person's face to within a few pixels to get the
    code to find it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722158