38 #include <visp3/core/vpConfig.h>
40 #ifdef VISP_MOMENTS_COMBINE_MATRICES
44 #include <visp3/core/vpMomentAreaNormalized.h>
45 #include <visp3/core/vpMomentCentered.h>
46 #include <visp3/core/vpMomentObject.h>
47 #include <visp3/visual_features/vpFeatureMomentAreaNormalized.h>
48 #include <visp3/visual_features/vpFeatureMomentBasic.h>
49 #include <visp3/visual_features/vpFeatureMomentCentered.h>
50 #include <visp3/visual_features/vpFeatureMomentDatabase.h>
63 bool found_moment_centered;
64 bool found_moment_surface_normalized;
65 bool found_FeatureMoment_centered;
67 bool found_featuremoment_basic;
75 moments.
get(
"vpMomentAreaNormalized", found_moment_surface_normalized));
79 if (!found_FeatureMoment_centered)
81 if (!found_moment_surface_normalized)
83 if (!found_moment_centered)
85 if (!found_featuremoment_basic)
89 double normalized_multiplier;
93 a = momentCentered.
get(2, 0) + momentCentered.
get(0, 2);
96 a = momentObject.
get(0, 0);
100 normalized_multiplier =
110 #include <visp3/core/vpMomentAreaNormalized.h>
111 #include <visp3/core/vpMomentCentered.h>
112 #include <visp3/core/vpMomentGravityCenter.h>
113 #include <visp3/core/vpMomentObject.h>
114 #include <visp3/visual_features/vpFeatureMomentAreaNormalized.h>
115 #include <visp3/visual_features/vpFeatureMomentDatabase.h>
127 bool found_moment_centered;
128 bool found_moment_surface_normalized;
129 bool found_moment_gravity;
137 moments.
get(
"vpMomentAreaNormalized", found_moment_surface_normalized));
139 if (!found_moment_surface_normalized)
141 if (!found_moment_centered)
143 if (!found_moment_gravity)
147 double n11 = momentCentered.
get(1, 1) / momentObject.
get(0, 0);
148 double n20 = momentCentered.
get(2, 0) / momentObject.
get(0, 0);
149 double n02 = momentCentered.
get(0, 2) / momentObject.
get(0, 0);
150 double Xg = momentGravity.
getXg();
151 double Yg = momentGravity.
getYg();
153 double An = momentSurfaceNormalized.
get()[0];
158 double Anvx, Anvy, Anvz, Anwx, Anwy;
161 double a = momentCentered.
get(2, 0) + momentCentered.
get(0, 2);
163 double e01 = momentCentered.
get(0, 1) / a;
164 double e10 = momentCentered.
get(1, 0) / a;
165 double e11 = momentCentered.
get(1, 1) / a;
166 double e02 = momentCentered.
get(0, 2) / a;
167 double e20 = momentCentered.
get(2, 0) / a;
168 double e12 = momentCentered.
get(1, 2) / a;
169 double e21 = momentCentered.
get(2, 1) / a;
170 double e03 = momentCentered.
get(0, 3) / a;
171 double e30 = momentCentered.
get(3, 0) / a;
173 Anvx = An *
A * e20 + An *
B * e11;
174 Anvy = An *
A * e11 + An *
B * e02;
176 Anwx = (n02 * e01 + n11 * e10 - e03 - e21) * An - Xn * e11 + (-1 - e02) * Yn;
177 Anwy = (e12 + e30 - n11 * e01 - n20 * e10) * An + (2 - e02) * Xn + Yn * e11;
179 Anvz = -An *
C +
B * Anwx -
A * Anwy;
184 Anvz = -An *
C - (3. / 2.) *
A * Xn - (3. / 2.) *
B * Yn;
186 Anwx = -(3. / 2.) * Yn;
187 Anwy = (3. / 2.) * Xn;
error that can be emited by ViSP classes.
@ notInitialized
Used to indicate that a parameter is not initialized.
void compute_interaction()
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 char *type, 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 char *type, 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