Interpolation is an indispensable step in image processing, such as image scaling and rotation. The following describes some common interpolation algorithms:
1. Nearest Neighbor Interpolation
This interpolation method is the simplest interpolation algorithm. The size of the pixel value output from the image is directly set to the value of the vertex closest to the image. This algorithm is the simplest and does not need to be said, can be expressed
F (x, y) = g (round (x), round (y ))
Enlarged source Image
It can be seen that after the nearest neighbor interpolation is used to zoom in, the pixels of the large blocks can be seen at the edge of the image, which is quite different from the expected results.
2. bilinear interpolation
Bilinear interpolation is also called a first-order interpolation. It is an application of linear interpolation that extends to two-dimensional. It processes the pixel values of the four surrounding points as the value of the point. Suppose we want to get the pixel value (x, y) of point F (x, y is not an integer, and the coordinates of the surrounding points are )), the bilinear interpolation formula is as follows:
F (x, 0) = f () + X [F ()-f ()]
F (x, 1) = f (0, 1) + X [F (1, 1)-f (0, 1)]
F (x, y) = f (x, 0) + Y [F (x, 1)-f (x, 0)]
The original image is also magnified by four times, but the bilinear interpolation effect is significantly higher than that of the nearest neighbor interpolation, but there are still some shortcomings, and the details of the enlarged image become blurred, this is because bilinear interpolation has a smooth effect on the image.
3. cubic Interpolation (high-order interpolation)
Cubic Interpolation uses the following cubic polynomials to approximate the theoretical optimal interpolation function sin (X)/X,
S (x) = 1-2 | x | ^ 2 + | x | ^ 3 0 <= | x |, <1
4-8 | x | + 5 | x | ^ 2-| x | ^ 3 1 <= | x |, <2
0 | x |> = 2
The gray value of the pixel (X, Y) is calculated from the pixel value of the surrounding 16 points. The calculation formula is as follows:
After cubic Interpolation, the enlarged image is as follows:
4. Fractal algorithms
Fractal interpolation is an algorithm proposed by Altamira group. The image obtained by this algorithm is clearer and clearer than other algorithms (see figure 5 ).
Nowadays, many digital camera manufacturers use interpolation algorithms on digital cameras and publicize the resolution values obtained through the algorithms. Although their algorithms are much more advanced than double three interpolation algorithms, however, the fact is that the image details cannot be created out of thin air. Because the interpolation resolution is used by a digital camera to increase the pixel of the image through its own built-in software, so as to increase the resolution.
5. Code Implementation
Http://blog.csdn.net/liyuan02/article/details/6765442
Http://blog.csdn.net/liyuan02/article/details/6750410
Http://blog.csdn.net/cui134/article/details/23684321
Http://wenku.baidu.com/view/0628700016fc700abb68fc10.html
Http://baike.baidu.com/view/2477544.htm
Foundation of Image Processing-some gray interpolation algorithms in Image Scaling