# Image Magnification Based on Bicubic Approximation with Edge as Constraint
## 3 Constructing Quadratic Sampling Patches
### Calculating the Coefficients of Quadratic Term
In order to make the quadratic polynomial as simple as possible, \(|a_{0}|,|a_{1}|\), and \(|a_{2}|\) should be as small as possible. According to the approximation theory, the interpolation function should be as simple as possible on the premise of satisfying the approximation accuracy. Therefore, \(a_{0}\) is determined by weighted average of \(a_{0}^{k},k=0,1,2,3\), and the weight corresponding to \(a_{0}^{k}\) should be inversely proportional to \(|a_{0}^{k}|\). Now, the second set of values for \(a_{0},a_{1},a_{2}\), denoted as \(a_{0}^{B},a_{1}^{B}\), and \(a_{2}^{B}\), is defined by  
\[ \begin{array}{l}a_{0}^{B}=w_{0,0}a_{0}^{0}+w_{0,1}a_{0}^{1}+w_{0,2}a_{0}^{2}+ w_{0,3}a_{0}^{3}\\ a_{1}^{B}=w_{1,0}a_{1}^{0}+w_{1,1}a_{1}^{1}+w_{1,2}a_{1}^{2}+w_{1,3}a_{1}^{3} \\ a_{2}^{B}=w_{2,0}a_{2}^{0}+w_{2,1}a_{2}^{1}+w_{2,2}a_{2}^{2}+w_{2,3}a_{2}^{3}.\end{array}  \tag{14}\]  
where \(w_{l,k}=1/(|a_{l}^{k}|+\lambda),l,k=0,1,2\) are weight functions, \(\lambda\) is a very small positive value. We do not simply use Equation (15) to compute the second set of values for \(a_{0},a_{1},a_{2}\). Equation (15) is a simple weighted average. The experiment results and the following discussion also showed that the magnified image is not good using Equation (15) to compute the second set of values for \(a_{0}\), \(a_{1}\), and \(a_{2}\). \[ \begin{array}{l}a_{0}^{4}=\left(a_{0}^{0}+a_{0}^{1}+a_{0}^{2}+a_{0}^{3} \right)/4\\ a_{1}^{4}=\left(a_{1}^{0}+a_{1}^{1}+a_{1}^{2}+a_{1}^{3}\right)/4\\ a_{2}^{4}=\left(a_{2}^{0}+a_{2}^{1}+a_{2}^{2}+a_{2}^{3}\right)/4.\end{array}  \tag{15}\]  
Experimental results also show that the quadratic polynomial defined by Equation (14) does integrate the advantages of the four quadratic polynomials, and its surface shape is closer to the shape represented by the 9 pixels in Figure 1. From \(a_{0}^{k}\), \(a_{1}^{k}\), and \(a_{2}^{k}\), \(k=0,1,2,3,4\) and Equation (14), we can define 6 patches, respectively, denoted as \(f_{k}(x,y),k=0,1,2,3,4\) and \(f_{5}(x,y)\), which are all approximation to the 9 pixels in Figure 1. The approximation errors of six patches to 9 pixels are denoted as \(E_{i,j}^{k},k=0,1,2,3,4,5,i,j=2,3\cdots,n-1\), respectively, and hence, 6 error images \(E_{k},k=0,1,2,3,4,5\) can be obtained by \(E_{i,j}^{k},k=0,1,2,3,4,5,i,j=2,3\cdots,n-1\). Using Baboon and Kod in the 12 typical images in Section 5, two error images can be generated with the 6 patches. Figure 2 is a histogram of two error images, where the top-down histograms correspond to Baboon and Kod images, respectively. In Figure 2, \(e_{k}(n)\) denotes the number of pixels with value \(n\) in the error image \(E_{k},k=0,1,2,3,4,5\). For the sake of clarity, each histogram is divided into two parts. Since the number of pixels with value 0 is too small compared with the number of pixels with value 1, the former is not displayed to make the histogram visually clear. In Figure 2, the left figures are the histograms of pixels with error values of 1-20 and the right figures are the histograms of the rest error pixels. It is obvious from the curve \(e_{5}(n)\) in Figure 2 that, in the error image \(E_{5}\) generated using \(a_{0}