Reprinted from: http://blog.csdn.net/andrewseu/article/details/51783181
In the process of image processing, we often see the concept of matrix convolution, for example, with a template to the convolution with a picture, so it is necessary to understand the matrix convolution to do what, and how to calculate the specific.
In Matlab, there is a conv2 function to the matrix convolution operation, which has a shape parameter, the value of the specific three kinds:
-full - (default) returns the full 2-D convolution, -‘same‘ - returns the central part of the convolution that is the same size as A. -‘valid‘ - returns only those parts of the convolution that are computed without the zero-padded edges. size(C) = max([ma-max(0,mb-1),na-max(0,nb-1)],0).
Use a picture to understand the exact meaning of these three parameter codes:
Calculation method of matrix convolution
To give a simple example,
The MATLAB calculation results are as follows:
Matlab Matrix convolution Understanding (reprint)