Eye Tracking on IR image

Hello everyone,

I am looking for a way to track eyes in my IR image stack.

Would really appreciate if someone helps us out here.

Thank you.



@sohailhaleem Can you please post a sample image to illustrate your issue? And describe exactly what you are trying to achieve?

The problem is that when i try to threshold, it selects most of the black area around the eye with it. How can I selectively threshold the pupil and then be able to track it.

Thank you so much for helping out.

It did not upload correctly for the first time.

@sohailhaleem That is tricky. Those dark eyelashes overlap and make it hard to segment just the pupil. You can’t do this on someone with blonde eyelashes, can you?! Anyway, there are a couple of options. Firstly, I tried stretching and applying the contrast before adjusting the threshold, and then used a couple of erodes. This worked quite well, and using identify particles I could ignore the background areas based on size and shape and connected to edges, but the flare from the back of the retina reflection means I don’t have a single large object to identify the pupil (left hand image). Secondly I tried instead just to segment out the bright point of reflection by thresholding the other way (right hand image). This is really easy, and would be robust for tracking movement, as long as that point of reflection moves with the eye- it may move less than the eyeball does since the lightsource stays fixed and it is bouncing off the part of the retina that is opposite the camera. You would have to look at the timelpase images. If that isn’t suitable, you could try doing both and merging the result of the dark and the light threshold- this may give you a single pupil.


Hi @sohailhaleem

I tried my best too :slight_smile:
Here the segmentation result:

I used Curved Gabor Filter to enhance the iris-borders, once I’ve got the iris I was able to extract the pupil with a combination of thresholding and morphological image operations with a large sphere (radius 20px) as kernel.

Here (523.9 KB) is the KNIME Image Processing workflow.

PS: I tired to create a robust solution, but I could only test it on this one image.