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)
75 (momentCentered.
get(2, 0) * momentCentered.
get(2, 0) - 2 * momentCentered.
get(0, 2) * momentCentered.
get(2, 0) +
76 4 * momentCentered.
get(1, 1) * momentCentered.
get(1, 1) + momentCentered.
get(0, 2) * momentCentered.
get(0, 2));
80 multiplier * (momentCentered.
get(1, 1) * featureMomentCentered.
interaction(2, 0) +
81 (momentCentered.
get(0, 2) - momentCentered.
get(2, 0)) * featureMomentCentered.
interaction(1, 1) -
82 momentCentered.
get(1, 1) * featureMomentCentered.
interaction(0, 2));
96 bool found_moment_centered;
97 bool found_moment_gravity;
105 if (!found_moment_centered)
107 if (!found_moment_gravity)
110 double mu11 = momentCentered.
get(1, 1);
111 double mu20 = momentCentered.
get(2, 0);
112 double mu02 = momentCentered.
get(0, 2);
113 double mu12 = momentCentered.
get(1, 2);
114 double mu21 = momentCentered.
get(2, 1);
115 double mu03 = momentCentered.
get(0, 3);
116 double mu30 = momentCentered.
get(3, 0);
118 double Xg = momentGravity.
getXg();
119 double Yg = momentGravity.
getYg();
121 double Avx, Avy, Avz, Awx, Awy;
132 double d = (mu20 - mu02) * (mu20 - mu02) + 4 * mu11 * mu11;
133 double DA = mu20 + mu02;
134 double DA_2 = DA * DA;
135 double mu11_2 = mu11 * mu11;
137 Avx = mu11 * DA *
A / d + (DA * mu02 + (0.5) * d - (0.5) * DA_2) *
B / d;
138 Avy = (DA * mu02 - (0.5) * d - (.5) * DA_2) *
A / d -
B * mu11 * DA / d;
140 Awx = (beta * (mu12 * (mu20 - mu02) + mu11 * (mu03 - mu21)) + gamma * Xg * (mu02 * (mu20 - mu02) - 2 * mu11_2) +
141 gamma * Yg * mu11 * (mu20 + mu02)) /
143 Awy = (beta * (mu21 * (mu02 - mu20) + mu11 * (mu30 - mu12)) + gamma * Xg * mu11 * (mu20 + mu02) +
144 gamma * Yg * (mu20 * (mu02 - mu20) - 2 * mu11_2)) /
147 Avz =
B * Awx -
A * Awy;
170 double err =
s[0] - s_star[0];
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
vpColVector error(const vpBasicFeature &s_star, const unsigned int select=FEATURE_ALL)
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.