1 #include <Geometry/Covariance3Dto2D.hh>
3 #include <Base/Geometry/PMatrixBase.hh>
4 #include <Base/Geometry/HomgPoint2D.hh>
5 #include <Base/Geometry/HomgPoint3D.hh>
6 #include <Base/Debug/Exception.hh>
30 BIASCDOUT(D_C3DT2D_COV,
"X: "<<X<<
"\nCov_X: "<<Cov_X<<endl);
31 const int pose_dim = Pose.
Size();
32 const int dim = pose_dim + 3;
39 for (
int c=0; c<3; c++){
41 for (
int r=c; r<3; r++){
42 src_cov[c][r] = src_cov[r][c] = 0.5 * (Cov_X[r][c] + Cov_X[c][r]);
46 for (
int c=0; c<pose_dim; c++){
48 for (
int r=c; r<pose_dim; r++){
49 src_cov[c+3][r+3] = src_cov[r+3][c+3] =
50 0.5 * (Cov_Pose[r][c] + Cov_Pose[c][r]);
54 BIASCDOUT(D_C3DT2D_COV,
"src: "<<src<<
"\nsrc_cov: "<<src_cov<<endl);
55 if (
Transform(src, src_cov, dst, dst_cov)!=0){
58 BIASCDOUT(D_C3DT2D_COV,
"dst: "<<dst<<
"\ndst_cov: "<<dst_cov<<endl);
71 const int pose_size = src.
Size() - 3;
73 for (
int i=0; i<pose_size; i++){
76 BIASCDOUT(D_C3DT2D_COV,
"K: "<<
K_<<
"\tparam: "<<param<<endl);
79 X.
Set(src[0], src[1], src[2], 1.0);
84 const double len = x.
NormL2();
85 if (len < 1e-9 || x[2]/len < 1e-9)
return -1;
88 BIASCDOUT(D_C3DT2D_COV,
"Pc32: "<<P<<
"\tXc32: "<<X<<
"\txx32: "<<x<<endl);
93 BIASCDOUT(D_C3DT2D_COV,
"dst_c32: "<<dst<<endl);
int Project(const BIAS::Vector< double > &Pose, const BIAS::Matrix< double > &Cov_Pose, const BIAS::Vector3< double > &X, const BIAS::Matrix3x3< double > &Cov_X, BIAS::Vector2< double > &x, BIAS::Matrix2x2< double > &Cov_x) const
project covariance onto w=1 plane in camera coordinate system
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
void Set(const HOMGPOINT3D_TYPE &x, const HOMGPOINT3D_TYPE &y, const HOMGPOINT3D_TYPE &z)
set elementwise with given 3 euclidean scalar values.
HomgPoint2D & Homogenize()
homogenize class data member elements to W==1 by divison by W
Matrix< T > & newsize(Subscript M, Subscript N)
unsigned int Size() const
length of the vector
E_ParametrizationType
description of supported parametrization types
Covariance3Dto2D(BIAS::KMatrix &K, enum BIAS::PMatrixBase::E_ParametrizationType par)
virtual int Transform_(const BIAS::Vector< double > &src, BIAS::Vector< double > &dst) const
src is a vector consisting of [ 3d point, camera center, orientation ] The orientation must be repres...
Vector< T > & newsize(Subscript N)
Represents 3d pose transformations, parametrized as Euclidean translation and unit quaternion orienta...
void SetZero()
Sets all values to zero.
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
describes a projective 3D -> 2D mapping in homogenous coordinates
K describes the mapping from world coordinates (wcs) to pixel coordinates (pcs).
void Compose(const Matrix3x3< PMATRIX_TYPE > &K, const Matrix3x3< PMATRIX_TYPE > &R, const Vector3< PMATRIX_TYPE > &C)
composes this from K, R and C using P = [ K R' | -K R' C ] with R' = transpose(R) ...
enum BIAS::PMatrixBase::E_ParametrizationType Parametrization_
double NormL2() const
the L2 norm sqrt(a^2 + b^2 + c^2)