//该类利用模式识别方法识别事物的两面，如正、反，左、右，上、下，黑、白，方、圆等等。

#if !defined(__RV_DUAL_DETECT_H_INCLUDED_)
#define      __RV_DUAL_DETECT_H_INCLUDED_
 


#include "pixelmatch.h"


class PATMAT_API CDualDetect : 	public CPixelMatch
{
public:
	CDualDetect(void);
	virtual ~CDualDetect(void);
	
	virtual BOOL Serialize(HANDLE device, BOOL bIn );
	virtual CUCObj* Clone(  CUCObj *twin) ;

	virtual BOOL    Learn(const RvImage image=NULL, int* pErrCode = NULL) { return LearnOne(image, pErrCode); };
	BOOL  LearnOne(const RvImage image=NULL, int* pErrCode = NULL);
	BOOL  LearnTwo(const RvImage image=NULL, int* pErrCode = NULL);

	virtual int     Recognize(const RvImage image=NULL, int* pErrCode = NULL);

	BOOL IsPatternOneExist() { return m_bPattern1Exist;};
	BOOL IsPatternTwoExist() { return m_bPattern2Exist;};
 

	//RvImage GetPatternImage(int index);
	//RvMask  GetPatternMask(int index);	

	PM_MATCH_RESULT* GetMatchResult(int index) ;

public:
	 //virtual void OnEndTrack(HGPD hCur,  GPoint point, int nHitType) ;

	 //索引为-1， 0，1. -1表示当前设置为空。
	 //当设置当前模板的时候，如果对应的模板没有学习的话
	 //设置将失败，无效。
	 void SetCurPatternIndex(int index);
	 int  GetCurPatternIndex();
private:
	BOOL m_bPattern1Exist, m_bPattern2Exist;
 
	
	//记住缩小的维度
//	int  m_nReduction1Count, m_nReduction2Count;
//	int  m_nMipLevel1, m_nMipLevel2;
	int      m_nFineLevel1, m_nFineLevel2;
	int      m_nCoarseLevel1, m_nCoarseLevel2;

	int  m_nPattern1Count;
	void* m_pPatternSet1;

	int  m_nPattern2Count;
	void* m_pPatternSet2;

	int m_nCurPattIndex;

	PM_MATCH_RESULT m_matchResult1, m_matchResult2;

};









#endif

