
#if !defined(__RV_COLOR_BLOB_H_INCLUDED_)
#define  __RV_COLOR_BLOB_H_INCLUDED_
#pragma once

#include "color.h"

typedef struct __cb_target_param_
{
	RvRgb target;
	int   nRedToler;
	int   nGreenToler;
	int   nBlueToler;
}CB_TARGET_PARAM;

typedef struct __cb_range_param_
{
	int    nRedLower,  nRedUpper;
	int    nGreenLower,  nGreenUpper;
	int    nBlueLower, nBlueUpper;
}CB_RANGE_PARAM;


class COLOR_API CColorBlob :	public CBlobExtractor
{
public:
	CColorBlob(void);
	virtual ~CColorBlob(void);
	
	virtual int Segment();	

	virtual BOOL Serialize(HANDLE device, BOOL bIn ) ;
    virtual CUCObj* Clone(  CUCObj *twin) ;

	//转成二进制
	//image - 原图(输入), 格式：RIT_RGB,RIT_GRAY, RIT_BIN
	//imBin - 二值图(输出)
	RvImage ConvertToBin(const RvImage image, const RvMask mask, RvImage imBin);

public:
	BOOL m_bUseTargetParam;     
	CB_TARGET_PARAM m_tp;
	CB_RANGE_PARAM   m_rp;
};



#endif
