1) in "ComputeWeightedRigidMatchMatrix" I changed:
std::vector<double> weights ----->to------> std::vector<ScalarType> weights tmp.Trasp(); ----->to------> tmp.Transpose(); QQ.Zero(); ----->to------> QQ.SetZero(); RM.Zero(); ----->to------> RM.SetZero(); ccm.Trasp(); ----->to------> ccm.Transpose(); QQ.Jacobi(d,v,nrot); ----->to------> Jacobi(QQ,d,v,nrot); q.RotMatrix(Rot); ----->to------> q.ToMatrix(Rot); tr= (bfix - Rot.Apply(bmov)); ----->to------> tr= (bfix - Rot *bmov); Trn.Translate(tr); ----->to------> Trn.SetTranslate(tr); 2) in "ComputeRigidMatchMatrix" I changed: return ComputeRigidMatchMatrix(res,Pfix,Pmov,qtmp,tr); ----->to------> return ComputeWeightedRigidMatchMatrix(res,Pfix,Pmov,weights,qtmp,tr);
This commit is contained in:
parent
a880db7489
commit
6a4631b94b
|
@ -101,7 +101,7 @@ static bool ComputeRigidMatchMatrix(std::vector<ScalarType> weights,
|
||||||
{
|
{
|
||||||
Quaterniond qtmp;
|
Quaterniond qtmp;
|
||||||
Point3d tr;
|
Point3d tr;
|
||||||
return ComputeRigidMatchMatrix(res,Pfix,Pmov,qtmp,tr);
|
return ComputeWeightedRigidMatchMatrix(res,Pfix,Pmov,weights,qtmp,tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ static
|
||||||
bool ComputeWeightedRigidMatchMatrix(Matrix44x &res,
|
bool ComputeWeightedRigidMatchMatrix(Matrix44x &res,
|
||||||
std::vector<Point3x> &Pfix,
|
std::vector<Point3x> &Pfix,
|
||||||
std::vector<Point3x> &Pmov,
|
std::vector<Point3x> &Pmov,
|
||||||
std::vector<double> weights,
|
std::vector<ScalarType> weights,
|
||||||
Quaternionx &q,
|
Quaternionx &q,
|
||||||
Point3x &tr
|
Point3x &tr
|
||||||
)
|
)
|
||||||
|
@ -155,20 +155,20 @@ bool ComputeWeightedRigidMatchMatrix(Matrix44x &res,
|
||||||
|
|
||||||
cyc=ccm;
|
cyc=ccm;
|
||||||
tmp=ccm;
|
tmp=ccm;
|
||||||
tmp.Trasp();
|
tmp.Transpose();
|
||||||
cyc-=tmp;
|
cyc-=tmp;
|
||||||
|
|
||||||
Matrix44x QQ;
|
Matrix44x QQ;
|
||||||
QQ.Zero();
|
QQ.SetZero();
|
||||||
Point3x D(cyc[1][2],cyc[2][0],cyc[0][1]);
|
Point3x D(cyc[1][2],cyc[2][0],cyc[0][1]);
|
||||||
|
|
||||||
Matrix33x RM;
|
Matrix33x RM;
|
||||||
RM.Zero();
|
RM.SetZero();
|
||||||
RM[0][0]=-ccm.Trace();
|
RM[0][0]=-ccm.Trace();
|
||||||
RM[1][1]=-ccm.Trace();
|
RM[1][1]=-ccm.Trace();
|
||||||
RM[2][2]=-ccm.Trace();
|
RM[2][2]=-ccm.Trace();
|
||||||
RM+=ccm;
|
RM+=ccm;
|
||||||
ccm.Trasp();
|
ccm.Transpose();
|
||||||
RM+=ccm;
|
RM+=ccm;
|
||||||
|
|
||||||
QQ[0][0] = ccm.Trace();
|
QQ[0][0] = ccm.Trace();
|
||||||
|
@ -185,7 +185,7 @@ bool ComputeWeightedRigidMatchMatrix(Matrix44x &res,
|
||||||
Point4d d;
|
Point4d d;
|
||||||
Matrix44x v;
|
Matrix44x v;
|
||||||
int nrot;
|
int nrot;
|
||||||
QQ.Jacobi(d,v,nrot);
|
Jacobi(QQ,d,v,nrot);
|
||||||
// printf("Done %i iterations\n %f %f %f %f\n",nrot,d[0],d[1],d[2],d[3]);
|
// printf("Done %i iterations\n %f %f %f %f\n",nrot,d[0],d[1],d[2],d[3]);
|
||||||
// print(v);
|
// print(v);
|
||||||
// Now search the maximum eigenvalue
|
// Now search the maximum eigenvalue
|
||||||
|
@ -199,12 +199,12 @@ bool ComputeWeightedRigidMatchMatrix(Matrix44x &res,
|
||||||
}
|
}
|
||||||
// The corresponding eigenvector define the searched rotation,
|
// The corresponding eigenvector define the searched rotation,
|
||||||
Matrix44x Rot;
|
Matrix44x Rot;
|
||||||
q.RotMatrix(Rot);
|
q.ToMatrix(Rot);
|
||||||
// the translation (last row) is simply the difference between the transformed src barycenter and the trg baricenter
|
// the translation (last row) is simply the difference between the transformed src barycenter and the trg baricenter
|
||||||
tr= (bfix - Rot.Apply(bmov));
|
tr= (bfix - Rot *bmov);
|
||||||
//res[3][0]=tr[0];res[3][1]=tr[1];res[3][2]=tr[2];
|
//res[3][0]=tr[0];res[3][1]=tr[1];res[3][2]=tr[2];
|
||||||
Matrix44x Trn;
|
Matrix44x Trn;
|
||||||
Trn.Translate(tr);
|
Trn.SetTranslate(tr);
|
||||||
|
|
||||||
res=Rot*Trn;
|
res=Rot*Trn;
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue