haarcascade face detection for loop
In implementing haarcascade for face detection , after reading video file the following loop is used .
I need explanation on how it works for exmaple what is the meaning of
faces[i].x+faces[i].width, faces[i].y+faces[i].height
face_cascade.detectMultiScale(gray_img, faces, 1.1, 5, CV_HAAR_SCALE_IMAGE | CV_HAAR_DO_CANNY_PRUNING, cvSize(0,0), cvSize(300,300));
for(int i=0; i < faces.size();i++)
{
Point pt1(faces[i].x+faces[i].width, faces[i].y+faces[i].height);
Point pt2(faces[i].x,faces[i].y);
rectangle(cap_img, pt1, pt2, cvScalar(0,255,0), 2, 8, 0);
}
Thanks for help
That is an unneeded thing. You can just do
rectangle(cap_img, faces[i], cvScalar(0,255,0), 2, 8, 0)
and do not compute the 2 pointsis faces[i] refers to the number of detected faces or something else ?
faces is a vector of cv::Rect that is the output of detectMultiScale. Based on teh flags of the function, you can have different results.