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

📄 readme-pf.txt

📁 关于时下流行的粒子滤波程序的源码
💻 TXT
字号:
//****************************************************************************
// Copyright 2003, 2004, 2005, by Xin Fan
// Thanks for the acknowledgements in research publications based on the codes.
// Usage of the codes for Commercial purpose is PROHIBITED.
//
//Institute of signal and image processing
//School of information engineering 
//Dalian Maritime University, China
//http://sipi.dlmu.edu.cn
//
// Author: Xin Fan
// The codes were accomplished when the author was pursuing PHD degree in 
// Xi'an Jiaotong University, China

//Reference:
//	[1] S. Arulampalam and S. Maskell and N. Gordon and T. Clapp,"A Tutorial on Particle Filters for On-line 
//		Non-linear/Non-Gaussian Bayesian Tracking",IEEE Transactions On Signal Processing, Vol. 50(2), 
//		pages 174-188, February 2002.
//	[2] Jun S. Liu and Rong Chen, "Sequential {Monte Carlo} Methods for Dynamic Systems", 
//		Journal of the American Statistical Association, Vol. 93, No. 443, pp.1032--1044, 1998
//	[3] Gordon, N., Salmond, D., and Smith, A. ." Novel approach to nonlinear/non-Gaussian 
//		Bayesian state estimation". IEE Proc. F, 140, 2, 107-113.
//	[4]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.
// The sourcecode is partly based on Intel OpenCV
//

***************************************CParticle class*******************************************************
The class "CParticle" is an ABSTRACT class for particle filter. Derived classes from "CParticle" are required 
to perform particle filtering in various applications, but the filtering can be achieved by calling the SAME 
function as follows:

void * cvrParticleIteration(CParticle *cvrParticle, int nStep)
{
	//Predict...
	cvrParticle->UpdateByTime(nStep);
	//Update weights
	cvrParticle->EvalWeight(nStep);
	//if Estimation performed
	return (cvrParticle->GetState(nStep));
}

NOTE:
  1. "UpdateByTime", "EvalWeight", and "GetState" are virtual functions that make it viable for
access overloaded functions of derived classes through the pointer to the base class "CParticle". 
  2. The virtual functions should be overloaded based on applications, which are 
illustrated in CJetStream as an example.
  3. The returned pointer should be allocated when implementing the virtual function "GetState".
***********************************************************************************************************

********************************CJetstream Class **********************************************************
The class "CJetStream" is a class for implementing JetStream algorithm. The following sample gives how to 
perform JetStream algorithm and draw the extracted contour in an image.

	//Specify parameters
	//Dimension of contour(2-D)
	const int point_dim = 2;
	const int sample_num = 100;
	const int step_num = 20;
	const int dyn_order = 2;
	
	/////////////////////////////
	//convert input to 1-channel image
	IplImage *src = cvrConvertChannel(m_pOrigImg->GetImage(), CV_BGR2GRAY);

	/////////////////////////////
	//Initializing JetStream
	CJetStream *pJet = new CJetStream(point_dim, sample_num, step_num);
	CJetInit CvrJetStartPt(dyn_order);
	for (int i = 0; i < dyn_order; i++)
	{
		CvrJetStartPt.SetPoints((long*)(m_pPoints + i), i);
	}
	//Prepare Image Data for Jetstream
	CJetImgData CvrJetData;
	cvrJetInitData(src, &CvrJetData);
	cvrJetInitPara(&CvrJetPara, &CvrJetData);
	pJet->Initialize(&CvrJetPara, &CvrJetData, &CvrJetStartPt);
	
	//////////////////////////////////////////////////////////
	//JetStream iteration
	for (int i = 2; i < step_num; i ++)
	{
		cvrParticleIteration(pJet, i);
		//Act as resampling, but all the previous states will be updated
		//Need to discuss more...
		pJet->Selection(i);
		pJet->EstState(i);
		cvrProbContour(src, pJet,, i);
	}
	cvrProbContour(src, pJet, step_num - 1);

	////////////////////////////////////////////////////
	//Convert to the image format which can be displayed
	cvrConvertImage(src, m_pResImg->GetImage());
	cvReleaseImage( &src );

NOTE:
  The functions with the prefix "cvr" are defined in "ProbContour.cpp"

⌨️ 快捷键说明

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