separate iris from eye

i am doing a iris detection project,,,in that i have code to detect and plot circles around the iris but now i want to separate the iris part only from the eye image,,,i am trying to us e edge detection and imcrop techniques but not work suggest any way

9 Comments

What is "not working" about edge detection techniques? Can you show us both your image as well as your Matlab code?
lakshmi
lakshmi on 27 Sep 2012
Edited: Walter Roberson on 27 Sep 2012
number=1;
for I=1:number
kp=strcat(num2str(I),'.jpg');
%I=imread('I.jpg');
I=imread(kp);
I=imresize(I,0.1)
figure,imshow(I)
rmin=50
rmax=200
[ci,cp,out]=thresh(I,rmin,rmax);
imshow(out)
[xx,yy] = ndgrid((1:size(out,1))-ci(1),(1:size(out,2))-ci(2));
mask = (xx.^2 + yy.^2)<ci(3)^2;
x=mask.*out(:,:,1);
y=mask.*out(:,:,2);
z=mask.*out(:,:,3);
h=cat(3,x,y,z);
figure;imshow(h)
%f=imcrop(h,[ci(1)-ci(3) ci(2)-ci(3)])
%figure;imshow(f)
h=h*255;
t = wpdec2(f,3,'db1');
X = wprec2(t);
figure,imshow(X)
lakshmi
lakshmi on 27 Sep 2012
Edited: Walter Roberson on 27 Sep 2012
y=edge(h)
h=rgb2gray(h)
y=edge(h)
imshow(y)
lakshmi
lakshmi on 27 Sep 2012
this only main code subcode are their... and i am unble to attach the output h to display
Looks like you got the iris, so all that's left to do is to crop it out. So use any() and find() to locate the top and bottom rows, and left and right columns, then use imcrop to crop it out. Demo code is in my tutorial.
lakshmi
lakshmi on 28 Sep 2012
i am using 2011b... when i use edge detection i can draw outer boundary but i am loosing iris so i want to keep the iris in-side and get reedit of outside part of the circle. but how to do that...and one more thing is i am using neural networks and in that, i am getting very poor training percentage ..so how to improve that? i am using train-lm .. thank you for ur valuable advice's
hi lakshmi may you please give me the code for detect the iris and pupil?

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 27 Sep 2012

0 votes

What is thresh() and the ci that it returns? But anyway, basically this looks just like simple thresholding, like I do in my Image Segmentation Tutorial to find coins in an image. I suggest you look at that demo. It does just like you are doing - threshold to find round objects, then crop them from the image to form small cropped sub-images. I think this is what you said you want to do.
As far as your edge detection code goes, you aren't doing anything with it. You simply get an edge image and then display it. Of course that would require lots of additional processing most likely since I envision all kinds of edges, like where the white of the eye hits the eyelids, where the eyelashes are, striations in the iris itself, etc.
Have you tried imfindcircle()?

7 Comments

lakshmi
lakshmi on 27 Sep 2012
imfindcircle()? ? what is command? in help in not their?
It's fairly new. What version of MATLAB do you have? See http://www.mathworks.com/help/images/ref/imfindcircles.html Make sure you expand the examples and look at them.
lakshmi
lakshmi on 28 Sep 2012
i am using 2011b... when i use edge detection i can draw outer boundary but i am loosing iris so i want to keep the iris in-side and get reedit of outside part of the circle. but how to do that...and one more thing is i am using neural networks and in that, i am getting very poor training percentage ..so how to improve that? i am using train-lm .. thank you for ur valuable advice's.
I don't have the Neural Network toolbox - I use just standard methods.
lakshmi
lakshmi on 28 Sep 2012
so kk but can plz tell me how to take that iris out of the image.
You haven't uploaded the image yet, just a screenshot. And why can't you upgrade to the latest MATLAB so you can use imfindcircle? Did you not get the maintenance agreement?
Ryan
Ryan on 28 Sep 2012
Edited: Ryan on 28 Sep 2012
What you're trying to do (minus the neural network toolbox part) falls within the scope of this tutorial by Image Analyst.
You will not be able to create a circular image of just the iris, it will need to be square to fit into a matrix so Matlab can process it. The background will simply be a known value that you can disregard in further processing. Typically a background value of 0 works well.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!