图像人脸检测+人眼检测 (opencv + c++)
2021-09-28 21:17
标签:直方图 inf result asc scalar cas 实现图 const ++ 摘要:实现图像中人脸检测,和人眼定位。输出检测标记图像和定位坐标。 工具:vs2015 opencv3 C++ 资源:haarcascade_frontalface_alt2.xml;haarcascade_eye_tree_eyeglasses.xml 链接:https://pan.baidu.com/s/1uk8P1TF7XXCoMMd0sNDGVg 提取码:az01 实现结果: 实现过程: Detect.h 1 #pragma once 2 #include 3 #include 4 #include 5 #include 6 #ifndef DETECT_H 7 #define DETECT_H 8 int DetectFaceEyes(); //检测人脸定位人眼 9 #endif // !DETECT_H Detect.cpp #include #include "Detect.h" using namespace std; using namespace cv; int DetectFaceEyes() { Mat heying = imread("./Data/heying.jpg"); Mat hyGray = imread("./Data/heying.jpg", 0); equalizeHist(hyGray, hyGray); //直方图均匀化 vector faces, eyes; const char *faceCascadeFilename = "./Data/haarcascade_frontalface_alt2.xml"; const char *eyeCascadeFilename = "./Data/haarcascade_eye_tree_eyeglasses.xml"; CascadeClassifier faceCascade; CascadeClassifier eyeCascade; if (!faceCascade.load(faceCascadeFilename)) { cout 0) { for (size_t i = 0; i
上一篇:加权轮询算法