Need a flag to shows an eye has been detected

asked 2016-07-30 05:51:04 -0600

updated 2016-07-30 12:36:32 -0600

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++){

              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...

edit retag flag offensive close merge delete

Comments

3

in other words, you got no idea, what above code does ?

berak gravatar imageberak ( 2016-07-31 06:54:07 -0600 )edit

No I just want add some codes to my program to give me a flag when eyes detected

Arash Karimi gravatar imageArash Karimi ( 2016-07-31 11:32:14 -0600 )edit

do you understand, what happens here: for(size_t j=0; j<eyes.size(); j++) ?

berak gravatar imageberak ( 2016-07-31 14:03:30 -0600 )edit

Nop.... you tell me plz

Arash Karimi gravatar imageArash Karimi ( 2016-07-31 16:03:36 -0600 )edit

Thanks for your guide

Arash Karimi gravatar imageArash Karimi ( 2016-08-03 07:22:19 -0600 )edit