Bilinear Interpolation Algorithm for up-sampling 2D images

In keras it is possible to use UpSampling2D layer to up-sample an image. You can use Bilinear Interpolation.

Given an image $${h\times w}$$ it is possible to increase its size in $${h*k\times w*l}$$, where $$k$$ and $$l$$ are factors greater than or equal to $$1$$.

I understand the Bilinear Interpolation formula applied to $$4$$ neighbouring pixels ($${2\times 2}$$ sub-matrix). But I just can't figure out how to apply it to perform up-sampling. What is the actual algorithm being implemented? How is Bilinear Interpolation mathematically defined for up-sampling 2D images?

Nowhere have I found the real algorithm, no one explains how to construct the new matrix correctly and consistently. It is always explained in an incomprehensible way, please help me.

• This is an interesting question, and I think you might have better luck on the signal processing Stack: dsp.stackexchange.com
– Dave
Mar 12, 2021 at 20:35
• ehm, surely you have already looked at this, right? en.wikipedia.org/wiki/Bilinear_interpolation I mean, the formula is there Mar 12, 2021 at 20:38
• ok thanks, then I ask the question about Signal Processing Stack Mar 12, 2021 at 20:43
• Yes, I have already seen on the wikipedia page, it does not specify exactly how the up-sampling is performed Mar 12, 2021 at 20:44