本文主要介绍三个点:
1. 如何单独建立一个工程,使用dlib的人脸检测功能。
2. 提高人脸检测率的两个方法
3. 加速人脸检测的方法
下面围绕这几个点展开叙述。
建人脸检测工程
1 . 首先我们先使用上期说的examples里的人脸检测。
我们只要将face_detection_ex设为启动项,即可运行。效果如下:
2. 建立单独的工程。像其他正常的方法,建立一般的工程。然后
在项目 属性中选择C/C++ :
常规-》附加包含目录:填写之前准备好的dlib的include的路径,我这里是:D:\dlib_win32\include
预处理器定义:
WIN32
_WINDOWS
DLIB_PNG_SUPPORT
DLIB_JPEG_SUPPORT
NDEBUG
DLIB_HAVE_AVX
链接器-》常规-》附加库目录:填写你要加的库目录。我这里是
D:\dlib_win32\lib
输入-》附加依赖项:dlib.lib
命令行-》其它选项:/arch:AVX
最后在配置属性-》调试中添加:你要检测的图片的路径,
main.cpp可以使用dlib提供的官方示例:
// The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt
/*
This example program shows how to find frontal human faces in an image. In
particular, this program shows how you can take a list of images from the
command line and display each on the screen with red boxes overlaid on each
human face.
The examples/faces folder contains some jpg images of people. You can run
this program on them and see the detections by executing the following command:
./face_detection_ex faces/*.jpg
This face detector is made using the now classic Histogram of Oriented
Gradients (HOG) feature combined with a linea