I'm trying to create a function the scales an image based on a value (scale_zoom) for a homework assignment. I don't want to use the MATLAB built in function resize()
in this function so I'm trying to interpolate. Any help would be greatly appreciated. This is what I have so far:
function pic_new=scale_image(pic,scale_zoom)
[row, col]=size(pic)
ht_scale=size(pic,1)/scale_zoom*col
wid_scale=size(pic,2)/scale_zoom*row
size(ht_scale)
size(wid_scale)
x=(0:scale_zoom)*wid_scale
y=(0:scale_zoom)*ht_scale
length(x)
length(y)
%plotvals=0:0.1:scale_zoom (this is not necessary i think)
newimg=interp1(pic,x,y,'cubic')
image(newimg)
end
I think I'm interpolating it very incorrectly :/