34 #include <visp3/core/vpMomentCentered.h>
35 #include <visp3/core/vpMomentGravityCenter.h>
36 #include <visp3/core/vpMomentObject.h>
37 #include <visp3/visual_features/vpFeatureMomentAlpha.h>
38 #include <visp3/visual_features/vpFeatureMomentCentered.h>
39 #include <visp3/visual_features/vpFeatureMomentDatabase.h>
44 #ifdef VISP_MOMENTS_COMBINE_MATRICES
55 bool found_moment_centered;
56 bool found_FeatureMoment_centered;
63 if (!found_moment_centered)
65 if (!found_FeatureMoment_centered)
68 double u11 = momentCentered.
get(1, 1);
69 double u20_u02 = momentCentered.
get(2, 0) - momentCentered.
get(0, 2);
70 double dinv = 1 / (4 * u11 * u11 + u20_u02 * u20_u02);
73 (u20_u02 * dinv) * featureMomentCentered.
interaction(1, 1) +
88 bool found_moment_centered;
89 bool found_moment_gravity;
97 if (!found_moment_centered)
99 if (!found_moment_gravity)
102 double mu11 = momentCentered.
get(1, 1);
103 double mu20 = momentCentered.
get(2, 0);
104 double mu02 = momentCentered.
get(0, 2);
105 double mu12 = momentCentered.
get(1, 2);
106 double mu21 = momentCentered.
get(2, 1);
107 double mu03 = momentCentered.
get(0, 3);
108 double mu30 = momentCentered.
get(3, 0);
110 double Xg = momentGravity.
getXg();
111 double Yg = momentGravity.
getYg();
113 double Avx, Avy, Avz, Awx, Awy;
116 double d = (mu20 - mu02) * (mu20 - mu02) + 4 * mu11 * mu11;
117 double DA = mu20 + mu02;
118 double DA_2 = DA * DA;
119 double mu11_2 = mu11 * mu11;
121 Avx = mu11 * DA *
A / d + (DA * mu02 + (0.5) * d - (0.5) * DA_2) *
B / d;
122 Avy = (DA * mu02 - (0.5) * d - (.5) * DA_2) *
A / d -
B * mu11 * DA / d;
124 Awx = (beta * (mu12 * (mu20 - mu02) + mu11 * (mu03 - mu21)) + Xg * (mu02 * (mu20 - mu02) - 2 * mu11_2) +
125 Yg * mu11 * (mu20 + mu02)) /
127 Awy = (beta * (mu21 * (mu02 - mu20) + mu11 * (mu30 - mu12)) + Xg * mu11 * (mu20 + mu02) +
128 Yg * (mu20 * (mu02 - mu20) - 2 * mu11_2)) /
131 Avz =
B * Awx -
A * Awy;
156 double err =
s[0] - s_star[0];
class that defines what is a visual feature
vpColVector s
State of the visual feature.
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
@ notInitialized
Used to indicate that a parameter is not initialized.
void compute_interaction() VP_OVERRIDE
vpColVector error(const vpBasicFeature &s_star, unsigned int select=FEATURE_ALL) VP_OVERRIDE
Functionality computation for centered moment feature. Computes the interaction matrix associated wit...
vpMatrix interaction(unsigned int select_one, unsigned int select_two) const
vpFeatureMoment & get(const std::string &feature_name, bool &found)
std::vector< vpMatrix > interaction_matrices
vpFeatureMomentDatabase * featureMomentsDataBase
vpMomentDatabase & moments
This class defines the double-indexed centered moment descriptor .
double get(unsigned int i, unsigned int j) const
const vpMoment & get(const std::string &moment_name, bool &found) const
Class describing 2D gravity center moment.
Class for generic objects.
vpObjectType getType() const
const vpMomentObject & getObject() const