%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  Run2DClassifiersComputation.m
%
%  Copyright (c) 2012 Roberto Manduchi and Homayoun Bagherinia 
%
% This program is free software: you can redistribute it and%or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program.  If not, see <http:%%www.gnu.org%licenses/>.
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%    CLASSIFIER DESIGN PARAMETERS   %%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear ParamStructure;
%% Training data file name (generated by createTMI.m)
ParamStructure.TrainingDataFile = 'forWeb';

%% Pathname of folder containing background images
% BackgroundImagesFolder = '.\bckgr_images\';   % DOS convention
ParamStructure.BackgroundImagesFolder = './bckgr_images/';     % Mac convention

%% Suffix of background image files
ParamStructure.BackgroundImageSuffix = '.png';

%% Output xml parameter file name
ParamStructure.OutputXMLFileName = 'ClassifierParameters.xml';

%% Intercept (0: intercept at the origin; 1: otherwise)
ParamStructure.Intercept = 1;

%% Saturated color pointa removal before design (0: do not remove; otherwise, it sets the saturation value)
ParamStructure.SaturatedPointRemoval = 240;

%% Margin ratio (>= 1)
ParamStructure.MarginRatio = 2;

%% Display intermediate results (scatterplots) (1: display)
ParamStructure.ScatterplotsDisplay = 1;

%% Gamma correction (0: no gamma correction; 1: gamma correction using the
%% parameters below
ParamStructure.GammaCorrection = 0;

%% Gamma correction parameters (if Gamma correction = 1_
%% Offset
 ParamStructure.a = [0 0 0];
%% Gain
 ParamStructure.c = [0.9489 1.1409 1.2712];
%% Gamma
 ParamStructure.g = [0.5315 0.6322 0.5872];

%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load(ParamStructure.TrainingDataFile);

Compute2DClassifiers(C,ParamStructure,'IntermediateParametersFile.mat');

load 'IntermediateParametersFile.mat'

CreateXMLTable(ParamStructure, m, b1, b2, t_min, t_max, IX);
