Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ExampleEParametrization.cpp
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 
26 /**
27  @example ExampleEParametrization.cpp
28  @relates EParametrization
29  @brief Example for the parameter of the EMatrix and usage
30  @ingroup g_examples
31  @author MIP
32 */
33 
34 #include <Base/Math/Random.hh>
35 
36 #include <Base/Geometry/EParametrization.hh>
37 #include <Base/Geometry/HomgPoint3D.hh>
38 #include <Base/Geometry/HomgPoint2D.hh>
39 #include <Base/Geometry/RMatrixBase.hh>
40 #include <Base/Geometry/PMatrixBase.hh>
41 #include <Base/Geometry/KMatrix.hh>
42 
43 using namespace BIAS;
44 using namespace std;
45 
46 int main(int argc, char *argv[])
47 {
48  Random r;
49  HomgPoint3D p3d;
50  p3d[0] = r.GetUniformDistributed(-5.0, 5.0);
51  p3d[1] = r.GetUniformDistributed(-5.0, 5.0);
52  p3d[2] = r.GetUniformDistributed(10, 15.0);
53  p3d[3] = 1.0;
54 
56  Vector3<double> C1(0,0,0), C2(1,0,0);
58  R2.SetXYZ(0.01, -0.01, 0.01);
59  R = R1.Transpose() * R2;
60  PMatrixBase P1(K, R1, C1), P2(K, R2, C2);
61  HomgPoint2D p1=P1*p3d, p2=P2*p3d, epp=P1*HomgPoint3D(C2);
62  cout << "p1: "<<p1<<"\tp2: "<<p2<<"\nepipole: "<<epp<<endl;
64  R.GetQuaternion(q);
65  EParametrization ep, epi;
66  ep.SetEpipole(epp);
67  ep.SetOrientation(q);
68  epi = ep;
69  epi.Invert();
70 
72 
73  cout << p1.ScalarProduct(E*p2) << "\t"
74  //<< p2.ScalarProduct(E*p1) << "\n"
75  //<< p1.ScalarProduct(Ei*p2) << "\t"
76  << p2.ScalarProduct(Ei*p1) << "\n";
77 
78 }
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
Definition: HomgPoint2D.hh:67
void SetXYZ(ROTATION_MATRIX_TYPE PhiX, ROTATION_MATRIX_TYPE PhiY, ROTATION_MATRIX_TYPE PhiZ)
Set Euler angles (in rad) in order XYZ.
void ScalarProduct(const Vector3< T > &argvec, T &result) const
scalar product (=inner product) of two vectors, storing the result in result
Definition: Vector3.hh:603
Matrix3x3< EP_TYPE > GetEssentialMatrix() const
returns the essential matrix computed from parametrization
double GetUniformDistributed(const double min, const double max)
on succesive calls return uniform distributed random variable between min and max ...
Definition: Random.hh:84
Slim class bundling essential matrix parameterization and associated covariance matrix.
int GetQuaternion(Quaternion< ROTATION_MATRIX_TYPE > &quat) const
Calculates quaternion representation for this rotation matrix.
void SetOrientation(const Quaternion< EP_TYPE > &q)
set orientation part of vector and zero covariance matrix
void Invert()
inverts the direction,
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
Definition: HomgPoint3D.hh:61
describes a projective 3D -&gt; 2D mapping in homogenous coordinates
Definition: PMatrixBase.hh:74
Matrix3x3< T > Transpose() const
returns transposed matrix tested 12.06.2002
Definition: Matrix3x3.cpp:167
K describes the mapping from world coordinates (wcs) to pixel coordinates (pcs).
Definition: KMatrix.hh:48
void SetEpipole(const Vector3< EP_TYPE > &epipole)
set epipole part of vector and zero covariance matrix
Implements a 3D rotation matrix.
Definition: RMatrixBase.hh:44
class for producing random numbers from different distributions
Definition: Random.hh:51
class BIASGeometryBase_EXPORT HomgPoint3D