1 #include "TrifocalTensor.hh"
2 #include <Base/Debug/DebugSimple.hh>
3 #include <MathAlgo/SVD.hh>
9 TrifocalTensor::TrifocalTensor()
15 TrifocalTensor::~TrifocalTensor()
24 Compose( P1, P2, P3 );
35 void TrifocalTensor::Init()
66 SetFromMatrices( T[0], T[1], T[2] );
70 void TrifocalTensor::ComputeEpipoles()
72 if ( Epipole21_!=NULL )
delete Epipole21_;
73 if ( Epipole31_!=NULL )
delete Epipole31_;
78 GetMatrices(T1, T2, T3);
96 U[0][0] = u1[0]; U[0][1] = u2[0]; U[0][2] = u3[0];
97 U[1][0] = u1[1]; U[1][1] = u2[1]; U[1][2] = u3[1];
98 U[2][0] = u1[2]; U[2][1] = u2[2]; U[2][2] = u3[2];
102 V[0][0] = v1[0]; V[0][1] = v2[0]; V[0][2] = v3[0];
103 V[1][0] = v1[1]; V[1][1] = v2[1]; V[1][2] = v3[1];
104 V[2][0] = v1[2]; V[2][1] = v2[2]; V[2][2] = v3[2];
117 if ( Epipole21_==NULL || ForceReCalc ) ComputeEpipoles();
124 if ( Epipole31_==NULL || ForceReCalc ) ComputeEpipoles();
128 FMatrix TrifocalTensor::GetFMatrix21(
bool ForceReCalc )
138 GetMatrices(T1, T2, T3);
147 F[0][0] = f1[0]; F[0][1] = f2[0]; F[0][2] = f3[0];
148 F[1][0] = f1[1]; F[1][1] = f2[1]; F[1][2] = f3[1];
149 F[2][0] = f1[2]; F[2][1] = f2[2]; F[2][2] = f3[2];
155 FMatrix TrifocalTensor::GetFMatrix31(
bool ForceReCalc )
165 GetMatrices(T1, T2, T3);
174 F[0][0] = f1[0]; F[0][1] = f2[0]; F[0][2] = f3[0];
175 F[1][0] = f1[1]; F[1][1] = f2[1]; F[1][2] = f3[1];
176 F[2][0] = f1[2]; F[2][1] = f2[2]; F[2][2] = f3[2];
182 PMatrix TrifocalTensor::GetPMatrix2(
bool ForceReCalc )
193 GetMatrices(T1, T2, T3);
199 P[0][0] = p1[0]; P[0][1] = p2[0]; P[0][2] = p3[0]; P[0][3] = e2[0];
200 P[1][0] = p1[1]; P[1][1] = p2[1]; P[1][2] = p3[1]; P[1][3] = e2[1];
201 P[2][0] = p1[2]; P[2][1] = p2[2]; P[2][2] = p3[2]; P[2][3] = e2[2];
207 PMatrix TrifocalTensor::GetPMatrix3(
bool ForceReCalc )
218 GetMatrices(T1, T2, T3);
225 M[0][0] = e3[0]*e3[0]-1; M[0][1] = e3[1]*e3[0]; M[0][2] = e3[2]*e3[0];
226 M[1][0] = e3[0]*e3[1]; M[1][1] = e3[1]*e3[1]-1; M[1][2] = e3[2]*e3[1];
227 M[2][0] = e3[0]*e3[2]; M[2][1] = e3[1]*e3[2]; M[2][2] = e3[2]*e3[2]-1;
236 P[0][0] = p1[0]; P[0][1] = p2[0]; P[0][2] = p3[0]; P[0][3] = e3[0];
237 P[1][0] = p1[1]; P[1][1] = p2[1]; P[1][2] = p3[1]; P[1][3] = e3[1];
238 P[2][0] = p1[2]; P[2][1] = p2[2]; P[2][2] = p3[2]; P[2][3] = e3[2];
280 LeftContravariantContraction2(l2).TransposedMult(x1,x3);
287 TrifocalTensorBase::operator=(t);
Vector< double > GetNullvector(const int last_offset=0)
return one of the nullvectors.
Matrix4x4< PMATRIX_TYPE > GetCanonicalH() const
Get the projective homography matrix so that P * H = [ I | 0 ].
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
computes and holds the singular value decomposition of a rectangular (not necessarily quadratic) Matr...
class for column vectors with arbitrary size
bool GetLeftNullvector(Vector< double > &nv, const int last_offset=0)
Return one of the left nullvectors.
void OuterProduct(const Vector3< T > &v, Matrix3x3< T > &res) const
outer product, constructs a matrix.
Vector< T > GetCol(const int &col) const
return a copy of column "col", zero based counting
void CrossProduct(const Vector3< T > &argvec, Vector3< T > &destvec) const
cross product of two vectors destvec = this x argvec
void Mult(const Vector3< T > &argvec, Vector3< T > &destvec) const
matrix - vector multiplicate this matrix with Vector3, storing the result in destvec calculates: dest...
void GetPerpendicularLine(HomgPoint2D &point, HomgLine2D &perpline)
return perpendicular line throug point
class representing a Fundamental matrix
a line l = (a b c)^T is a form of the implicit straight line equation 0 = a*x + b*y + c if homogenize...
is a 'fixed size' quadratic matrix of dim.
matrix class with arbitrary size, indexing is row major.
Matrix3x3< T > Transpose() const
returns transposed matrix tested 12.06.2002
describes a projective 3D -> 2D mapping in homogenous coordinates
bool IsIdentity(double eps=0.0) const
Checks if the matrix a an identity.
Vector3< T > & Normalize()
normalize this vector to length 1