
#if !defined(__RV_EASY_COLOR_H_INCLUDED_)
#define __RV_EASY_COLOR_H_INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000




#include "color.h"



class  COLOR_API CEasyColor :	public CAreaCal
{
public:
	CEasyColor(void);
	virtual ~CEasyColor(void);

	enum METHOD{
		EC_DEFAULT =0,
		EC_HSV,   
	};

	void ClearAll();
	int  GetCount();
	void RemoveAt(int index);

	const TCHAR* GetDesc(int index);

	//这个函数仅作学习用，检测的时候直接返回最高的分数
	UINT GetHits(int index);

	//获得ROI区域大小
	UINT GetArea();

	virtual BOOL  Create(/*CDelegate* pDelegate ,*/ const TCHAR* strName =NULL, UINT id = -1, int style= RV_UC_DEFAULT_STYLE) ;
	virtual void  Destroy(/*BOOL bEraseStroke =FALSE*/) ;

	virtual BOOL Learn(const RvImage image=NULL, const TCHAR* strDesc =NULL, int* pErrCode =NULL);
	virtual int  Recognize(const RvImage image=NULL, int* pErrCode = NULL);

	//存储和复制，必须要的
	virtual BOOL Serialize(HANDLE device, BOOL bIn ) ;
    virtual CUCObj* Clone( CUCObj* twin);

public:
	//可信度，该属性决定颜色的归属。范围： 0 - 1。
	float m_nScore;

	//识别的时候允许的颜色误差
	float m_nTolerance;//0-1.

	int GetMethod(){ return m_nMethod;};

	void SetMethod(METHOD method) ;

private:
	BOOL LearnDefault(const RvImage imRoi, const RvMask mask, const TCHAR* strDesc, int* pErrCode);
	BOOL LearnHSV(const RvImage imRoi, const RvMask mask, const TCHAR* strDesc, int* pErrCode);

	RvSequence m_lstColor;

	METHOD m_nMethod;
};



#endif
