contrib/oxl/mvl/FMatrixCompute.h
Go to the documentation of this file.
00001 // This is oxl/mvl/FMatrixCompute.h
00002 #ifndef _FMatrixCompute_h
00003 #define _FMatrixCompute_h
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief Base class for fundamental matrix fitters
00010 //
00011 // FMatrixCompute defines the abstract interface to an object which can compute
00012 // a fundamental matrix.  The method compute should be overloaded by
00013 // implementation subclasses.
00014 //
00015 // The input points are supplied in a class PairMatchSetCorner, which may be
00016 // updated by any robust methods to reflect the new set of inliers.
00017 //
00018 // Currently implemented subclasses:
00019 //
00020 // - FMatrixComputeLinear    - Hartley's normalized linear method
00021 // - FMatrixComputeRANSAC    - Oxford robust RANSAC computation
00022 // - FMatrixComputeNonLinear - Oxford nonlinear optimization
00023 // - FMatrixCompute7Point    - Oxford implementation of 7-point algorithm
00024 // - FMatrixCompute8Point    - linear least squares on 8 point matches
00025 // - FMatrixComputeLMedSq    - Zhengyou Zhang's Least Medium of Squares estimation
00026 // - FMatrixComputeMLESAC    - Phil Torr's Maximum Likelihood estimation
00027 // - FMatrixComputeRANSAC    - Phil Torr's Robust Sampling Consensus
00028 //
00029 // \verbatim
00030 // Modifications
00031 //    22 Oct 2002 - Peter Vanroose - added vgl_homg_point_2d interface
00032 // \endverbatim
00033 //
00034 
00035 #include <vcl_vector.h>
00036 #include <mvl/FMatrix.h>
00037 #include <vgl/vgl_homg_point_2d.h>
00038 class HomgPoint2D;
00039 class PairMatchSetCorner;
00040 
00041 class FMatrixCompute
00042 {
00043  public:
00044   FMatrixCompute();
00045   virtual ~FMatrixCompute();
00046 
00047   //: This is the virtual compute interface
00048   // These 3 functions are implemented in terms of each other,
00049   // so it suffices to implement exactly one of them in a derived class,
00050   // and implement the other ones by calling this implementation.
00051   virtual bool compute(PairMatchSetCorner& matched_points, FMatrix* f_matrix_ptr);
00052   virtual bool compute(vcl_vector<HomgPoint2D>&, vcl_vector<HomgPoint2D>&, FMatrix* f_matrix_ptr);
00053   virtual bool compute(vcl_vector<vgl_homg_point_2d<double> >&,
00054                        vcl_vector<vgl_homg_point_2d<double> >&,
00055                        FMatrix& f_matrix_ptr);
00056 
00057   //: Compute fundamental matrix using given matchlist and return an FMatrix object.
00058   //  This is implemented in terms of compute(MatchList*, FMatrix*)
00059   inline FMatrix compute(PairMatchSetCorner& matched_points)
00060     { FMatrix ret; compute(matched_points, &ret); return ret; }
00061 
00062   inline FMatrix compute(vcl_vector<HomgPoint2D>& pts1, vcl_vector<HomgPoint2D>& pts2)
00063     { FMatrix ret; compute(pts1, pts2, &ret); return ret; }
00064   inline FMatrix compute(vcl_vector<vgl_homg_point_2d<double> >& pts1,
00065                          vcl_vector<vgl_homg_point_2d<double> >& pts2)
00066     { FMatrix ret; compute(pts1, pts2, ret); return ret; }
00067 };
00068 
00069 #endif // _FMatrixCompute_h