Interpolation filters

For interpolating data, Pandora2d uses its own interpolation filters. Those filters are used in the refinement step.

Bicubic

This filter uses the following kernel in 1D:

W(x) =
\begin{cases}
 (\alpha + 2)|x|^3 - (\alpha + 3) |x|^2 + 1           & \text{if } |x| \leq 1 \\
 \alpha |x|^3 - 5\alpha |x|^2 + 8\alpha |x| - 4\alpha & \text{if } 1 < |x| < 2
\end{cases}

Where

\alpha = -0.5

and

x = a - \text{fractional\_shift}

In the following image, two lines of an image are sketched with on each a point to interpolate at indices 3.5 and 5.5:

../_images/bicubic_filter_shift.drawio.svg

For both points to interpolate, the fractional_shift is 0.5. Thus, the coefficients to apply to pixels’ values are the same for both points.

../_images/bicubic_filter_get_coeff.drawio.svg

x values for which kernel is not null are available for a ranging from -1 to 2.

Thus, for an image in 2D, the filter is applied on an array of shape 4 \times 4 where coefficients are applied on columns then lines.

Sinc

This filter use a cardinal sine of the form:

\frac{\sin(x\ \pi)}{x\ \pi}

Where x is the fractional shift.

Computed coefficients are windowed by a Gaussian of form:

\exp\left(\frac{-2\ \pi\ x^2}{\sigma^2}\right)

Where \sigma correspond to the size of the filter (half width of the window).