iris and pupil detection

asked 2015-11-10 01:40:13 -0500

afnan gravatar image

updated 2019-12-10 01:24:58 -0500

Akhil Patel gravatar image

Hello everyone, I want to localize the iris and pupil in eye image. I used the circle how transforms of opencv, but I can't estimate the correct parameters' values. If there is any way to correctly estimation parameters, please tell me how?? Or Are there any mistake in the following my code?

the original image : C:\fakepath\img_10_1_1.jpg canny image: C:\fakepath\20151109232057.jpg

and I didn't get any circle.

the code:

 //convert image to gray 
 org.opencv.imgproc.Imgproc.cvtColor(mRgba, imgCny, Imgproc.COLOR_RGB2GRAY);
 //apply threshold and morphology
  org.opencv.imgproc.Imgproc.threshold(imgCny, imgCny, 150, 150, Imgproc.THRESH_BINARY);
  org.opencv.imgproc.Imgproc.morphologyEx(imgCny, imgCny, Imgproc.MORPH_CLOSE,Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(3, 3)));
  org.opencv.imgproc.Imgproc.morphologyEx(imgCny,imgCny,Imgproc.MORPH_ERODE ,Imgproc.getStructuringElement(Imgproc.MORPH_RECT,new Size(3,3) ));
 //canny
  org.opencv.imgproc.Imgproc.Canny(imgCny, imgCny, 10,30 );
 //Hough Circles
  org.opencv.imgproc.Imgproc.HoughCircles(imgCny,circles, Imgproc.CV_HOUGH_GRADIENT,1,imgCny.rows()/8,100,300,2,400);
 //draw circle
  if(!circles.empty()){
    for (int i=0; i < circles.cols();i++){
         double vCircle[] = circles.get(0,i);
         pt = new Point((int) Math.round((vCircle[0])),(int) Math.round((vCircle[1])));
         int radius = (int) Math.round(vCircle[2] );
         Core.circle(mRgba, pt, radius, new Scalar(0,255,0),3);
edit retag flag offensive close merge delete

Comments

why 150, 150 in threshold?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-11-10 07:14:20 -0500 )edit