美文网首页
LoG函数可视化的Matlab实现

LoG函数可视化的Matlab实现

作者: 北欧森林 | 来源:发表于2021-04-10 14:21 被阅读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算子

    相关文章

      网友评论

          本文标题:LoG函数可视化的Matlab实现

          本文链接:https://www.haomeiwen.com/subject/iqcnkltx.html