gusucode.com > 车辆识别matlab源码程序 > source/zipSUSAN/getUSAN.m
%function U = getUSAN(A,maxInt,sigma,thresh,width) % % Returns the USAN response of a greysale image % % INPUT: % A - the image. Intensity must be quantized as integers with a minimum % intensity 0 to a maximum maxInt % maxInt- the maximum intensity % sigma - the guassian mask coefficient % thresh - the maximum allowed difference between intensity values % width(optional) - the width of the mask, which must be odd. % % OUTPUT: % U - the normalized USAN response function U = getUSAN(A,maxInt,sigma,thresh,width) if(nargin == 4) width = 2*ceil(sigma)+1; end %prepare A A = double(A); if(isrgb(A)) A = rgb2gray(A); end %create the guassian mask halfWidth = (width-1)/2; mask = meshgrid(-halfWidth:halfWidth,-halfWidth:halfWidth)/(sqrt(2)*sigma); mask = exp(-mask.^2 - (mask').^2); maxResponse = sum(mask(:)); %make the lookup table table = [exp(-([maxInt:-1:0]/thresh).^6) exp(-([1:maxInt]/thresh).^6)]; %pass it to the nonlinear filter U = nlDiffFilter(A,table,mask)/maxResponse;