4 #include "AppearanceModel.h" 32 int _n_sub_regions_x,
int _n_sub_regions_y,
33 int _spacing_x,
int _spacing_y,
34 int _n_bins,
double _pre_seed,
35 bool _partition_of_unity,
42 typedef double ElementType;
43 typedef double ResultType;
44 LKLDDist(
const string &_name,
const unsigned int _feat_size) :
45 AMDist(_name), feat_size(_feat_size){}
46 double operator()(
const double* a,
const double* b,
47 size_t size,
double worst_dist = -1)
const override;
49 const unsigned int feat_size;
59 LKLD(
const ParamType *kld_params =
nullptr);
65 void initializeSimilarity()
override;
66 void initializeGrad()
override;
67 void initializeHess()
override;
69 void updateSimilarity(
bool prereq_only =
true)
override;
70 void updateInitGrad()
override;
71 void updateCurrGrad()
override;
73 void cmptInitHessian(MatrixXd &hessian,
const MatrixXd &curr_pix_jacobian)
override;
74 void cmptCurrHessian(MatrixXd &hessian,
const MatrixXd &curr_pix_jacobian)
override;
76 void cmptInitHessian(MatrixXd &init_hessian,
const MatrixXd &init_pix_jacobian,
77 const MatrixXd &init_pix_hessian)
override;
78 void cmptCurrHessian(MatrixXd &curr_hessian,
const MatrixXd &curr_pix_jacobian,
79 const MatrixXd &curr_pix_hessian)
override;
81 void cmptSelfHessian(MatrixXd &self_hessian,
const MatrixXd &curr_pix_jacobian)
override;
82 void cmptSelfHessian(MatrixXd &self_hessian,
const MatrixXd &curr_pix_jacobian,
83 const MatrixXd &curr_pix_hessian)
override;
89 return new DistType(name, feat_size);
91 void initializeDistFeat()
override;
94 updateDistFeat(feat_vec.data());
96 const double* getDistFeat()
override{
return feat_vec.data(); }
97 void updateDistFeat(
double* feat_addr)
override;
107 double hist_norm_mult;
110 MatrixXd init_hists, curr_hists;
111 MatrixXd init_hists_log, curr_hists_log;
112 MatrixXd init_grad_factors, curr_grad_factors;
114 MatrixXd init_hist_mat, curr_hist_mat;
116 MatrixXd init_hist_grad, curr_hist_grad;
117 MatrixXd init_hist_hess, curr_hist_hess;
120 int patch_size_x, patch_size_y;
121 int sub_region_size_x, sub_region_size_y;
122 int sub_region_n_pix;
123 MatrixX2i sub_region_x, sub_region_y;
124 MatrixXi sub_region_pix_id;
130 MatrixX2i _std_bspl_ids;
131 MatrixX2i _init_bspl_ids;
132 MatrixX2i _curr_bspl_ids;
double getLikelihood() const override
returns a normalized version of the similarity that lies between 0 and 1 and can be interpreted as th...
Definition: LKLD.h:61
int n_sub_regions_x
no. of sub regions in horizontal and vertical directions
Definition: LKLD.h:11
bool debug_mode
decides whether logging data will be printed for debugging purposes; only matters if logging is enabl...
Definition: LKLD.h:28
Definition: AMParams.h:12
Distance functor for FLANN.
Definition: AppearanceModel.h:40
double pre_seed
initial value with which each bin of the joint histogram is pre-seeded to avoid numerical instabiliti...
Definition: LKLD.h:22
int n_bins
no.
Definition: LKLD.h:19
LKLDParams(const AMParams *am_params, int _n_sub_regions_x, int _n_sub_regions_y, int _spacing_x, int _spacing_y, int _n_bins, double _pre_seed, bool _partition_of_unity, bool _debug_mode)
value constructor
int spacing_x
spacing in pixels between adjacent sub regions
Definition: LKLD.h:13
const DistType * getDistFunc() override
Support for FLANN library.
Definition: LKLD.h:88
void updateDistFeat() override
computes a "distance" vector using the current image patch such that, when the distance vectors corre...
Definition: LKLD.h:93
Similarity function that indicates how well a candidate warped patch matches the template.
Definition: AppearanceModel.h:63
unsigned int getDistFeatSize() override
returns the size of the distance vector
Definition: LKLD.h:92
bool partition_of_unity
decides whether the partition of unity constraint has to be strictly observed for border bins; if ena...
Definition: LKLD.h:25