Previous | Next --- Slide 57 of 116
Back to Lecture Thumbnails
motoole2

So what is the difference between using a convolution vs. correlation to do image filtering? Well, here's one example.

Click here for full resolution image. Note that image is 200 x 200, kernel is 9 x 9.

We have a image of a night sky (a bunch of bright stars) and I'm interested in applying an "arrow" filter for artistic effect. Notice that when I perform a convolution, the arrows are pointing in the same direction as my kernel. When performing a correlation, the arrows are actually pointing in the opposite direction. So the sign used in this case is important, because the kernel is not symmetric.

ots0121

Hi, I wonder in what scenarios we use correlation and in what situation we use convolution? Thanks!

motoole2

Good question! The two operators are very similar. In fact, one can use a correlation operator to implement a convolution operator (and vice versa) by simply flipping the filter along both the x- and y-axis.

Convolution operators are often used when applying filters to images (e.g., blur kernels, derivative kernels, etc.). As shown in the example above, every pixel in an image gets replaced by the given kernel (e.g., stars become arrows).

Correlation operators are often sued when comparing two signals. For example, we will use correlations to perform a vision task called template matching (i.e., identify the location of a kernel within an image).

For a longer discussion, see this article.