gridSpacing = 8;
patchSize = 16;

input_folder = 'images/';
output_folder = 'descriptors/';

classes = {'badminton', 'rowing', 'sailing', 'snowboarding'};
input_files = cell(0, 1);
output_files = cell(0, 1);


for i=1:length(classes)
    files = arrayfun(@(x) x.name, dir([input_folder classes{i} '/train/*.jpg']), 'UniformOutput', false);
    input_files(end+1:end+length(files), 1) = cellfun(@(x) [input_folder classes{i} '/train/' x], files, 'UniformOutput', false);
    output_files(end+1:end+length(files), 1) = cellfun(@(x) [output_folder classes{i} '/train/' x(1:end-3) 'mat'], files, 'UniformOutput', false);
    
    files = arrayfun(@(x) x.name, dir([input_folder classes{i} '/test/*.jpg']), 'UniformOutput', false);
    input_files(end+1:end+length(files), 1) = cellfun(@(x) [input_folder classes{i} '/test/' x], files, 'UniformOutput', false);
    output_files(end+1:end+length(files), 1) = cellfun(@(x) [output_folder classes{i} '/test/' x(1:end-3) 'mat'], files, 'UniformOutput', false);
end

GenerateSiftDescriptors(input_files, output_files, gridSpacing, patchSize);