www.pudn.com > backmode824.rar > ImageProcess.h


// ImageProcess.h: interface for the CImageProcess class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_IMAGEPROCESS_H__A92792DD_587F_4B3E_8CA9_0F1A82295D69__INCLUDED_) 
#define AFX_IMAGEPROCESS_H__A92792DD_587F_4B3E_8CA9_0F1A82295D69__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#ifdef    IHARDWARE 
      #define   BITS       4 
#else      
      #define   BITS       3 
#endif 
 
 
#include "Memory.h" 
#include "KCluster.h" 
#include "bgmodel.h" 
#include "GaussianModel.h" 
#include "Blob.h" 
#include "TrackObject.h" 
 
// maximum number of valid or invalid blobs at any one time 
//  invalid blobs are pruned dynamically, but noise can still 
//  lead to a large number of small CCs on one row 
#define MAX_NUM_BLOBS      128 
 
// maximum number of tracked objects at any one time 
#define MAX_NUM_TOBS       32 
 
 
// used in connected component finder -- in 2-pass algo, 
//  one component can be found multiple times before it is 
//  merged.  this value is the max number of such parts 
#define MAX_CC_IDS         2048 
 
class Blob; 
class TrackObject; 
 
 
class CImageProcess   
{ 
public: 
 
	 
 
	LPBITMAPINFOHEADER  m_lpMapHeader;//图象头指针 
	LPBYTE              m_lpImage;//图象数据指针 
	LPBYTE              m_lpBackImage;//背景图像指针 
	LPBYTE              m_lpMask;//背景图像的灰度图,只有黑白两种颜色 
	LPBYTE              m_lpGrayMask;//转换为灰度图 
 
	LPBYTE              m_lpDMap;//处理图象数据指针 
	LPBYTE              m_lpHMap;//H图象数据指针 
	LPBYTE              m_lpSMap;//S图象数据指针 
	LPBYTE              m_lpNewEdgeChain;// 
	LPBYTE              m_lpOldEdgeChain;// 
	CPalette*           m_lpPalette;//调色板指针 
	CBitmap*            m_lpBitmap;//位图指针 
   
 
	//LPBYTE              m_lpBackMask; //背景标致  =255 表示 r g b 都等于255 
    CBGModel*           bgm;  //背景模型结构体 
	Blob*               blobs[MAX_NUM_BLOBS];//分块结构体 
    TrackObject*        tobs[MAX_NUM_TOBS]; 
 
	CKCluster*           m_lpKCluster; 
 
	int               m_iThreshold;//图像差分阈值 
 
	int               map[MAX_CC_IDS]; //进行域连接的映射 
 
 
	CImageProcess(); 
	virtual ~CImageProcess(); 
 
	BOOL InitData(CMemory *lpmemory); 
	BOOL LoadImage(CFile* pFile,LPBYTE lpimage); 
	BOOL BuildPalette(); 
	BOOL BuildBitmap(LPBYTE lpimage); 
	BOOL Display(CDC* pDC,CRect rcDest,CRect rcSrc,DWORD dwRop); 
 
 
	void simpleFrameDiff(); 
	bool creatBackModel(LPBYTE m_lpBackImage); //创建背景模型 
	bool doGaussSub(LPBYTE m_lpImage,int Num); //进行高斯模型 抽取背景 
	bool FindConnectedComponents(LPBYTE pMask, LPBYTE pLabels); 
	bool FindBlobs(IplImage *pLabels, Blob **blobs, int *nBlobs, int minSize);//找到各个分块 
	bool MatchBlobsTobs(Blob **blobs, int nBlobs,TrackObject **tobs, int *nTobs);// 
	bool ColorTob(IplImage *pImg, IplImage *pLabels,TrackObject *tob, BYTE *color);// 
 
	bool KCluster(int type,double *lpMeanValue,int ClusterNum,int IterativeNum,double error); 
    BOOL ZeroDMemory(); 
}; 
 
#endif // !defined(AFX_IMAGEPROCESS_H__A92792DD_587F_4B3E_8CA9_0F1A82295D69__INCLUDED_)