LoG函数可视化的Matlab实现

2021-04-10  本文已影响0人  北欧森林

Matlab 上运行:

N = 4;
x=linspace(-N, N,30);
[X,Y]=meshgrid(x,x);
z=del2((1000/sqrt(2*pi).*exp(-(X.^2/2)-(Y.^2/2))));
surf(X,Y,z);

Output:


image.png

或者:

laplace_gaussian_filter = fspecial('log',[50 50],5);
subplot(121)
surf(laplace_gaussian_filter);
subplot(122)
surf(-laplace_gaussian_filter);

Output:


image.png

俭朴版:

x = linspace(-4,4,41);
G = exp(-x.^2/2)/sqrt(2*pi);
Gxx = G .* (x.^2-1);
data = G .* Gxx.';
data = data + data.';
surf(x,x,data,'facecolor','white')
view(45,13)
set(gca,'dataaspectratio',[1,1,0.08])
grid off
xlabel('X')
ylabel('Y')

Output:


image.png

参考资料
How to graph/plot 2D Laplacian of Gaussian (LoG) function in MATLAB or python?

LoG算子与DoG算子

上一篇下一篇

猜你喜欢

热点阅读