6
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$ Commented Feb 13, 2022 at 20:05
  • $\begingroup$ Is sounds like the question is asking you to find the kernel that corresponds to linear interpolation. $\endgroup$ Commented Feb 15, 2022 at 2:00

1 Answer 1

1
$\begingroup$

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].
Then, let's follow the steps:

  1. Upsample the Data with Zeros
    We add zero between each 2 samples: vU = [1, 0, 7, 0, 3].
  2. Convolve the Upsampled Data with the Kernel
    Since the kernel is symmetric, we can just see whet it does.
    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].

So indeed this is the kernel which applies a liner interpolation.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.