4 #include "AppearanceModel.h" 23 int _n_bins,
double _pre_seed,
24 bool _partition_of_unity,
bool _debug_mode);
30 typedef bool is_kdtree_distance;
31 typedef double ElementType;
32 typedef double ResultType;
33 KLDDist(
const string &_name,
const unsigned int _feat_size) :
34 AMDist(_name), feat_size(_feat_size){}
35 double operator()(
const double* a,
const double* b,
36 size_t size,
double worst_dist = -1)
const override;
37 inline double accum_dist(
const double& a,
const double& b,
int)
const{
39 return ratio > 0 ? a * log(ratio) : 0;
42 const unsigned int feat_size;
52 KLD(
const ParamType *kld_params =
nullptr);
54 void initializeSimilarity()
override;
55 void updateSimilarity(
bool prereq_only = 1)
override;
56 void initializeGrad()
override;
57 void initializeHess()
override;
59 void updateInitGrad()
override;
60 void updateCurrGrad()
override;
62 void cmptInitHessian(MatrixXd &hessian,
const MatrixXd &curr_pix_jacobian)
override;
63 void cmptCurrHessian(MatrixXd &hessian,
const MatrixXd &curr_pix_jacobian)
override;
65 void cmptInitHessian(MatrixXd &init_hessian,
const MatrixXd &init_pix_jacobian,
66 const MatrixXd &init_pix_hessian)
override;
67 void cmptCurrHessian(MatrixXd &curr_hessian,
const MatrixXd &curr_pix_jacobian,
68 const MatrixXd &curr_pix_hessian)
override;
74 return new DistType(name, feat_size);
76 void initializeDistFeat()
override;
79 updateDistFeat(feat_vec.data());
81 const double* getDistFeat()
override{
return feat_vec.data(); }
82 void updateDistFeat(
double* feat_addr)
override;
91 double hist_norm_mult;
94 VectorXd init_hist, curr_hist;
95 MatrixXd init_hist_mat, curr_hist_mat;
98 MatrixXd init_hist_grad, curr_hist_grad;
99 MatrixXd init_hist_hess, curr_hist_hess;
100 VectorXd init_grad_factor, curr_grad_factor;
101 VectorXd init_hist_log, curr_hist_log;
107 MatrixX2i _std_bspl_ids;
108 MatrixX2i _init_bspl_ids;
109 MatrixX2i _curr_bspl_ids;
const DistType * getDistFunc() override
Support for FLANN library.
Definition: KLD.h:73
KLDParams(const AMParams *am_params, int _n_bins, double _pre_seed, bool _partition_of_unity, bool _debug_mode)
decides whether logging data will be printed for debugging purposes;
Definition: AMParams.h:12
void updateDistFeat() override
computes a "distance" vector using the current image patch such that, when the distance vectors corre...
Definition: KLD.h:78
bool debug_mode
initial value with which each bin of the joint histogram is pre-seeded
Definition: KLD.h:18
Distance functor for FLANN.
Definition: AppearanceModel.h:40
double pre_seed
decides whether the partition of unity constraint has to be strictly observed for border bins; ...
Definition: KLD.h:16
unsigned int getDistFeatSize() override
returns the size of the distance vector
Definition: KLD.h:77
Similarity function that indicates how well a candidate warped patch matches the template.
Definition: AppearanceModel.h:63
bool partition_of_unity
no.
Definition: KLD.h:14