#ifdef _CH_
#pragma package <opencv>
#endif

#ifndef _EiC
#include "cv.h"
#include "highgui.h"
#endif

#ifndef _BESTWC_H
#define _BESTWC_H

#include <vector>
#include "feature.h"
#include "training.h"

#define MAX_DATABASE_ENTRIES			(2000)

class BestWC {

protected:
	std::vector<training*> bestClassifiers;
	float combinedError;
	float bestClassifiersAlpha;
	float *alphaHX;	//array of alpha*h(x) stored values for quicker testing 

public:
	float desiredDetect;
	float desiredfalsepos;
	float currentdetect;
	float currentfalsepos;
	short Tmax;
	int numpos;	//number of positive training examples
	int numneg;	//number of negative training examples
	bool isFuzzy;
	bool constantAlpha;	//alpha ==1 or alpha determined by each feature independantly

	BestWC();
	BestWC(float desDetect, float desfalsepos, int pos, int neg);	
	~BestWC();

	//list of all WC (740000) and index of first WC with minimal ce (determined in main)
	void findBestWC(std::vector<training*>& trList, int indexFirstWC, std::vector<feature*>& featList, 
		std::vector<IplImage*>& positiveIntegrals, std::vector<IplImage*>& negativeIntegrals, 
		std::vector<IplImage*>& reds, IplImage *EObins[MAX_DATABASE_ENTRIES][6]);	
	std::vector<training*>& getBestWCs();
	void printWCs();
	void showWCs(IplImage *demo);
};

#endif // !defined(AFX_BESTWC_H__947046A8_9580_4249_A6E5_3CF2B4DF69F7__INCLUDED_)

#ifdef _EiC
main(1,"BestWC.cpp");
#endif