How do I fill in reflections with an eye Image?
Show older comments
HI There, I am trying to localize and fill in the reflections within an eye. Below is the function which should Localize the reflections: (Input: eye Image, Output: Eye Image with Localize reflections)
function [eyeClose] = findReflections(eye);
%Since Images are already greyscale, no need to convert them.
%Average Intensity Value of image
iAve = mean2(eye);
%*Maximum Intensity Value of image calculated*%
%Gets the 0.04% of the Total amount of pixels in the image
iMaxS = 300*400*0.04;
%Sort the values in descending order
[sortedValues,sortIndex] = sort(eye(:),'descend');
%Get a linear index into Eye image of the iMaxS largest values
highValues = sortedValues(1:iMaxS);
%Fixed amount of Brighest Pixels averaged
iMaxB = mean(highValues);
%P (fixed proportion) is between 0 to 1
%After trial and error 0.8 seems to gather the best of the reflections in
%the Iris
P = 0.8;
%Intensity Threshold
tRef = iAve + P*(iMaxB-iAve)
indicies = uint8(double(eye <=tRef));
eyeTref = eye.*indicies;
%creates a nonflat, ball-shaped structuring element (actually an ellipsoid)
%whose radius in the X-Y plane is R and whose height is H.
se = strel('ball',5,45);
%Dilation Operator
eyeMorph = imdilate(eyeTref,se);
%Closure Operator
eyeClose = imclose(eyeMorph,se);
I am duplicating an algorithm from a scientific paper called " Reliable Algorithm for Iris Segmentation in eye image" by Wojciech Sankoski. Any help would be greatly appreciated
here is the image of the eye:

%
Accepted Answer
More Answers (0)
Categories
Find more on Images in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!