patternModerate
Intuition for convolution in image processing
Viewed 0 times
imageconvolutionforprocessingintuition
Problem
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 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?
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 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?
Solution
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.
It's easy to see why Box Blur:
_____________
|1/9|1/9|1/9|
|1/9|1/9|1/9|
|1/9|1/9|1/9|
-------------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:
_____________________
|.01|.04|.07|.04|.01|
|.04|.16|.26|.16|.04|
|.07|.26|.41|.26|.07|
|.04|.16|.26|.16|.04|
|.01|.04|.07|.04|.01|
---------------------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:
__________
|-1|-1|-1|
|-1|.8|-1|
|-1|-1|-1|
----------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.
Code Snippets
_____________
|1/9|1/9|1/9|
|1/9|1/9|1/9|
|1/9|1/9|1/9|
-------------_____________________
|.01|.04|.07|.04|.01|
|.04|.16|.26|.16|.04|
|.07|.26|.41|.26|.07|
|.04|.16|.26|.16|.04|
|.01|.04|.07|.04|.01|
---------------------__________
|-1|-1|-1|
|-1|.8|-1|
|-1|-1|-1|
----------Context
StackExchange Computer Science Q#3215, answer score: 14
Revisions (0)
No revisions yet.