# How to Find the Kernel of the Convolution for Linear Interpolation?

I'm trying to solve the following exercise:

Image A was doubled by linear interpolation. The magnification was performed in two stages. In the first stage, add about zero pixel to the image between any two existing pixels. In the second stage, perform a convolution. Find the kernel of the convolution.

In the solution they said the kernel should be: $$0.25\begin{bmatrix}1 & 2 & 1\\ 2 & 4 & 2\\ 1 & 2 & 1 \end{bmatrix}$$ But I can't seem to figure why and how did they got to that specific kernel. Is it possible to explain in technical terms?

• You choose a kernel depending on the application and the desired effect. You need to get experience with many kernels to learn to pick a suitable kernel in any given situation. Commented Feb 13, 2022 at 20:05
• Is sounds like the question is asking you to find the kernel that corresponds to linear interpolation. Commented Feb 15, 2022 at 2:00

You may notice that the kernel is a separable kernel.
So we can analyze it in 1D:

$$\boldsymbol{K} = \frac{1}{4} \begin{bmatrix} 1 & 2 & 1 \\ 2 & 4 & 2 \\ 1 & 2 & 1 \end{bmatrix} = \boldsymbol{k} \boldsymbol{k}^{T}, \; \boldsymbol{k} = \frac{1}{2} \begin{bmatrix} 1 \\ 2 \\ 1 \end{bmatrix}$$

Now, let's see what the kernel vK = 0.5 * [1, 2, 1] does in 1D.
Assume we have the signal vX = [1, 7, 3].
We add zero between each 2 samples: vU = [1, 0, 7, 0, 3].
For the 0 between 1 and 7 it basically yields: 0.5 * 1 + 1 * 0 + 0.5 * 7 = 4. The is basically linear interpolation between 1 and 7.
When it works on the 7 it multiplies it by 1 and each size is zero, hence have no meaning, so nothing happens. For the zero between 7 and 3 it will again do a linear interpolation (The average as the sampling is uniform) and yield 5 so the result: conv(vK, vX) = [1, 4, 7, 5, 3].