Search code examples
imagemathimage-processingcolor-space

How to perform Bilinear Interpolation on RGB values?


figure

Given the black pixel coordinates, I could interpolate the coordinate values of the blue pixel via the mathematical equation y = mx + c. But what about the new RGB pixel values? How do I go about getting the weighted average RGB value for the blue pixels given that the black pixel RGB values are given as such in the figure?

Any help is much appreciated. Thanks in advance.


Solution

  • You interpolate the values independently, performing a calculation each for R, G, and B. For example, interpolating halfway between (200,50,10) and (0,0,0) yields (100,25,5).