x = [0 0 1 1;... 0 0 1 1;... 0 0 0 0;... 0 0 0 0];imresize(x, [2 2], 'bilinear');interp2(x, 1.5:2:3.5, (1.5:2:3.5)', 'linear');
I would expect imresize and interp2 to return the same answer above. They do not, however:
>> imresize(x, [2 2], 'bilinear')ans = 0.1094 0.7656 0.0156 0.1094>> interp2(x, 1.5:2:3.5, (1.5:2:3.5)', 'linear')ans = 0 1 0 0
My assumption is that imresize does not adhere to the common definition of bilinear scaling (a linear weighted sum of the immediate 2 neighours in each dimension). Perhaps it is using the (functionally more sensible, but terminology-wise problematic) definition used by ImageMagick, where a triangular function is used as a continouus prototype, meaning that when used for large scale downsampling, more than 4 input samples are used to form one output sample?
https://en.wikipedia.org/wiki/Bilinear_interpolation
Best Answer