---
title: "FindFaces"
language: "en"
type: "Symbol"
summary: "FindFaces[image] attempts to find human faces in image and returns a list of bounding boxes. FindFaces[image, prop] returns the specified property prop for each detected face. FindFaces[image, crit, prop] finds faces that satisfy the criterion crit. FindFaces[video, ...] finds faces in frames of video."
keywords: 
- face detection
- face recognition
- face localization
- computer vision
- Haar like features
- Haar classifier
- Viola-Jones
- object detection
canonical_url: "https://reference.wolfram.com/language/ref/FindFaces.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Computer Vision"
    link: "https://reference.wolfram.com/language/guide/ComputerVision.en.md"
  - 
    title: "Feature Detection"
    link: "https://reference.wolfram.com/language/guide/FeatureDetection.en.md"
  - 
    title: "Video Analysis"
    link: "https://reference.wolfram.com/language/guide/VideoAnalysis.en.md"
  - 
    title: "Image Processing & Analysis"
    link: "https://reference.wolfram.com/language/guide/ImageProcessing.en.md"
  - 
    title: "Machine Learning"
    link: "https://reference.wolfram.com/language/guide/MachineLearning.en.md"
  - 
    title: "Video Computation: Update History"
    link: "https://reference.wolfram.com/language/guide/VideoComputation-UpdateHistory.en.md"
  - 
    title: "Computational Photography"
    link: "https://reference.wolfram.com/language/guide/ComputationalPhotography.en.md"
  - 
    title: "Video Processing"
    link: "https://reference.wolfram.com/language/guide/VideoProcessing.en.md"
  - 
    title: "Signal Visualization & Analysis"
    link: "https://reference.wolfram.com/language/guide/SignalAnalysis.en.md"
---
# FindFaces

FindFaces[image] attempts to find human faces in image and returns a list of bounding boxes.

FindFaces[image, prop] returns the specified property prop for each detected face.

FindFaces[image, crit, prop] finds faces that satisfy the criterion crit.

FindFaces[video, …] finds faces in frames of video.

## Details and Options

* ``FindFaces`` is also known as face detection, which is a common computer vision technique that returns detected faces.

* ``FindFaces`` returns faces as a list of bounding boxes, each given as a ``Rectangle`` object.

[image]

* Coordinates ``{x, y}`` are assumed to be in the standard image coordinate system.

* The property ``prop`` can be any of the following:

|                   |                                              |
| ----------------- | -------------------------------------------- |
| "BoundingBox"     | bounding boxes returned as Rectangle objects |
| "BoundingBoxArea" | pixel area of each face                      |
| "Confidence"      | strength of the detected face                |
| "Image"           | subimages containing each face               |
| "Position"        | the position of each face given as {x, y}    |
| feature           | any feature available in FacialFeatures      |
| {prop1, prop2, …} | a list of properties                         |

* The criterion ``crit`` can be any of the following:

|                              |                                         |
| ---------------------------- | --------------------------------------- |
| {min, max}                   | faces of size min through max in pixels |
| {Scaled[amin], Scaled[amax]} | faces of relative size amin to amax     |
| f                            | faces that satisfy f                    |

* When a pure function ``f`` is used, facial features such as age and gender can be accessed using ``#Age`` and ``#Gender``. A face is returned if ``f`` returns ``True``.

* For the complete list of facial features, see the reference page for ``FacialFeatures``.

* The following options can be given:

|                      |                   |                                             |
| -------------------- | ----------------- | ------------------------------------------- |
| AcceptanceThreshold  | Automatic         | detection acceptance threshold              |
| MaxFeatures          | All               | number of faces to return                   |
| MaxOverlapFraction   | Automatic         | maximum allowed overlap fraction            |
| Method               | Automatic         | method to use                               |
| Padding              | "Fixed"           | padding scheme to use at image boundaries   |
| PaddingSize          | 0                 | amount of padding around each detected face |
| PerformanceGoal      | \$PerformanceGoal | what to optimize in the detection           |
| SortedBy             | Automatic         | function to use for sorting the result      |
| TargetDevice         | "CPU"             | the target device to use                    |

* With ``PaddingSize -> x``, each detected face is padded by ``x`` pixels on each side. Using ``PaddingSize -> Scaled[s]``, each face is padded by a fraction ``s`` of its bounding box.

* If available, faces are padded with ``image`` content. At the boundaries, the setting of ``Padding`` is used.

* By default, detected faces are sorted based on their strength. Use ``SortedBy -> f`` to specify a different sorting function. The function ``f`` can access available properties using the pattern ``#prop``.

* Possible settings for ``Method`` include:

|                       |                                                   |
| --------------------- | ------------------------------------------------- |
| "Haar"                | cascade detector based on Haar features           |
| "LocalBinaryPatterns" | cascade detector based on LBP features            |
| "SingleShotDetector"  | neural network detector based on SSD architecture |
| {method1, method2, …} | aggregates the result of all methodi              |

* For multichannel images, the ``"Haar"`` and ``"LocalBinaryPatterns"`` methods operate on grayscale intensities.

* ``FindFaces`` uses machine learning. Its methods, training sets and biases included therein may change and yield varied results in different versions of the Wolfram Language.

* ``FindFaces`` may download resources that will be stored in your local object store at ``\$LocalBase``, and that can be listed using ``LocalObjects[]`` and removed using ``ResourceRemove``.

---

## Examples (29)

### Basic Examples (2)

Find coordinates of faces in an image:

```wl
In[1]:=
i = [image];
FindFaces[i]

Out[1]= {Rectangle[{82.5, 124.5}, {127.5, 191.5}], Rectangle[{172.5, 104.5}, {214.5, 154.5}]}
```

Extract subimages that include faces:

```wl
In[2]:= FindFaces[i, "Image"]

Out[2]= {[image], [image]}
```

---

Detect and highlight a face in an image:

```wl
In[1]:=
i = [image];
box = FindFaces[i]

Out[1]= {Rectangle[{77.5, 92.5}, {167.5, 200.5}]}

In[2]:= HighlightImage[i, box]

Out[2]= [image]
```

### Scope (9)

#### Data (2)

Find faces in an image:

```wl
In[1]:= FindFaces[[image]]

Out[1]= {Rectangle[{169.5, 189.5}, {219.5, 258.5}], Rectangle[{627.5, 222.5}, {695.5, 300.5}], Rectangle[{294.5, 216.5}, {346.5, 305.5}]}

In[2]:= HighlightImage[[image], %]

Out[2]= [image]
```

---

Find faces in frames of a video:

```wl
In[1]:= faces = FindFaces[\!\(\*VideoBox["![Embedded Video Player](video://content-htcbu)"]\)]

Out[1]=
TemporalData[TimeSeries, 
 {{{{Rectangle[{263.5, 293.5}, {338.5, 397.5}], Rectangle[{959.5, 345.5}, {1075.5, 461.5}], 
     Rectangle[{451.5, 333.5}, {532.5, 468.5}]}, {Rectangle[{255.5, 288.5}, {327.5, 395.5}], 
     Rectangle[{956.5, 336.5}, {106 ...  318.5}, {240.5, 479.5}]}}}, 
  {{0.016666666666666666, 0.9833333333333334, 0.03333333333333333}}, 1, {"Discrete", 1}, 
  {"Discrete", 1}, 1, {ResamplingMethod -> {"Interpolation", InterpolationOrder -> 0}, 
   ValueDimensions -> 1}}, False, 14.2]
```

Highlight detected faces on the video:

```wl
In[2]:= HighlightVideo[\!\(\*VideoBox["![Embedded Video Player](video://content-htcbu)"]\), faces]

Out[2]= \!\(\*VideoBox["![Embedded Video Player](video://content-59ols)"]\)
```

#### Properties (4)

Compute the face bounding box:

```wl
In[1]:= FindFaces[i = [image]]

Out[1]= {Rectangle[{145.5, 131.5}, {182.5, 182.5}], Rectangle[{31.5, 128.5}, {62.5, 174.5}], Rectangle[{262.5, 135.5}, {294.5, 179.5}], Rectangle[{215.5, 125.5}, {241.5, 155.5}], Rectangle[{83.5, 110.5}, {114.5, 145.5}]}

In[2]:= FindFaces[i, "BoundingBox"]

Out[2]= {Rectangle[{145.5, 131.5}, {182.5, 182.5}], Rectangle[{31.5, 128.5}, {62.5, 174.5}], Rectangle[{262.5, 135.5}, {294.5, 179.5}], Rectangle[{215.5, 125.5}, {241.5, 155.5}], Rectangle[{83.5, 110.5}, {114.5, 145.5}]}
```

---

Extract the portion of the image corresponding to the bounding box:

```wl
In[1]:= FindFaces[[image], "Image"]

Out[1]= {[image], [image], [image], [image], [image]}
```

---

Extract multiple properties:

```wl
In[1]:= FindFaces[[image], {"Image", "BoundingBoxArea"}]

Out[1]= {<|"Image" -> [image], "BoundingBoxArea" -> 1887.|>, <|"Image" -> [image], "BoundingBoxArea" -> 1426.|>, <|"Image" -> [image], "BoundingBoxArea" -> 1408.|>, <|"Image" -> [image], "BoundingBoxArea" -> 780.|>, <|"Image" -> [image], "BoundingBoxArea" -> 1085.|>}
```

---

Extract features available in ``FacialFeatures`` :

```wl
In[1]:= FindFaces[[image], {"Image", "Emotion", "Gender"}]

Out[1]= {<|"Image" -> [image], "Emotion" -> Entity["Emotion", "Happiness::d8973"], "Gender" -> "Male"|>, <|"Image" -> [image], "Emotion" -> Entity["Emotion", "Happiness::d8973"], "Gender" -> "Female"|>, <|"Image" -> [image], "Emotion" -> Entity["Emotion", "Happiness::d8973"], "Gender" -> "Female"|>, <|"Image" -> [image], "Emotion" -> Entity["Emotion", "Happiness::d8973"], "Gender" -> "Female"|>, <|"Image" -> [image], "Emotion" -> Entity["Emotion", "Neutral::7468h"], "Gender" -> "Male"|>}
```

#### Criteria (3)

Use a computable property as a test argument:

```wl
In[1]:=
i = [image];
FindFaces[i, #Gender === "Female"&, "BoundingBox"]

Out[1]= {Rectangle[{31.5, 128.5}, {62.5, 174.5}], Rectangle[{262.5, 135.5}, {294.5, 179.5}], Rectangle[{215.5, 125.5}, {241.5, 155.5}]}

In[2]:= HighlightImage[i, %]

Out[2]= [image]
```

---

Some test results can be used as shortcuts for the whole test:

```wl
In[1]:= FindFaces[[image], "Female", "Image"]

Out[1]= {[image], [image], [image]}
```

---

Find faces of all sizes:

```wl
In[1]:=
i = [image];
HighlightImage[i, {"Boundary", Green, FindFaces[#]&}]

Out[1]= [image]
```

Specify a maximum face size in pixels:

```wl
In[2]:= b = FindFaces[i, {0, 35}, "BoundingBox"]

Out[2]= {Rectangle[{215.5, 125.5}, {241.5, 155.5}], Rectangle[{83.5, 110.5}, {114.5, 145.5}]}

In[3]:= HighlightImage[i, {"Boundary", Green, b}]

Out[3]= [image]
```

Specify a minimum face size in pixels:

```wl
In[4]:= b = FindFaces[i, {38, ∞}, "BoundingBox"]

Out[4]= {Rectangle[{145.5, 131.5}, {182.5, 182.5}]}

In[5]:= HighlightImage[i, {Green, b}]

Out[5]= [image]
```

Use ``Scaled`` to specify the face size relative to the image dimensions:

```wl
In[6]:= b = FindFaces[i, {Scaled[1 / 7], Scaled[1]}, "BoundingBox"]

Out[6]= {Rectangle[{145.5, 131.5}, {182.5, 182.5}]}

In[7]:= HighlightImage[i, {"Boundary", Green, b}]

Out[7]= [image]
```

### Options (10)

#### AcceptanceThreshold (1)

By default, all the detected faces are returned:

```wl
In[1]:=
i = [image];
FindFaces[i, "Image"]

Out[1]= {[image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image]}
```

Use ``AcceptanceThreshold -> t`` to return only detections with strength greater than ``t`` :

```wl
In[2]:= FindFaces[i, "Image", AcceptanceThreshold -> .95]

Out[2]= {[image], [image], [image], [image], [image], [image]}
```

Use ``AcceptanceThreshold -> 0`` to return all the detected faces:

```wl
In[3]:= FindFaces[i, "Image", AcceptanceThreshold -> 0]

Out[3]= {[image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image]}
```

#### MaxFeatures (1)

By default, all the detected faces are returned:

```wl
In[1]:=
i = [image];
FindFaces[i]//Length

Out[1]= 79
```

Use ``MaxFeatures -> n`` to return only the ``n`` strongest detections:

```wl
In[2]:= FindFaces[i, MaxFeatures -> 5]

Out[2]= {Rectangle[{183.5, 221.5}, {204.5, 246.5}], Rectangle[{380.5, 225.5}, {400.5, 252.5}], Rectangle[{283.5, 168.5}, {302.5, 191.5}], Rectangle[{255.5, 354.5}, {275.5, 377.5}], Rectangle[{342.5, 358.5}, {365.5, 383.5}]}
```

#### MaxOverlapFraction (1)

By default, all the detected faces are returned, regardless of their overlapping:

```wl
In[1]:=
i = [image];
HighlightImage[i, FindFaces]

Out[1]= [image]
```

Find only non-overlapping faces:

```wl
In[2]:= HighlightImage[i, FindFaces[i, MaxOverlapFraction -> 0]]

Out[2]= [image]
```

Allow up to 2 percent of overlap:

```wl
In[3]:= HighlightImage[i, FindFaces[i, MaxOverlapFraction -> 0.02]]

Out[3]= [image]
```

#### Method (2)

``FindFaces`` automatically picks the detection method:

```wl
In[1]:=
i = [image];
FindFaces[i]

Out[1]= {Rectangle[{170.5, 127.5}, {200.5, 173.5}], Rectangle[{280.5, 155.5}, {314.5, 202.5}], Rectangle[{73.5, 130.5}, {106.5, 173.5}]}
```

Specify the method to use:

```wl
In[2]:= FindFaces[i, Method -> "LocalBinaryPatterns"]

Out[2]= {Rectangle[{165.5, 124.5}, {208.5, 183.5}], Rectangle[{72.5, 138.5}, {122.5, 206.5}]}
```

Use the combined result from multiple methods:

```wl
In[3]:= FindFaces[i, Method -> {"LocalBinaryPatterns", "Haar", "SingleShotDetector"}]

Out[3]= {Rectangle[{69.5, 130.5}, {109.5, 170.5}], Rectangle[{165.5, 124.5}, {208.5, 183.5}], Rectangle[{280.5, 155.5}, {314.5, 202.5}]}
```

---

The ``"LocalBinaryPatterns"`` method is a cascade classifier that works on a histogram of the gradients (HoG) features. It is a very fast and lightweight multiscale method:

```wl
In[1]:= i = [image];FindFaces[i, "Image", Method -> "LocalBinaryPatterns"]//AbsoluteTiming

Out[1]= {0.0565158, {[image], [image]}}
```

The ``"Haar"`` method is a cascade classifier working on Haar features. It is more robust than ``"LocalBinaryPatterns"`` but generally slower:

```wl
In[2]:= FindFaces[i, "Image", Method -> "Haar"]//AbsoluteTiming

Out[2]= {0.133982, {[image], [image], [image]}}
```

The ``"SingleShotDetector"`` method is based on a single neural net evaluation, and it is very stable with respect to variations in pose, illumination, occlusion and subjects. It is slower compared to two other methods:

```wl
In[3]:= FindFaces[i, "Image", Method -> "SingleShotDetector"]//AbsoluteTiming

Out[3]= {0.194679, {[image], [image], [image]}}
```

#### Padding (1)

The bounding box of a detection can be padded beyond the image boundary:

```wl
In[1]:=
i = [image];
FindFaces[i, "Image", PaddingSize -> 60]

Out[1]= {[image], [image], [image]}
```

Specify a custom padding specification:

```wl
In[2]:= FindFaces[i, "Image", PaddingSize -> 60, Padding -> Gray]

Out[2]= {[image], [image], [image]}
```

#### PaddingSize (2)

``FindFaces`` by default returns a fairly tight crop around each face:

```wl
In[1]:= i = [image];

In[2]:= FindFaces[i, "Image"]

Out[2]= {[image], [image]}
```

Specify a padding size to be added around each face:

```wl
In[3]:= FindFaces[i, "Image", PaddingSize -> 20]

Out[3]= {[image], [image]}
```

Specify a negative padding to crop more:

```wl
In[4]:= FindFaces[i, "Image", PaddingSize -> -5]

Out[4]= {[image], [image]}
```

Specify a scaled padding:

```wl
In[5]:= FindFaces[i, "Image", PaddingSize -> Scaled[0.2]]

Out[5]= {[image], [image]}
```

---

Compare detected faces using different paddings:

```wl
In[1]:= i = [image];

In[2]:= HighlightImage[i, {EdgeForm[AbsoluteThickness[1.5]], FaceForm[], Yellow, Legended[FindFaces, "original"], Red, Legended[FindFaces[#, PaddingSize -> 5]&, "padded"], Green, Legended[FindFaces[#, PaddingSize -> -5]&, "cropped"]}]

Out[2]= [image]
```

#### PerformanceGoal (1)

Use ``PerformanceGoal -> "Quality"`` to emphasize the quality of the result:

```wl
In[1]:= i = [image];

In[2]:= FindFaces[i, "Image", PerformanceGoal -> "Quality"]//AbsoluteTiming

Out[2]= {0.229748, {[image], [image], [image], [image], [image], [image]}}
```

Use ``PerformanceGoal -> "Speed"`` to emphasize the speed of computation:

```wl
In[3]:= FindFaces[i, "Image", PerformanceGoal -> "Speed"]//AbsoluteTiming

Out[3]= {0.075623, {[image]}}
```

#### SortedBy (1)

By default, detections are sorted by ``"Confidence"`` :

```wl
In[1]:=
i = [image];
FindFaces[i, {"Image", "Confidence"}]//Values

Out[1]= {{[image], 0.998355}, {[image], 0.997351}, {[image], 0.996905}, {[image], 0.996131}, {[image], 0.92599}}
```

Specify a different property:

```wl
In[2]:= FindFaces[i, "Image", SortedBy -> (#Age&)]

Out[2]= {[image], [image], [image], [image], [image]}
```

### Applications (3)

Find and highlight detected faces:

```wl
In[1]:= i = [image];

In[2]:= HighlightImage[i, FindFaces[#, "BoundingBox"]&]

Out[2]= [image]
```

Find and blur all detected faces:

```wl
In[3]:= HighlightImage[i, {{"Blur", 10}, FindFaces[#, "BoundingBox"]&}]

Out[3]= [image]
```

---

Dynamic detection of faces:

```wl
In[1]:= Dynamic[HighlightImage[CurrentImage[], FindFaces]]

Out[1]= [image]
```

---

Find the number of faces in each video frame:

```wl
In[1]:= v = Import["http://exampledata.wolfram.com/office.ts"];

In[2]:= VideoFrameList[v, 3]

Out[2]= {[image], [image], [image]}

In[3]:= ts = VideoMapTimeSeries[Length[FindFaces[#Image]]&, v];
```

Plot the result:

```wl
In[4]:= ListLinePlot[ts]

Out[4]= [image]
```

### Properties & Relations (2)

Faces may be detected in spite of rotation in the image plane:

```wl
In[1]:=
Table[HighlightImage[
	ImageRotate[[image], r, Full], FindFaces], 
	{r, -(3 π/4) , (π/2), (π/4)}]

Out[1]= {[image], [image], [image], [image], [image], [image]}
```

---

Faces may be detected in spite of intensity changes:

```wl
In[1]:= list = Through[{Identity, Darker, Lighter}[[image]]];

In[2]:= HighlightImage[#, FindFaces]& /@ list

Out[2]= {[image], [image], [image]}
```

### Possible Issues (3)

Upright faces are usually better detected:

```wl
In[1]:=
i = [image];
b = FindFaces[i];
HighlightImage[i, {"Boundary", b}]

Out[1]= [image]
```

Other faces may be detected when rotating the image:

```wl
In[2]:=
r = ImageRotate[i, Top -> Bottom];
b = FindFaces[r];
HighlightImage[r, {"Boundary", b}]

Out[2]= [image]
```

---

Faces turned away from the camera may not be detected:

```wl
In[1]:= HighlightImage[[image], FindFaces]

Out[1]= [image]
```

---

Very small or low resolution faces may not be detected:

```wl
In[1]:= i = [image];

In[2]:= HighlightImage[i, FindFaces, ImageSize -> 300]

Out[2]= [image]
```

Resampling the image may improve the detection:

```wl
In[3]:= HighlightImage[ImageResize[i, Scaled[16]], FindFaces, ImageSize -> 300]

Out[3]= [image]
```

## See Also

* [`FacialFeatures`](https://reference.wolfram.com/language/ref/FacialFeatures.en.md)
* [`FaceAlign`](https://reference.wolfram.com/language/ref/FaceAlign.en.md)
* [`FaceRecognize`](https://reference.wolfram.com/language/ref/FaceRecognize.en.md)
* [`ImageIdentify`](https://reference.wolfram.com/language/ref/ImageIdentify.en.md)
* [`ImageContents`](https://reference.wolfram.com/language/ref/ImageContents.en.md)
* [`ImageBoundingBoxes`](https://reference.wolfram.com/language/ref/ImageBoundingBoxes.en.md)
* [`HighlightImage`](https://reference.wolfram.com/language/ref/HighlightImage.en.md)
* [`HighlightVideo`](https://reference.wolfram.com/language/ref/HighlightVideo.en.md)
* [`Classify`](https://reference.wolfram.com/language/ref/Classify.en.md)
* [`CurrentImage`](https://reference.wolfram.com/language/ref/CurrentImage.en.md)
* [`ImageKeypoints`](https://reference.wolfram.com/language/ref/ImageKeypoints.en.md)
* [`FacialAge`](https://reference.wolfram.com/language/ref/classifier/FacialAge.en.md)
* [`FacialGender`](https://reference.wolfram.com/language/ref/classifier/FacialGender.en.md)
* [`FacialExpression`](https://reference.wolfram.com/language/ref/classifier/FacialExpression.en.md)
* [`NotablePerson`](https://reference.wolfram.com/language/ref/classifier/NotablePerson.en.md)

## Related Guides

* [Computer Vision](https://reference.wolfram.com/language/guide/ComputerVision.en.md)
* [Feature Detection](https://reference.wolfram.com/language/guide/FeatureDetection.en.md)
* [Video Analysis](https://reference.wolfram.com/language/guide/VideoAnalysis.en.md)
* [Image Processing & Analysis](https://reference.wolfram.com/language/guide/ImageProcessing.en.md)
* [Machine Learning](https://reference.wolfram.com/language/guide/MachineLearning.en.md)
* [Video Computation: Update History](https://reference.wolfram.com/language/guide/VideoComputation-UpdateHistory.en.md)
* [Computational Photography](https://reference.wolfram.com/language/guide/ComputationalPhotography.en.md)
* [Video Processing](https://reference.wolfram.com/language/guide/VideoProcessing.en.md)
* [Signal Visualization & Analysis](https://reference.wolfram.com/language/guide/SignalAnalysis.en.md)

## History

* [Introduced in 2012 (9.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn90.en.md) \| [Updated in 2018 (11.3)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn113.en.md) ▪ [2019 (12.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn120.en.md) ▪ [2020 (12.1)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn121.en.md) ▪ [2024 (14.1)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn141.en.md) ▪ [2025 (14.2)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn142.en.md)