histeq_ag = ag;
i = 0;
ag_back = ag(:,:,1);
diff_ag = ag;
sharper = [0 1 0; 1 -5 1;0 1 0];
se = [1 1 1 1 1; 1 1 1 1 1;1 1 1 1 1; 1 1 1 1 1; 1 1 1 1 1];
%se = strel('square', 5);

for i = 1:size(ag,3)
    histeq_ag(:,:,i) = histeq( ag(:,:,i) );
    ag_back = ag_back + ag(:,:,i);
end

ag_back = ag_back / 400;
ag_back = histeq(ag_back);

for i = 1:size(ag,3)
    diff_ag(:,:,i) = ag_back - ag(:,:,i);
    %diff_ag(:,:,i) = histeq( diff_ag(:,:,i) );
end

diff_ag = diff_ag + .75;

for i = 1:size(ag,3)
   diff_ag( :,:,i) = imfilter( diff_ag( :,:,i), sharper, 'replicate');
end

diff_ag = diff_ag + .5;

for i = 1:size(ag,3)
    diff_ag( :,:,i) = imdilate( diff_ag( :,:,i), se );
end    

