c++ - opencv face detection loop parameters -
i need explanation of following loop face detection in opencv
videocapture capture("dsc_0772.avi"); //-1, 0, 1 device id mat cap_img,gray_img; vector<rect> faces, eyes; while(1) { capture >> cap_img; waitkey(10); cvtcolor(cap_img, gray_img, cv_bgr2gray); cv::equalizehist(gray_img,gray_img); 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; < 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); }
i don't understand faces[i].x , other loop parameters
how selected face detection
thanks help
faces
std::vector
of rect
. loop going through each rect
in vecto
r , creating 2 points. rect
stores not x , y(of top left corner) height , width of rectangle. faces[i].x+faces[i].width
taking x coordinate of rectangle plus width , faces[i].y+faces[i].height
taking y coordinate of rectangle plus height. getting opposite corner of rectangle. feeding points plus image rectangle()
function.
Comments
Post a Comment