pythonmatlabimage-processingplotlaplacianofgaussian

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


enter image description here

Hello.

I am trying to make a 3-D graph similar to the one below, that illustrates the 2-D Laplacian of Gaussian (LoG) function. How can I accomplish this through MATLAB or python? Code snippets would be greatly appreciated.

I have found that we can plot the gaussian using this method, but I am looking for how to plot the laplacian of gaussian.


Solution

  • You can use the discrete laplacian function del2:

    N = 3;
    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);
    

    Results:

    enter image description here