%SCRIPT_WindowDetectInListOfImages.m

 %% Get a list of images
 CAfilelist = {'mydumbImage1.jpg','myotherdumbimage.jpg'};
 
 %%% Load a model 
 load('/cbcl/scratch03/bileschi/Release/CropData/RocsPlus/C1CarDetection_iter26.mat');
 
 %%% Hardcode a save root
 saveRoot = '/cbcl/PLEASE SET A LOCATION'
 
 
 %%% Set the scanning options
 WinOpts.WindowSize = [128 128];
 WinOpts.bPadBorders = 1;
 WinOpts.PadStrategy = 'symmetric';
 WinOpts.yxStep = [4 4];  % must be integers greater than 0
 WinOpts.FeatureSubsample = [];          % use this subset of the indicies output by the feature function
                                        % empty matrix indicates no subset.
 WinOpts.bNormalizeDataSamples = 1;      % what type of data normalization
 WinOpts.NormalizationParams = [];       % modualates type of data normalization
 WinOpts.caNormalizationRegions = [];  % if different feature sets need to be normd independantly
 WinOpts.ImageToFeatureFunction = [];
 WinOpts.NormalizationParams = NormalizationParams;
 %% Set the _relative_ scales at which to scan 
 ScaleList = ((1/2).^(1/4)) .^ [0:11];

 ScaleList = ((1/2).^(1/4)) .^ [0:11];
 for i= randperm(length(CAfilelist));
   savename = fullfile(saveRoot,sprintf('C1_Detections_%.5d.mat',i));
   if(exist(savename)), continue, end;
   im = imread(CAfilelist{i}.imagename);
   img = rgb2gray(im);
   for iScale = 1:length(ScaleList);
     caimg{iScale} = imresize(img,ScaleList(iScale),'bilinear');
     caDMap{iScale} = WindowedObjectDetectionNaiveC1(caimg{iScale},Model,WinOpts);
   end
   save(savename,'caDMap','WinOpts');
 end
