function [post]=zoom(input,factor)

%This zoom function uses gaussian interpolation to achieve
%zoom factors of up to 4.
%---------------------------------------------------------
input=double(input);
[rows,cols]=size(input);
pre=zeros([rows,cols]);
post=zeros([rows,cols]);

%Establish portion of image to be zoomed
row_zoomed=(rows-(rows/factor))/2;
col_zoomed=(cols-(cols/factor))/2;

%Gaussian filter
filter=(1/16)*[1 2 3 4 3 2 1;2 4 6 8 6 4 2;3 6 9 12 9 6 3;
                4 8 12 16 12 8 4;3 6 9 12 9 6 3;2 4 6 8 6 4 2;1 2 3 4 3 2 1];

for i=row_zoomed:1:rows-row_zoomed-1
    for j=col_zoomed:1:cols-col_zoomed-1
        pre(((i-row_zoomed)*factor)+1,((j-col_zoomed)*factor)+1)=input(i,j);
    end;
end;

    post=conv2(pre,filter);
    post=post(1:rows,1:cols);
post=uint8(post);

