Comparison of Doubling the Size of Image Algorithms

In this paper the comparative analysis for quality of some interpolation non-adaptive methods of doubling the image size is carried out. We used the value of a mean square error for estimation accuracy (quality) approximation. Artifacts (aliasing, Gibbs effect (ringing), blurring, etc.) introduced by interpolation methods were not considered. The description of the doubling interpolation upscale algorithms are presented, such as: the nearest neighbor method, linear and cubic interpolation, Lanczos convolution interpolation (with a = 1, 2, 3), and 17-point interpolation method. For each method of upscaling to twice optimal coefficients of kernel convolutions for different down-scale to twice algorithms were found. Various methods for reducing the image size by half were considered the mean value over 4 nearest points and the weighted value of 16 nearest points with optimal coefficients. The optimal weights were calculated for each method of doubling described in this paper. The optimal weights were chosen in such a way as to minimize the value of mean square error between the accurate value and the found approximation. A simple method performing correction for approximation of any algorithm of doubling size is offered. The proposed correction method shows good results for simple interpolation algorithms. However, these improvements are insignificant for complex algorithms (17-point interpolation, Lanczos a = 3). According to the results of numerical experiments, the most accurate among the reviewed algorithms is the 17-point interpolation method, slightly worse is Lanczos convolution interpolation with the parameter a = 3 (see Table 2).


INTRODUCTION
Image scaling is one of the classic tasks of computer graphics [2,5,10]. A special case of this problem is to reduce and double the image size. These methods play a special role in the compressing raster images [1,7,8,10], where the quality of approximation depends on the overall efficiency of encoding.
The paper presents a comparative analysis of the error of some interpolation methods of doubling the image size. The standard deviation was used as an estimate of the accuracy of the algorithm. Only non-adaptive methods were taken into account, introduced artifacts (aliasing, blurring, etc.) were not considered. A simple method of "correction" (p. 1, 5) is proposed, which gives an approximation improvement on simple algorithms.
Let be the brightness matrix of a gray image or one of the color components of a full-color image, its dimensions.
y y y y my my y my In addition, we can consider the matrix as a function of of two integer variables and extend its values to the entire real plane using some interpolation formula. Thus, the function is defined on the entire real plane.
To obtain an image with a matrix half the size of you can use one of two basic methods.
(1) Averaging: (1) (2) Even points: (2) In the present work we shall confine ourselves to the first method. In some tasks (e.g. image compression), the size reduction algorithm may use a larger number of adjacent points. There is a need instead of (1) to consider a more general formula: where a some weight function. According to the measurement results, it can be noted that the transition from averaging over four points to a weighted average of shows a noticeable improvement in the accuracy of approximation. Weighting at gives some more improvement, but a further increase in the area has almost no effect on the results of interpolation. Therefore, in the present work, we limited ourselves to the case of nonzero coefficients of the function , among which only are different. They can be arranged as follows: and their sum should be equal to : The work consists of four parts. The first section describes some algorithms of linear image size doubling (nearest neighbor method, linear and cubic interpolation, interpolation by convolution with Lanczos kernel), their properties, as well as a description of the correction algorithm and 17-point interpolation method. The second section includes a description of the methods of optimal image size reduction for the doubling methods discussed in the first section. The third section contains the results of numerical estimates of the quality (accuracy) of the methods of doubling considered in the work. The last section summarizes the results of the work.

Trivial, Linear and Cubic Interpolations
The following methods of interpolating brightness values are most popular (see, for example, [2], p. 406): -Trivial interpolation (nearest neighbor method), that is, by the nearest integer point. The interpolation kernel: -Linear interpolation, kernel -Cubic interpolation, its (one-dimensional) kernel can be written as

Lanczos Kernel
The Lanczos kernel is considered one of the most effective in the interpolation of the brightness values of the images (see, for example, [6], p. 231-232). Let + . , + . , + . , + . , + . , + . 0 75 1 25 1 75 2 25 2 75 . , . , . , . , . , . , The Lanczos function with the natural parameter (window size) is called the function where the constant is chosen such that When using the Lanczos kernel, it should be borne in mind that due to the zeroing of its values at , the condition will be fulfilled only approximately. Therefore, the kernel weights must be normalized so that their sum is .

Decomposable Kernels
As mentioned above, in the case of a decomposable kernel, to find a matrix of doubled size, we do not need the entire function , but only six of its values: that is, in fact, a vector of six numbers. We explicitly write this vector in all cases of interest to us. Remark 1. The coefficients in the Lanczos kernels normalized so that they sum to one. These coefficients can be selected so as to minimize the error on real files. Such sets will be called optimal.

17-Point Interpolation
In all the cases considered above, the kernel had the form of a product: . In General, this is not necessarily the case. In [4], a -point interpolation formula is proposed whose kernel cannot be written in this form.
If we want to use the kernel function only to double the size of the image, it will be enough to define the values of the function at points of the form where , are integers. Therefore, taking into account the symmetry ( ) we need the values of the function can be set by Table 1.
Thus, the function is determined by ten coefficients. It is named -point formula because the interpolated value is calculated as a weighted sum of the values of the original function in the nearest integer points.
A large number of numerical experiments made it possible to find a formula close to optimal in this class: Adding additional nonzero coefficients to the kernel improves the quality of the algorithm by hundredths of a percent at best and can hardly be considered appropriate.

Doubling Algorithm Correction
Let be the image halved with (1). Suppose we have some algorithm for doubling the image size . If the enlarged image is halved, then we do not necessarily get when it is enlarged.
Therefore, consider the following algorithm to improve the restored image . Let be an approximation of the image obtained by averaging the enlarged image . Then, due to linearity (1), the correction of values is determined by the following relation: (8) where is the value of the deviation of the true value from the approximation.
The presented correction method allows improving the quality of approximation of some linear doubling methods (see Table 2).    (1), we can find the following six optimal coefficients (9) so that the interpolation error is minimal for all above described methods. Consider these methods in more detail.

Interpolation with Lanczos kernel :
Interpolation with Lanczos kernel :

Optimal linear formula.
We was found two coefficients for a linear interpolation formula ( ) and six factors. The found optimal kernels:     Let B be a halved image and be an image enlarged by the trivial method. Then the quality assessment of the doubling algorithm can be represented by the ratio: (10) where is the original image, and is the image doubled by the method under consideration.   (2) With "corr" correction.
(3) With the optimal reduction of "ods". (4) With optimal reduction and correction of "ods" + "corr". For example, for the "Lanczos " method, the error is 88.289% of the error of the trivial method, and under the condition of optimal reduction and subsequent correction -83.809% of the error of the trivial method.
The evaluation in other images, of course differ from those in the table, but not too much. And most importantly, the ratio between the different methods remains the same.

CONCLUSIONS
-If the image reduction is carried out by averaging over adjacent points, the best results among the considered linear formulas are obtained by -point interpolation with the kernel (7). Further complication of the formula improves the result by hundredths of a percent and can hardly be considered expedient.
-Correction of the doubled image (par. 1.5) -the proposed method of increasing the accuracy of approximation. It gives excellent results for simple methods (e.g. linear interpolation). However, when using the most complex algorithms (17-point, Lanczos ) the improvements are negligible. -If it is possible to choose the method of halving the image or the algorithm of reducing by which the original image was obtained is known, then the doubling algorithm can be somewhat improved.
-Further improvement of accuracy is possible only with the use of nonlinear or adaptive methods.