vpgl_fm_compute_7_point.h
Go to the documentation of this file.
1 // This is core/vpgl/algo/vpgl_fm_compute_7_point.h
2 #ifndef vpgl_fm_compute_7_point_h_
3 #define vpgl_fm_compute_7_point_h_
4 //:
5 // \file
6 // \brief The 7 point algorithm for computing a fundamental matrix from point correspondences.
7 // \author Thomas Pollard
8 // \date May 10, 2005
9 //
10 // Should template this class. The code here is lifted from oxl/mvl/FMatrixCompute7Point.
11 // Still need to add preconditioning to points.
12 
13 #include <vgl/vgl_homg_point_2d.h>
15 
17 {
18  public:
19  //: If precondition = true, points are conditioned prior to computation.
20  vpgl_fm_compute_7_point( bool precondition = true )
21  : precondition_(precondition) {}
22 
23  //: Compute from two sets of corresponding points.
24  // Put the resulting matrix into fm, return true if successful.
25  // Points pr are associated with the RHS of the fundamental matrix
26  // while the points pl are associated with the LHS.
27  bool compute( const std::vector< vgl_homg_point_2d<double> >& pr,
28  const std::vector< vgl_homg_point_2d<double> >& pl,
29  std::vector< vpgl_fundamental_matrix<double>* >& fm );
30 
31  protected:
32  static std::vector<double> get_coeffs( vnl_double_3x3 const& F1,
33  vnl_double_3x3 const& F2 );
34  static std::vector<double> solve_quadratic( std::vector<double> v );
35  static std::vector<double> solve_cubic( std::vector<double> v );
37 };
38 
39 #endif // vpgl_fm_compute_7_point_h_
A class for the fundamental matrix between two projective cameras.
static std::vector< double > get_coeffs(vnl_double_3x3 const &F1, vnl_double_3x3 const &F2)
static std::vector< double > solve_quadratic(std::vector< double > v)
static std::vector< double > solve_cubic(std::vector< double > v)
bool compute(const std::vector< vgl_homg_point_2d< double > > &pr, const std::vector< vgl_homg_point_2d< double > > &pl, std::vector< vpgl_fundamental_matrix< double > * > &fm)
Compute from two sets of corresponding points.
vpgl_fm_compute_7_point(bool precondition=true)
If precondition = true, points are conditioned prior to computation.