Ask Your Question

Finding the center of eye pupil

asked 2014-05-01 17:19:37 -0500

encinaar gravatar image

I want to find the center of eye pupil. Here are the steps that I followed:

1- Obtained eye image from the extracted face image: image description

2- Thresholding the grayscale eye image with the following settings: Max value: 255 Threshold: 60 Threshold Type: CV_THRESH_BINARY image description

3- I can't find the contour of the eye pupil from the image above. So I applied dilatation first opencv_imgproc.cvDilate(left_eye, left_eye, null, 3); image description

4- Need to rescale it: opencv_imgproc.cvErode(left_eye, left_eye, null, 6); image description

Now the problem is to find eye center as fast as possible. How can I achieve such a goal?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-05-02 03:57:46 -0500

Two steps are needed to succeed

  1. Calculate contours using the findContours function.
  2. Calculate the moments using the moments function, which gives you the mass center of your black pixels.
edit flag offensive delete link more


same difficulties myself - and it gets harder when there is a light source reflecting on the pupil. When you have this solved, please share an example piece of code...

Philippe gravatar imagePhilippe ( 2014-05-04 02:55:06 -0500 )edit

tried houghcircles?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-05-05 15:02:51 -0500 )edit

Does not work for me

encinaar gravatar imageencinaar ( 2014-05-10 05:37:39 -0500 )edit

I think you are doing something wrong then. Basically all research on eye localisation uses some sort of hough transform to look for the correct location of the iris.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-05-10 07:25:36 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2014-05-01 17:19:37 -0500

Seen: 1,799 times

Last updated: May 02 '14