Abstract: interpolation algorithms are a basic and important issue in image scaling. There are many kinds of interpolation algorithms, including nearest neighbor interpolation, bilinear interpolation, and cubic convolution interpolation. This paper analyzes the three interpolation algorithms and compares their processing results. Finally, it summarizes their respective advantages and disadvantages.
Key words: image processing; nearest neighbor interpolation; bilinear interpolation; cubic convolution interpolation
1 Introduction
Geometric transformations of images include translation, transpose, mirroring, and scaling. In the first three operation transformations, each pixel of the output image corresponds to a specific pixel in the input image. However, in the scaling operation, the pixel coordinates of the output image may correspond to the positions of several pixels on the input image, in this case, grayscale interpolation is used to calculate the gray value of the output point [1]. Image interpolation is an important part of super resolution processing. Different interpolation algorithms have different precision, and the quality of interpolation algorithms directly affects the degree of image distortion. There are three common interpolation algorithms:
Nearest Neighbor interpolation, bilinear interpolation, and cubic convolution interpolation, among which cubic convolution interpolation is the best.
2 Principle Analysis of Several interpolation algorithms
Interpolation algorithms are widely used in many fields. Scaling images is a typical application. Because the gray value of pixels is discrete, therefore, the general processing method is to generate a continuous surface by interpolation the pixel values of the original integer point coordinates, and then re-sample the interpolation surface to obtain the grayscale value of the scaled image pixels. The scaling process starts from the output image and uses the reverse ing method, that is, finding one or several pixels in the corresponding input image in the output image, this method ensures that each pixel in the output image has a definite value. Otherwise, if the output image is derived from the input image, the pixels in the output image may not have a gray value. Because there may be no one-to-one correspondence between output image pixels and input images during image scaling. The three algorithms are introduced below.
2.1 The simplest interpolation method of the nearest neighbor interpolation algorithm is the nearest neighbor interpolation method, also known as the zero-order interpolation method [2]. That is, select the gray value of the input pixel closest to the position mapped to it as the interpolation result. For a two-dimensional image, the gray value of the nearest adjacent point in four adjacent pixels around the sample to be tested is used as the pixel value of the sample to be tested. If the corresponding position of the coordinate on the output image after geometric transformation is (m, n), it is as follows:
2.2 The bilinear interpolation algorithm bilinear interpolation is also called the first-order interpolation method [3]. It must undergo cubic Interpolation to obtain the final result. It is an improvement of the nearest neighbor interpolation method, first, perform first-order linear interpolation in the two horizontal directions, and then perform first-order linear interpolation in the vertical direction.
The 2.3 cubic convolution interpolation algorithm cubic convolution interpolation is also called Double three interpolation [2]. It is an improvement of bilinear interpolation and a more complex interpolation method, it not only takes into account the effect of the gray value of four directly adjacent pixels, but also the effect of the gray value change rate.
In this method, the gray value of 16 pixels near the sampling point is used for cubic Interpolation, And the cubic polynomial S (w) shown in 3 is also used ).
First, determine the coordinates of 16 adjacent points and set the Matrix to [2]:
The square convolution method degrades to the bilinear interpolation method. From this point of view, cubic convolution can be considered as a two-part structure, where (1-| M |) represents the influence of the gray value of the direct neighboring point on the sampling point, l represents the influence of the gray value change rate between neighboring points on the sampling points. Compared with the bilinear interpolation method, the cubic convolution method not only considers the effect of the gray value of the direct neighboring point on the sampling point, but also considers the effect of the gray value change rate between neighboring points, therefore, the gray value obtained by the latter is more accurate.
3. processing results and analysis of three interpolation algorithms
By using three kinds of interpolation algorithms to scale images, You can intuitively compare their processing results. The following is a 128*128 pixel grayscale image that is magnified by 2 times to produce an image of 256*256 size.
3.1 Scaling (a) 128*128 source image (B) nearest neighbor interpolation (c) bilinear interpolation (d) cubic convolution interpolation amplification figure 4 3.2 Result Analysis The comparison results after the three interpolation algorithms process the image shows that the nearest neighbor interpolation method has the worst effect, has obvious sertices, and the details are not clear. The result of bilinear interpolation is second to that of the image, but the image's edge is slightly blurred. Cubic convolution interpolation is the best among the three interpolation methods. It can overcome the shortcomings of the first two interpolation methods and produce clear image edges with high computing accuracy.
4 Summary of advantages and disadvantages of three interpolation algorithms
The advantage of the nearest neighbor interpolation method is that the computation is small and the algorithm is simple, so the computation speed is fast. However, it only uses the gray level value of the pixel closest to the sample point to be tested as the gray level value of the sample point, but does not consider the effects of other adjacent pixels. Therefore, after re-sampling, the gray level value has obvious non-continuity, the image quality is greatly reduced, resulting in significant mosaic and sawtooth phenomena.
The bilinear interpolation method is better than the nearest neighbor interpolation method, but the calculation workload is slightly larger, the algorithm is more complex, and the program running time is slightly longer, but the image quality is higher after scaling, basically, the gray value of the nearest neighbor interpolation is not consecutive, because it takes into account the correlation of the four direct neighbors around the sample point to be tested. However, this method only takes into account the effect of the gray values of four direct neighboring points around the sample points to be tested, and does not take into account the effect of the gray value change rate between neighboring points. Therefore, it has the property of a low-pass filter, as a result, the high-frequency component of the scaled image is lost, and the image edge is blurred to a certain extent. Compared with the input image, the scaled output image still has the problem of poor image quality and low computing accuracy due to the poor consideration of the interpolation function design.
Cubic convolution interpolation has the largest amount of computing, and the algorithm is also the most complex. In geometric operations, the smoothing of bilinear interpolation may degrade the image details. This effect is more obvious during amplification. In other applications, the slope continuity of bilinear interpolation produces undesirable results. Cubic convolution interpolation not only takes into account the effects of the gray values of the four directly adjacent pixels, but also the effects of their gray value change rates. Therefore, the shortcomings of the first two methods can be overcome to generate an edge that is smoother than bilinear interpolation. The calculation accuracy is very high, and the image quality loss after processing is the least, and the effect is the best.
In short, three algorithms should be selected based on the actual situation during image scaling. The feasibility of time and image quality after transformation should be considered, in this way, the ideal results can be achieved.
References
[1] Zhang Honglin. proficient in Visual C ++ typical digital image processing algorithms and implementation [M]. Beijing: People's post and telecommunications Press, 2008.
[2] Xie fengying, Zhao danpei. Visual C ++ Digital Image Processing [M]. Beijing: Tsinghua University Press, 2008.
[3] He bin, Ma Tianyu, and Wang yunjian. Visual C ++ Digital Image Processing [M]. Beijing: published by People's Post and Telecommunications, 2001