contrib/oxl/mvl/FManifoldProject.h
Go to the documentation of this file.
00001 // This is oxl/mvl/FManifoldProject.h
00002 #ifndef FManifoldProject_h_
00003 #define FManifoldProject_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief Fast 2-view Hartley-Sturm
00010 //
00011 //    FManifoldProject is a class which allows repeated fast application of the
00012 //    manifold projection ("Hartley-Sturm") correction to points in two views.
00013 //
00014 // \author
00015 //     Andrew W. Fitzgibbon, Oxford RRG, 22 Jan 97
00016 //
00017 // \verbatim
00018 //  Modifications
00019 //   AWF 030897 Moved to MViewBasics
00020 //   210598 AWF Return squared error, as \sqrt(|x - p|^2 + |x' - p'|^2) is meaningless.
00021 //   AWF Handle affine F.
00022 //   P. Torr added in a check for multiple solutions
00023 //     this might be necessary to flag the instance when a particular correspondence
00024 //     might have several possible closest points all near to each other,
00025 //     indicating high structure variability and high curvature in the F manifold.
00026 //     These points should be treated with care, but are interesting as
00027 //     they are in loci of high information.
00028 //   22 Jun 2003 - Peter Vanroose - added vgl_homg_point_2d interface
00029 // \endverbatim
00030 //-----------------------------------------------------------------------------
00031 
00032 #include <vnl/vnl_double_3x3.h>
00033 #include <vnl/vnl_double_4x4.h>
00034 #include <vnl/vnl_double_4.h>
00035 #include <vgl/vgl_fwd.h>
00036 
00037 class FMatrix;
00038 class HomgPoint2D;
00039 
00040 class FManifoldProject
00041 {
00042   vnl_double_3x3 F_;
00043 
00044   // Information to be used for each point
00045   vnl_double_4x4 A_;
00046   vnl_double_4 t_;
00047   vnl_double_4x4 V_;
00048   vnl_double_4 d_;
00049 
00050   bool affine_F_;
00051 
00052  public:
00053   FManifoldProject();
00054   FManifoldProject(const FMatrix& F);
00055 
00056   void set_F(const FMatrix& F);
00057   double correct(vgl_homg_point_2d<double> const& point1,
00058                  vgl_homg_point_2d<double> const& point2,
00059                  vgl_homg_point_2d<double>& out1,
00060                  vgl_homg_point_2d<double>& out2) const;
00061   double correct(const HomgPoint2D& point1, const HomgPoint2D& point2, HomgPoint2D *, HomgPoint2D *) const;
00062   double correct(double   x1, double   y1, double   x2, double   y2,
00063                  double *ox1, double *oy1, double *ox2, double *oy2) const;
00064 
00065   vnl_double_3x3 const& get_F() const { return F_; }
00066 };
00067 
00068 #endif // FManifoldProject_h_