Ask Your Question

haarcascade_mcs_lefteye.xml - for which eye?

asked 2014-07-15 04:33:37 -0600

Jupiter gravatar image

I am going to use separate haar cascades to detect left and right eyes. My question is: is haarcascade_mcs_lefteye.xml applicable to the left eye of the person on the photo or to the eye at the left from the observer’s point of view? I cannot decide on my own because both haarcascade_mcs_lefteye.xml and haarcascade_mcs_righteye.xml detect both eyes on the photos that I have tried.

edit retag flag offensive close merge delete


I use both for both cases then combine the detections. It is best do take this approach since in the end you will gather more detections and less misses! :)

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-15 04:36:39 -0600 )edit
  1. Could you please give more details on how you combined the results? Did you just average them?
  2. In case you do not segregate left and right eyes, why not rather use the common detector haarcascade_eye.xml?
Jupiter gravatar imageJupiter ( 2014-07-15 06:59:24 -0600 )edit

What I do is add all detections into a single vector of rectangles. I then wrote a function called fuse_detections which takes a detection and checks if any of the other detections share more than 50% overlap. In that case, I merge both detections and create a bounding box containing the outer borders. Remove the two merged from the list and add the combined one. Keep going until no matches are found anymore. Then classify them as eyes. In order to know right and left, just analyze the coordinates of the corners. I used normal eye, right eye and left eye model. Running that on a detected face area takes almost no time and it gives a chance that one model missed but the other succeeded in detecting.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-15 07:19:33 -0600 )edit

1 answer

Sort by » oldest newest most voted

answered 2014-07-15 05:35:28 -0600

pthbrk gravatar image

According to Mastering OpenCV book page 271, it's the left eye of the subject:

...If the XML filename says "left eye", it means the actual left eye of the person, so in the camera image it would normally appear on the right-hand side of the face, not on the left-hand side!...

edit flag offensive delete link more


Thank you!

Jupiter gravatar imageJupiter ( 2014-07-15 06:48:59 -0600 )edit

Question Tools

1 follower


Asked: 2014-07-15 04:33:37 -0600

Seen: 3,612 times

Last updated: Jul 15 '14