About finding pupil in a video

↘锁芯ラ 提交于 2019-12-03 13:39:01

问题


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.


回答1:


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 -

You can use OpenCV then to threshold.

Then use the Erode function.

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

Eliminate the holes and invert the image.

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

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




回答2:


If you're still working on this, check out my OptimEyes project: https://github.com/LukeAllen/optimeyes

It uses Python with OpenCV, and works fairly well with images from a 640x480 webcam. You can check out the "Theory Paper" and demo video on that page also. (It was a class project at Stanford earlier this year; it's not very polished but we made some attempts to comment the code.)




回答3:


Depending on the application for tracking the pupil I would find a bounding box for the eyes and then find the darkest pixel within that box.

Some psuedocode:

box left_location = findlefteye()
box right_location = findrighteye()
image_matrix left = image[left_location]
image_matrix right = image[right_location]
image_matrix average = left + right
pixel min = min(average)
pixel left_pupil = left_location.corner + min
pixel right_pupil = right_location.corner + min



回答4:


In the first answer suggested by Anirudth...
Just apply the HoughCirles function after thresholding function (2nd step).
Then you can directly draw the circles around the pupil and using radius(r) and center of eye(x,y) you can easily find out the Center of Eye..



来源:https://stackoverflow.com/questions/10546323/about-finding-pupil-in-a-video

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!