Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

About finding pupil in a video

I am now working on an eye tracking project. In this project I am tracking eyes in a webcam video (resolution if 640X480).

I can locate and track the eye in every frame, but I need to locate the pupil. I read a lot of papers and most of them refer to Alan Yuille's deformable template method to extract and track the eye features. Can anyone help me with the code of this method in any languages (matlab/OpenCV)?

I have tried with different thresholds, but due to the low resolution in the eye regions, it does not work very well. I will really appreciate any kind of help regarding finding pupil or even iris in the video.

Sample image

like image 475
noname noname Avatar asked May 11 '12 06:05

noname noname


People also ask

Which is the pupil?

The round opening in the center of the iris (the colored tissue that makes the "eye color" at the front of the eye). The pupil changes size to let light into the eye. It gets smaller in bright light and larger as the amount of light decreases.

How do you observe pupil dilation?

Method: Use a bright handheld light in a dim room. Shine the light in one of the patient's eyes and observe for a reaction. After ~3 seconds, rapidly swing the light to the opposite pupil and observe the reaction. After ~3 seconds, swing back to the first eye and observe again.

What is the normal size of pupils?

The normal pupil size in adults varies from 2 to 4 mm in diameter in bright light to 4 to 8 mm in the dark. The pupils are generally equal in size. They constrict to direct illumination (direct response) and to illumination of the opposite eye (consensual response). The pupil dilates in the dark.


1 Answers

What you need to do is to convert your webcam to a Near-Infrared Cam. There are plenty of tutorials online for that. Try this.

A Image taken from an NIR cam will look something like this -

enter image description here

You can use OpenCV then to threshold.

enter image description here

Then use the Erode function.

enter image description here

After this fill the image with some color takeing a corner as the seed point.

enter image description here

Eliminate the holes and invert the image.

enter image description here

Use the distance transform to the nearest non-zero value.

enter image description here

Find the max-value's coordinate and draw a circle.

enter image description here

like image 125
Anirudh Avatar answered Sep 22 '22 23:09

Anirudh