马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
% Function "d2gauss.m":<BR>% This function returns a 2D Gaussian filter with size n1*n2; theta is <BR>% the angle that the filter rotated counter clockwise; and sigma1 and sigma2<BR>% are the standard deviation of the Gaussian functions.<BR>function h = d2gauss(n1,std1,n2,std2,theta)<BR>r=[cos(theta) -sin(theta);<BR> sin(theta) cos(theta)];<BR>for i = 1 : n2 <BR> for j = 1 : n1<BR> u = r * [j-(n1+1)/2 i-(n2+1)/2]';<BR> h(i,j) = gauss(u(1),std1)*gauss(u(2),std2);<BR> end<BR>end<BR>h = h / sqrt(sum(sum(h.*h)));<BR><BR>% Function "gauss.m":<BR>function y = gauss(x,std)<BR>y = exp(-x^2/(2*std^2)) / (std*sqrt(2*pi));<BR> |