Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EssentialPoint2Line.hh
1 #ifndef __EssentialPoint2Line_hh__
2 #define __EssentialPoint2Line_hh__
3 
4 #include <MathAlgo/UnscentedTransform.hh>
5 
6 namespace BIAS {
7 
8  /** computes line and associated covariance matrix given by a point and an
9  essential matrix using unscented transform
10  @author woelk 07/2007 */
12  {
13  public:
14  int Compute(const BIAS::HomgPoint2D& p2, const BIAS::HomgPoint2DCov &cov2,
16  BIAS::Matrix3x3<double> &cov_line)
17  {
18  BIAS::Vector<double> src(10), dst, Ev;
19  BIAS::Matrix<double> src_cov(10, 10, BIAS::MatrixZero), dst_cov, E_cov;
20 
21  Ev = E.GetEQ7();
22  E_cov = E.GetCov();
23  for (int c=0; c<7; c++){
24  src[c] = Ev[c];
25  for (int r=0; r<7; r++){
26  src_cov[r][c] = E_cov[r][c];
27  }
28  }
29 
30  for (int c=0; c<3; c++){
31  src[c+7] = p2[c];
32  for (int r=0; r<3; r++){
33  src_cov[r+7][c+7] = cov2[r][c];
34  }
35  }
36 
37  // TODO: enforce symmetry in lines above, this is slow:
38  src_cov.MakeSymmetric();
39 
40  int res = Transform(src, src_cov, dst, dst_cov);
41  line = dst;
42  cov_line = dst_cov;
43  return res;
44  }
45 
46  protected:
47 
48  virtual int Transform_(const BIAS::Vector<double>& src,
49  BIAS::Vector<double>& dst) const
50  {
53  for (int i=0; i<7; i++)
54  Ev[i] = src[i];
55  for (int i=0; i<3; i++)
56  p[i] = src[i+7];
57 
59  E.SetEQ(Ev);
60 
62  return 0;
63  }
64 
65  }; // class
66 
67 } // namespace
68 
69 
70 #endif // __EssentialPoint2Line_hh__
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
Definition: HomgPoint2D.hh:67
void SetEQ(const Vector< EP_TYPE > &EQvec)
Set this from E parametrization.
class representing the covariance matrix of a homogenous point 2D
computes line and associated covariance matrix given by a point and an essential matrix using unscent...
Matrix3x3< EP_TYPE > GetEssentialMatrix() const
returns the essential matrix computed from parametrization
Slim class bundling essential matrix parameterization and associated covariance matrix.
const Matrix< EP_TYPE > & GetCov() const
returns the covariance matrix associated with the EQ vector
int Transform(const Vector< double > &src_mean, const Matrix< double > &src_cov, Vector< double > &dst_mean, Matrix< double > &dst_cov) const
computes the second order approximation of the transformations of the mean and the associated covaria...
virtual int Transform_(const BIAS::Vector< double > &src, BIAS::Vector< double > &dst) const
implements a point transformation
const Vector< EP_TYPE > & GetEQ7() const
Returns a vector of dimension 7 where first 3 entries are the epipole and the last 4 entries are the ...
uses the unscented transformation to map a normal distribututed random variable using a nonlinear tra...
void MakeSymmetric()
averages transposed elements to make symmetric
int Compute(const BIAS::HomgPoint2D &p2, const BIAS::HomgPoint2DCov &cov2, const BIAS::EParametrization &E, BIAS::Vector3< double > &line, BIAS::Matrix3x3< double > &cov_line)