# Image Interpolation with Regional Gradient Estimation
## 3 Image Interpolation with Regional Gradient Estimation
### Image Interpolation  
After estimating the gradient of the unknown pixel in the high-resolution image, as mentioned in Section 2, we used the gradient to judge the properties of the unknown pixel and then calculate the pixel value according to the following steps. First, we calculated the gray value \(I_{\text{HR}}\) (\(2i\), \(2j\)) at position (\(2i\), \(2j\)) in the HR image according to the gray value \(I_{\text{LR}}\) (\(i\), \(j\)) at position (\(i\), \(j\)) in the LR image. Second, \(I_{\text{HR}}\) (\(2i-1\), \(2j\)) and \(I_{\text{HR}}\) (\(2i\), \(2j-1\)) were calculated from \(I_{\text{LR}}\) (\(i\), \(j\)) and \(I_{\text{HR}}\) (\(2i\), \(2j\)), respectively. We adopted this order of calculation because the calculation of \(I_{\text{HR}}\) (\(2i-1\), \(2j\)) and \(I_{\text{HR}}\) (\(2i\), \(2j-1\)) requires \(I_{\text{LR}}\) (\(i\), \(j\)) and \(I_{\text{HR}}\) (\(2i\), \(2j\)). Finally, each non-edge pixel was interpolated using bicubic interpolation. For edge pixels, we used Equation (11) for interpolation [20]. \[I=\omega(I_{a}+I_{b})+(0.5-\omega)(I_{c}+I_{d}) \tag{11}\]  
\(\omega\) is an adjustable parameter. We set up an interpolation experiment to estimate the optimal value of \(\omega\). Figure 8 shows PSNR results of our proposed method averaged for 12 test images using different values of \(\omega\). In this work, we obtained the highest PSNR value when \(\omega\) = 0.575; therefore, we regarded this value as the optimal value of \(\omega\) and applied it to all our experiments. Figure 6: Bicubic interpolation mapping. Figure 7: Comparison of visualization results for gradient estimation. (**a**) test image; (**b**) gradient calculation result of the test image; (**c**) gradient estimation result of the CGI method; (**d**) gradient estimation result of the GEI method. \(I\) represents the gray value of the pixel to be interpolated; \(I_{a}\), \(I_{b}\), \(I_{c}\), and \(I_{d}\) represent four known pixel values around the unknown pixel, and their values depend on the properties of the unknown pixel. The specific process is as follows [20]. Let us first address pixels on the diagonal in the HR image. If \(\theta\) = 135\({}^{\circ}\),  
\[I_{a} = I_{\mathrm{HR}}(i-1,j-1),I_{b}=I_{\mathrm{HR}}(i+1,j+1) \tag{12}\] \[I_{c} = I_{\mathrm{HR}}(i-3,j-3),I_{d}=I_{\mathrm{HR}}(i+3,j+3) \tag{13}\]  
if \(\theta\) = 45\({}^{\circ}\),  
\[I_{a} = I_{\mathrm{HR}}(i+1,j-1),I_{b}=I_{\mathrm{HR}}(i-1,j+1) \tag{14}\] \[I_{c} = I_{\mathrm{HR}}(i+3,j-3),I_{d}=I_{\mathrm{HR}}(i-3,j+3) \tag{15}\]  
Let us now address pixels in the horizontal or vertical direction in the HR image. If \(\theta\) = 90\({}^{\circ}\),  
\[I_{a} = I_{\mathrm{HR}}(i-1,j),I_{b}=I_{\mathrm{HR}}(i+1,j) \tag{16}\] \[I_{c} = I_{\mathrm{HR}}(i-3,j),I_{d}=I_{\mathrm{HR}}(i+3,j) \tag{17}\]  
if \(\theta\) = 0\({}^{\circ}\),  
\[I_{a} = I_{\mathrm{HR}}(i,j-1),I_{b}=I_{\mathrm{HR}}(i,j+1) \tag{18}\] Figure 6:0  
where \(\theta\) is the edge direction of the edge where the pixel is located and can be derived from Equations (2)-(5). So far, this paper has only addressed 2 \(\times\) 2 interpolation. For example, when the image enlargement factor is four, 2 \(\times\) 2 interpolation is performed on the original image twice. For the interpolation factor \(M\) that is not a power of two, one can first apply \(N\times N\) image interpolation (where \(N\) is a power of two and smaller than but as close as possible to \(M\)), followed by 2D bicubic image interpolation with a rational number as the image enlargement factor. For example, if an image requires 9 \(\times\) 9 image interpolation, we can first use the proposed method to interpolate the image by 8 \(\times\) 8, followed by a 9/8 \(\times\) 9/8 bicubic image interpolation. Figure 9 shows the structure of the proposed method. First, we identified and diffused the LR image's edge pixels. Second, the gradient and pixel properties of the HR image were estimated. Finally, the pixels of the HR image were separated into edge and non-edge pixels.