> ## Content Index
> Fetch the complete content index at: https://yinguobing.com/blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# Matlab中的人脸检测功能
- URL: https://yinguobing.com/blog/face-detection-in-matlab/
- Published: 2015-11-10T15:30:33.000Z
- Updated: 2022-05-29T07:35:10.000Z
- Description: Matlab工具箱Computer Vision System Toolbox中集成了物体检测功能，只需要用简单的三行命令即可实现人脸检测。
- Author: 尹国冰
- Tags: 图像处理

Matlab工具箱Computer Vision System Toolbox中集成了物体检测功能，只需要用简单的三行命令即可实现人脸检测。

```matlab

faceDetector = vision.CascadeObjectDetector(); % 构造检测器对象。
image = imread('faceImage.jpg'); % 读取包含面部的图像。
facebox = step(faceDetector, image); % 开始检测，将结果存储到facebox变量中
```

至此人脸识别完成。然后我们在原始图片中插入标记脸部的方框，并用`imshow()`将最终的图像显示出来。

\`\`\`

finalImage = insertShape(image, 'Rectangle', face box);  
  
figure; imshow(finalImage);

\`

![faceDetectionImage](https://yinguobing.com/blog/content/images/2015/11/faceDetectionImage.jpg)

PS. 我也不知道为什么皮特没有被检测出来。