Opencv pupil detection

I have been working on iris recognition for my project last year. Now I was able to detect the iris using the Hough circle transform, but this does not work with pupil detection, although I change my webcam to become an IR webcam. tried to use HSV color to detect black in the iris, but it still doesn't work, so what algorithms should I use?

IplImage *capturedImg = cvLoadImage("template.jpg",1); IplImage* imgHSV = cvCreateImage(cvGetSize(capturedImg), 8, 3); cvCvtColor(capturedImg, imgHSV, CV_BGR2HSV); IplImage* imgThreshed = cvCreateImage(cvGetSize(capturedImg), 8, 1); cvInRangeS(imgHSV, cvScalar(0, 0,0, 0), cvScalar(179, 200, 50,77), imgThreshed); cvShowImage("HSV",imgThreshed); 

enter image description here

+4
source share
1 answer

If you want to find black, it will be present where the value is close to zero. You can change the cvInRangeS command to the following:

 cvInRangeS(imgHSV, cvScalar(0,0,0) , cvScalar(255, 255,27), imgThreshed); 

That way, you exclude pixels if they are greater than 27. You might want to play around with hue and saturation to see what works best. Also, since each pixel in the image has three channels, I don’t think it makes sense to use a 4-channel scalar when using cvInRangeS.

Anyway, when I ran this code on my computer, this was the result:

Doesn't exactly isolate the left iris

You can use blob detection to isolate the left aperture in this image. You can check out this library: http://code.google.com/p/cvblob/

+1
source

All Articles