33 #include <visp3/core/vpConfig.h>
35 #ifdef VISP_MOMENTS_COMBINE_MATRICES
38 #include <visp3/core/vpMomentAreaNormalized.h>
39 #include <visp3/core/vpMomentCentered.h>
40 #include <visp3/core/vpMomentObject.h>
41 #include <visp3/visual_features/vpFeatureMomentAreaNormalized.h>
42 #include <visp3/visual_features/vpFeatureMomentBasic.h>
43 #include <visp3/visual_features/vpFeatureMomentCentered.h>
44 #include <visp3/visual_features/vpFeatureMomentDatabase.h>
58 bool found_moment_centered;
59 bool found_moment_surface_normalized;
60 bool found_FeatureMoment_centered;
62 bool found_featuremoment_basic;
70 moments.
get(
"vpMomentAreaNormalized", found_moment_surface_normalized));
74 if (!found_FeatureMoment_centered)
76 if (!found_moment_surface_normalized)
78 if (!found_moment_centered)
80 if (!found_featuremoment_basic)
84 double normalized_multiplier;
88 a = momentCentered.
get(2, 0) + momentCentered.
get(0, 2);
92 a = momentObject.
get(0, 0);
96 normalized_multiplier =
105 #include <visp3/core/vpMomentAreaNormalized.h>
106 #include <visp3/core/vpMomentCentered.h>
107 #include <visp3/core/vpMomentGravityCenter.h>
108 #include <visp3/core/vpMomentObject.h>
109 #include <visp3/visual_features/vpFeatureMomentAreaNormalized.h>
110 #include <visp3/visual_features/vpFeatureMomentDatabase.h>
123 bool found_moment_centered;
124 bool found_moment_surface_normalized;
125 bool found_moment_gravity;
133 moments.
get(
"vpMomentAreaNormalized", found_moment_surface_normalized));
135 if (!found_moment_surface_normalized)
137 if (!found_moment_centered)
139 if (!found_moment_gravity)
143 double n11 = momentCentered.
get(1, 1) / momentObject.
get(0, 0);
144 double n20 = momentCentered.
get(2, 0) / momentObject.
get(0, 0);
145 double n02 = momentCentered.
get(0, 2) / momentObject.
get(0, 0);
146 double Xg = momentGravity.
getXg();
147 double Yg = momentGravity.
getYg();
149 double An = momentSurfaceNormalized.
get()[0];
154 double Anvx, Anvy, Anvz, Anwx, Anwy;
157 double a = momentCentered.
get(2, 0) + momentCentered.
get(0, 2);
159 double e01 = momentCentered.
get(0, 1) / a;
160 double e10 = momentCentered.
get(1, 0) / a;
161 double e11 = momentCentered.
get(1, 1) / a;
162 double e02 = momentCentered.
get(0, 2) / a;
163 double e20 = momentCentered.
get(2, 0) / a;
164 double e12 = momentCentered.
get(1, 2) / a;
165 double e21 = momentCentered.
get(2, 1) / a;
166 double e03 = momentCentered.
get(0, 3) / a;
167 double e30 = momentCentered.
get(3, 0) / a;
169 Anvx = An *
A * e20 + An *
B * e11;
170 Anvy = An *
A * e11 + An *
B * e02;
172 Anwx = (n02 * e01 + n11 * e10 - e03 - e21) * An - Xn * e11 + (-1 - e02) * Yn;
173 Anwy = (e12 + e30 - n11 * e01 - n20 * e10) * An + (2 - e02) * Xn + Yn * e11;
175 Anvz = -An *
C +
B * Anwx -
A * Anwy;
181 Anvz = -An *
C - (3. / 2.) *
A * Xn - (3. / 2.) *
B * Yn;
183 Anwx = -(3. / 2.) * Yn;
184 Anwy = (3. / 2.) * Xn;
error that can be emitted by ViSP classes.
@ notInitialized
Used to indicate that a parameter is not initialized.
void compute_interaction() VP_OVERRIDE
Functionality computation for basic moment feature. Computes the interaction matrix associated with v...
vpMatrix interaction(unsigned int select_one, unsigned int select_two) const
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
Implementation of a matrix and operations on matrices.
Class handling the normalized surface moment that is invariant in scale and used to estimate depth.
double getDesiredArea() const
double getDesiredDepth() const
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.
const std::vector< double > & get() const
vpObjectType getType() const
const vpMomentObject & getObject() const
const std::vector< double > & get() const