I'm learning feature-detectors from this lecture notes, and I don't quite understand the Normalized Laplacian of Gaussian filtered image.

Here is the original image: enter image description here

this is the output presented in the lecture notes, filtered by Normalized Laplacian of Gaussian with $\sigma=2.502$: enter image description here

and here is mine, using scipy.ndimage.filters.gaussian_laplace with $\sigma=2.502$: enter image description here

Well, my output image is quite different from the one in the lecture notes. The background of the lecture's output is totally black, even if I did some thresholding, my output is still different from the lecture's.

Moreover, I noticed that edges almost disappeared in the lecture's output, and around each detected blob, there seems to be a ring surrounding it, like this: enter image description here

Why is that? Am I using Laplacian of Gaussian wrong?


Most likely your images look different from the ones in the lectures because of scaling. Note that the result of the convolution with a Laplacian filter will have positive and negative values. What the resulting image looks like depends on the data type of the array, and on the range to which the values are scaled. For example, if you store your filtered image in uint8, without doing any scaling yourself, the negative values will be truncated to 0.

Typically, when an image has negative values, it is scaled so that 0 corresponds to a neutral gray, the minimum value to black, and the maximum to white. It looks like this is what is happening in your code.

On the other hand, in this particular case you are probably interested in both maxima and minima of the Laplacian (dark on bright and bright on dark blobs), so you may as well just take the absolute value of the filtered image. Then you will not have any negative values, which makes the scaling easier.

As far as your question about the edges, this is exactly what should be happening. The value of the Laplacian at an edge should be close to zero. This property is used for very precise edge localization by finding the zero-crossings of the Laplacian of Gaussian.

  • $\begingroup$ I store pixel values as float64, so I think no values will be truncated. Now I kinda doubt that, my output is just edge detection, while the lecture's output is blob, right? $\endgroup$
    – avocado
    Aug 20 '13 at 2:30
  • $\begingroup$ As you said, I tried out taking the absolute value of the filtered image, and it starts to make sense, thank you so much. $\endgroup$
    – avocado
    Aug 20 '13 at 5:00
  • $\begingroup$ @loganecolss Your output is definitely not edge detection. As I said, if you look closely, you will see that the edges of the original image end up having values close to 0 in the filtered image. $\endgroup$
    – Dima
    Aug 20 '13 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.