How does Matlab function imresize calculate values on borders of image

14 views (last 30 days)
Hi, I am wondering how work Matlab function imresize with bicubic interpolation. I understand how it works in the middle of image where it have full access to all data, then usage of bicubic interpolation is quite straight forward.
A small example:
>> A= [3,1,2,6;1,5,2,7;1,3,6,2;4,1,9,2]
A =
3 1 2 6
1 5 2 7
1 3 6 2
4 1 9 2
>> imresize(A,size(A)*2,'bicubic')
ans =
3.3109 2.6187 1.1206 0.7166 1.4067 2.8883 5.1615 6.2060
2.6454 2.4435 2.0052 1.7138 1.5692 2.8062 5.4248 6.6307
1.2008 2.0609 3.9181 3.8763 1.9355 2.6382 5.9844 7.5302
0.4985 1.6796 4.2357 4.6921 3.0489 3.2618 5.3307 6.2876
0.5384 1.2996 2.9579 4.1612 4.9094 4.6769 3.4639 2.9028
1.5500 1.6768 1.9697 3.5367 6.3776 6.1378 2.8173 1.2798
3.5334 2.8110 1.2710 2.8185 7.4537 7.6444 3.3907 1.4186
4.4466 3.3344 0.9529 2.4891 7.9430 8.3334 3.6605 1.4930
But how does Matlab compute values on borders (for example in the upper left corner of the image/Matrix) where there is not enough values for the algorithm? Does it somehow simplified the algorithm? Or add some dull (zeros, ones?) values on the parts where algorithm goes beyond the defined matrix?
Thank you really much for any help and I wish you great weekend :) Maciek

Answers (1)

Steve Eddins
Steve Eddins on 19 Feb 2011
When the interpolation computation needs pixel values outside the domain of the image, it assumes they are equal to the nearest boundary pixel. For example, it assumes that the pixel value at the out-of-bounds location row = 5, column = -1 equals the pixel value at row = 5, column = 1.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!