function [c1ActSerre, c1ActBileschi] = CompareC1Code(TestImage)
%function [c1ActSerre, c1ActBileschi] = CompareC1Code(TestImage)
%bileschi 2004

DefaultParams.num_patch = 25;
DefaultParams.patch_siz = 5;
fparams = ResolveMissingOptions(fparams,DefaultParams);

rot = [90 -45 0 45];
div = [4:-.05:3.2];
clear c1OL
global fSiz filters c1SpaceSS c1ScaleSS c1OL minFS maxFS numSimpleFilters
c1ScaleSS = [1 3];
RF_siz    = [11 13];
c1SpaceSS = [10];
minFS     = 11;
maxFS     = 13;
Div       = div(3:4);
%case 'train'
disp('Initializing S1 features ...');
init_gabor(rot, RF_siz, Div);
fprintf(1,'done! \n\n');
disp('Processing C1 layer Serre\n');
stim = rgb2gray_cautious(double(getimage(sI(i))));
stim = imresize2(stim, [96,128]);
tic;
c1RespSerre = myRespC1(stim, filters, fSiz, c1SpaceSS, c1ScaleSS, c1OL, 1);
eSerre = toc;
%c1RespBileschi = BileschiRespC1(stim, filters, fSiz, c1SpaceSS, c1ScaleSS, c1OL, 1);
tic;
 c1RespBileschi = zeros(size(c1RespSerre); 
eBileschi = toc;
fprintf('Serre code %f sec.  Bileschi code %f sec\n',eSerre, eBileschi); 

  
function img = rgb2gray_cautious(im)
M = max(max(max(im)));
m = min(min(min(im)));
im = im - m;
im = im / M;
if(size(im,3) == 3)
  img = rgb2gray(im);
  return;
end
if(size(im,3) == 1)
  img = im;
  return
end
img = sum(im,3);
