vgl_h_matrix_2d_optimize_lmq.h
Go to the documentation of this file.
1 #ifndef vgl_h_matrix_2d_optimize_lmq_h_
2 #define vgl_h_matrix_2d_optimize_lmq_h_
3 //:
4 // \file
5 // \author J.L. Mundy Jan 05, 2005
6 // \brief contains class vgl_h_matrix_2d_optimize_lmq
7 //
8 // vgl_h_matrix_2d_optimize_lmq uses the Levenberg-Marquardt algorithm
9 // to refine an initial value for vgl_h_matrix_2d, given a set of corresponding
10 // points or lines. The number of points/lines must be greater than four,
11 // since for four or fewer points/lines the projective mapping is exact.
12 // \verbatim
13 // Modifications
14 // none
15 // \endverbatim
16 
18 
20 {
21  public:
22  //: Constructor from initial homography to be optimized
24 
25  int minimum_number_of_correspondences() const override { return 5; }
26 
27  protected: // -- internal utilities --
28 
29  //:the main routine for carrying out the optimization. (used by the others)
30  bool optimize_h(std::vector<vgl_homg_point_2d<double> > const& points1,
31  std::vector<vgl_homg_point_2d<double> > const& points2,
32  vgl_h_matrix_2d<double> const& h_initial,
33  vgl_h_matrix_2d<double>& h_optimized);
34 
35  //: compute from matched points
36 
37  bool optimize_p(std::vector<vgl_homg_point_2d<double> > const& points1,
38  std::vector<vgl_homg_point_2d<double> > const& points2,
39  vgl_h_matrix_2d<double>& H) override;
40 
41  //:compute from matched lines
42 
43  bool optimize_l(std::vector<vgl_homg_line_2d<double> > const& lines1,
44  std::vector<vgl_homg_line_2d<double> > const& lines2,
45  vgl_h_matrix_2d<double>& H) override;
46 
47  //:compute from matched points and lines
48 
49  bool optimize_pl(std::vector<vgl_homg_point_2d<double> > const& points1,
50  std::vector<vgl_homg_point_2d<double> > const& points2,
51  std::vector<vgl_homg_line_2d<double> > const& lines1,
52  std::vector<vgl_homg_line_2d<double> > const& lines2,
53  vgl_h_matrix_2d<double>& H) override;
54 };
55 
56 #endif // vgl_h_matrix_2d_optimize_lmq_h_
int minimum_number_of_correspondences() const override
Represents a homogeneous 2D line.
Definition: vgl_fwd.h:14
bool optimize_l(std::vector< vgl_homg_line_2d< double > > const &lines1, std::vector< vgl_homg_line_2d< double > > const &lines2, vgl_h_matrix_2d< double > &H) override
compute from matched lines.
vgl_h_matrix_2d_optimize_lmq(vgl_h_matrix_2d< double > const &initial_h)
Constructor from initial homography to be optimized.
bool optimize_pl(std::vector< vgl_homg_point_2d< double > > const &points1, std::vector< vgl_homg_point_2d< double > > const &points2, std::vector< vgl_homg_line_2d< double > > const &lines1, std::vector< vgl_homg_line_2d< double > > const &lines2, vgl_h_matrix_2d< double > &H) override
compute from matched points and lines.
bool optimize_p(std::vector< vgl_homg_point_2d< double > > const &points1, std::vector< vgl_homg_point_2d< double > > const &points2, vgl_h_matrix_2d< double > &H) override
compute from matched points.
Refine an initial 2d homography by minimizing projection error.
Represents a homogeneous 2D point.
Definition: vgl_fwd.h:8
bool optimize_h(std::vector< vgl_homg_point_2d< double > > const &points1, std::vector< vgl_homg_point_2d< double > > const &points2, vgl_h_matrix_2d< double > const &h_initial, vgl_h_matrix_2d< double > &h_optimized)
the main routine for carrying out the optimization. (used by the others).