haarcascade face detection for loop

asked 2015-07-28 04:30:32 -0600

elp14sma gravatar image

updated 2015-07-28 04:38:34 -0600

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

edit retag flag offensive close merge delete

Comments

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 points

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-28 04:59:14 -0600 )edit

is faces[i] refers to the number of detected faces or something else ?

elp14sma gravatar imageelp14sma ( 2015-07-28 08:17:07 -0600 )edit

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.

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-28 08:45:27 -0600 )edit