How easy to understand explanation convolution? Why convolution to rotate 180 degrees?

How easy to understand explanation convolution?

Know almost answered:

https://www.zhihu.com/question/22298352/answer/228543288

https://www.zhihu.com/question/22298352/answer/637156871

 

Why convolution to rotate 180 degrees?

A look at this title will think that what all the fuss, a lot of people might think this is a brain-dead subject, but I do misunderstood a couple of years ......

 

Today, reading the "fine solution OpenCV algorithms," we find the two matrices do convolution operation time, as the operator of convolution matrix to rotate counter-clockwise 180 degrees, which is never noticed in the previous stage, ashamed to say , I usually directly call API, ignoring the principle that the convolution is like drawing on a lot of painting, a convolution kernel matrix next to another scan, the results add up, the original digital image processing course, also hand-counted convolution, I do not know the teacher was wrong or I am wrong, in short, had never noticed the convolution is actually "first flip followed by a translation."

 

Wikipedia describes the physical meaning of convolution:

In the functional analysis, convolution, laminated, or spin convolution product, is a mathematical operator third function generated by two functions f and g, characterized by the product of the function f and flip through the translation g function surrounded curved edge area of ​​a trapezoid.

 

Continuous convolution

 

The mathematical definition is:


Functions f and g are defined on Rn measurable function, f and g convolution denoted f * g, where after it is turned over and a function of integrating the product of translation of another function, the shift amount is a peer function, that is:

 

640?wx_fmt=other

Continuous convolution formula (From Wikipedia)

 

Almost have to know on a Q & A on "easy to understand how to interpret the convolution", there are many explanations versions, are also easy to understand, very interesting, but personally think that the following Wikipedia This figure is sufficient for understanding convolution . Special attention sentence circled, meaning very helpful for understanding convolution.

 

640?wx_fmt=other

Deconvolution (From Wikipedia)

 

Discrete convolution

 

640?wx_fmt=other

Discrete convolution (From Wikipedia)

 

Example

 

I mainly do image processing, it is used in discrete convolution. Use python do verification.


The following graph is our most common convolution operation diagram:

 

640?wx_fmt=other

Convolution operation diagram (from Baidu Image Search)

 

Intermediate convolution kernel, in fact, has been rotated counterclockwise through 180 degrees, i.e., do in fact a convolution of two matrices [[2, 1, 0, 2, 3], [9, 5, 2, 4, 2 , 0], [2, 3, 4, 5, 6], [1, 2, 3, 1, 0], [0, 4, 4, 2, 8]] and [[1, 0, -1] , [1, 0, -1], [1, 0, -1]], not only the sum-of rotation is not called convolution.

 

First come two matrices derived at hand according to the formula:

 

640?wx_fmt=other

Hand count convolution

 

Can be found only rotated 180 degrees convolution kernel re-scanning, and will as result of the calculation formula derivation, I and K do convolution matrix python:

 

640?wx_fmt=other

 

And our hand count the same. So, if you do convolution, remember to "flip followed by a translation." ...... or simply calculated using the formula, at least wrong.

 

Published 98 original articles · won praise 301 · views 290 000 +

Guess you like

Origin blog.csdn.net/ljyljyok/article/details/103937844