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);
78 (u20_u02 * dinv) * featureMomentCentered.
interaction(1, 1) +
93 bool found_moment_centered;
94 bool found_moment_gravity;
102 if (!found_moment_centered)
104 if (!found_moment_gravity)
107 double mu11 = momentCentered.
get(1, 1);
108 double mu20 = momentCentered.
get(2, 0);
109 double mu02 = momentCentered.
get(0, 2);
110 double mu12 = momentCentered.
get(1, 2);
111 double mu21 = momentCentered.
get(2, 1);
112 double mu03 = momentCentered.
get(0, 3);
113 double mu30 = momentCentered.
get(3, 0);
115 double Xg = momentGravity.
getXg();
116 double Yg = momentGravity.
getYg();
118 double Avx, Avy, Avz, Awx, Awy;
121 double d = (mu20 - mu02) * (mu20 - mu02) + 4 * mu11 * mu11;
122 double DA = mu20 + mu02;
123 double DA_2 = DA * DA;
124 double mu11_2 = mu11 * mu11;
126 Avx = mu11 * DA *
A / d + (DA * mu02 + (0.5) * d - (0.5) * DA_2) *
B / d;
127 Avy = (DA * mu02 - (0.5) * d - (.5) * DA_2) *
A / d -
B * mu11 * DA / d;
129 Awx = (beta * (mu12 * (mu20 - mu02) + mu11 * (mu03 - mu21)) + Xg * (mu02 * (mu20 - mu02) - 2 * mu11_2) +
130 Yg * mu11 * (mu20 + mu02)) /
132 Awy = (beta * (mu21 * (mu02 - mu20) + mu11 * (mu30 - mu12)) + Xg * mu11 * (mu20 + mu02) +
133 Yg * (mu20 * (mu02 - mu20) - 2 * mu11_2)) /
136 Avz =
B * Awx -
A * Awy;
161 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 emited by ViSP classes.
@ notInitialized
Used to indicate that a parameter is not initialized.
void compute_interaction()
vpColVector error(const vpBasicFeature &s_star, unsigned int select=FEATURE_ALL)
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 char *type, 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 char *type, bool &found) const
Class describing 2D gravity center moment.
Class for generic objects.
vpObjectType getType() const
const vpMomentObject & getObject() const