# Laplacian of Gaussian operator

This might be a silly question. I was reading about the Laplacian of Gaussian (LoG) operator and got confused about the alternative equivelant ways we can make use of it.

Let's assume we have a 2D image $$I(x,y)$$

Since linear convolution commutes with differential operators the following equality is valid: $$\nabla^2 (G_{\sigma}\ast I) = (\nabla^2 G_{\sigma})\ast I$$ We also know that convolution is commutative, so we could also write (could we??) : $$\nabla^2 (G_{\sigma}\ast I) = \nabla^2 (I \ast G_{\sigma}) \mathop{=}\limits^?G_{\sigma}\ast(\nabla^2 I)$$ which means that we first have to apply the Laplacian operator on image $$I(x,y)$$ and then convolve the result with the Gaussian filter.

However, is this approach correct? It seems to me wrong and haven't found it anywhere. I tend to believe it's not valid since it will amplify the noise of initial image $$I(x,y)$$ (because we first apply the Laplacian operator on the noisy image) and then the smoothing will not be such efficient.

This sounds counter intuitive to many, but as long as the difference operator and the smoothing kernel are linear and space-invariant, they can be applied in any order, and thus are often combined in a single convolution operator (for more computational efficiency), for the same.

For some intuition, consider that, either for the linear smoothing and the derivative, a noisy pixel is replaced by a linear weighed combination of other pixels. And a linearly-weighed combination of another linearly-weighed combination remains a linear combination, the same due to the commutativity and the associativity properties of the addition and the multiplication.

This is illustrated below for the first derivative only, but you can follow the same argument by differentiating again.

What you describe is commonly known as the LoG, Laplacian of Gaussian. Note that when one operation becomes nonlinear, this is not true anymore.

• Thanks for your aswer. So, if I get it right, all the equalities I have writen on my question are valid (even the last one). Your illustration is really helpful but what got me confused was the implementation where we first apply the derivative on initial function $f$ ($\frac{\partial f}{\partial x}$) and not on filter $h$ and then apply the convolution. But I suppose it will be the same result right? – MJ13 Jul 6 at 15:30
• Strictly speaking, non totally, because it might happen that the derivative of $I$ does not exist, while the smooth image is derivable. But if all terms are regular enough, yes. And with discrète and finite support objects, this is fine. – Laurent Duval Jul 6 at 21:36
• Yeah I see!So in the example you have illustrated, where no such exceptions appear, if we first apply the differentiation on $f$ and then convolve the derivative with our filter $h$ the output signal will be the same as above right? – MJ13 Jul 6 at 22:23
• If you put aside mathematical monstrosities (I am very cautious), which don't appear in real life, yes: if you remain linear, you can differentiate and smooth, or smooth then differentiate, you get the same results up to numerical precision – Laurent Duval Jul 7 at 21:13
• Ok I got the point! I think it would be really helpful to add this final equivelant implementation (where we first apply the derivative on $f$ and then convolve with filter $h$) on your answer. I mean, if it's not hard for you, you could add the illustration of 3 more graphs showing this particular case. I'm gonna then accept the answer as well since it fully answers my question. – MJ13 Jul 8 at 12:43