人脸检测作为人脸识别最重要的第一步,检测速度和精度的好坏直接影响到最后识别的质量。本文使用了最好的开源算法,速度达到125FPS,精度达到90%以上。
1、LibFaceDetection
实时性(125fps),配置简单,不再赘述安装过程。
人脸检测源码
#include <iostream>
#include <opencv2/opencv.hpp>
#include "Monochrome.h"
#include "DlibRecognition.h"
#include "FaceDB.h"
#include "util.h"
int main(int argc, char* argv[])
{
//opencv捕获摄像头
cv::VideoCapture capture(cv::CAP_DSHOW);
if (!capture.isOpened()) {
std::cerr << "Can not open video from camera!" << std::endl