contrib/oxl/mvl/FMPlanarComputeNonLinear.h
Go to the documentation of this file.
00001 // This is oxl/mvl/FMPlanarComputeNonLinear.h
00002 #ifndef FMPlanarComputeNonLinear_h_
00003 #define FMPlanarComputeNonLinear_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief Nonlinear least squares planar fundamental matrix fit
00010 //
00011 // FMPlanarComputeNonLinear fits a planar fundamental matrix to point matches
00012 // by minimizing the Luong-Faugeras [ECCV '92] error function
00013 // \f\[
00014 // E = \sum_{i=1}^n d^2({\bf x}'_i, {\tt F} {\bf x}_i) + d^2({\bf x}_i, {\tt F}^\top {\bf x}'_i)
00015 // \f\]
00016 // Minimization currently uses vnl_levenberg_marquardt with finite-difference
00017 // derivatives, and does not minimize a Huber function---all matches
00018 // are assumed to be inliers.
00019 //
00020 // \author
00021 //   Martin Armstrong, Oxford 21/11/96
00022 //
00023 // \verbatim
00024 //  Modifications
00025 //   22 Oct 2002 - Peter Vanroose - added vgl_homg_point_2d interface
00026 // \endverbatim
00027 //
00028 //-----------------------------------------------------------------------------
00029 
00030 #include <vgl/vgl_fwd.h>
00031 #include <mvl/FMatrixCompute.h>
00032 
00033 class ImageMetric;
00034 class PairMatchSetCorner;
00035 class FMatrixPlanar;
00036 
00037 class FMPlanarComputeNonLinear : public FMatrixCompute
00038 {
00039  protected:
00040   // Data Members--------------------------------------------------------------
00041   double outlier_distance_squared_;
00042 
00043   const ImageMetric* image_metric1_;
00044   const ImageMetric* image_metric2_;
00045 
00046  public:
00047 
00048   // Constructors/Destructors--------------------------------------------------
00049   FMPlanarComputeNonLinear(const ImageMetric*, const ImageMetric*,
00050                            double outlier_threshold = 0);
00051 
00052   // Computations--------------------------------------------------------------
00053 
00054   bool compute_planar(vcl_vector<vgl_homg_point_2d<double> >& points1,
00055                       vcl_vector<vgl_homg_point_2d<double> >& points2,
00056                       FMatrixPlanar& F);
00057   bool compute_planar(PairMatchSetCorner& matches, FMatrixPlanar* F);
00058   bool compute_planar(vcl_vector<HomgPoint2D>& points1,
00059                       vcl_vector<HomgPoint2D>& points2, FMatrixPlanar* F);
00060 
00061   // FMatrixCompute virtuals
00062   bool compute(vcl_vector<vgl_homg_point_2d<double> >& points1,
00063                vcl_vector<vgl_homg_point_2d<double> >& points2, FMatrix& F);
00064   bool compute(PairMatchSetCorner& matches, FMatrix* F);
00065   bool compute(vcl_vector<HomgPoint2D>& points1,
00066                vcl_vector<HomgPoint2D>& points2, FMatrix* F);
00067 };
00068 
00069 #endif // FMPlanarComputeNonLinear_h_