38 #include <visp3/core/vpMomentObject.h> 39 #ifdef VISP_MOMENTS_COMBINE_MATRICES 40 #include <visp3/core/vpMomentCInvariant.h> 41 #include <visp3/core/vpMomentCentered.h> 42 #include <visp3/visual_features/vpFeatureMomentBasic.h> 43 #include <visp3/visual_features/vpFeatureMomentCInvariant.h> 44 #include <visp3/visual_features/vpFeatureMomentCentered.h> 46 #include <visp3/visual_features/vpFeatureMomentDatabase.h> 62 std::vector<vpMatrix> LI(16);
63 bool found_moment_centered;
64 bool found_moment_cinvariant;
65 bool found_FeatureMoment_centered;
66 bool found_featuremoment_basic;
79 if (!found_featuremoment_basic)
82 if (!found_moment_centered)
84 if (!found_moment_cinvariant)
86 if (!found_FeatureMoment_centered)
90 for (
int i = 0; i < 6; i++)
93 LI[1] = -featureMomentCentered.
interaction(2, 0) * momentCentered.
get(0, 2) -
94 momentCentered.
get(2, 0) * featureMomentCentered.
interaction(0, 2) +
95 2 * momentCentered.
get(1, 1) * featureMomentCentered.
interaction(1, 1);
97 LI[2] = 2 * (momentCentered.
get(2, 0) - momentCentered.
get(0, 2)) *
99 8 * momentCentered.
get(1, 1) * featureMomentCentered.
interaction(1, 1);
101 LI[3] = 2 * (momentCentered.
get(3, 0) - 3 * momentCentered.
get(1, 2)) *
103 2 * (3 * momentCentered.
get(2, 1) - momentCentered.
get(0, 3)) *
106 LI[4] = 2 * (momentCentered.
get(3, 0) + momentCentered.
get(1, 2)) *
108 2 * (momentCentered.
get(2, 1) + momentCentered.
get(0, 3)) *
111 LI[5] = -2 * pow(momentCentered.
get(0, 3), 2) * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(3, 0) +
112 6 * momentCentered.
get(0, 3) * momentCentered.
get(1, 2) * momentCentered.
get(2, 1) *
114 4 * pow(momentCentered.
get(1, 2), 3) * featureMomentCentered.
interaction(3, 0) +
115 6 * momentCentered.
get(0, 3) * momentCentered.
get(1, 2) * momentCentered.
get(3, 0) *
117 12 * momentCentered.
get(0, 3) * pow(momentCentered.
get(2, 1), 2) * featureMomentCentered.
interaction(2, 1) +
118 6 * pow(momentCentered.
get(1, 2), 2) * momentCentered.
get(2, 1) * featureMomentCentered.
interaction(2, 1) +
119 6 * momentCentered.
get(0, 3) * momentCentered.
get(2, 1) * momentCentered.
get(3, 0) *
121 12 * pow(momentCentered.
get(1, 2), 2) * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(1, 2) +
122 6 * momentCentered.
get(1, 2) * pow(momentCentered.
get(2, 1), 2) * featureMomentCentered.
interaction(1, 2) -
123 2 * momentCentered.
get(0, 3) * pow(momentCentered.
get(3, 0), 2) * featureMomentCentered.
interaction(0, 3) +
124 6 * momentCentered.
get(1, 2) * momentCentered.
get(2, 1) * momentCentered.
get(3, 0) *
126 4 * pow(momentCentered.
get(2, 1), 3) * featureMomentCentered.
interaction(0, 3);
128 LI[6] = 6 * pow(momentCentered.
get(1, 2), 2) * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(3, 0) +
129 4 * pow(momentCentered.
get(0, 3), 2) * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(3, 0) -
130 6 * momentCentered.
get(1, 2) * pow(momentCentered.
get(2, 1), 2) * featureMomentCentered.
interaction(3, 0) -
131 6 * momentCentered.
get(0, 3) * momentCentered.
get(1, 2) * momentCentered.
get(2, 1) *
133 2 * pow(momentCentered.
get(1, 2), 3) * featureMomentCentered.
interaction(3, 0) -
134 12 * momentCentered.
get(1, 2) * momentCentered.
get(2, 1) * momentCentered.
get(3, 0) *
136 6 * momentCentered.
get(0, 3) * momentCentered.
get(1, 2) * momentCentered.
get(3, 0) *
138 12 * pow(momentCentered.
get(2, 1), 3) * featureMomentCentered.
interaction(2, 1) +
139 6 * momentCentered.
get(0, 3) * pow(momentCentered.
get(2, 1), 2) * featureMomentCentered.
interaction(2, 1) +
140 6 * pow(momentCentered.
get(0, 3), 2) * momentCentered.
get(2, 1) * featureMomentCentered.
interaction(2, 1) -
141 6 * momentCentered.
get(0, 3) * pow(momentCentered.
get(1, 2), 2) * featureMomentCentered.
interaction(2, 1) +
142 6 * momentCentered.
get(1, 2) * pow(momentCentered.
get(3, 0), 2) * featureMomentCentered.
interaction(1, 2) -
143 6 * pow(momentCentered.
get(2, 1), 2) * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(1, 2) -
144 6 * momentCentered.
get(0, 3) * momentCentered.
get(2, 1) * momentCentered.
get(3, 0) *
146 6 * pow(momentCentered.
get(1, 2), 2) * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(1, 2) -
147 12 * momentCentered.
get(0, 3) * momentCentered.
get(1, 2) * momentCentered.
get(2, 1) *
149 12 * pow(momentCentered.
get(1, 2), 3) * featureMomentCentered.
interaction(1, 2) +
150 4 * momentCentered.
get(0, 3) * pow(momentCentered.
get(3, 0), 2) * featureMomentCentered.
interaction(0, 3) -
151 6 * momentCentered.
get(1, 2) * momentCentered.
get(2, 1) * momentCentered.
get(3, 0) *
153 2 * pow(momentCentered.
get(2, 1), 3) * featureMomentCentered.
interaction(0, 3) +
154 6 * momentCentered.
get(0, 3) * pow(momentCentered.
get(2, 1), 2) * featureMomentCentered.
interaction(0, 3) -
155 6 * pow(momentCentered.
get(1, 2), 2) * momentCentered.
get(2, 1) * featureMomentCentered.
interaction(0, 3);
157 LI[7] = -3 * momentCentered.
get(0, 3) * pow(momentCentered.
get(3, 0), 2) * featureMomentCentered.
interaction(3, 0) +
158 6 * momentCentered.
get(1, 2) * momentCentered.
get(2, 1) * momentCentered.
get(3, 0) *
160 2 * pow(momentCentered.
get(2, 1), 3) * featureMomentCentered.
interaction(3, 0) -
161 3 * momentCentered.
get(0, 3) * pow(momentCentered.
get(2, 1), 2) * featureMomentCentered.
interaction(3, 0) +
162 6 * pow(momentCentered.
get(1, 2), 2) * momentCentered.
get(2, 1) * featureMomentCentered.
interaction(3, 0) +
163 3 * momentCentered.
get(0, 3) * pow(momentCentered.
get(1, 2), 2) * featureMomentCentered.
interaction(3, 0) +
164 pow(momentCentered.
get(0, 3), 3) * featureMomentCentered.
interaction(3, 0) +
165 3 * momentCentered.
get(1, 2) * pow(momentCentered.
get(3, 0), 2) * featureMomentCentered.
interaction(2, 1) -
166 6 * pow(momentCentered.
get(2, 1), 2) * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(2, 1) -
167 6 * momentCentered.
get(0, 3) * momentCentered.
get(2, 1) * momentCentered.
get(3, 0) *
169 6 * pow(momentCentered.
get(1, 2), 2) * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(2, 1) -
170 9 * momentCentered.
get(1, 2) * pow(momentCentered.
get(2, 1), 2) * featureMomentCentered.
interaction(2, 1) -
171 12 * momentCentered.
get(0, 3) * momentCentered.
get(1, 2) * momentCentered.
get(2, 1) *
173 3 * pow(momentCentered.
get(1, 2), 3) * featureMomentCentered.
interaction(2, 1) -
174 3 * pow(momentCentered.
get(0, 3), 2) * momentCentered.
get(1, 2) * featureMomentCentered.
interaction(2, 1) +
175 3 * momentCentered.
get(2, 1) * pow(momentCentered.
get(3, 0), 2) * featureMomentCentered.
interaction(1, 2) +
176 12 * momentCentered.
get(1, 2) * momentCentered.
get(2, 1) * momentCentered.
get(3, 0) *
178 6 * momentCentered.
get(0, 3) * momentCentered.
get(1, 2) * momentCentered.
get(3, 0) *
180 3 * pow(momentCentered.
get(2, 1), 3) * featureMomentCentered.
interaction(1, 2) -
181 6 * momentCentered.
get(0, 3) * pow(momentCentered.
get(2, 1), 2) * featureMomentCentered.
interaction(1, 2) +
182 9 * pow(momentCentered.
get(1, 2), 2) * momentCentered.
get(2, 1) * featureMomentCentered.
interaction(1, 2) -
183 3 * pow(momentCentered.
get(0, 3), 2) * momentCentered.
get(2, 1) * featureMomentCentered.
interaction(1, 2) +
184 6 * momentCentered.
get(0, 3) * pow(momentCentered.
get(1, 2), 2) * featureMomentCentered.
interaction(1, 2) -
185 pow(momentCentered.
get(3, 0), 3) * featureMomentCentered.
interaction(0, 3) -
186 3 * pow(momentCentered.
get(2, 1), 2) * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(0, 3) +
187 3 * pow(momentCentered.
get(1, 2), 2) * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(0, 3) +
188 3 * pow(momentCentered.
get(0, 3), 2) * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(0, 3) -
189 6 * momentCentered.
get(1, 2) * pow(momentCentered.
get(2, 1), 2) * featureMomentCentered.
interaction(0, 3) -
190 6 * momentCentered.
get(0, 3) * momentCentered.
get(1, 2) * momentCentered.
get(2, 1) *
192 2 * pow(momentCentered.
get(1, 2), 3) * featureMomentCentered.
interaction(0, 3);
194 LI[8] = -2 * momentCentered.
get(3, 0) * momentCentered.
get(2, 1) * momentCentered.
get(0, 3) *
196 6 * momentCentered.
get(3, 0) * momentCentered.
get(2, 1) * momentCentered.
get(1, 2) *
198 6 * featureMomentCentered.
interaction(3, 0) * momentCentered.
get(2, 1) * momentCentered.
get(0, 3) *
199 momentCentered.
get(1, 2) -
200 6 * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(2, 1) * momentCentered.
get(0, 3) *
201 momentCentered.
get(1, 2) -
202 6 * momentCentered.
get(3, 0) * momentCentered.
get(2, 1) * featureMomentCentered.
interaction(0, 3) *
203 momentCentered.
get(1, 2) -
204 6 * momentCentered.
get(3, 0) * momentCentered.
get(2, 1) * momentCentered.
get(0, 3) *
206 2 * momentCentered.
get(3, 0) * momentCentered.
get(1, 2) * momentCentered.
get(0, 3) *
208 6 * momentCentered.
get(2, 1) * momentCentered.
get(1, 2) * momentCentered.
get(0, 3) *
210 pow((
double)momentCentered.
get(3, 0), (double)3) * featureMomentCentered.
interaction(1, 2) +
211 3 * featureMomentCentered.
interaction(3, 0) * pow((
double)momentCentered.
get(1, 2), (double)3) +
212 6 * pow((
double)momentCentered.
get(2, 1), (double)3) * featureMomentCentered.
interaction(0, 3) -
213 featureMomentCentered.
interaction(2, 1) * pow((
double)momentCentered.
get(0, 3), (double)3) +
214 3 * featureMomentCentered.
interaction(2, 1) * pow((
double)momentCentered.
get(1, 2), (double)2) *
215 momentCentered.
get(0, 3) +
216 18 * pow((
double)momentCentered.
get(2, 1), (double)2) * momentCentered.
get(0, 3) *
218 pow((
double)momentCentered.
get(3, 0), (double)2) * featureMomentCentered.
interaction(2, 1) *
219 momentCentered.
get(0, 3) +
220 9 * momentCentered.
get(3, 0) * pow((
double)momentCentered.
get(1, 2), (double)2) *
222 4 * pow((
double)momentCentered.
get(3, 0), (double)2) * momentCentered.
get(1, 2) *
224 2 * pow((
double)momentCentered.
get(1, 2), (double)2) * momentCentered.
get(0, 3) *
226 4 * momentCentered.
get(3, 0) * pow((
double)momentCentered.
get(1, 2), (double)2) *
228 2 * momentCentered.
get(1, 2) * pow((
double)momentCentered.
get(0, 3), (double)2) *
230 4 * momentCentered.
get(2, 1) * pow((
double)momentCentered.
get(0, 3), (double)2) *
232 3 * momentCentered.
get(3, 0) * pow((
double)momentCentered.
get(2, 1), (double)2) *
234 3 * pow((
double)momentCentered.
get(3, 0), (double)2) * momentCentered.
get(1, 2) *
236 momentCentered.
get(3, 0) * featureMomentCentered.
interaction(1, 2) *
237 pow((
double)momentCentered.
get(0, 3), (double)2) -
238 4 * pow((
double)momentCentered.
get(2, 1), (double)2) * momentCentered.
get(0, 3) *
240 3 * momentCentered.
get(2, 1) * pow((
double)momentCentered.
get(0, 3), (double)2) *
242 2 * momentCentered.
get(3, 0) * pow((
double)momentCentered.
get(2, 1), (double)2) *
244 2 * pow((
double)momentCentered.
get(3, 0), (double)2) * momentCentered.
get(2, 1) *
246 3 * featureMomentCentered.
interaction(3, 0) * pow((
double)momentCentered.
get(2, 1), (double)2) *
247 momentCentered.
get(1, 2) -
248 pow((
double)momentCentered.
get(3, 0), (double)2) * momentCentered.
get(2, 1) *
250 3 * momentCentered.
get(2, 1) * pow((
double)momentCentered.
get(1, 2), (double)2) *
252 featureMomentCentered.
interaction(3, 0) * momentCentered.
get(1, 2) *
253 pow((
double)momentCentered.
get(0, 3), (double)2);
255 LI[9] = 4 * pow(momentCentered.
get(3, 0), 3) * featureMomentCentered.
interaction(3, 0) +
256 18 * momentCentered.
get(1, 2) * pow(momentCentered.
get(3, 0), 2) * featureMomentCentered.
interaction(3, 0) +
257 12 * momentCentered.
get(0, 3) * momentCentered.
get(2, 1) * momentCentered.
get(3, 0) *
259 18 * pow(momentCentered.
get(1, 2), 2) * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(3, 0) +
260 4 * pow(momentCentered.
get(0, 3), 2) * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(3, 0) +
261 18 * momentCentered.
get(0, 3) * momentCentered.
get(1, 2) * momentCentered.
get(2, 1) *
263 6 * pow(momentCentered.
get(0, 3), 2) * momentCentered.
get(1, 2) * featureMomentCentered.
interaction(3, 0) +
264 6 * momentCentered.
get(0, 3) * pow(momentCentered.
get(3, 0), 2) * featureMomentCentered.
interaction(2, 1) +
265 18 * momentCentered.
get(0, 3) * momentCentered.
get(1, 2) * momentCentered.
get(3, 0) *
267 18 * pow(momentCentered.
get(0, 3), 2) * momentCentered.
get(2, 1) * featureMomentCentered.
interaction(2, 1) +
268 6 * pow(momentCentered.
get(0, 3), 3) * featureMomentCentered.
interaction(2, 1) +
269 6 * pow(momentCentered.
get(3, 0), 3) * featureMomentCentered.
interaction(1, 2) +
270 18 * momentCentered.
get(1, 2) * pow(momentCentered.
get(3, 0), 2) * featureMomentCentered.
interaction(1, 2) +
271 18 * momentCentered.
get(0, 3) * momentCentered.
get(2, 1) * momentCentered.
get(3, 0) *
273 6 * pow(momentCentered.
get(0, 3), 2) * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(1, 2) +
274 6 * momentCentered.
get(2, 1) * pow(momentCentered.
get(3, 0), 2) * featureMomentCentered.
interaction(0, 3) +
275 4 * momentCentered.
get(0, 3) * pow(momentCentered.
get(3, 0), 2) * featureMomentCentered.
interaction(0, 3) +
276 18 * momentCentered.
get(1, 2) * momentCentered.
get(2, 1) * momentCentered.
get(3, 0) *
278 12 * momentCentered.
get(0, 3) * momentCentered.
get(1, 2) * momentCentered.
get(3, 0) *
280 18 * momentCentered.
get(0, 3) * pow(momentCentered.
get(2, 1), 2) * featureMomentCentered.
interaction(0, 3) +
281 18 * pow(momentCentered.
get(0, 3), 2) * momentCentered.
get(2, 1) * featureMomentCentered.
interaction(0, 3) +
282 4 * pow(momentCentered.
get(0, 3), 3) * featureMomentCentered.
interaction(0, 3);
284 LI[10] = featureMomentCentered.
interaction(4, 0) * momentCentered.
get(0, 4) +
285 momentCentered.
get(4, 0) * featureMomentCentered.
interaction(0, 4) -
286 4 * featureMomentCentered.
interaction(3, 1) * momentCentered.
get(1, 3) -
287 4 * momentCentered.
get(3, 1) * featureMomentCentered.
interaction(1, 3) +
288 6 * momentCentered.
get(2, 2) * featureMomentCentered.
interaction(2, 2);
290 LI[11] = -3 * featureMomentCentered.
interaction(4, 0) * momentCentered.
get(2, 2) -
291 3 * momentCentered.
get(4, 0) * featureMomentCentered.
interaction(2, 2) -
292 2 * featureMomentCentered.
interaction(4, 0) * momentCentered.
get(0, 4) -
293 2 * momentCentered.
get(4, 0) * featureMomentCentered.
interaction(0, 4) +
294 6 * momentCentered.
get(3, 1) * featureMomentCentered.
interaction(3, 1) +
295 2 * featureMomentCentered.
interaction(3, 1) * momentCentered.
get(1, 3) +
296 2 * momentCentered.
get(3, 1) * featureMomentCentered.
interaction(1, 3) -
297 3 * featureMomentCentered.
interaction(2, 2) * momentCentered.
get(0, 4) -
298 3 * momentCentered.
get(2, 2) * featureMomentCentered.
interaction(0, 4) +
299 6 * momentCentered.
get(1, 3) * featureMomentCentered.
interaction(1, 3);
301 LI[12] = 6 * momentCentered.
get(4, 0) * featureMomentCentered.
interaction(4, 0) +
302 12 * featureMomentCentered.
interaction(4, 0) * momentCentered.
get(2, 2) +
303 12 * momentCentered.
get(4, 0) * featureMomentCentered.
interaction(2, 2) +
304 2 * featureMomentCentered.
interaction(4, 0) * momentCentered.
get(0, 4) +
305 2 * momentCentered.
get(4, 0) * featureMomentCentered.
interaction(0, 4) +
306 16 * featureMomentCentered.
interaction(3, 1) * momentCentered.
get(1, 3) +
307 16 * momentCentered.
get(3, 1) * featureMomentCentered.
interaction(1, 3) +
308 12 * featureMomentCentered.
interaction(2, 2) * momentCentered.
get(0, 4) +
309 12 * momentCentered.
get(2, 2) * featureMomentCentered.
interaction(0, 4) +
310 6 * momentCentered.
get(0, 4) * featureMomentCentered.
interaction(0, 4);
312 LI[13] = 2 * (momentCentered.
get(5, 0) + 2 * momentCentered.
get(3, 2) + momentCentered.
get(1, 4)) *
315 2 * (momentCentered.
get(0, 5) + 2 * momentCentered.
get(2, 3) + momentCentered.
get(4, 1)) *
319 LI[14] = 2 * (momentCentered.
get(5, 0) - 2 * momentCentered.
get(3, 2) - 3 * momentCentered.
get(1, 4)) *
322 2 * (momentCentered.
get(0, 5) - 2 * momentCentered.
get(2, 3) - 3 * momentCentered.
get(4, 1)) *
326 LI[15] = 2 * (momentCentered.
get(5, 0) - 10 * momentCentered.
get(3, 2) + 5 * momentCentered.
get(1, 4)) *
329 2 * (momentCentered.
get(0, 5) - 10 * momentCentered.
get(2, 3) + 5 * momentCentered.
get(4, 1)) *
333 double s3 = momentCInvariant.
getS(3);
334 double s2 = momentCInvariant.
getS(2);
335 double c3 = momentCInvariant.
getC(3);
336 double c2 = momentCInvariant.
getC(2);
337 double I1 = momentCInvariant.
getII(1);
338 double I2 = momentCInvariant.
getII(2);
339 double I3 = momentCInvariant.
getII(3);
343 vpMatrix Lc3 = 2 * (momentCentered.
get(2, 0) - momentCentered.
get(0, 2)) *
345 8 * momentCentered.
get(1, 1) * featureMomentCentered.
interaction(1, 1);
347 4 * momentCentered.
get(1, 1) *
349 vpMatrix LI1 = 2 * (momentCentered.
get(2, 0) - momentCentered.
get(0, 2)) *
351 8 * momentCentered.
get(1, 1) * featureMomentCentered.
interaction(1, 1);
352 vpMatrix LI2 = 2 * (momentCentered.
get(0, 3) - 3 * momentCentered.
get(2, 1)) *
354 2 * (momentCentered.
get(3, 0) - 3 * momentCentered.
get(1, 2)) *
361 a = momentCentered.
get(2, 0) + momentCentered.
get(0, 2);
364 a = momentObject.
get(0, 0);
370 (momentCInvariant.
getI(2) * LI[1] - momentCInvariant.
getI(1) * LI[2]);
372 (momentCInvariant.
getI(4) * LI[3] - momentCInvariant.
getI(3) * LI[4]);
375 (momentCInvariant.
getI(6) * LI[5] - momentCInvariant.
getI(5) * LI[6]);
378 (momentCInvariant.
getI(6) * LI[7] - momentCInvariant.
getI(7) * LI[6]);
381 (momentCInvariant.
getI(6) * LI[8] - momentCInvariant.
getI(8) * LI[6]);
384 (momentCInvariant.
getI(6) * LI[9] - momentCInvariant.
getI(9) * LI[6]);
387 (momentCInvariant.
getI(10) * LI[11] - momentCInvariant.
getI(11) * LI[10]);
390 (momentCInvariant.
getI(10) * LI[12] - momentCInvariant.
getI(12) * LI[10]);
393 (momentCInvariant.
getI(15) * LI[13] - momentCInvariant.
getI(13) * LI[15]);
396 (momentCInvariant.
getI(15) * LI[14] - momentCInvariant.
getI(14) * LI[15]);
398 interaction_matrices[10] = (Lc2 * c3 + c2 * Lc3 + Ls2 * s3 + s2 * Ls3) * sqrt(a) / I1 * pow(I3, -0.3e1 / 0.2e1) +
399 (c2 * c3 + s2 * s3) * pow(a, -0.1e1 / 0.2e1) / I1 * pow(I3, -0.3e1 / 0.2e1) * La / 0.2e1 -
400 (c2 * c3 + s2 * s3) * sqrt(a) * pow(I1, -0.2e1) * pow(I3, -0.3e1 / 0.2e1) * LI1 -
401 0.3e1 / 0.2e1 * (c2 * c3 + s2 * s3) * sqrt(a) / I1 * pow(I3, -0.5e1 / 0.2e1) * LI3;
403 interaction_matrices[11] = (Ls2 * c3 + s2 * Lc3 - Lc2 * s3 - c2 * Ls3) * sqrt(a) / I1 * pow(I3, -0.3e1 / 0.2e1) +
404 (s2 * c3 - c2 * s3) * pow(a, -0.1e1 / 0.2e1) / I1 * pow(I3, -0.3e1 / 0.2e1) * La / 0.2e1 -
405 (s2 * c3 - c2 * s3) * sqrt(a) * pow(I1, -0.2e1) * pow(I3, -0.3e1 / 0.2e1) * LI1 -
406 0.3e1 / 0.2e1 * (s2 * c3 - c2 * s3) * sqrt(a) / I1 * pow(I3, -0.5e1 / 0.2e1) * LI3;
410 (I2 / (I3 * I3 * I3)) * La + (a / (I3 * I3 * I3)) * LI2 - (3 * a * I2 / (I3 * I3 * I3 * I3)) * LI3;
414 #include <visp3/core/vpMomentCInvariant.h> 415 #include <visp3/core/vpMomentCentered.h> 416 #include <visp3/visual_features/vpFeatureMomentBasic.h> 417 #include <visp3/visual_features/vpFeatureMomentCInvariant.h> 418 #include <visp3/visual_features/vpFeatureMomentCentered.h> 420 #include <visp3/visual_features/vpFeatureMomentDatabase.h> 442 bool found_moment_centered;
443 bool found_moment_cinvariant;
444 bool found_FeatureMoment_centered;
445 bool found_featuremoment_basic;
459 if (!found_featuremoment_basic)
461 if (!found_moment_centered)
463 if (!found_moment_cinvariant)
465 if (!found_FeatureMoment_centered)
469 for (
int i = 0; i < 6; i++)
472 double mu30 = momentCentered.
get(3, 0);
473 double mu30_2 = mu30 * mu30;
474 double mu30_3 = mu30_2 * mu30;
476 double mu03 = momentCentered.
get(0, 3);
477 double mu03_2 = mu03 * mu03;
478 double mu03_3 = mu03 * mu03_2;
480 double mu20 = momentCentered.
get(2, 0);
481 double mu02 = momentCentered.
get(0, 2);
482 double mu50 = momentCentered.
get(5, 0);
483 double mu32 = momentCentered.
get(3, 2);
484 double mu14 = momentCentered.
get(1, 4);
485 double mu05 = momentCentered.
get(0, 5);
486 double mu23 = momentCentered.
get(2, 3);
487 double mu41 = momentCentered.
get(4, 1);
488 double mu40 = momentCentered.
get(4, 0);
489 double mu04 = momentCentered.
get(0, 4);
490 double mu31 = momentCentered.
get(3, 1);
491 double mu13 = momentCentered.
get(1, 3);
492 double mu22 = momentCentered.
get(2, 2);
493 double mu21 = momentCentered.
get(2, 1);
494 double mu12 = momentCentered.
get(1, 2);
495 double mu11 = momentCentered.
get(1, 1);
497 double mu12_2 = mu12 * mu12;
498 double mu21_2 = mu21 * mu21;
499 double mu21_3 = mu21 * mu21_2;
500 double mu12_3 = mu12_2 * mu12;
521 LI[1] = -Lmu20 * mu02 - mu20 * Lmu02 + 2 * mu11 * Lmu11;
523 LI[2] = (-2 * mu20 + 2 * mu02) * Lmu02 + 8 * mu11 * Lmu11 + (2 * mu20 - 2 * mu02) * Lmu20;
525 LI[3] = (-6 * mu21 + 2 * mu03) * Lmu03 + (-6 * mu30 + 18 * mu12) * Lmu12 + (18 * mu21 - 6 * mu03) * Lmu21 +
526 (2 * mu30 - 6 * mu12) * Lmu30;
528 LI[4] = (2 * mu21 + 2 * mu03) * Lmu03 + (2 * mu30 + 2 * mu12) * Lmu12 + (2 * mu21 + 2 * mu03) * Lmu21 +
529 (2 * mu30 + 2 * mu12) * Lmu30;
531 LI[5] = (-2 * mu30_2 * mu03 + 6 * mu30 * mu21 * mu12 - 4 * mu21_3) * Lmu03 +
532 (6 * mu30 * mu21 * mu03 - 12 * mu30 * mu12_2 + 6 * mu21_2 * mu12) * Lmu12 +
533 (6 * mu30 * mu12 * mu03 - 12 * mu21_2 * mu03 + 6 * mu21 * mu12_2) * Lmu21 +
534 (-2 * mu30 * mu03_2 - 4 * mu12_3 + 6 * mu21 * mu12 * mu03) * Lmu30;
536 LI[6] = (-6 * mu30 * mu21 * mu12 - 6 * mu21 * mu12_2 + 6 * mu21_2 * mu03 + 2 * mu21_3 + 4 * mu30_2 * mu03) * Lmu03 +
537 (-6 * mu30 * mu21_2 - 6 * mu30 * mu21 * mu03 + 12 * mu12_3 + 6 * mu30_2 * mu12 - 12 * mu21 * mu12 * mu03 +
540 (6 * mu21 * mu03_2 + 6 * mu21_2 * mu03 - 6 * mu30 * mu12 * mu03 + 12 * mu21_3 - 12 * mu30 * mu21 * mu12 -
543 (6 * mu30 * mu12_2 + 2 * mu12_3 + 4 * mu30 * mu03_2 - 6 * mu21_2 * mu12 - 6 * mu21 * mu12 * mu03) * Lmu30;
545 LI[7] = (-6 * mu21_2 * mu12 + 3 * mu30 * mu03_2 - mu30_3 - 3 * mu30 * mu21_2 - 6 * mu21 * mu12 * mu03 +
546 3 * mu30 * mu12_2 + 2 * mu12_3) *
548 (-3 * mu21 * mu03_2 + 12 * mu30 * mu21 * mu12 + 6 * mu30 * mu12 * mu03 + 3 * mu30_2 * mu21 +
549 9 * mu21 * mu12_2 - 6 * mu21_2 * mu03 - 3 * mu21_3 + 6 * mu12_2 * mu03) *
551 (3 * mu30_2 * mu12 - 9 * mu21_2 * mu12 - 12 * mu21 * mu12 * mu03 - 6 * mu30 * mu21 * mu03 -
552 6 * mu30 * mu21_2 + 6 * mu30 * mu12_2 + 3 * mu12_3 - 3 * mu12 * mu03_2) *
554 (6 * mu21 * mu12_2 + 6 * mu30 * mu21 * mu12 - 3 * mu30_2 * mu03 + 3 * mu12_2 * mu03 - 3 * mu21_2 * mu03 -
555 2 * mu21_3 + mu03_3) *
558 LI[8] = (6 * mu21_3 - 2 * mu30 * mu12 * mu03 + 2 * mu12_2 * mu03 + 3 * mu21 * mu12_2 - 6 * mu30 * mu21 * mu12 -
559 mu30_2 * mu21 - 4 * mu21_2 * mu03 - 3 * mu21 * mu03_2) *
561 (2 * mu12 * mu03_2 - 4 * mu30_2 * mu12 + 9 * mu30 * mu12_2 - mu30 * mu03_2 - 6 * mu30 * mu21 * mu03 +
562 3 * mu30 * mu21_2 + 6 * mu21 * mu12 * mu03 - mu30_3) *
564 (18 * mu21_2 * mu03 + 6 * mu30 * mu21 * mu12 - 4 * mu21 * mu03_2 - mu03_3 - mu30_2 * mu03 -
565 6 * mu30 * mu12 * mu03 + 3 * mu12_2 * mu03 + 2 * mu30_2 * mu21) *
567 (-6 * mu21 * mu12 * mu03 - 4 * mu30 * mu12_2 - 2 * mu30 * mu21 * mu03 + 2 * mu30 * mu21_2 + 3 * mu12_3 +
568 3 * mu21_2 * mu12 - 3 * mu30_2 * mu12 - mu12 * mu03_2) *
571 LI[9] = (2 * (2 * mu03 + 3 * mu21)) * (3 * mu03 * mu21 + 3 * mu30 * mu12 + mu30_2 + mu03_2) * Lmu03 +
572 6 * mu30 * (3 * mu03 * mu21 + 3 * mu30 * mu12 + mu30_2 + mu03_2) * Lmu12 +
573 6 * mu03 * (3 * mu03 * mu21 + 3 * mu30 * mu12 + mu30_2 + mu03_2) * Lmu21 +
574 (2 * (2 * mu30 + 3 * mu12)) * (3 * mu03 * mu21 + 3 * mu30 * mu12 + mu30_2 + mu03_2) * Lmu30;
576 LI[10] = Lmu40 * mu04 + mu40 * Lmu04 - 4 * Lmu31 * mu13 - 4 * mu31 * Lmu13 + 6 * mu22 * Lmu22;
578 LI[11] = (-2 * mu40 - 3 * mu22) * Lmu04 + (2 * mu31 + 6 * mu13) * Lmu13 + (-3 * mu04 - 3 * mu40) * Lmu22 +
579 (2 * mu13 + 6 * mu31) * Lmu31 + (-3 * mu22 - 2 * mu04) * Lmu40;
581 LI[12] = (2 * mu40 + 12 * mu22 + 6 * mu04) * Lmu04 + 16 * mu31 * Lmu13 + (12 * mu40 + 12 * mu04) * Lmu22 +
582 16 * Lmu31 * mu13 + (6 * mu40 + 12 * mu22 + 2 * mu04) * Lmu40;
584 LI[13] = (2 * mu05 + 4 * mu23 + 2 * mu41) * Lmu05 + (2 * mu50 + 4 * mu32 + 2 * mu14) * Lmu14 +
585 (4 * mu05 + 8 * mu23 + 4 * mu41) * Lmu23 + (4 * mu50 + 8 * mu32 + 4 * mu14) * Lmu32 +
586 (2 * mu05 + 4 * mu23 + 2 * mu41) * Lmu41 + (2 * mu50 + 4 * mu32 + 2 * mu14) * Lmu50;
588 LI[14] = (2 * mu05 - 4 * mu23 - 6 * mu41) * Lmu05 + (-6 * mu50 + 12 * mu32 + 18 * mu14) * Lmu14 +
589 (-4 * mu05 + 8 * mu23 + 12 * mu41) * Lmu23 + (-4 * mu50 + 8 * mu32 + 12 * mu14) * Lmu32 +
590 (-6 * mu05 + 12 * mu23 + 18 * mu41) * Lmu41 + (2 * mu50 - 4 * mu32 - 6 * mu14) * Lmu50;
592 LI[15] = (2 * mu05 - 20 * mu23 + 10 * mu41) * Lmu05 + (10 * mu50 - 100 * mu32 + 50 * mu14) * Lmu14 +
593 (-20 * mu05 + 200 * mu23 - 100 * mu41) * Lmu23 + (-20 * mu50 + 200 * mu32 - 100 * mu14) * Lmu32 +
594 (10 * mu05 - 100 * mu23 + 50 * mu41) * Lmu41 + (2 * mu50 - 20 * mu32 + 10 * mu14) * Lmu50;
596 double s3 = momentCInvariant.
getS(3);
597 double s2 = momentCInvariant.
getS(2);
598 double c3 = momentCInvariant.
getC(3);
599 double c2 = momentCInvariant.
getC(2);
601 double I1 = momentCInvariant.
getII(1);
602 double I2 = momentCInvariant.
getII(2);
603 double I3 = momentCInvariant.
getII(3);
605 vpMatrix Lmu20__Lmu02 = Lmu20 - Lmu02;
606 double mu20__mu02 = mu20 - mu02;
609 vpMatrix Lc3 = 2 * (mu20__mu02) * (Lmu20__Lmu02)-8. * mu11 * Lmu11;
610 vpMatrix Ls3 = 4 * Lmu11 * (mu20__mu02) + 4 * mu11 * (Lmu20__Lmu02);
611 vpMatrix LI1 = 2 * (mu20__mu02) * (Lmu20__Lmu02) + 8 * mu11 * Lmu11;
612 vpMatrix LI2 = 2 * (mu03 - 3 * mu21) * (Lc2) + 2 * (mu30 - 3 * mu12) * (Ls2);
618 a = momentCentered.
get(2, 0) + momentCentered.
get(0, 2);
621 a = momentObject.
get(0, 0);
633 (momentCInvariant.
getI(2) * LI[1] - momentCInvariant.
getI(1) * LI[2]);
636 (momentCInvariant.
getI(4) * LI[3] - momentCInvariant.
getI(3) * LI[4]);
639 (momentCInvariant.
getI(6) * LI[5] - momentCInvariant.
getI(5) * LI[6]);
642 (momentCInvariant.
getI(6) * LI[7] - momentCInvariant.
getI(7) * LI[6]);
645 (momentCInvariant.
getI(6) * LI[8] - momentCInvariant.
getI(8) * LI[6]);
648 (momentCInvariant.
getI(6) * LI[9] - momentCInvariant.
getI(9) * LI[6]);
651 (momentCInvariant.
getI(10) * LI[11] - momentCInvariant.
getI(11) * LI[10]);
654 (momentCInvariant.
getI(10) * LI[12] - momentCInvariant.
getI(12) * LI[10]);
657 (momentCInvariant.
getI(15) * LI[13] - momentCInvariant.
getI(13) * LI[15]);
660 (momentCInvariant.
getI(15) * LI[14] - momentCInvariant.
getI(14) * LI[15]);
662 interaction_matrices[10] = (Lc2 * c3 + c2 * Lc3 + Ls2 * s3 + s2 * Ls3) * sqrt(a) / I1 * pow(I3, -0.3e1 / 0.2e1) +
663 (c2 * c3 + s2 * s3) * pow(a, -0.1e1 / 0.2e1) / I1 * pow(I3, -0.3e1 / 0.2e1) * La / 0.2e1 -
664 (c2 * c3 + s2 * s3) * sqrt(a) * pow(I1, -0.2e1) * pow(I3, -0.3e1 / 0.2e1) * LI1 -
665 0.3e1 / 0.2e1 * (c2 * c3 + s2 * s3) * sqrt(a) / I1 * pow(I3, -0.5e1 / 0.2e1) * LI3;
667 interaction_matrices[11] = (Ls2 * c3 + s2 * Lc3 - Lc2 * s3 - c2 * Ls3) * sqrt(a) / I1 * pow(I3, -0.3e1 / 0.2e1) +
668 (s2 * c3 - c2 * s3) * pow(a, -0.1e1 / 0.2e1) / I1 * pow(I3, -0.3e1 / 0.2e1) * La / 0.2e1 -
669 (s2 * c3 - c2 * s3) * sqrt(a) * pow(I1, -0.2e1) * pow(I3, -0.3e1 / 0.2e1) * LI1 -
670 0.3e1 / 0.2e1 * (s2 * c3 - c2 * s3) * sqrt(a) / I1 * pow(I3, -0.5e1 / 0.2e1) * LI3;
675 (I2 / (I3 * I3 * I3)) * La + (a / (I3 * I3 * I3)) * LI2 - (3 * a * I2 / (I3 * I3 * I3 * I3)) * LI3;
691 for (
unsigned int i = 1; i < 15; ++i) {
692 os <<
"LI[" << i <<
"] = ";
693 LI[i].matlabPrint(os);
705 for (
unsigned int i = 0; i < 10; ++i) {
706 os <<
"L_c[" << i <<
"] = ";
Functionality computation for basic moment feature. Computes the interaction matrix associated with v...
Implementation of a matrix and operations on matrices.
double get(unsigned int i, unsigned int j) const
double getI(unsigned int index) const
Functionality computation for centered moment feature. Computes the interaction matrix associated wit...
const vpMoment & get(const char *type, bool &found) const
error that can be emited by ViSP classes.
Class for generic objects.
std::vector< vpMatrix > interaction_matrices
const vpMomentObject & getObject() const
void printLsofInvariants(std::ostream &os) const
vpMomentDatabase & moments
double getII(unsigned int i) const
const std::vector< double > & get() const
This class defines the double-indexed centered moment descriptor .
vpObjectType getType() const
double getC(unsigned int i) const
vpFeatureMomentDatabase * featureMomentsDataBase
Functionality computation for 2D rotation/translation/scale non-symmetric invariant moment feature...
vpMatrix interaction(unsigned int select_one, unsigned int select_two) const
void compute_interaction()
vpMatrix interaction(unsigned int select_one, unsigned int select_two) const
friend VISP_EXPORT std::ostream & operator<<(std::ostream &os, const vpFeatureMomentCInvariant &featcinv)
vpFeatureMoment & get(const char *type, bool &found)
double getS(unsigned int i) const