Particlefilter_code
所属分类:文章/文档
开发工具:Visual C++
文件大小:20KB
下载次数:93
上传日期:2009-07-26 10:56:45
上 传 者:
jing823823
说明: 粒子滤波源码,可以用于运动目标跟踪,具有很好的参考意义。
(Source particle filter, can be used for moving target tracking, with a very good reference value.)
文件列表:
39709593Particlefilter_code\FileIO.cpp (4577, 2003-07-24)
39709593Particlefilter_code\FileIO.h (715, 2003-07-24)
39709593Particlefilter_code\JetStream.cpp (19496, 2005-01-05)
39709593Particlefilter_code\JetStream.h (3133, 2003-08-10)
39709593Particlefilter_code\Macro.h (904, 2003-06-12)
39709593Particlefilter_code\MemAlloc.cpp (3323, 2003-05-28)
39709593Particlefilter_code\MemAlloc.h (904, 2003-05-28)
39709593Particlefilter_code\Particle.cpp (4822, 2005-03-28)
39709593Particlefilter_code\Particle.h (2741, 2005-03-28)
39709593Particlefilter_code\ProbContour.cpp (9564, 2003-09-15)
39709593Particlefilter_code\ProbContour.h (2252, 2003-09-14)
39709593Particlefilter_code\utility.cpp (3653, 2003-08-10)
39709593Particlefilter_code\Utility.h (915, 2003-08-10)
39709593Particlefilter_code (0, 2009-04-13)
//****************************************************************************
// 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, ***
//http://sipi.dlmu.edu.cn
//
// Author: Xin Fan
// The codes were accomplished when the author was pursuing PHD degree in
// Xi'an Jiaotong University, ***
//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, 19***
// [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"
近期下载者:
相关文件:
收藏者: