Ask Your Question

afnan's profile - activity

2015-11-21 10:41:45 -0500 received badge  Enthusiast
2015-11-10 02:04:27 -0500 asked a question iris and pupil detection

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);