2
有没有一种方法来优化哈尔级联分类器的人脸检测?哈尔级联分类器增加人脸检测的准确性
我创造了这个功能,它工作得很好,但我仍然有一些问题,一些照片:
void ImageManager::detectAndDisplay(Mat frame, CascadeClassifier face_cascade){
string window_name = "Capture - Face detection";
string filename;
std::vector<Rect> faces;
std::vector<Rect> eyes;
Mat frame_gray;
Mat crop;
Mat res;
Mat gray;
string text;
stringstream sstm;
cvtColor(frame, frame_gray, COLOR_BGR2GRAY);
equalizeHist(frame_gray, frame_gray);
// Detect faces
face_cascade.detectMultiScale(frame_gray, faces, 1.1, 2, 0 | CASCADE_SCALE_IMAGE, Size(30, 30));
// Set Region of Interest
cv::Rect roi_b;
cv::Rect roi_c;
size_t ic = 0; // ic is index of current element
for (ic = 0; ic < faces.size(); ic++) // Iterate through all current elements (detected faces)
{
roi_c.x = faces[ic].x;
roi_c.y = faces[ic].y;
roi_c.width = (faces[ic].width);
roi_c.height = (faces[ic].height);
crop = frame_gray(roi_c);
faces_img.push_back(crop);
rectangle(frame, Point(roi_c.x, roi_c.y), Point(roi_c.x + roi_c.width, roi_c.y + roi_c.height), Scalar(0,0,255), 2);
}
imshow("test", frame);
waitKey(0);
cout << faces_img.size();
}
框架:照片我必须analize。
face_cascade:从haar_cascade.xml
创建级联分类这是我作为试验的algoritm的照片,结果是这样的:
结果是相当不错,脸部都能正确检测到,但正如你所看到的,我想删除三个误报。
在此先感谢
可能会将minNeighbours参数从2增加到5(直到您开始错过正数)。 – berak
哇,它的工作原理。谢谢 –
顺便说一句,如果你发现更好的错误检测, - 随时[在这里添加它们](http://machine-pareidolia.appspot.com/) – berak