37 #include <visp3/core/vpMomentObject.h>
38 #ifdef VISP_MOMENTS_COMBINE_MATRICES
39 #include <visp3/visual_features/vpFeatureMomentCInvariant.h>
40 #include <visp3/core/vpMomentCentered.h>
41 #include <visp3/core/vpMomentCInvariant.h>
42 #include <visp3/visual_features/vpFeatureMomentCentered.h>
43 #include <visp3/visual_features/vpFeatureMomentBasic.h>
45 #include <visp3/visual_features/vpFeatureMomentDatabase.h>
61 std::vector<vpMatrix> LI(16);
62 bool found_moment_centered;
63 bool found_moment_cinvariant;
64 bool found_FeatureMoment_centered;
65 bool found_featuremoment_basic;
82 for(
int i=0;i<6;i++) zeros[0][i]=0;
85 LI[1]=-featureMomentCentered.
interaction(2, 0) * momentCentered.
get(0, 2) - momentCentered.
get(2, 0) * featureMomentCentered.
interaction(0, 2) + 2 * momentCentered.
get(1, 1) * featureMomentCentered.
interaction(1, 1);
88 LI[2]=2 * (momentCentered.
get(2, 0) - momentCentered.
get(0, 2)) * (featureMomentCentered.
interaction(2, 0) - featureMomentCentered.
interaction(0, 2)) + 8 * momentCentered.
get(1, 1) * featureMomentCentered.
interaction(1, 1);
91 LI[3]=2 * (momentCentered.
get(3, 0) - 3 * momentCentered.
get(1, 2)) * (featureMomentCentered.
interaction(3, 0) - 3 * featureMomentCentered.
interaction(1, 2)) + 2 * (3 * momentCentered.
get(2, 1) - momentCentered.
get(0, 3)) * (3 * featureMomentCentered.
interaction(2, 1) - featureMomentCentered.
interaction(0, 3));
94 LI[4]=2 * (momentCentered.
get(3, 0) + momentCentered.
get(1, 2)) * (featureMomentCentered.
interaction(3, 0) + featureMomentCentered.
interaction(1, 2)) + 2 * (momentCentered.
get(2, 1) + momentCentered.
get(0, 3)) * (featureMomentCentered.
interaction(2, 1) + featureMomentCentered.
interaction(0, 3));
96 LI[5]=-2*pow(momentCentered.
get(0,3),2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(3,0)+6*momentCentered.
get(0,3)*momentCentered.
get(1,2)*momentCentered.
get(2,1)*featureMomentCentered.
interaction(3,0)-4*pow(momentCentered.
get(1,2),3)*featureMomentCentered.
interaction(3,0)+6*momentCentered.
get(0,3)*momentCentered.
get(1,2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(2,1)-12*momentCentered.
get(0,3)*pow(momentCentered.
get(2,1),2)*featureMomentCentered.
interaction(2,1)+6*pow(momentCentered.
get(1,2),2)*momentCentered.
get(2,1)*featureMomentCentered.
interaction(2,1)+6*momentCentered.
get(0,3)*momentCentered.
get(2,1)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(1,2)-12*pow(momentCentered.
get(1,2),2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(1,2)+6*momentCentered.
get(1,2)*pow(momentCentered.
get(2,1),2)*featureMomentCentered.
interaction(1,2)-2*momentCentered.
get(0,3)*pow(momentCentered.
get(3,0),2)*featureMomentCentered.
interaction(0,3)+6*momentCentered.
get(1,2)*momentCentered.
get(2,1)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(0,3)-4*pow(momentCentered.
get(2,1),3)*featureMomentCentered.
interaction(0,3);
99 LI[6]=6*pow(momentCentered.
get(1,2),2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(3,0)+4*pow(momentCentered.
get(0,3),2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(3,0)-6*momentCentered.
get(1,2)*pow(momentCentered.
get(2,1),2)*featureMomentCentered.
interaction(3,0)-6*momentCentered.
get(0,3)*momentCentered.
get(1,2)*momentCentered.
get(2,1)*featureMomentCentered.
interaction(3,0)+2*pow(momentCentered.
get(1,2),3)*featureMomentCentered.
interaction(3,0)-12*momentCentered.
get(1,2)*momentCentered.
get(2,1)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(2,1)-6*momentCentered.
get(0,3)*momentCentered.
get(1,2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(2,1)+12*pow(momentCentered.
get(2,1),3)*featureMomentCentered.
interaction(2,1)+6*momentCentered.
get(0,3)*pow(momentCentered.
get(2,1),2)*featureMomentCentered.
interaction(2,1)+6*pow(momentCentered.
get(0,3),2)*momentCentered.
get(2,1)*featureMomentCentered.
interaction(2,1)-6*momentCentered.
get(0,3)*pow(momentCentered.
get(1,2),2)*featureMomentCentered.
interaction(2,1)+6*momentCentered.
get(1,2)*pow(momentCentered.
get(3,0),2)*featureMomentCentered.
interaction(1,2)-6*pow(momentCentered.
get(2,1),2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(1,2)-6*momentCentered.
get(0,3)*momentCentered.
get(2,1)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(1,2)+6*pow(momentCentered.
get(1,2),2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(1,2)-12*momentCentered.
get(0,3)*momentCentered.
get(1,2)*momentCentered.
get(2,1)*featureMomentCentered.
interaction(1,2)+12*pow(momentCentered.
get(1,2),3)*featureMomentCentered.
interaction(1,2)+4*momentCentered.
get(0,3)*pow(momentCentered.
get(3,0),2)*featureMomentCentered.
interaction(0,3)-6*momentCentered.
get(1,2)*momentCentered.
get(2,1)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(0,3)+2*pow(momentCentered.
get(2,1),3)*featureMomentCentered.
interaction(0,3)+6*momentCentered.
get(0,3)*pow(momentCentered.
get(2,1),2)*featureMomentCentered.
interaction(0,3)-6*pow(momentCentered.
get(1,2),2)*momentCentered.
get(2,1)*featureMomentCentered.
interaction(0,3);
102 LI[7] = -3*momentCentered.
get(0,3)*pow(momentCentered.
get(3,0),2)*featureMomentCentered.
interaction(3,0)+6*momentCentered.
get(1,2)*momentCentered.
get(2,1)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(3,0)-2*pow(momentCentered.
get(2,1),3)*featureMomentCentered.
interaction(3,0)-3*momentCentered.
get(0,3)*pow(momentCentered.
get(2,1),2)*featureMomentCentered.
interaction(3,0)+6*pow(momentCentered.
get(1,2),2)*momentCentered.
get(2,1)*featureMomentCentered.
interaction(3,0)+3*momentCentered.
get(0,3)*pow(momentCentered.
get(1,2),2)*featureMomentCentered.
interaction(3,0)+pow(momentCentered.
get(0,3),3)*featureMomentCentered.
interaction(3,0)+3*momentCentered.
get(1,2)*pow(momentCentered.
get(3,0),2)*featureMomentCentered.
interaction(2,1)-6*pow(momentCentered.
get(2,1),2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(2,1)-6*momentCentered.
get(0,3)*momentCentered.
get(2,1)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(2,1)+6*pow(momentCentered.
get(1,2),2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(2,1)-9*momentCentered.
get(1,2)*pow(momentCentered.
get(2,1),2)*featureMomentCentered.
interaction(2,1)-12*momentCentered.
get(0,3)*momentCentered.
get(1,2)*momentCentered.
get(2,1)*featureMomentCentered.
interaction(2,1)+3*pow(momentCentered.
get(1,2),3)*featureMomentCentered.
interaction(2,1)-3*pow(momentCentered.
get(0,3),2)*momentCentered.
get(1,2)*featureMomentCentered.
interaction(2,1)+3*momentCentered.
get(2,1)*pow(momentCentered.
get(3,0),2)*featureMomentCentered.
interaction(1,2)+12*momentCentered.
get(1,2)*momentCentered.
get(2,1)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(1,2)+6*momentCentered.
get(0,3)*momentCentered.
get(1,2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(1,2)-3*pow(momentCentered.
get(2,1),3)*featureMomentCentered.
interaction(1,2)-6*momentCentered.
get(0,3)*pow(momentCentered.
get(2,1),2)*featureMomentCentered.
interaction(1,2)+9*pow(momentCentered.
get(1,2),2)*momentCentered.
get(2,1)*featureMomentCentered.
interaction(1,2)-3*pow(momentCentered.
get(0,3),2)*momentCentered.
get(2,1)*featureMomentCentered.
interaction(1,2)+6*momentCentered.
get(0,3)*pow(momentCentered.
get(1,2),2)*featureMomentCentered.
interaction(1,2)-pow(momentCentered.
get(3,0),3)*featureMomentCentered.
interaction(0,3)-3*pow(momentCentered.
get(2,1),2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(0,3)+3*pow(momentCentered.
get(1,2),2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(0,3)+3*pow(momentCentered.
get(0,3),2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(0,3)-6*momentCentered.
get(1,2)*pow(momentCentered.
get(2,1),2)*featureMomentCentered.
interaction(0,3)-6*momentCentered.
get(0,3)*momentCentered.
get(1,2)*momentCentered.
get(2,1)*featureMomentCentered.
interaction(0,3)+2*pow(momentCentered.
get(1,2),3)*featureMomentCentered.
interaction(0,3);
104 LI[8]=-2 * momentCentered.
get(3, 0) * momentCentered.
get(2, 1) * momentCentered.
get(0, 3) * featureMomentCentered.
interaction(3, 0) + 6 * momentCentered.
get(3, 0) * momentCentered.
get(2, 1) * momentCentered.
get(1, 2) * featureMomentCentered.
interaction(2, 1) - 6 * featureMomentCentered.
interaction(3, 0) * momentCentered.
get(2, 1) * momentCentered.
get(0, 3) * momentCentered.
get(1, 2) - 6 * momentCentered.
get(3, 0) * featureMomentCentered.
interaction(2, 1) * momentCentered.
get(0, 3) * momentCentered.
get(1, 2) - 6 * momentCentered.
get(3, 0) * momentCentered.
get(2, 1) * featureMomentCentered.
interaction(0, 3) * momentCentered.
get(1, 2) - 6 * momentCentered.
get(3, 0) * momentCentered.
get(2, 1) * momentCentered.
get(0, 3) * featureMomentCentered.
interaction(1, 2) - 2 * momentCentered.
get(3, 0) * momentCentered.
get(1, 2) * momentCentered.
get(0, 3) * featureMomentCentered.
interaction(0, 3) + 6 * momentCentered.
get(2, 1) * momentCentered.
get(1, 2) * momentCentered.
get(0, 3) * featureMomentCentered.
interaction(1, 2) - pow((
double) momentCentered.
get(3, 0), (double) 3) * featureMomentCentered.
interaction(1, 2) + 3 * featureMomentCentered.
interaction(3, 0) * pow((
double) momentCentered.
get(1, 2), (double) 3) + 6 * pow((
double) momentCentered.
get(2, 1), (double) 3) * featureMomentCentered.
interaction(0, 3) - featureMomentCentered.
interaction(2, 1) * pow((
double) momentCentered.
get(0, 3), (double) 3) + 3 * featureMomentCentered.
interaction(2, 1) * pow((
double) momentCentered.
get(1, 2), (double) 2) * momentCentered.
get(0, 3) + 18 * pow((
double) momentCentered.
get(2, 1), (double) 2) * momentCentered.
get(0, 3) * featureMomentCentered.
interaction(2, 1) - pow((
double) momentCentered.
get(3, 0), (double) 2) * featureMomentCentered.
interaction(2, 1) * momentCentered.
get(0, 3) + 9 * momentCentered.
get(3, 0) * pow((
double) momentCentered.
get(1, 2), (double) 2) * featureMomentCentered.
interaction(1, 2) - 4 * pow((
double) momentCentered.
get(3, 0), (double) 2) * momentCentered.
get(1, 2) * featureMomentCentered.
interaction(1, 2) + 2 * pow((
double) momentCentered.
get(1, 2), (double) 2) * momentCentered.
get(0, 3) * featureMomentCentered.
interaction(0, 3) - 4 * momentCentered.
get(3, 0) * pow((
double) momentCentered.
get(1, 2), (double) 2) * featureMomentCentered.
interaction(3, 0) + 2 * momentCentered.
get(1, 2) * pow((
double) momentCentered.
get(0, 3), (double) 2) * featureMomentCentered.
interaction(1, 2) - 4 * momentCentered.
get(2, 1) * pow((
double) momentCentered.
get(0, 3), (double) 2) * featureMomentCentered.
interaction(2, 1) + 3 * momentCentered.
get(3, 0) * pow((
double) momentCentered.
get(2, 1), (double) 2) * featureMomentCentered.
interaction(1, 2) - 3 * pow((
double) momentCentered.
get(3, 0), (double) 2) * momentCentered.
get(1, 2) * featureMomentCentered.
interaction(3, 0) - momentCentered.
get(3, 0) * featureMomentCentered.
interaction(1, 2) * pow((
double) momentCentered.
get(0, 3), (double) 2) - 4 * pow((
double) momentCentered.
get(2, 1), (double) 2) * momentCentered.
get(0, 3) * featureMomentCentered.
interaction(0, 3) - 3 * momentCentered.
get(2, 1) * pow((
double) momentCentered.
get(0, 3), (double) 2) * featureMomentCentered.
interaction(0, 3) + 2 * momentCentered.
get(3, 0) * pow((
double) momentCentered.
get(2, 1), (double) 2) * featureMomentCentered.
interaction(3, 0) + 2 * pow((
double) momentCentered.
get(3, 0), (double) 2) * momentCentered.
get(2, 1) * featureMomentCentered.
interaction(2, 1) + 3 * featureMomentCentered.
interaction(3, 0) * pow((
double) momentCentered.
get(2, 1), (double) 2) * momentCentered.
get(1, 2) - pow((
double) momentCentered.
get(3, 0), (double) 2) * momentCentered.
get(2, 1) * featureMomentCentered.
interaction(0, 3) + 3 * momentCentered.
get(2, 1) * pow((
double) momentCentered.
get(1, 2), (double) 2) * featureMomentCentered.
interaction(0, 3) - featureMomentCentered.
interaction(3, 0) * momentCentered.
get(1, 2) * pow((
double) momentCentered.
get(0, 3), (double) 2);
106 LI[9] = 4*pow(momentCentered.
get(3,0),3)*featureMomentCentered.
interaction(3,0)+18*momentCentered.
get(1,2)*pow(momentCentered.
get(3,0),2)*featureMomentCentered.
interaction(3,0)+12*momentCentered.
get(0,3)*momentCentered.
get(2,1)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(3,0)+18*pow(momentCentered.
get(1,2),2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(3,0)+4*pow(momentCentered.
get(0,3),2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(3,0)+18*momentCentered.
get(0,3)*momentCentered.
get(1,2)*momentCentered.
get(2,1)*featureMomentCentered.
interaction(3,0)+6*pow(momentCentered.
get(0,3),2)*momentCentered.
get(1,2)*featureMomentCentered.
interaction(3,0)+6*momentCentered.
get(0,3)*pow(momentCentered.
get(3,0),2)*featureMomentCentered.
interaction(2,1)+18*momentCentered.
get(0,3)*momentCentered.
get(1,2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(2,1)+18*pow(momentCentered.
get(0,3),2)*momentCentered.
get(2,1)*featureMomentCentered.
interaction(2,1)+6*pow(momentCentered.
get(0,3),3)*featureMomentCentered.
interaction(2,1)+6*pow(momentCentered.
get(3,0),3)*featureMomentCentered.
interaction(1,2)+18*momentCentered.
get(1,2)*pow(momentCentered.
get(3,0),2)*featureMomentCentered.
interaction(1,2)+18*momentCentered.
get(0,3)*momentCentered.
get(2,1)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(1,2)+6*pow(momentCentered.
get(0,3),2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(1,2)+6*momentCentered.
get(2,1)*pow(momentCentered.
get(3,0),2)*featureMomentCentered.
interaction(0,3)+4*momentCentered.
get(0,3)*pow(momentCentered.
get(3,0),2)*featureMomentCentered.
interaction(0,3)+18*momentCentered.
get(1,2)*momentCentered.
get(2,1)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(0,3)+12*momentCentered.
get(0,3)*momentCentered.
get(1,2)*momentCentered.
get(3,0)*featureMomentCentered.
interaction(0,3)+18*momentCentered.
get(0,3)*pow(momentCentered.
get(2,1),2)*featureMomentCentered.
interaction(0,3)+18*pow(momentCentered.
get(0,3),2)*momentCentered.
get(2,1)*featureMomentCentered.
interaction(0,3)+4*pow(momentCentered.
get(0,3),3)*featureMomentCentered.
interaction(0,3);
109 LI[10]=featureMomentCentered.
interaction(4, 0) * momentCentered.
get(0, 4) + momentCentered.
get(4, 0) * featureMomentCentered.
interaction(0, 4) - 4 * featureMomentCentered.
interaction(3, 1) * momentCentered.
get(1, 3) - 4 * momentCentered.
get(3, 1) * featureMomentCentered.
interaction(1, 3) + 6 * momentCentered.
get(2, 2) * featureMomentCentered.
interaction(2, 2);
111 LI[11]=-3 * featureMomentCentered.
interaction(4, 0) * momentCentered.
get(2, 2) - 3 * momentCentered.
get(4, 0) * featureMomentCentered.
interaction(2, 2) - 2 * featureMomentCentered.
interaction(4, 0) * momentCentered.
get(0, 4) - 2 * momentCentered.
get(4, 0) * featureMomentCentered.
interaction(0, 4) + 6 * momentCentered.
get(3, 1) * featureMomentCentered.
interaction(3, 1) + 2 * featureMomentCentered.
interaction(3, 1) * momentCentered.
get(1, 3) + 2 * momentCentered.
get(3, 1) * featureMomentCentered.
interaction(1, 3) - 3 * featureMomentCentered.
interaction(2, 2) * momentCentered.
get(0, 4) - 3 * momentCentered.
get(2, 2) * featureMomentCentered.
interaction(0, 4) + 6 * momentCentered.
get(1, 3) * featureMomentCentered.
interaction(1, 3);
114 LI[12]=6 * momentCentered.
get(4, 0) * featureMomentCentered.
interaction(4, 0) + 12 * featureMomentCentered.
interaction(4, 0) * momentCentered.
get(2, 2) + 12 * momentCentered.
get(4, 0) * featureMomentCentered.
interaction(2, 2) + 2 * featureMomentCentered.
interaction(4, 0) * momentCentered.
get(0, 4) + 2 * momentCentered.
get(4, 0) * featureMomentCentered.
interaction(0, 4) + 16 * featureMomentCentered.
interaction(3, 1) * momentCentered.
get(1, 3) + 16 * momentCentered.
get(3, 1) * featureMomentCentered.
interaction(1, 3) + 12 * featureMomentCentered.
interaction(2, 2) * momentCentered.
get(0, 4) + 12 * momentCentered.
get(2, 2) * featureMomentCentered.
interaction(0, 4) + 6 * momentCentered.
get(0, 4) * featureMomentCentered.
interaction(0, 4);
117 LI[13]=2 * (momentCentered.
get(5, 0) + 2 * momentCentered.
get(3, 2) + momentCentered.
get(1, 4)) * (featureMomentCentered.
interaction(5, 0) + 2 * featureMomentCentered.
interaction(3, 2) + featureMomentCentered.
interaction(1, 4)) + 2 * (momentCentered.
get(0, 5) + 2 * momentCentered.
get(2, 3) + momentCentered.
get(4, 1)) * (featureMomentCentered.
interaction(0, 5) + 2 * featureMomentCentered.
interaction(2, 3) + featureMomentCentered.
interaction(4, 1));
119 LI[14]=2 * (momentCentered.
get(5, 0) - 2 * momentCentered.
get(3, 2) - 3 * momentCentered.
get(1, 4)) * (featureMomentCentered.
interaction(5, 0) - 2 * featureMomentCentered.
interaction(3, 2) - 3 * featureMomentCentered.
interaction(1, 4)) + 2 * (momentCentered.
get(0, 5) - 2 * momentCentered.
get(2, 3) - 3 * momentCentered.
get(4, 1)) * (featureMomentCentered.
interaction(0, 5) - 2 * featureMomentCentered.
interaction(2, 3) - 3 * featureMomentCentered.
interaction(4, 1));
121 LI[15]=2 * (momentCentered.
get(5, 0) - 10 * momentCentered.
get(3, 2) + 5 * momentCentered.
get(1, 4)) * (featureMomentCentered.
interaction(5, 0) - 10 * featureMomentCentered.
interaction(3, 2) + 5 * featureMomentCentered.
interaction(1, 4)) + 2 * (momentCentered.
get(0, 5) - 10 * momentCentered.
get(2, 3) + 5 * momentCentered.
get(4, 1)) * (featureMomentCentered.
interaction(0, 5) - 10 * featureMomentCentered.
interaction(2, 3) + 5 * featureMomentCentered.
interaction(4, 1));
123 double s3 = momentCInvariant.
getS(3);
124 double s2 = momentCInvariant.
getS(2);
125 double c3 = momentCInvariant.
getC(3);
126 double c2 = momentCInvariant.
getC(2);
127 double I1 = momentCInvariant.
getII(1);
128 double I2 = momentCInvariant.
getII(2);
129 double I3 = momentCInvariant.
getII(3);
143 a = momentCentered.
get(2,0)+momentCentered.
get(0,2);
146 a = momentObject.
get(0,0);
173 interaction_matrices[10] = (Lc2 * c3 + c2 * Lc3 + Ls2 * s3 + s2 * Ls3) * sqrt(a) / I1 * pow(I3, -0.3e1 / 0.2e1) + (c2 * c3 + s2 * s3) * pow(a, -0.1e1 / 0.2e1) / I1 * pow(I3, -0.3e1 / 0.2e1) * La / 0.2e1 - (c2 * c3 + s2 * s3) * sqrt(a) * pow(I1, -0.2e1) * pow(I3, -0.3e1 / 0.2e1) * LI1 - 0.3e1 / 0.2e1 * (c2 * c3 + s2 * s3) * sqrt(a) / I1 * pow(I3, -0.5e1 / 0.2e1) * LI3;
175 interaction_matrices[11] = (Ls2 * c3 + s2 * Lc3 - Lc2 * s3 - c2 * Ls3) * sqrt(a) / I1 * pow(I3, -0.3e1 / 0.2e1) + (s2 * c3 - c2 * s3) * pow(a, -0.1e1 / 0.2e1) / I1 * pow(I3, -0.3e1 / 0.2e1) * La / 0.2e1 - (s2 * c3 - c2 * s3) * sqrt(a) * pow(I1, -0.2e1) * pow(I3, -0.3e1 / 0.2e1) * LI1 - 0.3e1 / 0.2e1 * (s2 * c3 - c2 * s3) * sqrt(a) / I1 * pow(I3, -0.5e1 / 0.2e1) * LI3;
182 #include <visp3/visual_features/vpFeatureMomentCInvariant.h>
183 #include <visp3/core/vpMomentCentered.h>
184 #include <visp3/core/vpMomentCInvariant.h>
185 #include <visp3/visual_features/vpFeatureMomentCentered.h>
186 #include <visp3/visual_features/vpFeatureMomentBasic.h>
188 #include <visp3/visual_features/vpFeatureMomentDatabase.h>
209 bool found_moment_centered;
210 bool found_moment_cinvariant;
211 bool found_FeatureMoment_centered;
212 bool found_featuremoment_basic;
228 for(
int i=0;i<6;i++) zeros[0][i]=0;
230 double mu30 = momentCentered.
get(3,0);
231 double mu30_2 = mu30*mu30;
232 double mu30_3 = mu30_2*mu30;
234 double mu03 = momentCentered.
get(0,3);
235 double mu03_2 = mu03*mu03;
236 double mu03_3 = mu03*mu03_2;
238 double mu20 = momentCentered.
get(2,0);
239 double mu02 = momentCentered.
get(0,2);
240 double mu50 = momentCentered.
get(5,0);
241 double mu32 = momentCentered.
get(3,2);
242 double mu14 = momentCentered.
get(1,4);
243 double mu05 = momentCentered.
get(0,5);
244 double mu23 = momentCentered.
get(2,3);
245 double mu41 = momentCentered.
get(4,1);
246 double mu40 = momentCentered.
get(4,0);
247 double mu04 = momentCentered.
get(0,4);
248 double mu31 = momentCentered.
get(3,1);
249 double mu13 = momentCentered.
get(1,3);
250 double mu22 = momentCentered.
get(2,2);
251 double mu21 = momentCentered.
get(2,1);
252 double mu12 = momentCentered.
get(1,2);
253 double mu11 = momentCentered.
get(1,1);
255 double mu12_2 = mu12*mu12;
256 double mu21_2 = mu21*mu21;
257 double mu21_3 = mu21*mu21_2;
258 double mu12_3 = mu12_2*mu12;
279 LI[1]= -Lmu20*mu02-mu20*Lmu02+2*mu11*Lmu11;
281 LI[2]= (-2*mu20+2*mu02)*Lmu02+8*mu11*Lmu11+(2*mu20-2*mu02)*Lmu20;
283 LI[3]= (-6*mu21+2*mu03)*Lmu03+(-6*mu30+18*mu12)*Lmu12+(18*mu21-6*mu03)*Lmu21+(2*mu30-6*mu12)*Lmu30;
285 LI[4]= (2*mu21+2*mu03)*Lmu03+(2*mu30+2*mu12)*Lmu12+(2*mu21+2*mu03)*Lmu21+(2*mu30+2*mu12)*Lmu30;
287 LI[5]= (-2*mu30_2*mu03+6*mu30*mu21*mu12-4*mu21_3)*Lmu03+(6*mu30*mu21*mu03-12*mu30*mu12_2+6*mu21_2*mu12)*Lmu12+(6*mu30*mu12*mu03-12*mu21_2*mu03+6*mu21*mu12_2)*Lmu21+(-2*mu30*mu03_2-4*mu12_3+6*mu21*mu12*mu03)*Lmu30;
289 LI[6]= (-6*mu30*mu21*mu12-6*mu21*mu12_2+6*mu21_2*mu03+2*mu21_3+4*mu30_2*mu03)*Lmu03+(-6*mu30*mu21_2-6*mu30*mu21*mu03+12*mu12_3+6*mu30_2*mu12-12*mu21*mu12*mu03+6*mu30*mu12_2)*Lmu12+(6*mu21*mu03_2+6*mu21_2*mu03-6*mu30*mu12*mu03+12*mu21_3-12*mu30*mu21*mu12-6*mu12_2*mu03)*Lmu21+(6*mu30*mu12_2+2*mu12_3+4*mu30*mu03_2-6*mu21_2*mu12-6*mu21*mu12*mu03)*Lmu30;
291 LI[7] = (-6*mu21_2*mu12+3*mu30*mu03_2-mu30_3-3*mu30*mu21_2-6*mu21*mu12*mu03+3*mu30*mu12_2+2*mu12_3)*Lmu03+(-3*mu21*mu03_2+12*mu30*mu21*mu12+6*mu30*mu12*mu03+3*mu30_2*mu21+9*mu21*mu12_2-6*mu21_2*mu03-3*mu21_3+6*mu12_2*mu03)*Lmu12+(3*mu30_2*mu12-9*mu21_2*mu12-12*mu21*mu12*mu03-6*mu30*mu21*mu03-6*mu30*mu21_2+6*mu30*mu12_2+3*mu12_3-3*mu12*mu03_2)*Lmu21+(6*mu21*mu12_2+6*mu30*mu21*mu12-3*mu30_2*mu03+3*mu12_2*mu03-3*mu21_2*mu03-2*mu21_3+mu03_3)*Lmu30;
293 LI[8]= (6*mu21_3-2*mu30*mu12*mu03+2*mu12_2*mu03+3*mu21*mu12_2-6*mu30*mu21*mu12-mu30_2*mu21-4*mu21_2*mu03-3*mu21*mu03_2)*Lmu03+(2*mu12*mu03_2-4*mu30_2*mu12+9*mu30*mu12_2-mu30*mu03_2-6*mu30*mu21*mu03+3*mu30*mu21_2+6*mu21*mu12*mu03-mu30_3)*Lmu12+(18*mu21_2*mu03+6*mu30*mu21*mu12-4*mu21*mu03_2-mu03_3-mu30_2*mu03-6*mu30*mu12*mu03+3*mu12_2*mu03+2*mu30_2*mu21)*Lmu21+(-6*mu21*mu12*mu03-4*mu30*mu12_2-2*mu30*mu21*mu03+2*mu30*mu21_2+3*mu12_3+3*mu21_2*mu12-3*mu30_2*mu12-mu12*mu03_2)*Lmu30;
295 LI[9] = (2*(2*mu03+3*mu21))*(3*mu03*mu21+3*mu30*mu12+mu30_2+mu03_2)*Lmu03+6*mu30*(3*mu03*mu21+3*mu30*mu12+mu30_2+mu03_2)*Lmu12+6*mu03*(3*mu03*mu21+3*mu30*mu12+mu30_2+mu03_2)*Lmu21+(2*(2*mu30+3*mu12))*(3*mu03*mu21+3*mu30*mu12+mu30_2+mu03_2)*Lmu30;
297 LI[10]= Lmu40*mu04+mu40*Lmu04-4*Lmu31*mu13-4*mu31*Lmu13+6*mu22*Lmu22;
299 LI[11]= (-2*mu40-3*mu22)*Lmu04+(2*mu31+6*mu13)*Lmu13+(-3*mu04-3*mu40)*Lmu22+(2*mu13+6*mu31)*Lmu31+(-3*mu22-2*mu04)*Lmu40;
301 LI[12]= (2*mu40+12*mu22+6*mu04)*Lmu04+16*mu31*Lmu13+(12*mu40+12*mu04)*Lmu22+16*Lmu31*mu13+(6*mu40+12*mu22+2*mu04)*Lmu40;
303 LI[13]=(2*mu05+4*mu23+2*mu41)*Lmu05+(2*mu50+4*mu32+2*mu14)*Lmu14+(4*mu05+8*mu23+4*mu41)*Lmu23+(4*mu50+8*mu32+4*mu14)*Lmu32+(2*mu05+4*mu23+2*mu41)*Lmu41+(2*mu50+4*mu32+2*mu14)*Lmu50 ;
305 LI[14]= (2*mu05-4*mu23-6*mu41)*Lmu05+(-6*mu50+12*mu32+18*mu14)*Lmu14+(-4*mu05+8*mu23+12*mu41)*Lmu23+(-4*mu50+8*mu32+12*mu14)*Lmu32+(-6*mu05+12*mu23+18*mu41)*Lmu41+(2*mu50-4*mu32-6*mu14)*Lmu50;
307 LI[15]= (2*mu05-20*mu23+10*mu41)*Lmu05+(10*mu50-100*mu32+50*mu14)*Lmu14+(-20*mu05+200*mu23-100*mu41)*Lmu23+(-20*mu50+200*mu32-100*mu14)*Lmu32+(10*mu05-100*mu23+50*mu41)*Lmu41+(2*mu50-20*mu32+10*mu14)*Lmu50;
309 double s3 = momentCInvariant.
getS(3);
310 double s2 = momentCInvariant.
getS(2);
311 double c3 = momentCInvariant.
getC(3);
312 double c2 = momentCInvariant.
getC(2);
314 double I1 = momentCInvariant.
getII(1);
315 double I2 = momentCInvariant.
getII(2);
316 double I3 = momentCInvariant.
getII(3);
318 vpMatrix Lmu20__Lmu02 = Lmu20 - Lmu02;
319 double mu20__mu02 = mu20 - mu02;
322 vpMatrix Lc3 = 2 * (mu20__mu02) * (Lmu20__Lmu02) - 8. * mu11 * Lmu11;
323 vpMatrix Ls3 = 4 * Lmu11 * (mu20__mu02) + 4 * mu11 * (Lmu20__Lmu02);
324 vpMatrix LI1 = 2 * (mu20__mu02) * (Lmu20__Lmu02) + 8 * mu11 * Lmu11;
325 vpMatrix LI2 = 2 * (mu03 - 3 * mu21) * (Lc2) + 2 * (mu30 - 3 * mu12) * (Ls2);
331 a = momentCentered.
get(2,0)+momentCentered.
get(0,2);
334 a = momentObject.
get(0,0);
365 interaction_matrices[10] = (Lc2 * c3 + c2 * Lc3 + Ls2 * s3 + s2 * Ls3) * sqrt(a) / I1 * pow(I3, -0.3e1 / 0.2e1) + (c2 * c3 + s2 * s3) * pow(a, -0.1e1 / 0.2e1) / I1 * pow(I3, -0.3e1 / 0.2e1) * La / 0.2e1 - (c2 * c3 + s2 * s3) * sqrt(a) * pow(I1, -0.2e1) * pow(I3, -0.3e1 / 0.2e1) * LI1 - 0.3e1 / 0.2e1 * (c2 * c3 + s2 * s3) * sqrt(a) / I1 * pow(I3, -0.5e1 / 0.2e1) * LI3;
367 interaction_matrices[11] = (Ls2 * c3 + s2 * Lc3 - Lc2 * s3 - c2 * Ls3) * sqrt(a) / I1 * pow(I3, -0.3e1 / 0.2e1) + (s2 * c3 - c2 * s3) * pow(a, -0.1e1 / 0.2e1) / I1 * pow(I3, -0.3e1 / 0.2e1) * La / 0.2e1 - (s2 * c3 - c2 * s3) * sqrt(a) * pow(I1, -0.2e1) * pow(I3, -0.3e1 / 0.2e1) * LI1 - 0.3e1 / 0.2e1 * (s2 * c3 - c2 * s3) * sqrt(a) / I1 * pow(I3, -0.5e1 / 0.2e1) * LI3;
386 for (
unsigned int i = 1; i < 15; ++i){
387 os <<
"LI[" << i <<
"] = ";
388 LI[i].matlabPrint(os);
396 for (
unsigned int i = 0; i < 10; ++i){
397 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 getS(unsigned int i) const
Functionality computation for centered moment feature. Computes the interaction matrix associated wit...
error that can be emited by ViSP classes.
Class for generic objects.
const std::vector< double > & get() const
std::vector< vpMatrix > interaction_matrices
vpMatrix interaction(unsigned int select_one, unsigned int select_two) const
vpMatrix interaction(unsigned int select_one, unsigned int select_two) const
double getI(unsigned int index) const
double getC(unsigned int i) const
const vpMoment & get(const char *type, bool &found) const
vpMomentDatabase & moments
This class defines the double-indexed centered moment descriptor .
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
double get(unsigned int i, unsigned int j) const
double getII(unsigned int i) const
vpObjectType getType() const
void printLsofInvariants(std::ostream &os) const
vpFeatureMomentDatabase * featureMomentsDataBase
Functionality computation for 2D rotation/translation/scale non-symmetric invariant moment feature...
void compute_interaction()
const vpMomentObject & getObject() const
vpFeatureMoment & get(const char *type, bool &found)