Conversion from: Image Processing: Basic (template, convolution)
1.
Use templates to process image-related concepts:
Template: matrix square. Its mathematical meaning is a convolution operation.
Convolution: it can be seen as a process of weighted summation. each pixel in the used image area corresponds to each element in the convolution kernel (weight matrix ).
Multiplication. The sum of all products is the new value of the regional center pixel.
Convolution core: The weight used for Convolution is represented by a matrix. The size of this matrix is the same as that of the image area, and its rows and columns are odd,
Is a weight matrix.
Convolution example:
Convolution between 3*3 pixel region R and convolution core G:
R5 (center pixel) = r1g1 + r2g2 + r3g3 + r4g4 + r5g5 + r6g6 + r7g7 + r8g8 + r9g9
2.Image processing using templates:
Border problem: when processing image boundary pixels, the convolution kernel and the image use region cannot match. The center of the convolution kernel corresponds to the border pixel,
Convolutional operations may cause problems.
Solution:
A. Ignore the boundary pixels, that is, the processed images will lose these pixels.
B. Retain the original boundary pixel, that is, copy the boundary pixel to the processed image.
3.Common templates: