# facedetect

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

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

Detect and show faces

     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

## Hierarchy

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstElement
                    ╰──GstBaseTransform
                        ╰──GstVideoFilter
                            ╰──GstOpencvVideoFilter
                                ╰──facedetect

## Factory details

Authors: – Michael Sheldon <mike@mikeasoft.com></mike@mikeasoft.com>

Classification: – `Filter/Effect/Video`

Rank – none

Plugin – opencv

Package – GStreamer Bad Plug-ins

## Pad Templates

### `sink`

    video/x-raw:
             format: RGB
              width: [ 1, 2147483647 ]
             height: [ 1, 2147483647 ]
          framerate: [ 0/1, 2147483647/1 ]

Presence – always

Direction – sink

Object type – GstPad

### `src`

    video/x-raw:
             format: RGB
              width: [ 1, 2147483647 ]
             height: [ 1, 2147483647 ]
          framerate: [ 0/1, 2147483647/1 ]

Presence – always

Direction – src

Object type – GstPad

## Properties

### display

    “display” gboolean

Sets whether the detected faces should be highlighted in the output

Flags : Read / Write

Default value : true

### eyes-profile

    “eyes-profile” gchararray

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

Flags : Read / Write

Default value : /usr/share/opencv4/haarcascades/haarcascade_mcs_eyepair_small.xml

### flags

    “flags” Opencv-face-detect-flags *

Flags to cvHaarDetectObjects

Flags : Read / Write

Default value : do-canny-pruning

### min-neighbors

    “min-neighbors” gint

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

Flags : Read / Write

Default value : 3

### min-size-height

    “min-size-height” gint

Minimum area height to be recognized as a face

Flags : Read / Write

Default value : 30

### min-size-width

    “min-size-width” gint

Minimum area width to be recognized as a face

Flags : Read / Write

Default value : 30

### min-stddev

    “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

Default value : 0

### mouth-profile

    “mouth-profile” gchararray

Location of Haar cascade file to use for mouth detection

Flags : Read / Write

Default value : /usr/share/opencv4/haarcascades/haarcascade_mcs_mouth.xml

### nose-profile

    “nose-profile” gchararray

Location of Haar cascade file to use for nose detection

Flags : Read / Write

Default value : /usr/share/opencv4/haarcascades/haarcascade_mcs_nose.xml

### profile

    “profile” gchararray

Location of Haar cascade file to use for face detection

Flags : Read / Write

Default value : /usr/share/opencv4/haarcascades/haarcascade_frontalface_default.xml

### scale-factor

    “scale-factor” gdouble

Factor by which the frame is scaled after each object scan

Flags : Read / Write

Default value : 1.25

### updates

    “updates” Face-detect-updates *

When send update bus messages, if at all

Flags : Read / Write

Default value : every_frame (0)

## Named constants

### Face-detect-updates

Bus messages update scheme

#### Members

`every_frame` (0) – Send update messages on every frame
`on_change` (1) – Send messages when a new face is detected or one is not anymore detected
`on_face` (2) – Send messages whenever a face is detected
`none` (3) – Send no messages update

### Opencv-face-detect-flags

Flags parameter to OpenCV's cvHaarDetectObjects function.

#### Members

`do-canny-pruning` (0x00000001) – Do Canny edge detection to discard some regions

The results of the search are