⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jetstream.h

📁 关于时下流行的粒子滤波程序的源码
💻 H
字号:
/////////////////////////////////////////////////////////////////////
//	
//	Header file of JetStream, 
//				which extracts contour based on particle filter
//
//	XinFan	2003.5.26
//Reference:
//	P. Pérez, A. Blake, and M. Gangnet. 
//	JetStream: Probabilistic contour extraction with particles. 
//	Proc. Int. Conf. on Computer Vision (ICCV),  II:524-531, 2001.
////////////////////////////////////////////////////////////////////
#ifndef _JETSTREAM_H
#define _JETSTREAM_H

#include	"Particle.h"
#ifndef MAX_STEP
#define MAX_STEP 1000
#endif
const int max_order = 3;
const unsigned char mask_value = 255;//or 1
const int mask_bound = 3;
//
//Structure for JetStream Parameters
//
typedef struct tagJetPara
{
	float step_length;		//Step Length
	float dyn_mu;			//Mixture Proportion in the Dynamics
	float dyn_sigma;		//Standard Deviation in the Dynamics
	float mea_lamda;		//Constant of the Exponential Distribution
	float mea_sigma;		//Standard Deviation in the Data Model
}JETPARA;
class CJetStream;
class CShapeStream;
//
//Structure for Measurement
//
class CJetImgData
{
	friend CJetStream;
	friend CShapeStream;
public:
	CJetImgData();
	~CJetImgData();
	CopyOf(const CJetImgData *);
	void SetMagOr(void * dX, void * dY);
	void SetCornerMask(void *corners, int corner_count, void* szImg);
protected:
//	void *img_dx;			//Gradient along X
//	void *img_dy;			//Gradient along Y
	void *gradient_norm;	//Norm of gradient
	void *gradient_orient;	//Orietation of gradient
	void *corner_mask;		//Masks for Corners
//public acess 
public:
	float NormalizeNorm(void);
	const void * GetNorm(void) const { return gradient_norm;}
private:
	CJetImageData(CJetImgData&);
};
//
//Structure for initial samples
//
class CJetInit
{
	friend CJetStream;
	friend CShapeStream;
	//x(0:1) Initial position of the Jet
protected:
	int ptNum;
	float * pt[max_order];//maximal dynamics order
public:
	CJetInit()
	{
		ptNum = 0;
	}
	CJetInit(int nPtNum);
	~CJetInit();
	void SetPoints(long *point, int i);
	//SetPoints(int *pt);
};
//
//JetStream Class
//
class CJetStream : public CParticle
{
public:
	CJetStream();
	CJetStream(int nStateDim, int nSamplesNum, int nStepNum);
	~CJetStream();
public:
	virtual void UpdateByTime(int nStep);
	virtual void EvalWeight(int nStep);
	virtual void * GetState(int nStep) const;
	virtual void Initialize(const JETPARA* jetInitPara, const CJetImgData* jetImgData, const CJetInit* jetInit);
	void Selection(int nStep);

	void EstState(int nStep);
protected:
	//Total time step
	int			m_nStepNum;
	//Image dimension
	int			m_nDataWidth;
	int			m_nDataHeight;
	//Estimated states sequence
	//Each row is the estmated state
	float		**m_flStateSeq;
	//Since All the Past Samples should be Updated with Posterior Prob., 
	//Declare a member varible to store all the samples
	float		***m_flStream;
	float		***m_tmpStream;
	//Parameters for JetStream
	JETPARA		m_jetPara;
	//Data for JetStream
	CJetImgData	m_jetData;
protected:
	void InitSample(float **sampleArr, float *startPt, float d);

};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -