4

I am doing iris recognition for my final year project. Now, i was able to detect iris by using Hough circle transform but it is not works on the detection of pupils although i modifies my webcam become IR webcam. have tried to use HSV color to detect black color in iris but it still cant work, so what algorithms should I refer?

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

Din Hee
  • 123
  • 1
  • 2
  • 7
  • It all depends on how your input frames look. Can you post an example an the code, that you use and does not work? – Tobias Hermann Dec 11 '12 at 20:28
  • the webcam i use is logitech c920 and I made it become IR webcam, then the codes is the part of my project that uses to detect pupil, however, is it the problem on cvScalar? thanks a lot...... – Din Hee Dec 12 '12 at 07:36

1 Answers1

1

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

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

This way, you exclude pixels if their value is greater than 27. You may want to play around with the hue and saturation values to see what works best exactly. Also, because each pixel in the image has three channels, I don't think it makes sense to use a 4-channel scalar when using cvInRangeS.

Anyways,When I ran this code on my computer this was the result:

Doesn't exactly isolate the left iris

You could use blob detection to isolate the left iris in this image. You might want to check out this library: http://code.google.com/p/cvblob/

zackg
  • 319
  • 2
  • 11
  • If I detect the circle in HSV image, then how I detect the circle (pupil)? Because I use cvCanny but it is not works... – Din Hee Dec 12 '12 at 14:19
  • Canny edge detection should be run on a grayscale image. It would make sense to run it on the value channel. After using canny edge detection, you would probably want to use blob detection on the result to isolate the circle. To isolate the circle shape, [this](http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.html#hough-circle) might help you. – zackg Dec 12 '12 at 21:17
  • how to perform canny edge in HSV image? or I need convert it back to BGR? I have no idea at all... – Din Hee Dec 13 '12 at 12:51
  • You can only perform canny edge detection on a grayscale image. I would recommend you extract the value channel from your image, and use that as the channel to perform edge detection on. See [this](http://docs.opencv.org/modules/core/doc/operations_on_arrays.html) for the split syntax. If you want a tutorial on edge detection, there is one [here](http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/canny_detector/canny_detector.html) – zackg Dec 13 '12 at 21:25