Need explanation of this matlab file ridgeorient.m

Status
Not open for further replies.

leekk8

Full Member level 5
Joined
Sep 6, 2005
Messages
309
Helped
35
Reputation
70
Reaction score
18
Trophy points
1,298
Location
Malaysia
Activity points
3,817
This is a matlab file computing the orientation field of a fingerprint. However, I may need the mathematical equation or theory of this code. Please help if anyone understand this. TQ

function [orientim, reliability] = ...
ridgeorient(im, gradientsigma, blocksigma, orientsmoothsigma)

[rows,cols] = size(im);

% Calculate image gradients.
sze = fix(6*gradientsigma); if ~mod(sze,2); sze = sze+1; end
f = fspecial('gaussian', sze, gradientsigma); % Generate Gaussian filter.
[fx,fy] = gradient(f); % Gradient of Gausian.

Gx = filter2(fx, im); % Gradient of the image in x
Gy = filter2(fy, im); % ... and y

% Estimate the local ridge orientation at each point by finding the
% principal axis of variation in the image gradients.

Gxx = Gx.^2; % Covariance data for the image gradients
Gxy = Gx.*Gy;
Gyy = Gy.^2;

% Now smooth the covariance data to perform a weighted summation of the
% data.
sze = fix(6*blocksigma); if ~mod(sze,2); sze = sze+1; end
f = fspecial('gaussian', sze, blocksigma);
Gxx = filter2(f, Gxx);
Gxy = 2*filter2(f, Gxy);
Gyy = filter2(f, Gyy);

% Analytic solution of principal direction
denom = sqrt(Gxy.^2 + (Gxx - Gyy).^2) + eps;
sin2theta = Gxy./denom; % Sine and cosine of doubled angles
cos2theta = (Gxx-Gyy)./denom;

sze = fix(6*orientsmoothsigma); if ~mod(sze,2); sze = sze+1; end
f = fspecial('gaussian', sze, orientsmoothsigma);
cos2theta = filter2(f, cos2theta); % Smoothed sine and cosine of
sin2theta = filter2(f, sin2theta); % doubled angles

orientim = pi/2 + atan2(sin2theta,cos2theta)/2;
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…