I need to find the orientation of a fingerprint.I have a code that uses gaussian filter that I got from mathworks.in but I'm getting a weird error that I cant figure out what to do about.
2 次查看(过去 30 天)
显示 更早的评论
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.
[x,y] = gradient(f); % Gradient of Gausian.
[fx,fy]=meshgrid(x,y);
Gx = filter1(fx, im); % Gradient of the image in x
Gy = filter1(fy, im); % ... and y
%Gx=imfilter(im,fx,'conv','replicate');
%Gy=imfilter(im,fy,'conv','replicate');
% 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;
??? Undefined function or method 'conv2' for input arguments of type 'double' and attributes 'full 3d real'.
Error in ==> filter2 at 73 y = conv2(hcol, hrow, x, shape);
Error in ==> ridgeorient at 56 Gxx = filter2(f, Gxx);
0 个评论
采纳的回答
Walter Roberson
2012-2-24
Is your image possibly an RGB (truecolor) image? That code is not designed to support that. Try using rgb2gray() on your original image and passing that grayscale image to this routine.
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!