I have a 4*4 image 'A' with the following intensities.
A = 55.0000 75.0000 95.0000 115.0000
152.5000 110.0000 130.0000 150.0000
125.0000 145.0000 165.0000 185.0000
160.0000 55.0000 75.0000 95.0000
I'm doing bicubic interpolation on this image in matlab using
B = interp2(A,'cubic')
I got a 7*7 image(B) as the output.
B = 55.0000 65.0000 75.0000 85.0000 95.0000 105.0000 115.0000
119.3750 100.0781 92.5000 99.5703 112.5000 122.5000 132.5000
152.5000 123.4375 110.0000 116.0938 130.0000 140.0000 150.0000
142.6563 135.5664 135.3125 143.6035 155.3125 165.3125 175.3125
125.0000 135.0000 145.0000 155.0000 165.0000 175.0000 185.0000
134.6875 120.2734 115.6250 123.1836 135.6250 145.6250 155.6250
160.0000 91.8750 55.0000 57.1875 75.0000 85.0000 95.0000
But I need an 8*8 image.How it can be achieved.Please explain the method too.
I must say, that 7x7 seems more logical to me since one point is inserted in the middle between neighbouring points. However, if you insist on 8x8 you can create a coordinate grid and resample it:
[mgx mgy] = meshgrid(1:4,1:4);
[mgx2 mgy2] = meshgrid(linspace(1,4,8), linspace(1,4,8));
B= interp2(mgx, mgy, A, mgx2, mgy2, 'cubic')