00001 // This is core/vpgl/algo/vpgl_fm_compute_8_point.h 00002 #ifndef vpgl_fm_compute_8_point_h_ 00003 #define vpgl_fm_compute_8_point_h_ 00004 //: 00005 // \file 00006 // \brief The 8 point algorithm for computing a fundamental matrix from point correspondences. 00007 // \author Thomas Pollard 00008 // \date May 10, 2005 00009 // 00010 // The point correspondences in relation to F are defined by 00011 // $pl^t[F]pr = 0$ 00012 // 00013 // \verbatim 00014 // Modifications 00015 // Sep 27, 2007 Ricardo Fabbri Imposed order of 1) rank-enforcement and 2) de-normalization. 00016 // \endverbatim 00017 00018 #include <vgl/vgl_homg_point_2d.h> 00019 #include <vpgl/vpgl_fundamental_matrix.h> 00020 00021 class vpgl_fm_compute_8_point 00022 { 00023 public: 00024 //: If precondition = true, points are conditioned prior to computation. 00025 vpgl_fm_compute_8_point( bool precondition = true ) : 00026 precondition_(precondition) {} 00027 00028 //: Compute from two sets of corresponding points. 00029 // Put the resulting matrix into fm, return true if successful. 00030 // Points pr are associated with the RHS of the fundamental matrix 00031 // while the points pl are associated with the LHS. 00032 bool compute( const vcl_vector< vgl_homg_point_2d<double> >& pr, 00033 const vcl_vector< vgl_homg_point_2d<double> >& pl, 00034 vpgl_fundamental_matrix<double>& fm ); 00035 00036 protected: 00037 bool precondition_; 00038 }; 00039 00040 #endif // vpgl_fm_compute_8_point_h_