Im trying to create a pupil detector. Tue input images have the problem of being noisy and with many intensity variations, and therefore no thresholding algorithm is feasible to detect it. Im using the Canny edge detector instead (after histogram equalization).
The problem is that even this algorithm is not perfect finding circles. I find many situations where the circles are incomplete, or not fully closed.Therefore, I would like to connect all the edges of the circle.
Notice that simply conecting the nearest edges is not always the best option, because there are several other edges that may be near but not belong to the circle (the left image I present here is quite clean, but the right one is not so much). There is also the problem of specular reflection edges inside the pupil (not shown here).
I also tried to compute the euclidian distance to find the center, but as you can see from this example, the center is not always the highest euclidian distance as theres penty of larger distances, specially for small pupils. For example, euclidian distance might work with the right image, but probably not with the left one.
For me the only option is to try to compute the center and radius of curvature of each edge and then use it to fit a circle. Any suggestion of how I should do this?
This must be done in an efficient way and in real time. I also tried the Hough transform, but it didnt't work, even after using the euclidian distance method (it also seems too slow in Matlab).