%%makefinal
%%takes the intermediate image, a 16x16 matrix, in which each entry represents
%%a 32x32 block and the number of the block we want to shade in the final image

%%if the 32x32 block's classification is undetermined, it calls classify32;
%%otherwise, it edits final image (a 512x512 matrix), and fills in the 32x32 block
%%on the final image, according to its classification

x1=(I-1)*32+1;
y1=(J-1)*32+1;
x2=(I-1)*32+32;
y2=(J-1)*32+32;
if intermimage(I,J) ~=  7     %%block is classified
   for m = x1 : x2,
     for n = y1 : y2,
        finalimage(m,n)=intermimage(I,J);
     end
   end

else   
   %we must break the 32x32 block down into four 16x16 blocks
   %and classify those blocks individually
   x=x1;
   y=y1;
   classify32
   %%classifies 32x32 undetermined block 
end


