39 #include <visp3/core/vpMomentCentered.h> 40 #include <visp3/core/vpMomentGravityCenter.h> 41 #include <visp3/core/vpMomentObject.h> 42 #include <visp3/visual_features/vpFeatureMomentAlpha.h> 43 #include <visp3/visual_features/vpFeatureMomentCentered.h> 44 #include <visp3/visual_features/vpFeatureMomentDatabase.h> 49 #ifdef VISP_MOMENTS_COMBINE_MATRICES 60 bool found_moment_centered;
61 bool found_FeatureMoment_centered;
68 if (!found_moment_centered)
70 if (!found_FeatureMoment_centered)
73 double u11 = momentCentered.
get(1,1);
74 double u20_u02 = momentCentered.
get(2,0)-momentCentered.
get(0,2);
75 double dinv = 1 / (4*u11*u11 + u20_u02*u20_u02);
81 #else // #ifdef VISP_MOMENTS_COMBINE_MATRICES 92 bool found_moment_centered;
93 bool found_moment_gravity;
101 if (!found_moment_centered)
103 if (!found_moment_gravity)
106 double mu11 = momentCentered.
get(1, 1);
107 double mu20 = momentCentered.
get(2, 0);
108 double mu02 = momentCentered.
get(0, 2);
109 double mu12 = momentCentered.
get(1, 2);
110 double mu21 = momentCentered.
get(2, 1);
111 double mu03 = momentCentered.
get(0, 3);
112 double mu30 = momentCentered.
get(3, 0);
114 double Xg = momentGravity.
getXg();
115 double Yg = momentGravity.
getYg();
117 double Avx, Avy, Avz, Awx, Awy;
120 double d = (mu20 - mu02) * (mu20 - mu02) + 4 * mu11 * mu11;
121 double DA = mu20 + mu02;
122 double DA_2 = DA * DA;
123 double mu11_2 = mu11 * mu11;
125 Avx = mu11 * DA *
A / d + (DA * mu02 + (0.5) * d - (0.5) * DA_2) *
B / d;
126 Avy = (DA * mu02 - (0.5) * d - (.5) * DA_2) *
A / d -
B * mu11 * DA / d;
128 Awx = (beta * (mu12 * (mu20 - mu02) + mu11 * (mu03 - mu21)) + Xg * (mu02 * (mu20 - mu02) - 2 * mu11_2) +
129 Yg * mu11 * (mu20 + mu02)) /
131 Awy = (beta * (mu21 * (mu02 - mu20) + mu11 * (mu30 - mu12)) + Xg * mu11 * (mu20 + mu02) +
132 Yg * (mu20 * (mu02 - mu20) - 2 * mu11_2)) /
135 Avz =
B * Awx -
A * Awy;
155 #endif // #ifdef VISP_MOMENTS_COMBINE_MATRICES 160 double err =
s[0] - s_star[0];
vpColVector error(const vpBasicFeature &s_star, unsigned int select=FEATURE_ALL)
Functionality computation for centered moment feature. Computes the interaction matrix associated wit...
error that can be emited by ViSP classes.
Class for generic objects.
std::vector< vpMatrix > interaction_matrices
vpMatrix interaction(unsigned int select_one, unsigned int select_two) const
class that defines what is a visual feature
const vpMoment & get(const char *type, bool &found) const
vpMomentDatabase & moments
This class defines the double-indexed centered moment descriptor .
double get(unsigned int i, unsigned int j) const
Class describing 2D gravity center moment.
vpObjectType getType() const
vpFeatureMomentDatabase * featureMomentsDataBase
Implementation of column vector and the associated operations.
Used to indicate that a parameter is not initialized.
void compute_interaction()
const vpMomentObject & getObject() const
vpFeatureMoment & get(const char *type, bool &found)
vpColVector s
State of the visual feature.