core/vpgl/algo/vpgl_fm_compute_2_point.h
Go to the documentation of this file.
00001 // This is core/vpgl/algo/vpgl_fm_compute_2_point.h
00002 #ifndef vpgl_fm_compute_2_point_h_
00003 #define vpgl_fm_compute_2_point_h_
00004 //:
00005 // \file
00006 // \brief A 2 point algorithm for computing the fundamental matrix for translation from point correspondences
00007 // \author J. L. Mundy
00008 // \date March 21, 2007
00009 //
00010 // The point correspondences in relation to F are defined by
00011 // \verbatim
00012 //         [0    tz   -ty]
00013 //     pl^t[-tz   0    tx]pr = 0
00014 //         [ty   -tx    0]
00015 // \endverbatim
00016 // This computation assumes that the cameras differ by only a translation
00017 // Normalization of point coordinates is performed if precondition is true
00018 // In this case, the computation is modified to account for the normalization
00019 // so that F is expressed in the original coordinate system.
00020 
00021 #include <vpgl/vpgl_fundamental_matrix.h>
00022 #include <vgl/vgl_homg_point_2d.h>
00023 
00024 class vpgl_fm_compute_2_point
00025 {
00026  public:
00027   //: If precondition = true, points are conditioned prior to computation.
00028   vpgl_fm_compute_2_point( bool precondition = true )
00029   : precondition_(precondition) {}
00030 
00031   //: Compute from two sets of corresponding points.
00032   // Put the resulting matrix into fm, return true if successful.
00033   // Points pr are associated with the RHS of the fundamental matrix
00034   // while the points pl are associated with the LHS.
00035   bool compute( const vcl_vector< vgl_homg_point_2d<double> >& pr,
00036                 const vcl_vector< vgl_homg_point_2d<double> >& pl,
00037                 vpgl_fundamental_matrix<double>& fm );
00038 
00039  protected:
00040   bool precondition_;
00041 };
00042 
00043 #endif // vpgl_fm_compute_2_point_h_