#pragma once

#ifndef _LBP_SVM_FACE_CLASSIFIER_
#define _LBP_SVM_FACE_CLASSIFIER_

#include <FaceClassifier/SVMFaceClassifier.h>

namespace face {

class FACE_API LBPSVMFaceClassifier : public SVMFaceClassifier
{
public:
	LBPSVMFaceClassifier();
	LBPSVMFaceClassifier(const std::string name, const std::map<float, std::string> classLabel, const int width, const int height, const std::list<SPLIT> split, const int p, const double r);
	LBPSVMFaceClassifier(const std::string name, const std::map<float, std::string> classLabel, const int width, const int height, const std::list<SPLIT> split, const int p, const double r, const std::string modelFile);
	~LBPSVMFaceClassifier();
	int p;
	double r;
	std::list<CvRect> rect;
	std::list<SPLIT> split;
	std::vector<int> rectOfSplit;
	virtual std::string ToString();

protected:
	virtual IplImage *Preprocess(const IplImage * const img);
	virtual void CreateFeatureVector(const IplImage * const img, CvMat * const fv);
	void init(const std::list<SPLIT> split, const int p, const double r);
protected:
	int widthOfPreprocessedImg;
	int heightOfPreprocessedImg;
	int ceilingR; // ceilingR
	double **vector; // shifting vectors
	double bilinearInterpolation(const double f00, const double f01, const double f10, const double f11, const double x, const double y);
	double interpolationAt(const IplImage * const img, const double x, const double y);
	int LBPCodeAt(const IplImage * const img, const int x, const int y);
};

}

#endif
