How to detect sclera accurately ? Please Help

2 views (last 30 days)
G.Liz
G.Liz on 18 Jul 2013
The code below does not detect the sclera part perfectly. Could anyone please suggest a modification which would make it work correctly. I'm working on the UBIRIS database.
[filename pathname] = uigetfile('*.jpg','Select an Image'); testimg = imread([pathname filename]); figure(1), subplot(3,3,2), imshow(testimg); title('Test Eye Image'); axis off %% Sclera Map Creation HSIimg = rgb2hsi(testimg); S = HSIimg(:,:,2); [m n] = size(S); subplot(3,3,4), imshow(S); title('Saturation Image'); axis off %% threshsclera = S; for i = 1:m for j = 1:n if S(i,j) < 0.08 % 0.06 threshsclera(i,j) = 255; else threshsclera(i,j) = 0; end end end threshsclera = uint8(threshsclera); subplot(3,3,6), imshow(threshsclera); title('Thresholded Sclera'); axis off; %% BW = (threshsclera==255); scleraimg = bwareaopen(BW,100);%6000 subplot(3,3,7), imshow(scleraimg); title('Sclera Mask'); axis off %% Segment sclera R = testimg(:,:,1); G = testimg(:,:,2); B = testimg(:,:,3); R(scleraimg==0) = 0; G(scleraimg==0) = 0; B(scleraimg==0) = 0; segsclera = cat(3,R,G,B); subplot(3,3,8), imshow(segsclera);

Answers (0)

Community Treasure Hunt

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

Start Hunting!