www.pudn.com > Gesture[20040824].rar > Background.h


// Background.h: interface for the CBackground class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_BACKGROUND_H__FE21F618_B488_468D_B2C0_AF99A0B40D82__INCLUDED_) 
#define AFX_BACKGROUND_H__FE21F618_B488_468D_B2C0_AF99A0B40D82__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#include "camavi.h" 
 
typedef enum {GaussianAndThreshold,GaussianAndVar,MixtureofGaussian} BkgType; 
 
struct MoGParameters { 
	double miu[5]; 
}; 
 
class CBackground 
{ 
private: 
	CCamAvi *BkgAvi; 
 
	bool m_bBkgReady; 
 
	BkgType m_BkgType; 
 
	CImage *m_BkgImage; 
	IplImage *GrayBkg; 
 
	int Th_diff; 
 
	//Parameters of Mixture of Gaussian 
	struct MoGParameters *m_MoG;  
	int k_center; 
	float *omega; 
	float *mu; 
 
	bool displayflag,testflag; 
	CImage *imageshow1; 
	CImage *imageshow2; 
	CImage *imageshow3; 
 
	double EMmu[3]; 
	double gauss[256]; 
	double gauss2[256]; 
	double probb[256]; 
	int pixpro[12000]; 
	int geshu[256]; 
public: 
	CBackground(CCamAvi *avi); 
	virtual ~CBackground(); 
 
	bool GetBkgStatus() { return m_bBkgReady; } 
	void SetBkgStatus(bool status) { m_bBkgReady = status; } 
	CCamAvi *GetBkgAvi() { return BkgAvi;} 
	BkgType GetBkgType() { return m_BkgType;} 
	CImage *GetBkgImage() { return m_BkgImage;} 
 
 
	void ConvertColorBkg2GrayBkg(); 
 
	void ExtractBackgroundFromVideo(); 
	void ExtractGaussianBackground(); 
	IplImage *Thresholding_GrayLevel(IplImage *image); 
	 
	void ExtractMoGBackground(IplImage** gray); 
 
	//added by wyr 
	void EM(unsigned char* pixelprocess,int x_co,int y_co); 
	void EM23(unsigned char* pixelprocess,double* ome,double* miu,double* xig,int x_co,int y_co,int height,int width); 
	bool Getdisplayflag() {return displayflag;} 
	void Setdisplayflag() {displayflag = false;} 
	bool Gettestflag() {return testflag;} 
	void Settestflag() {testflag = false;} 
	struct MoGParameters *GetMoGParameters() { return m_MoG; } 
	CImage *GetImageshow1() {return imageshow1;} 
	CImage *GetImageshow2() {return imageshow2;} 
	CImage *GetImageshow3() {return imageshow3;} 
	void Test(); 
	int Judge(double ranran,double* probb); 
	int KJudge(int w,double x,double y,double z); 
	double GetEMmu0() {return EMmu[0];} 
	double GetEMmu1() {return EMmu[1];} 
	double GetEMmu2() {return EMmu[2];} 
	double Getgauss(int posi){return gauss[posi];} 
	double Getgauss2(int posi){return gauss2[posi];} 
	double Getprobb(int posi){return probb[posi];} 
	int Getpixpro(int posi){return pixpro[posi];} 
	int Getgeshu(int posi){return geshu[posi];} 
}; 
 
#endif // !defined(AFX_BACKGROUND_H__FE21F618_B488_468D_B2C0_AF99A0B40D82__INCLUDED_)