-
Notifications
You must be signed in to change notification settings - Fork 2
/
filter.h
42 lines (27 loc) · 986 Bytes
/
filter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <opencv2/opencv.hpp>
#include <opencv2/saliency.hpp>
#include "condens.h"
void calc_hist(cv::Mat& bgr, cv::Mat& hist);
class ParticleFilter : private ConDensation {
public:
enum FilterStates {
STATE_X,
STATE_Y,
STATE_X_VEL,
STATE_Y_VEL,
STATE_SCALE,
NUM_STATES
};
ParticleFilter(int num_particles);
virtual ~ParticleFilter();
void init(const cv::Rect& selection);
cv::Mat& update(cv::Mat& image, const cv::Size& target_size, cv::Mat& target_hist);
void draw_estimated_state(cv::Mat& image, const cv::Size& target_size, const cv::Scalar& color);
void draw_particles(cv::Mat& image, const cv::Size& target_size, const cv::Scalar& color);
void redistribute(const float lower_bound[], const float upper_bound[]);
const cv::Mat& state() const { return m_state; }
float confidence() const { return m_mean_confidence; };
private:
float calc_likelihood(cv::Mat& image_roi, cv::Mat& target_hist);
float m_mean_confidence;
};