基于多项式拟合的数字图像放大

第一个函数:fangda.mat

img=imread('111.jpg');
small=img(1:2:end,1:2:end,:);
figure,imshow(small)

[row,col,ch]=size(img);
large=zeros(size(img));
for c=1:ch
    for y=5:col-5
        for x=5:row-5
            large(x,y,c)=mypoly(x,y,c,small);
        end
    end
end

第二个函数:mypoly.mat

function value=mypoly(x,y,c,small)
%fit the data small by poly and compute value at x,y,c
small_x=floor((x+1)/2);
small_y=floor((y+1)/2);
value=1;

if small_x==(x+1)/2 && small_y==(y+1)/2
    value=small(small_x,small_y,c);
    return;
end

[localx,localy]=meshgrid(-2:2,-2:2);
localz=small(small_x-2:small_x+2,small_y-2:small_y+2,c);


if small_x<(x+1)/2 && small_y<(y+1)/2

end

if small_x<(x+1)/2 && small_y==(y+1)/2

end

if small_x==(x+1)/2 && small_y<(y+1)/2

end
if small_x==(x+1)/2 && small_y==(y+1)/2

end

这样写是对的吗?
运行出来确实分辨率确实小了,但是不知道有没有拟合。

img