Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have read many documents about convolution in image processing, and most of them say about its formula, some additional parameters. No one explains the intuition and real meaning behind doing convolution on an image. For example, intuition of derivation on the graph is make it more linear for example.

I think a quick summary of the definition is: convolution is multiplied overlap square between image and kernel, after that sum again and put it into anchor. And this doesn't make any sense with me.

According to this article about convolution I cannot imagine why convolution can do some "unbelievable" things. For example, line and edge detection on the last page of this link. Just choose appropriate convolution kernel can make a nice effects (detect line or detect edge).

Can anyone provide some intuition (doesn't need to have to be a neat proof) on how it can do that?

share|cite|improve this question

I think the simplest way to think of Convolution is as a method of changing a pixel's value to a new value based on the weight of nearby pixels.

It's easy to see why Box Blur:


works. Convolving this kernel is the same as going through every pixel of a photo and making the new value of the pixel the average of itself and the eight surrounding pixels.

If you get that, you can see why Gaussian Blur works:


It's basically the same thing, except the averaging is weighted more strongly toward pixels that are closer. The function that defines how quickly the weights fall off as you move further away is the Gaussian Function, but you don't need to know the details of the function in order to use it for blurring.

The edge detection kernel in the linked article makes sense if you stare at it long enough too:


It's basically saying that the value of any pixel starts at 8/9ths of it's original value. You then subtract the values of every pixel around it to arrive at your new pixel.

So if the value of a pixel is high and the value of the pixels around it are high too, they will cancel each other out. If the value of the pixel is low and all of the pixels around it are low as well, they will also cancel each other out. If the value of the pixel is high and the value of the pixels around it are low (as in a pixel on the edge of an object) the new pixel value will be high.

share|cite|improve this answer

One way to think about convolution/crosscorrelation is as if you were searching for some signal in your data. The more the data looks like the kernel, the higher the resulting value will be. I actually take the reverse of the kernel, i.e. as in cross-correlation, but it is basically the same thing.

For example, let's say you are looking for a directional step in your 1d data.

The kernel could be

[-1 1]

and let's apply that to the data

[2 2 2 2 2 1 1 1 1 1]

The result will be

[0 0 0 0 0 1 0 0 0 0]

Which detects the location of the step. A larger step would give a larger value.

This works because when you multiply a pattern by the one appearing in the kernel you get a high value.

Edge detection (or any other pattern detection) works the same way, for example with the kernel

[-1 2 -1]

Extensions to higher dimensions can also be thought if this way.

This should give you intuition at least about some of the applications of convolution image processing.

share|cite|improve this answer

If you think convolution is a little too hard to understand, I recommend you start searching about Mathematical Morphology applied to image processing, the big idea behind Mathematical Morphology is that you'll do a operation very close to the convolution, to "change" the morphology of the image, but retain the topology information, this way, you can make a image of a standing human, a skeleton, which is pretty much a stick human, try applying the erosion operation, then dilate operation, then go to the open/close operation, you'll start to understand what a mask applied to every pixel of image can do, and how they can be used in a big scenario to achieve great results(like finding a spot to start something using last erosion), once you understand Mathematical Morphology, convolution is a little bit harder, because its based on calculus, and defined after integrate, but still, alot of convolution are easy to understand, like median blur, gaussian blur, sharpen, edge detection, laplace, gradient, etc.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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