1 // This is core/vpgl/algo/vpgl_fm_compute_8_point.h
2 #ifndef vpgl_fm_compute_8_point_h_
3 #define vpgl_fm_compute_8_point_h_
4 //:
5 // \file
6 // \brief The 8 point algorithm for computing a fundamental matrix from point correspondences.
7 // \author Thomas Pollard
8 // \date May 10, 2005
9 //
10 //  The point correspondences in relation to F are defined by
11 //     $pl^t[F]pr = 0$
12 //
13 // \verbatim
14 //  Modifications
15 //   Sep 27, 2007  Ricardo Fabbri   Imposed order of 1) rank-enforcement and 2) de-normalization.
16 // \endverbatim
17 
18 #include <vgl/vgl_homg_point_2d.h>
19 #include <vpgl/vpgl_fundamental_matrix.h>
20 
21 class vpgl_fm_compute_8_point
22 {
23  public:
24   //: If precondition = true, points are conditioned prior to computation.
25   vpgl_fm_compute_8_point( bool precondition = true ) :
precondition_(precondition)26       precondition_(precondition) {}
27 
28   //: Compute from two sets of corresponding points.
29   // Put the resulting matrix into fm, return true if successful.
30   // Points pr are associated with the RHS of the fundamental matrix
31   // while the points pl are associated with the LHS.
32   bool compute( const std::vector< vgl_homg_point_2d<double> >& pr,
33                 const std::vector< vgl_homg_point_2d<double> >& pl,
34                 vpgl_fundamental_matrix<double>& fm ) const;
35 
36  protected:
37   bool precondition_;
38 };
39 
40 #endif // vpgl_fm_compute_8_point_h_
41