Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Covariance3Dto2D.hh
1 #ifndef _Covariance3Dto2D_hh_
2 #define _Covariance3Dto2D_hh_
3 
4 #include <MathAlgo/UnscentedTransform.hh>
5 #include <Base/Geometry/KMatrix.hh>
6 #include <Base/Geometry/PMatrixBase.hh>
7 #include <Base/Math/Vector3.hh>
8 #include <Base/Math/Matrix3x3.hh>
9 #include <Base/Math/Vector2.hh>
10 #include <Base/Math/Matrix2x2.hh>
11 
12 namespace BIAS {
13 
14 #define D_C3DT2D_COV 0x00000100
15 
16  /** @class Covariance3Dto2D
17  @brief Projection of 3D points with uncertainties covariances into the
18  2d image plane taking the camera pose uncertainty into account.
19 
20  Given a point in 3D with uncertainty represented/approximated by a
21  multivariate normal distribution (i.e. 3x3 covariance matrix).
22  Given further a camera pose (camer center and orientation).
23 
24  The algorithm computes the projection of the 3D point into the image
25  taking the camera pose uncertainty into account. The probabilty
26  distribution function in the image is represented by a 2D normal
27  distribution (i.e. a 2D covariance matrix).
28 
29  The resulting 2D covariance matrix is approximated using the unscented
30  transform. See UnscentedTransform for details.
31 
32  To use it instantiate this class with the appropriate parametrization
33  of the camera orientation. Currently Euler angles,
34  axis (norm 1) and angle, axis times angle and quaternion are supported.
35 
36  See Example/ExampleCovariance3Dto2D for exemplary usage.
37 
38  TODO: implement for point normalization instead of homogenization
39 
40  @author woelk 02/2006 */
41  class BIASGeometry_EXPORT Covariance3Dto2D
43  {
44  public:
47 
49 
50  /** project covariance onto w=1 plane in camera coordinate system
51  @return 0: ok, -1 if ray behind/parallel to that plane */
52  int Project(const BIAS::Vector<double>& Pose,
53  const BIAS::Matrix<double>& Cov_Pose,
54  const BIAS::Vector3<double>& X,
55  const BIAS::Matrix3x3<double>& Cov_X,
57  BIAS::Matrix2x2<double>& Cov_x) const;
58 
59  inline void SetK(const BIAS::KMatrix& K)
60  { K_ = K; }
61 
62  protected:
65 
66  /** src is a vector consisting of [ 3d point, camera center, orientation ]
67  The orientation must be represented using one case from
68  E_Parametrization
69  dst is the projection into the image */
70  virtual int Transform_(const BIAS::Vector<double>& src,
71  BIAS::Vector<double>& dst) const;
72 
73 
74  };
75 } // namespace
76 
77 #endif // _Covariance3Dto2D_hh_
void SetK(const BIAS::KMatrix &K)
E_ParametrizationType
description of supported parametrization types
Definition: PMatrixBase.hh:166
Represents 3d pose transformations, parametrized as Euclidean translation and unit quaternion orienta...
Definition: Pose.hh:73
uses the unscented transformation to map a normal distribututed random variable using a nonlinear tra...
K describes the mapping from world coordinates (wcs) to pixel coordinates (pcs).
Definition: KMatrix.hh:48
Projection of 3D points with uncertainties covariances into the 2d image plane taking the camera pose...