# Bilinear interpolation implemented by convolution

I read the paper Deep Feature Flow for Video Recognition https://arxiv.org/abs/1611.07715.

In Sec.3, the author implements bilinear interpolation like this:

$$f_i^c(p)=\sum\limits_{q}G(q,p+\delta p)f_k^c(q) \tag{1}$$

Where $$q$$ is the point from the source image, and $$p$$ is the points on the target image. $$\delta p$$ is the distance the point moved each point $$p$$ (not $$\delta \bullet p$$). $$G$$ is defined as

$$G(q,p+\delta p)=g(q_x,p_x+\delta p_x)g(q_y,p_y+\delta p_y)\tag{2}$$

And the bilinear interpolation is defined in wiki as:

$$f(x,y)\approx {\frac {y_{2}-y}{y_{2}-y_{1}}}f(x,y_{1})+{\frac {y-y_{1}}{y_{2}-y_{1}}}f(x,y_{2})\tag{3}$$

I think the operation $$(1)$$ and $$(3)$$ is equivalent. How can I derive the filter $$(1)$$ from $$(3)$$?

• Can you please clarify if you are asking for a verification of the steps taken or how to actually do it? (Or what are the implications to the subject of the paper? ). What is the question in this case?
– A_A
Nov 10 '18 at 11:08
• @A_A Sorry for confusing you. What I mean is, it seems that operation $(1)$ (applying the filter $G$ on the image $f$) and $(3)$ is equivalent, how can I derive the filter (1) from (3)? Nov 10 '18 at 14:07

Honestly I haven't read that article you linked to, but as long as you want a convolution kernel for 2D bilinear interpolation, then the following should help.

Bilinear interpolation gives a crude result which can be sufficient in case the application does not require a perfect output otherwise. Then the following simple triangular 2D convolution kernel implements a bilinear interpolation of the ratio (after compression by $$M$$) given by $$r = \frac{L}{M} > 1$$.

L = 9;          % upsampling ratio
M = 5;          % downsampling ratio (M < L assumed)

h   = (1/L)*conv(ones(1,L),ones(1,L));  % 1D linear interpolator.
hBL = h'*h;                             % 2D bi-linear interpolator.


• Thank you for your code. I want to know why 1D linear interpolator kernel is h = (1/L)*conv(ones(1,L),ones(1,L)); and why 2D bi-linear interpolator kernel is h'*h? Can you give some mathematical derivation? Nov 13 '18 at 2:55