facedetect: GStreamer Bad Plugins 1.0 Plugins Reference Manual

## facedetect facedetect |

## Properties

gboolean | display | Read / Write
gchar * | eyes-profile | Read / Write
GstOpencvFaceDetectFlags | flags | Read / Write
gint | min-neighbors | Read / Write
gint | min-size-height | Read / Write
gint | min-size-width | Read / Write
gchar * | mouth-profile | Read / Write
gchar * | nose-profile | Read / Write
gchar * | profile | Read / Write
gdouble | scale-factor | Read / Write
GstFaceDetectUpdates | updates | Read / Write
gint | min-stddev | Read / Write

## Types and Values

struct | GstFaceDetect
enum | GstFaceDetectUpdates

## Description

Performs face detection on videos and images. If you have high cpu load you need to use videoscale with capsfilter and reduce the video resolution.

The image is scaled down multiple times using the GstFaceDetect::scale-factor until the size is <= GstFaceDetect::min-size-width or GstFaceDetect::min-size-height.

### Example launch line

    1
    gst-launch-1.0 autovideosrc ! decodebin ! colorspace ! facedetect ! videoconvert ! xvimagesink

Detect and show faces

    1
    gst-launch-1.0 autovideosrc ! video/x-raw,width=320,height=240 ! videoconvert ! facedetect min-size-width=60 min-size-height=60 ! colorspace ! xvimagesink

Detect large faces on a smaller image

## Synopsis

### Element Information

plugin | opencv
author | Michael Sheldon <mike@mikeasoft.com>
class | Filter/Effect/Video

### Element Pads

name | sink
direction | sink
presence | always
details | video/x-raw, format=(string)RGB, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]

name | src
direction | source
presence | always
details | video/x-raw, format=(string)RGB, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]

## Functions

## Types and Values

### struct GstFaceDetect

    struct GstFaceDetect {
      GstOpencvVideoFilter element;

      gboolean display;
      gboolean face_detected;

      gchar *face_profile;
      gchar *nose_profile;
      gchar *mouth_profile;
      gchar *eyes_profile;
      gdouble scale_factor;
      gint min_neighbors;
      gint flags;
      gint min_size_width;
      gint min_size_height;
      gint min_stddev;
      gint updates;

      IplImage *cvGray;
      cv::CascadeClassifier *cvFaceDetect;
      cv::CascadeClassifier *cvNoseDetect;
      cv::CascadeClassifier *cvMouthDetect;
      cv::CascadeClassifier *cvEyesDetect;
    };

### enum GstFaceDetectUpdates

Bus messages update scheme

#### Members

GST_FACEDETECT_UPDATES_EVERY_FRAME | Send bus update messages for every frame |
GST_FACEDETECT_UPDATES_ON_CHANGE | Send bus update messages on change (face detected/not detected) |
GST_FACEDETECT_UPDATES_ON_FACE | Send bus update messages when a face is detected |
GST_FACEDETECT_UPDATES_NONE | No bus update messages |

## Property Details

### The `“display”` property

      “display”                  gboolean

Sets whether the detected faces should be highlighted in the output.

Flags: Read / Write

Default value: TRUE

### The `“eyes-profile”` property

      “eyes-profile”             gchar *

Location of Haar cascade file to use for eye-pair detection.

Flags: Read / Write

Default value: "/usr/share/opencv/haarcascades/haarcascade_mcs_eyepair_small.xml"

### The `“flags”` property

      “flags”                    GstOpencvFaceDetectFlags

Flags to cvHaarDetectObjects.

Flags: Read / Write

Default value: Do Canny edge detection to discard some regions

### The `“min-neighbors”` property

      “min-neighbors”            gint

Minimum number (minus 1) of neighbor rectangles that makes up an object.

Flags: Read / Write

Allowed values: >= 0

Default value: 3

### The `“min-size-height”` property

      “min-size-height”          gint

Minimum area height to be recognized as a face.

Flags: Read / Write

Allowed values: >= 0

Default value: 30

### The `“min-size-width”` property

      “min-size-width”           gint

Minimum area width to be recognized as a face.

Flags: Read / Write

Allowed values: >= 0

Default value: 30

### The `“mouth-profile”` property

      “mouth-profile”            gchar *

Location of Haar cascade file to use for mouth detection.

Flags: Read / Write

Default value: "/usr/share/opencv/haarcascades/haarcascade_mcs_mouth.xml"

### The `“nose-profile”` property

      “nose-profile”             gchar *

Location of Haar cascade file to use for nose detection.

Flags: Read / Write

Default value: "/usr/share/opencv/haarcascades/haarcascade_mcs_nose.xml"

### The `“profile”` property

      “profile”                  gchar *

Location of Haar cascade file to use for face detection.

Flags: Read / Write

Default value: "/usr/share/opencv/haarcascades/haarcascade_frontalface_default.xml"

### The `“scale-factor”` property

      “scale-factor”             gdouble

Factor by which the frame is scaled after each object scan.

Flags: Read / Write

Allowed values: [1.1,10]

Default value: 1.25

### The `“updates”` property

      “updates”                  GstFaceDetectUpdates

When send update bus messages, if at all.

Flags: Read / Write

Default value: Send update messages on every frame

### The `“min-stddev”` property

      “min-stddev”               gint

Minimum image average standard deviation: on images with standard deviation lesser than this value facedetection will not be performed. Setting this property help to save cpu and reduce false positives not performing face detection on images with little changes.

Flags: Read / Write

Allowed values: [0,255]

Default value: 0