PedestrainCounting
|
#include <ParticleFilter.h>
Public Member Functions | |
ParticleFilter (int n=100, int szParticle=2) | |
void | InitBuffer () |
void | InitTarget (const Rect &target) |
void | Propagate (const Size &imgSize) |
void | Observe (const StrongClassifier *classifier, const IntegralImage *intImage) |
void | Observe (const StrongClassifier *classifier, const IntegralImage *intImage, const Rect &detection, float detectionWeight) |
void | ResampleWithBest () |
void | ResampleWithConfidence () |
void | DrawParticles (cv::Mat &img, const cv::Scalar &color) const |
void | DrawParticlesWithConfidence (cv::Mat &img, const cv::Scalar &color) const |
void | DrawTarget (cv::Mat &img, const cv::Scalar &color) const |
const Rect & | GetTarget () const |
void | SetTarget (const Rect &t) |
Protected Member Functions | |
int | BinarSearch (float prob) const |
void | InitParticles () |
Protected Attributes | |
const int | numParticles |
int * | particles |
const int | sizeParticle |
float * | confidence |
Rect | target |
std::deque< Rect > | prevDets |
std::default_random_engine | generator |
std::normal_distribution< float > | gaussian |
std::uniform_real_distribution< float > | resampler |
int * | resampleBuffer |
A basic particle filter. It just propagates the particles and observe using the strong classifier's evaluate function. We leave the training to upper class.
This class doesn't support virtual function!!!!
ParticleFilter::ParticleFilter | ( | int | n = 100 , |
int | szParticle = 2 |
||
) |
This constructor doesn't initialize particles. Should call InitializeBuffer and InitializeTarget before actually using it.
void ParticleFilter::InitBuffer | ( | ) |
Initialize the buffer, mainly the particles, confidence, resample buffer.
|
protected |
Initialize the particles around the target.
void ParticleFilter::InitTarget | ( | const Rect & | target | ) |
Initialize the target, used in multiple targets tracking.
void ParticleFilter::Observe | ( | const StrongClassifier * | classifier, |
const IntegralImage * | intImage | ||
) |
Observe with classifier output confidence.
void ParticleFilter::Observe | ( | const StrongClassifier * | classifier, |
const IntegralImage * | intImage, | ||
const Rect & | detection, | ||
float | detectionWeight | ||
) |
Observe with classifier output confidence and associated detection.
void ParticleFilter::Propagate | ( | const Size & | imgSize | ) |
Propagate the particles.
imgSize | Is the particle still inside the image? |
void ParticleFilter::ResampleWithBest | ( | ) |
Resample directly around the best particle.
void ParticleFilter::ResampleWithConfidence | ( | ) |
Resample with the confidence.