`
xiaoer_1982
  • 浏览: 1812279 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

OpenCV学习——物体跟踪的粒子滤波算法实现之权重归一化

阅读更多

/*
Normalizes particle weights so they sum to 1

@param particles an array of particles whose weights are to be normalized
@param n the number of particles in \a particles
*/
void normalize_weights( particle* particles, int n )
{
float sum = 0;
int i;

for( i = 0; i < n; i++ )
sum += particles[i].w;
for( i = 0; i < n; i++ )
particles[i].w /= sum;
}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics