Image normalization using Daugman Rubber sheet model

Hello everyone. i have segmenated image of iris and i need to normalize it using daugman rubber sheet model. i tried using https://www.mathworks.com/matlabcentral/fileexchange/51246-pupil-limbus-detection-and-daugman-normalization but i cannot get the output.
here's the error. can expalin how to use it?
i also put declaration like this; and dont get the output
% % Input parameters
% xPosPupil = 625;
% yPosPupil = 306;
% rPupil = 70;
% xPosIris = 625;
% yPosIris = 306;
% rIris = 250;
soalan.JPG

 Accepted Answer

You are calling the daugmanCircleDetection function which complains that it cannot find the class ASSStack. To solve this you should make sure that Matlab can find the class (https://github.com/frankcorneliusmartin/IrisAlgorithms/blob/master/Classes/ASSStack.m) . However: The function daugmanCircleDetection is used to segment the limbus and pupil, and not for normalization.
You should call the function rubberSheetNormalisation instead to perform the normalization, which is defined in https://github.com/frankcorneliusmartin/IrisAlgorithms/blob/master/Segmentation/rubberSheetNormalisation.m

5 Comments

ohh okay sorry, im not good in coding. thank you so much for helping me sir.
before i run rubberSheetNormalisation.m, i should change the input parameter in example then paste it in rubberSheetNormalisation.m. it that how to do it?
That would be a valid way to do this yes.
this is how i insert the coding. is it correct?
function image = rubberSheetNormalisation( img, xPosPupil, yPosPupil, rPupil , xPosIris , yPosIris , rIris , varargin )
%rubberSheetNormalisation, function that normalizes the iris region. This is
%the region between the pupil boundary and the limbus. This is done
%according to the rubber sheet model proposed by Daugman (1).
%
% SYNOPSIS
% - image = rubberSheetNormalisation( img, xPosPupil, yPosPupil, rPupil , xPosIris , yPosIris , rIris )
% - image = rubberSheetNormalisation( img, xPosPupil, yPosPupil, rPupil , xPosIris , yPosIris , rIris , 'DebugMode' , 1 )
%
% INPUTS
% - img <double>
% Eye image from the cassini, preferably a NIR image. If no image
% is supplied, a pop up will ask to select one.
% - xPosPupil <integer>, yPosPupil <integer>, rPupil <integer>
% The x,y-position of the pupil center and the pupil radius
% - xPosIris <integer>, yPosIris <integer>, rIris <integer>
% The x,y-position of the iris center and the iris radius
% - varargin <optional>, input scheme
% 'DebugMode': {0: off, 1: on} - if set to 1 shows extra info
% 'AngleSamples': <integer> - number of radial samples
% 'RadiusSamples': <integer> - number of radius samples
% 'UseInterpolation': <boolean> - if 1, the samples will be
% interpolated else nearest neighbor interpolation is used.
%
% OUTPUT
% - image, containing the normalized iris region
%
% DEPENDANCIES
% - Communications Toolbox
% - Computer Vision System Toolbox (for debugmode)
%
% HISTORY
% - 26th may 2017: removed Communications Toolbox
% - 19th June 2016: added the interpolation option
%
% REFERENCES
% (1) How iris recognition works, Daugman, J.G.
%
% AUTHOR
% F.C. Martin <frank@grafikus.nl>
% 19th of May 2015 - 26th may 2017
%
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
% Load the image
img = imread('1.jpg');
% Input parameters
xPosPupil = 1007;
yPosPupil = 947;
rPupil = 503;
xPosIris = 313;
yPosIris = 323;
rIris = 156;
% Normalize the iris region according to daugmans model
irisRegion = rubberSheetNormalisation( img, xPosPupil, yPosPupil, rPupil , xPosIris , yPosIris , rIris, 'DebugMode', 1 );
%todo: remove for-loop for line detection
if(size(img, 3) == 3) % if RGB image is inputted
img = rgb2gray(img);
end
% parse input
p = inputParser();
addRequired( p , 'xPosPupil' , @isnumeric );
addRequired( p , 'yPosPupil' , @isnumeric );
addRequired( p , 'rPupil' , @isnumeric );
addRequired( p , 'xPosIris' , @isnumeric );
addRequired( p , 'yPosIris' , @isnumeric );
addRequired( p , 'rIris' , @isnumeric );
addOptional( p , 'AngleSamples', 360 ,@isnumeric );
addOptional( p , 'RadiusSamples', 360 ,@isnumeric );
addOptional( p , 'DebugMode', 0, @isnumeric );
addOptional( p , 'UseInterpolation', 1, @isnumeric );
parse( p , xPosPupil, yPosPupil, rPupil , xPosIris , yPosIris , rIris , varargin{:} )
% Normalize the iris region according to daugmans model
% irisRegion = rubberSheetNormalisation( img, xPosPupil, yPosPupil, rPupil , xPosIris , yPosIris , rIris, 'DebugMode', 1 );
% Note that internally matrix coordinates are used
xp = p.Results.yPosPupil;
yp = p.Results.xPosPupil;
rp = p.Results.rPupil;
xi = p.Results.yPosIris;
yi = p.Results.xPosIris;
ri = p.Results.rIris;
angleSamples = p.Results.AngleSamples;
RadiusSamples = p.Results.RadiusSamples;
debug = p.Results.DebugMode;
interpolateQ = p.Results.UseInterpolation;
% Initialize samples
angles = (0:pi/angleSamples:pi-pi/angleSamples) + pi/(2*angleSamples);%avoiding infinite slope
r = 0:1/RadiusSamples:1;
nAngles = length(angles);
% Calculate pupil points and iris points that are on the same line
x1 = ones(size(angles))*xi;
y1 = ones(size(angles))*yi;
x2 = xi + 10*sin(angles);
y2 = yi + 10*cos(angles);
dx = x2 - x1;
dy = y2 - y1;
slope = dy./dx;
intercept = yi - xi .* slope;
xout = zeros(nAngles,2);
yout = zeros(nAngles,2);
for i = 1:nAngles
[xout(i,:),yout(i,:)] = linecirc(slope(i),intercept(i),xp,yp,rp);
end
% Get samples on limbus boundary
xRightIris = yi + ri * cos(angles);
yRightIris = xi + ri * sin(angles);
xLeftIris = yi - ri * cos(angles);
yLeftIris = xi - ri * sin(angles);
% Get samples in radius direction
xrt = (1-r)' * xout(:,1)' + r' * yRightIris;
yrt = (1-r)' * yout(:,1)' + r' * xRightIris;
xlt = (1-r)' * xout(:,2)' + r' * yLeftIris;
ylt = (1-r)' * yout(:,2)' + r' * xLeftIris;
% Create Normalized Iris Image
if interpolateQ
image = uint8(reshape(interp2(double(img),[yrt(:);ylt(:)],[xrt(:);xlt(:)]),length(r), 2*length(angles))');
else
image = reshape(img(sub2ind(size(img),round([xrt(:);xlt(:)]),round([yrt(:);ylt(:)]))),length(r), 2*length(angles));
end
% Show all points on original input image
if debug
img = insertShape(img, 'circle', [yrt(:),xrt(:),2*ones(size(xrt(:)))],'Color','r');
img = insertShape(img, 'circle', [ylt(:),xlt(:),2*ones(size(xrt(:)))],'Color','r');
figure('name','Sample scheme of the rubber sheet normalization');
imshow(img);
drawnow;
end
% Show Resulting image
figure(2);
imshow(irisRegion);
end
ques 2.JPG
I feel this is no longer in the scope of providing support for my script, as these are more general Matlab questions. I recommend you follow some basic Matlab tutorials from:

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!