d2dgauss.m
来自「非常好的数字处理教程」· M 代码 · 共 24 行
M
24 行
% Function "d2dgauss.m":% This function returns a 2D edge detector (first order derivative% of 2D Gaussian function) with size n1*n2; theta is the angle that% the detector rotated counter clockwise; and sigma1 and sigma2 are the% standard deviation of the Gaussian functions.function h = d2dgauss(n1,sigma1,n2,sigma2,theta) r=[cos(theta) -sin(theta); sin(theta) cos(theta)]; for i = 1 : n2 for j = 1 : n1 u = r * [j-(n1+1)/2 i-(n2+1)/2]'; h(i,j) = gauss(u(1),sigma1)*dgauss(u(2),sigma2); end end h = h / sqrt(sum(sum(abs(h).*abs(h))));% Function "gauss.m":function y = gauss(x,std) y = exp(-x^2/(2*std^2)) / (std*sqrt(2*pi));% Function "dgauss.m"(first order derivative of gauss function):function y = dgauss(x,std) y = -x * gauss(x,std) / std^2;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?