0

I am trying to create an application that is able to detect and track the iris of an eye in a live video stream. In order to do that, I want to use Python and OpenCV. While researching for this on the internet, it seemed to me that there are multiple possible ways to do that.

First Way:

Run a Canny Filter to get the edges, and then use HoughCircle to find the Iris.

Second Way:

Use Otsus-Algorithm to find the perfect threshold and then use cv2.findContours() to find the Iris.

Since I want this to run on a Raspberry Pi (4B), my question is which of these methods is better, especially in terms of reliability and performance?

milanbalazs
  • 4,811
  • 4
  • 23
  • 45
Alex1
  • 27
  • 6
  • Edge detection is more reliable than thresholding , the reson is that your thresholding values varies with light intensity of your images(maybe other factors like skin ...etc). So you'll have to select the right method .... Sobel , Canny , Prewitt ...etc and Select the righ method for circle detection too. – Ziri Nov 27 '19 at 07:35

1 Answers1

0

I would take a third path and start from a well enstablished method for facial landmark detection (e.g. dlib). You can use a pre-trained model to get a reliable estimate on the position of the eye.

This is an example output from a facial landmark detector:

enter image description here

Then you go ahead from there to find the iris, either using edge detection, Hough or whathever.

Probably you can simply use an heuristic as you can assume the iris to be always in the center of mass of the keypoints around each eye.

There are also some good tutorials online in a similar setting (even for Raspberry) for example this one or this other one from PyImageSearch.

ndrplz
  • 1,584
  • 12
  • 16
  • I've been using Haar-Cascade to detect the position of the eyes, is there any advantage in using landmark detection compared to haar cascades? – Alex1 Nov 28 '19 at 10:07
  • I would say that landmark detection is more robust, however if Haar-Cascade works for you that's fine! – ndrplz Nov 28 '19 at 20:02
  • Haar-Cascade, gives you too many false positives! need to use OpenCV nn with cafe or train your own model. – Oscar Rangel Nov 02 '21 at 23:58