Re: Fingerprint Image orientatiom problem
in Final_part2.pdf have come the formula that not work, but in Wau university by peter write a program like this for orientation image like fingerprint.
in following , I have commented som For , in that , I want to calculate formula in that pdf paper. but not work.
can u say me y it not Work with For lines?
can u say me , What is "denom" variable and how to calculate this?
regards
zahedpoor
blksize=16;
f = fspecial('sobel'); % Generate sobel filter. sobel is gradient mask,
Gx = filter2(f', im); % Gradient of the image in x
Gy = filter2(f, im); % ... and y
Gxy = zeros(size(im));
Gxx = zeros(size(im));
Gyy = zeros(size(im));
Gyyxx = zeros(size(im));
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.
f = fspecial('gaussian', 18,3);
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;
% n=blksize/2;
%
% [rows,cols]=size(im);
%
%
% for i=n+1:rows-n
% for j=n+1:cols-n
% Gxy(i,j)=Gxy(i,j)+ sum(sum( 2* Gx(i-n:i+n,j-n:j+n) .* Gy(i-n:i+n,j-n:j+n) )) ;
% Gxx(i,j)=Gxx(i,j)+ sum(sum( Gx(i-n:i+n,abs(j-n):j+n).^2 )) ;
% Gyy(i,j)=Gyy(i,j)+ sum(sum( Gy(i-n:i+n,abs(j-n):j+n).^2 )) ;
% Gyyxx(i,j)= Gyyxx(i,j)+ sum(sum( Gxx(i-n:i+n,abs(j-n):j+n) .* Gyy(i-n:i+n,abs(j-n):j+n) ));
% end
% end
%theta=atan2( (Gxx .* Gyy), 2 .* Gxy)/2;
%SMOOTHING the local neighbourhood base on x and y
f=fspecial('gaussian',8,1);
% theta = imfilter(theta ,f) ;
%
%
% cos2theta = cos(2*theta);
% sin2theta = sin(2*theta);
%final smoothed orientation image
cos2theta = imfilter(cos2theta ,f) ;
sin2theta = imfilter(sin2theta ,f);
Orientim= pi/2+atan2(sin2theta , cos2theta)/2;