Sunday, 13 July 2014

To extract iris region from eye image

It is a program to detect the iris region in an image based on RGB values. The outermost region is eliminated and then the image is as shown


The program to convert the image into binary is as shown:

 a=imread('eye1.jpg');
[m n p]=size(a);
 r=a(:,:,1);
 g=a(:,:,2);
 b=a(:,:,3);
for i=1:m
    for j=1:n
        for k=1:p
        if (r(i,j)>125)||(g(i,j)>75)||(b(i,j)>42)
      d(i,j)=0;
  else
      d(i,j)=a(i,j);
        end
    end
    end
end
d1=uint(d);
figure,imshow(d1);
b=rgb2gray(a);
 figure,imshow(a);
figure,imshow(b);
%figure,imshow(c);
c=im2bw(b,0.3);
i6=medfilt2(c,[3 3]);
figure,imshow(c);
%imtool(i6);
figure,imshow(i6);

No comments:

Post a Comment