# The difference between convolution and cross-correlation from image processing point of view

The difference between convolution and cross-correlation from a signal-analysis point of view

The above question gives very good information from signal processing point of view. But what about images?How we can differentiate between convolution and correlation from image processing point of view ?since in my understanding signals are usually 1D and images are 2D matrices

• it's exactly identical. (and I'd say an image is just a 2D signal, I wouldn't make that distinction between image and signal. If we did make that distinction, the name of this site would be kind of ill-fitting!) Commented Jul 26, 2022 at 7:55
• May help Commented Jul 26, 2022 at 8:11
• The difference is exactly the same -- obfuscated by the fact that for image processing, you're almost always applying symmetrical filters, so for the purpose of filtering you can confuse convolution and correlation and get the same result. Commented Jul 26, 2022 at 14:59
• Does this answer your question? Difference Between Correlation and Convolution in the Context of Image Processing
– Dima
Commented Jul 27, 2022 at 14:10

## 1 Answer

• Convolution is the operation of applying a linear shift invariant on an image.
• Correlation is the operation of searching the template which is most similar in the $${L}_{2}$$ metric.
• When building the operators in their matrix form they are the adjoint of each other.
• For symmetric kernels they yield the same result (Assuming the same boundary conditions).

Convolution is correlation with the filter rotated 180 degrees. This makes no difference, if the filter is symmetric, like a Gaussian, or a Laplacian. But it makes a whole lot of difference, when the filter is not symmetric, like a derivative.

The reason we need convolution is that it is associative, while correlation, in general, is not. To see why this is true, remember that convolution is multiplication in the frequency domain, which is obviously associative. On the other hand, correlation in the frequency domain is multiplication by the complex conjugate, which is not associative.