#pragma once

#ifndef _SVM_FACE_CLASSIFIER_
#define _SVM_FACE_CLASSIFIER_

#include <FaceClassifier/FaceClassifier.h>

namespace face {

class FACE_API SVMFaceClassifier : public FaceClassifier
{
public:
	SVMFaceClassifier();
	// base constructor used in subclasses during training
	SVMFaceClassifier(const std::string name, const std::map<float, std::string> classLabel, const int width, const int height);
	// base constructor used in subclasses during classification
	SVMFaceClassifier(const std::string name, const std::map<float, std::string> classLabel, const int width, const int height, const std::string modelFile);
	~SVMFaceClassifier();

	void LoadModelFile(const std::string modelFile);

	virtual void Train(const std::string modelFile, const std::list<std::string> trainFiles, const std::list<float> trainResponses);
	virtual void Test(const std::string modelFile, const std::list<std::string> testFiles, const std::list<float> testResponses);
	virtual float Classify(const IplImage * const img);

	void setSVMParams(const int kernelType, const double degree, const double gamma, const double coef0);
	CvSVM *getSVM();
	CvSVMParams getSVMParams();
	int getWidth();
	int getHeight();
	std::string getModelFile();

protected:
	virtual IplImage *Preprocess(const IplImage * const img) = 0;
	void init(const int width, const int height);

	std::string modelFile;
	CvSVM *svm;
	CvSVMParams *svmParams;
	int width;
	int height;
};

}

#endif
