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

Matlab工具箱Computer Vision System Toolbox中集成了物体检测功能,只需要用简单的三行命令即可实现人脸检测。
faceDetector = vision.CascadeObjectDetector(); % 构造检测器对象。
image = imread('faceImage.jpg'); % 读取包含面部的图像。
facebox = step(faceDetector, image); % 开始检测,将结果存储到facebox变量中
至此人脸识别完成。然后我们在原始图片中插入标记脸部的方框,并用imshow()
将最终的图像显示出来。
```
finalImage = insertShape(image, 'Rectangle', face box);
figure; imshow(finalImage);
`

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