The particle filter program essentially introduces the particle structure in the following program:
程序中粒子本质就是选取的区域,只不过该区域加上了权值,程序中构造一个结构体用来描述粒子:主要有以下属性,区域的中心、区域的长宽、区域的权值、区域的原始中心、区域前一帧的中心和长宽,区域的权值、区域的变化尺度、区域的前一帧变化尺度、区域的直方图。
1. Color space conversion of the first frame image, from BGR space to HSV space, find the need to track the region, generate the tracking area histogram.
2. Initialize particle information, set each particle information to track the initial state of the object, so that the center of the area equals the original center of the region and equal to the center of the previous frame of the region. The long width of the previous frame of the region equals the length of the previous frame of the region. The weighted value of the zone is initialized to zero. The region's change scale equals the region's previous frame change scale equal to 1.
3. Read the next frame and make predictions for each particle, and the predicted content is actually using random numbers (Gauss) to randomly change the center position and length of the region. Here you can assume that the final position and size of the area is mainly based on the last change plus a random change to get
。
4. The similarity between the histogram in the HSV space and the histogram of the initialized time is obtained, and the similarity is expressed by the Battacharyya coefficient, assuming that the initial graph is {0.1,0.2,0.5,0.2}, and the changed histogram is {0.2,0.2,0.4,0.2 }, the similarity is sqrt (0.1*0.2+0.2*0.2+0.5*0.4+0.2*0.2) = 0.55, where the similarity is the weight of the particles.
5. The position information and weights of all particle updates are obtained by Process four. Redistribute the range of particles according to weight, say there is a particle weight of 0.1, a total of 100 particles, then, when we redistribute the particles, at the position of the particle distribution 0.1*100=10 particles. And the state of the 10 particles is exactly the same as the particle. Where the particle weights the most can be considered to track the current position of the target.
6. Return to step 3.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Welcome to the Csdn-markdown Editor