%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Script to collect data of all classes - Averaged LJ NL 3 
%
% Author: Marc'Aurelio Ranzato
% Date: Dec 2003


dirct = 'DB';
pat = {'IRIS-BACT' 'IRIS-RBC' 'IRIS-SPRM'};

lc = length(pat);
cl = 1 : lc;
scale = 3;
car = {'/' '-' '\' '|'};
% MAIN LOOP: OUT -> class, IN -> index
    
for jj = 1 : lc
    
    fprintf(1,'cl %u ',cl(jj));
    ii = 0;
    store = [];
    resol = [];
    while ( exist ( [dirct '/' pat{cl(jj)} '/' int2str(ii) '.jpg'], 'file') == 2 ) 
        
        ima = imread( [dirct '/' pat{cl(jj)} '/' int2str(ii) '.jpg'] );
        
        fprintf(1,'\b');
        fprintf(1,'%c',car{mod(ii,4)+1});
        
%        % COMPUTE INVARIANTS AT DIFFERENT SCALES
        
        data = calcola_invarianti(ima, scale);
        
        % Apply non linearity                
        
        val = apply_non_lin3(data,scale);
        
        % store info
 
        resol(ii+1) = size(ima,1);
        store(ii+1,:) = val;
         

        ii = ii + 1;
        
    end
    
    save(['DB/features/data_collection_avljNL3_cl' int2str(cl(jj))],'store');
    save(['DB/features/resol_collection_avljNL3_cl' int2str(cl(jj))],'resol');
    fprintf(1,'\n');
    
end

