4 #include "AppearanceModel.h" 19 typedef bool is_kdtree_distance;
20 typedef double ElementType;
21 typedef double ResultType;
22 SPSSDist(
const string &_name,
const double _c) :
AMDist(_name), c(_c){}
23 double operator()(
const double* a,
const double* b,
24 size_t size,
double worst_dist = -1)
const override;
25 double accum_dist(
const ElementType& a,
26 const ElementType& b,
int)
const{
27 return -(2 * a*b + c) / (a*a + b*b + c);
39 SPSS(
const ParamType *spss_params =
nullptr,
const int _n_channels = 1);
41 double getLikelihood()
const override;
44 void initializePixVals(
const Matrix2Xd& init_pts)
override;
45 void initializeSimilarity()
override;
46 void initializeGrad()
override;
50 void updatePixVals(
const Matrix2Xd& curr_pts)
override;
52 void updateSimilarity(
bool prereq_only =
true)
override;
53 void updateInitGrad()
override;
55 void updateCurrGrad()
override;
57 void cmptInitHessian(MatrixXd &d2f_dp2,
const MatrixXd &dI0_dp)
override;
58 void cmptInitHessian(MatrixXd &d2f_dp2,
const MatrixXd &dI0_dp,
59 const MatrixXd &d2I0_dp2)
override;
61 void cmptCurrHessian(MatrixXd &d2f_dp2,
const MatrixXd &dIt_dp)
override;
62 void cmptCurrHessian(MatrixXd &d2f_dp2,
const MatrixXd &dIt_dp,
63 const MatrixXd &d2It_dp2)
override;
65 void cmptSelfHessian(MatrixXd &d2f_dp2,
const MatrixXd &dIt_dp)
override;
66 void cmptSelfHessian(MatrixXd &d2f_dp2,
const MatrixXd &dIt_dp,
67 const MatrixXd &d2It_dp2)
override;
70 const DistType* getDistFunc()
override{
71 return new DistType(name, c);
75 void updateDistFeat(
double* feat_addr)
override;
76 const double* getDistFeat()
override{
return getCurrPixVals().data(); }
83 VectorXd f_vec, f_vec_den;
84 VectorXd I0_sqr, It_sqr;
Definition: AMParams.h:12
Sum of Pixelwise Structural Similarity.
Definition: SPSS.h:34
Distance functor for FLANN.
Definition: AppearanceModel.h:40
void initializeDistFeat() override
to be called once during initialization if any of the distance feature functionality is to be used ...
Definition: SPSS.h:74
Definition: ImageBase.h:51
unsigned int getDistFeatSize() override
returns the size of the distance vector
Definition: SPSS.h:73
void updateDistFeat() override
computes a "distance" vector using the current image patch such that, when the distance vectors corre...
Definition: SPSS.h:77
Similarity function that indicates how well a candidate warped patch matches the template.
Definition: AppearanceModel.h:63
void initializeHess() override
even though the Hessian of the error norm w.r.t.
Definition: SPSS.h:47