opencv 08 微笑检测(smiledetect) vs2015
程序员文章站
2022-07-12 20:31:02
...
01 资源
OpenCV自带的微笑检测demo,opencv\samples\cpp\smiledetect.cpp。smiledetect.cpp会通过画出一个矩形框来表示微笑强度。测试效果不是很准确。
opencv/data/haarcascades/haarcascade_frontalface_alt.xml
opencv/data/haarcascades/haarcascade_smile.xml
dlib/examples/faces/2008_001009.jpg
haarcascade_frontalface_alt.xml
haarcascade_smile.xml
2008_001009.jpg
02 编译smiledetect
参考opencv01 相对完整的编译opencv3.3.0 win版本,编译opencv3.3.0 vs2015版本。
生成文件:D:\git\opencv\build\v3.3.0\x64\bin\Debug\cpp-example-smiledetect.exe
03 smiledetect项目配置
设置smiledetect项目为启动项。
# 如果路径中有空格,需要使用双引号
配置属性==>调试==>命令参数=-cascade=../../../../../data/haarcascades/haarcascade_frontalface_alt.xml -smile-cascade=../../../../../data/haarcascades/haarcascade_smile.xml -scale=2.0 -@input=D:/git/DeepLearning/dlib/examples/faces/2008_001009.jpg
配置属性==>调试==>工作目录=$(OutDir)
04 运行结果
This program demonstrates the smile detector.
Usage:
./smiledetect [--cascade=<cascade_path> this is the frontal face classifier]
[--smile-cascade=[<smile_cascade_path>]]
[--scale=<image scale greater or equal to 1, try 2.0 for example. The larger the faster the processing>]
[--try-flip]
[video_filename|camera_index]
Example:
./smiledetect --cascade="../../data/haarcascades/haarcascade_frontalface_alt.xml" --smile-cascade="../../data/haarcascades/haarcascade_smile.xml" --scale=2.0
During execution:
Hit any key to quit.
Using OpenCV version 3.3.0
Video capturing has been started ...
NOTE: Smile intensity will only be valid after a first smile has been detected