Ask Your Question

Revision history [back]

Need a flag to shows an eye has been detected.Hi

Hi. I have a code that detect just open eyes and draws a circle around it, Now I need a variable like "A" that should works as a flag that means if an open eye has been detected it should be A=1, and when there is no eye in the picture A=0, to use in following codes. here is a part of my codes :

face_cascade.detectMultiScale(gray_img, faces, 1.1, 10, 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); Mat faceROI = gray_img(faces[i]); haarcascade_eye.detectMultiScale(faceROI, eyes, 1.2, 40, 0 | CV_HAAR_SCALE_IMAGE, Size(30,30)); for(size_t j=0; j<eyes.size(); j++){<="" p="">

          Point center(faces[i].x+eyes[j].x+eyes[j].width*0.5, faces[i].y+eyes[j].y+eyes[j].height*0.5);
          int radius = cvRound((eyes[j].width+eyes[j].height)*0.25);

Please help...

Need a flag to shows an eye has been detected.Hidetected

Hi. I have a code that detect just open eyes and draws a circle around it, Now I need a variable like "A" that should works as a flag that means if an open eye has been detected it should be A=1, and when there is no eye in the picture A=0, to use in following codes. here is a part of my codes :

 face_cascade.detectMultiScale(gray_img, faces, 1.1, 10, 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);
Mat faceROI = gray_img(faces[i]);
haarcascade_eye.detectMultiScale(faceROI, eyes, 1.2, 40, 0 | CV_HAAR_SCALE_IMAGE, Size(30,30));
for(size_t j=0; j<eyes.size(); j++){<="" p="">

j++){
 Point center(faces[i].x+eyes[j].x+eyes[j].width*0.5, faces[i].y+eyes[j].y+eyes[j].height*0.5);
  int radius = cvRound((eyes[j].width+eyes[j].height)*0.25);

Please help...