%%classify512
%%takes the vector of LH and HL coefficients of 32x32 block in row xcx and column yc
%%modifies the intermediate image, marking the block as background, text, picture,
%%or undetermined

%%define colors
global black
global white
global gray
global undetermined
global T1
global T2
global T0
global T3
global T4

black=0;
white=255;
gray=128;
undetermined=7;
T0=700 ;
T1=100;
T2=2150;

T3=2650;
T4=3000;

variance=abs(variance);
if variance <0.1   %background -> image will be black
   intermimage(xc,yc)=black;
elseif variance < T1    %picture  -> image will be white
      intermimage(xc,yc)=white;
elseif variance > T2     %text   -> image will be gray
      intermimage(xc,yc)=gray;
else   % classification of 32x32 block is undetermined, mark it as color 7
    intermimage(xc,yc)=undetermined;
end
