MATLAB: Interpolation done without imresize

interpolation

How to do nearest neighbor interpolation and bilinear interpolation on a gray scale image without using imresize? The code is supposed to mimic the operation of imresize but should not use any functions available on matlab.

Best Answer

You'll have to scan your output image, figure out where the input pixel lies on your input pixel - it will be located somewhere in a square between 3 original input pixels. Then use the bilinear interpolation formula on Wikipedia to get the output pixel value. You can use a pair of for loops for this - one over rows and one over columns.