# Image Magnification Based on Bicubic Approximation with Edge as Constraint
## 3 Constructing Quadratic Sampling Patches  
Firstly, we construct a quadratic polynomial sampling patch \(f_{i,j}(x,y)\) to approximate the pixels on the small neighborhood with the edge features as constraints. Considering the symmetry, we construct \(P_{i,j}(x,y)\) (Equation (3)) with \(P_{i,j}\) and 8 pixel points adjacent to \(P_{i,j}\) (as shown in Figure 1, where \(P_{i,j}\) is the center of 9 points) for \(f_{i,j}(x,y)\). That is, \(f_{i,j}(x,y)\) is determined by 9 pixels \(P_{i+l,j+k},l,k=-1,0,1\). The constructed \(f_{i,j}(x,y)\) should have the quadratic polynomial precision and the shape described by 9 pixels. Ideally, \(f_{i,j}(x,y)\) passes \(P_{i,j}\) and 8 adjacent points, i.e., passes \((i+l,j+k,P_{i+l,j+k}),l,k=-1,0,1\). Replace \(P(x,y)\) in Equation (1) with \(P_{i,j}(x,y)\) in Equation (3) and integrate to get the sampling surface patch \(f_{i,j}(x,y)\) on the square area with side length \(2h\) as follows:  
\[f_{i,j}(x,y)=a_{0}(u^{2}+h^{2}/3)+a_{1}uv+a_{2}(v^{2}+h^{2}/3)+a_{3}u+a_{4}v+a _{5}. \tag{4}\]  
where \(u=x-i,v=y-j\) and where \(a_{0},a_{1},a_{2},a_{3},a_{4}\), and \(a_{5}\) are the undetermined coefficients.  
In Equation (4), taking h = 0.5 and \((x,y,f_{i,j}(x,y))=(i+l,j+k,P_{i+l,j+k}),l,k=-1,0,1\) gets the following 9 equations:  
\[P_{i+l,j+k}=a_{0}(l^{2}+1/12)+a_{1}lk+a_{2}(k^{2}+1/12)+a_{3}l+a_{4}k+a_{5},l,k=-1,0,1. \tag{5}\]  
Equation (5) is the integral of Equation (2) over the 9 unit squares as shown in Figure 1.  
The accuracy and shape of the sampling surface \(F(x,y)\) is completely determined by the sampling patch \(f_{i,j}(x,y),i,j=1,2,3,\cdots,n\) (4). In order to improve the accuracy of \(F(x,y)\), the technology of balancing polynomial coefficients is put forward. Next, we will discuss how to calculate the 6 undetermined coefficients \(a_{0},a_{1},a_{2},a_{3},a_{4}\), and \(a_{5}\) using the 9 equations in Eqauation (5).  
In Equation (5), there are 9 equations and 6 unknowns. The common method is to determine 6 unknowns by the least square method. Because 9 points in the neighborhood of \(P_{i,j}\) may belong to different surfaces in the original scene, the role of 9 points should be different in the construction of \(f_{i,j}(x,y)\). To make \(f_{i,j}(x,y)\) closer to 9 pixels, we use the weighted least squares to determine 6 unknowns. Different weights are used to make each pixel have different effects on determining 6 unknowns. In order to determine the 6 unknowns better, we first analyze the coefficient influence of \(f_{i,j}(x,y)\) on the shape of the surface. Because \(f_{i,j}(x,y)\), \(i,j=1,2,3\cdots,n\) are local surface patches, they form a whole sampling surface \(F(x,y)\) by the weighted average. \(f_{i,j}(x,y)\) only plays a large role on the \(F(x,y)\) in its adjacent area. According to the characteristics of Taylor expansion, in the local area, the influence of constant term, line term, and quadratic term of \(f_{i,j}(x,y)\) on the shape of \(F(x,y)\) decrease in turn. Therefore, we will use different strategies to determine these unknowns. The six coefficients are divided into three groups according to the constant term, the first term, and the quadratic term. The calculation of the three groups of coefficients will be discussed below.  
Let us firstly discuss the calculation of the coefficients \(a_{3}\) and \(a_{4}\); then discuss the calculation of \(a_{0},a_{1}\), and \(a_{2}\); and finally calculate \(a_{5}\). The process of calculating \(a_{0},a_{1},a_{2},a_{3},a_{4}\), and \(a_{5}\) is divided into three steps, which not only reduces the amount of calculation but also improves the accuracy of the patches. The following discusses how to calculate the coefficients \(a_{3}\) and \(a_{4}\).