core/vgl/algo/vgl_h_matrix_2d_optimize_lmq.h
Go to the documentation of this file.
00001 #ifndef vgl_h_matrix_2d_optimize_lmq_h_
00002 #define vgl_h_matrix_2d_optimize_lmq_h_
00003 //:
00004 // \file
00005 // \author  J.L. Mundy Jan 05, 2005
00006 // \brief contains class vgl_h_matrix_2d_optimize_lmq
00007 //
00008 // vgl_h_matrix_2d_optimize_lmq uses the Levenberg-Marquardt algorithm
00009 // to refine an initial value for vgl_h_matrix_2d, given a set of corresponding
00010 // points or lines.  The number of points/lines must be greater than four,
00011 // since for four or fewer points/lines the projective mapping is exact.
00012 // \verbatim
00013 //  Modifications
00014 //   none
00015 // \endverbatim
00016 
00017 #include <vgl/algo/vgl_h_matrix_2d_optimize.h>
00018 
00019 class vgl_h_matrix_2d_optimize_lmq : public vgl_h_matrix_2d_optimize
00020 {
00021  public:
00022   //: Constructor from initial homography to be optimized
00023   vgl_h_matrix_2d_optimize_lmq(vgl_h_matrix_2d<double> const& initial_h);
00024 
00025   int minimum_number_of_correspondences() const { return 5; }
00026 
00027  protected: // -- internal utilities --
00028 
00029   //:the main routine for carrying out the optimization. (used by the others)
00030   bool optimize_h(vcl_vector<vgl_homg_point_2d<double> > const& points1,
00031                   vcl_vector<vgl_homg_point_2d<double> > const& points2,
00032                   vgl_h_matrix_2d<double> const& h_initial, 
00033                   vgl_h_matrix_2d<double>& h_optimized);
00034 
00035   //: compute from matched points
00036   virtual
00037   bool optimize_p(vcl_vector<vgl_homg_point_2d<double> > const& points1,
00038                   vcl_vector<vgl_homg_point_2d<double> > const& points2,
00039                   vgl_h_matrix_2d<double>& H);
00040 
00041   //:compute from matched lines
00042   virtual
00043   bool optimize_l(vcl_vector<vgl_homg_line_2d<double> > const& lines1,
00044                   vcl_vector<vgl_homg_line_2d<double> > const& lines2,
00045                   vgl_h_matrix_2d<double>& H);
00046 
00047   //:compute from matched points and lines
00048   virtual
00049   bool optimize_pl(vcl_vector<vgl_homg_point_2d<double> > const& points1,
00050                    vcl_vector<vgl_homg_point_2d<double> > const& points2,
00051                    vcl_vector<vgl_homg_line_2d<double> > const& lines1,
00052                    vcl_vector<vgl_homg_line_2d<double> > const& lines2,
00053                    vgl_h_matrix_2d<double>& H);
00054 };
00055 
00056 #endif // vgl_h_matrix_2d_optimize_lmq_h_