Convolution vs Cross-correlation

  • #1
fog37
1,568
108
TL;DR Summary
understand the difference between convolution and cross-correlation results
Hello,
Convolution is essentially superposition. Conceptually, a copy of the same mask/filter is essentially placed at every point in the signal (1D, 2D, ect.). Once all these convolution masks are in place, we just compute the sum and get the convolved signal. The integral formula for convolution, which implies rotating by 180 degrees the mask, is less intuitive.

Let's now talk about cross-correlation. In this case, we don't place the mask at EVERY point in the input signal but simply slide the mask around and calculate the inner product with the overlapped area and move on to the next input signal area....The correlation map looks therefore very different from a convolution operation. The integral formula for cross- correlation seems very similar (the mask is not rotated) to the convolution integral but the concept is quite different.

Concetually, convolution places the mask everywhere in the input signal, does the inner product, and sum everything up. Cross-correlation simply perform the inner product area by area...

What actually occurs in deep learning and CNN (convolutional neural networks) is really cross-correlation and not convolution, correct?
 
  • Like
Likes Philip Koeck
Computer science news on Phys.org
  • #2
fog37 said:
TL;DR Summary: understand the difference between convolution and cross-correlation results

Hello,
Convolution is essentially superposition. Conceptually, a copy of the same mask/filter is essentially placed at every point in the signal (1D, 2D, ect.). Once all these convolution masks are in place, we just compute the sum and get the convolved signal. The integral formula for convolution, which implies rotating by 180 degrees the mask, is less intuitive.

Let's now talk about cross-correlation. In this case, we don't place the mask at EVERY point in the input signal but simply slide the mask around and calculate the inner product with the overlapped area and move on to the next input signal area....The correlation map looks therefore very different from a convolution operation. The integral formula for cross- correlation seems very similar (the mask is not rotated) to the convolution integral but the concept is quite different.

Concetually, convolution places the mask everywhere in the input signal, does the inner product, and sum everything up. Cross-correlation simply perform the inner product area by area...

What actually occurs in deep learning and CNN (convolutional neural networks) is really cross-correlation and not convolution, correct?
I don't know what CNN does, but in image processing CC is used to compare two functions in n dimensions: How similar are they and in what position to each other do they match best?

Convolution is used to produce a weighted sum of copies of the one function placed in positions (and with the respective weights) given by the other function. Obvioulsy this is quite messy unless the first function is limited in extent and the second function is a sum of delta distributions sufficiently far apart to avoid extensive overlap between the copies.
The minus in the argument makes sure the copies of the first function are correctly oriented.

This doesn't sound right to me or at least I don't understand it:
Concetually, convolution places the mask everywhere in the input signal, does the inner product, and sum everything up. Cross-correlation simply perform the inner product area by area...
 
  • Like
Likes fog37
  • #3
fog37 said:
TL;DR Summary: understand the difference between convolution and cross-correlation results

Hello,
Convolution is essentially superposition. Conceptually, a copy of the same mask/filter is essentially placed at every point in the signal (1D, 2D, ect.). Once all these convolution masks are in place, we just compute the sum and get the convolved signal. The integral formula for convolution, which implies rotating by 180 degrees the mask, is less intuitive.

Let's now talk about cross-correlation. In this case, we don't place the mask at EVERY point in the input signal but simply slide the mask around and calculate the inner product with the overlapped area and move on to the next input signal area....The correlation map looks therefore very different from a convolution operation. The integral formula for cross- correlation seems very similar (the mask is not rotated) to the convolution integral but the concept is quite different.

Concetually, convolution places the mask everywhere in the input signal, does the inner product, and sum everything up. Cross-correlation simply perform the inner product area by area...

What actually occurs in deep learning and CNN (convolutional neural networks) is really cross-correlation and not convolution, correct?
One more thing I should point out since you talk about masks and filters.
The latter are usually symmetrical. In that case it makes no difference whether you convolute or cross-correlate with them.
 
  • Like
Likes fog37
  • #4
In both convolution and correlation, the filter and the mask are generally smaller in size than the input signal.
True, if the filter is symmetric, convolution and correlation will give the same result.

But correlation is about finding similarity while convolution is more about processing of the input signal by convolution filter (to blur, enhance, etc.). Convolution is when an input passes through a system. The system's output is determined by the convolution filter, also known as the impulse response of the system/filter....

I was not completely correct in the way I described the mechanics of correlation. Even in the case of correlation, the correlation mask is translated around and its entries multiply the input signal. The only difference between correlation and convolution is really the 180 flip of the mask...
 
  • Like
Likes Philip Koeck

What is the difference between convolution and cross-correlation?

Convolution and cross-correlation are mathematical operations that are commonly used in signal processing and image processing. Both operations involve multiplying two signals and summing the results, but the main difference between them lies in the direction of the multiplication. In convolution, one of the signals is flipped (inverted) before the multiplication, while in cross-correlation, both signals are used as they are.

When is convolution used?

Convolution is commonly used in signal processing to model the response of a system to an input signal. It is also used in image processing for tasks such as blurring, edge detection, and noise reduction. In general, convolution is used when the output signal is dependent on the entire history of the input signal.

When is cross-correlation used?

Cross-correlation is commonly used in signal processing for tasks such as determining the similarity between two signals or finding a specific pattern within a larger signal. In image processing, it can be used for tasks such as template matching. In general, cross-correlation is used when the output signal is only dependent on a subset of the input signal.

How do convolution and cross-correlation relate to each other?

Convolution and cross-correlation are closely related, with the main difference being the direction of the multiplication. In fact, cross-correlation can be thought of as a convolution with one of the signals not being flipped. Mathematically, convolution can be represented as a combination of cross-correlation and flipping one of the signals.

Which operation is more commonly used in practice?

Both convolution and cross-correlation have their own specific applications and are commonly used in practice. However, cross-correlation is more commonly used in signal processing and image processing, as it allows for more flexibility in analyzing signals and finding patterns. Convolution is also widely used, but mainly for tasks such as modeling the response of systems to signals.

Similar threads

Replies
2
Views
2K
Replies
10
Views
727
  • Linear and Abstract Algebra
2
Replies
43
Views
5K
Replies
6
Views
2K
Replies
1
Views
1K
Replies
33
Views
20K
  • Quantum Physics
Replies
20
Views
3K
Replies
7
Views
1K
  • STEM Academic Advising
Replies
13
Views
2K
Back
Top