###########Play with the code

Extract the files to a directory. 
Start Matlab and move to the above directory. 
Type ¡°StartFromHere¡±. 




###########Options for normalizing filter responses

localOrNot: +1 means normalizing a filter response by dividing the filter response 
by the average response pooled within a window centered at this filter. -1 means not 
using local normalization. localHalfx and localHalfy specify the half length and width 
of the local window for normalization.  
 	
windowNormalizeOrNot: when we scan the template over the testing image in the detection 
stage, at each position, we need to normalize the filter responses within the scanning 
window of the template by dividing them by the average response pooled within this 
scanning window. +1 means using window normalization, -1 means not. 

If we use local normalization, we should not use window normalization. They are kind of 
similar to each other. 
 	
Currently, we set localOrNot = -1, and windowNormalizeOrNot = 1. That is, we use 
within-window normalization in ABfind. 



###########Key parameters 

numScale: total number of scales of the Gabor filters.

scales: scales of the Gabor filters. 

numElement: number of elements. Result on classification and detection is not sensitive 
to this number. However, it is still worthwhile to play with it. 
 	
subsample: the subsample rate in learning and detection. Currently we set it at 2, you 
may set it at 1. 
 	
locationShiftLimit: the range of displacement of the Gabor element along its normal 
direction. Currently we set localShiftLimit = 3, which means the range of displacement 
is 6 pixels, because currently we set sample rate = 2. You can decrease the range to 3 
pixels or 2 pixels with subsample = 1. 
 	
saturation: saturation level for sigmoid transformation. Currently we set it at 6, you may 
increase it to favor strong edges. 
 	
resizefactor: the factor to resize all the training images. 
 	
numResolution: number of resolutions to search in detection
line -3 from bottom in ParameterCodeImage: specify the actual resolutions to search for. 



###########About the files in zip
            
StartFromHere.m : run the code. 
            
ParameterCodeImage.m : set up parameter values, mex C code, and read in images. 
 	
ABlearn.m: Matlab code for learning active basis from images in a dictionary. 
 	
CsharedSketch.c: mex-C code for learning active basis. It is called by ABlearn.m. 
 	
Csigmoid.c: mex-C code for sigmoid transformation of SUM1 maps. 
 	
CgetMAX1track.c: mex-C code for getting MAX1 maps and track maps, called by ABlearn.m. 
 	
CgetMAX1.c: mex-C code for getting MAX1 maps but not track maps, called by ABfind.m. 
 	
GaborFilter.m: create a pair of Gabor sine and cosine filters. 
 	
MakeFilter.m: make a set of Gabor filters at different orientations. 
 	
CorrFilter.m: compute correlations between filters to be used in non-maximum suppression. 
 	
ApplyFilterfft.m: filtering input images by Gabor filters based on fft. 
 	
ApplyFilterfftSame.m: filtering images that are of the same size, so we only need fft 
the filters once. 
 	
ClocalNormalize.c: local instead of global normalization in filtering. 
 	
ClocalNormalizeDouble.c: used in ExponentialModel.m, for images of type double. 
 	
ExponentialModel.m: store the grid of lambda values and the corresponding expectation and 
logZ values to be used for estimating lambda and computing logZ in model fitting.
 	
Chistogram.c: compute the marginal histogram of filter responses from negative images. 
We do not need negative images beyond this marginal histogram. 
 	
ABfind.m: Matlab code for detecting and sketching object in the testing image using the 
learned model, output from ABlearn.m. 
 	
Caverage.c: mex-C code for computing window averages of filter responses, to be used in 
normalization. 
 	
CgetSUM2.c: mex-C code for computing the SUM2 maps. It is called by ABfind.m. 
 	
CgetMAX2.c: mex-C code for computing the MAX2 scores at multiple resolutions. 
 	
CgetBack.c: after detection, get back to sketch the object.  

CgetBackInhibit.c: with local inhibition, for re-calculating MAX2 scores. 
 	
OutLearningResult.m: output learning results. 
 	
Outepsgif.m: output eps and gif files to be included in latex or html. 

CleanUp.m: removed generated files during the running of matlab code. 
 	
PositiveImage: the folder that contains training images. 
 	
NegativeImage: the folder that contains natural images. We do not need negative images 
beyond pooling a marginal histogram. 
 	
test1.jpg: the testing image. 
 	

