4 #include "SearchMethod.h" 5 #include <boost/random/mersenne_twister.hpp> 6 #include <boost/random/normal_distribution.hpp> 7 #include <boost/random/uniform_real_distribution.hpp> 10 #ifdef ENABLE_PARALLEL 25 void resize(
int state_size){
26 state[0].resize(state_size);
27 state[1].resize(state_size);
28 ar[0].resize(state_size);
29 ar[1].resize(state_size);
34 template<
class AM,
class SSM>
40 typedef ParamType::DynamicModel DynamicModel;
41 typedef ParamType::UpdateType UpdateType;
42 typedef ParamType::LikelihoodFunc LikelihoodFunc;
43 typedef ParamType::ResamplingType ResamplingType;
44 typedef ParamType::MeanType MeanType;
46 typedef boost::mt11213b RandGenT;
47 typedef boost::normal_distribution<double> MeasureDistT;
49 typedef boost::random::uniform_real_distribution<double> ResampleDistT;
51 typedef ResampleDistT::param_type ResampleDistParamT;
62 PF(
const ParamType *pf_params =
nullptr,
67 void initialize(
const cv::Mat &corners)
override;
68 void update()
override;
69 void setRegion(
const cv::Mat& corners)
override;
73 #ifdef ENABLE_PARALLEL 74 typedef std::unique_ptr<AM> AMPTr;
75 typedef std::unique_ptr<SSM> SSMPTr;
76 std::vector<AMPTr> am_vec;
77 std::vector<SSMPTr> ssm_vec;
82 RandGenT measurement_gen;
83 MeasureDistT measurement_dist;
85 RandGenT resample_gen;
86 ResampleDistT resample_dist;
91 unsigned int ssm_state_size;
96 CornersT mean_corners;
97 CornersT prev_corners;
102 std::vector<VectorXd> particle_states[2];
104 std::vector<VectorXd> particle_ar[2];
110 VectorXd particle_wts;
111 VectorXd particle_cum_wts;
113 VectorXd perturbed_state;
114 VectorXd perturbed_ar;
116 VectorXd state_sigma, state_mean;
117 VectorXi resample_ids;
118 VectorXd uniform_rand_nums;
119 bool using_pix_sigma;
121 double measurement_likelihood;
122 double measurement_factor;
123 cv::Mat curr_img_uchar;
125 bool enable_adaptive_resampling;
126 double min_eff_particles;
131 void initializeParticles();
132 void linearMultinomialResampling();
133 void binaryMultinomialResampling();
134 void residualResampling();
135 void updateMeanCorners();
Definition: StateSpaceModel.h:35
structure with all information about a particle might be used for a possible future migration from th...
Definition: PF.h:19
Definition: AMParams.h:12
int max_wt_id
ID of the particle with the maximum weight.
Definition: PF.h:108
double max_similarity
similarity of the initial patch (or template) with itself
Definition: PF.h:89
Definition: SearchMethod.h:10