vgl_h_matrix_2d_compute_linear.h
Go to the documentation of this file.
1 #ifndef vgl_h_matrix_2d_compute_linear_h_
2 #define vgl_h_matrix_2d_compute_linear_h_
3 //:
4 // \file
5 // \brief contains class vgl_h_matrix_2d_compute_linear
6 //
7 // vgl_h_matrix_2d_compute_linear contains a linear method to calculate
8 // the plane projectivity which relates four 2D point (or plane)
9 // correspondences.
10 // The returned $H$ is such that
11 // $H [p_1 p_2 p_3 p_4 ] \sim [p'_1 p'_2 p'_3 p'_4 ]$
12 // where the $p_i$ are the homogeneous points in the first view, and the
13 // $p'_i$ their images.
14 //
15 // \verbatim
16 // Modifications
17 // 200598 FSM added checks for degenerate or coincident points.
18 // 230603 Peter Vanroose - made compute_pl() etc. pure virtual
19 // 240603 Peter Vanroose - added rough first implementation for compute_pl()
20 // \endverbatim
21 
23 
25 {
27  protected:
28  //: compute from matched points
29 
30  bool compute_p(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>& H) override;
33 
34  //:compute from matched lines
35 
36  bool compute_l(std::vector<vgl_homg_line_2d<double> > const& lines1,
37  std::vector<vgl_homg_line_2d<double> > const& lines2,
38  vgl_h_matrix_2d<double>& H) override;
39 
40  //:compute from matched lines with weight vector
41 
42  bool compute_l(std::vector<vgl_homg_line_2d<double> > const& lines1,
43  std::vector<vgl_homg_line_2d<double> > const& lines2,
44  std::vector<double> const& weights,
45  vgl_h_matrix_2d<double>& H) override;
46 
47  //:compute from matched points and lines
48 
49  bool compute_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  //:Assumes all corresponding points have equal weight
56  bool solve_linear_problem(int equ_count,
57  std::vector<vgl_homg_point_2d<double> > const& p1,
58  std::vector<vgl_homg_point_2d<double> > const& p2,
60 
61  //: for lines, the solution should be weighted by line length
62  bool
64  std::vector<vgl_homg_line_2d<double> > const& l2,
65  std::vector<double> const& w,
67 
68  public:
69  vgl_h_matrix_2d_compute_linear(bool allow_ideal_points = false);
70  int minimum_number_of_correspondences() const override { return 4; }
71 };
72 
73 #endif // vgl_h_matrix_2d_compute_linear_h_
Represents a homogeneous 2D line.
Definition: vgl_fwd.h:14
bool compute_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.
vgl_h_matrix_2d_compute_linear(bool allow_ideal_points=false)
Construct a vgl_h_matrix_2d_compute_linear object.
bool solve_weighted_least_squares(std::vector< vgl_homg_line_2d< double > > const &l1, std::vector< vgl_homg_line_2d< double > > const &l2, std::vector< double > const &w, vgl_h_matrix_2d< double > &H)
for lines, the solution should be weighted by line length.
bool solve_linear_problem(int equ_count, std::vector< vgl_homg_point_2d< double > > const &p1, std::vector< vgl_homg_point_2d< double > > const &p2, vgl_h_matrix_2d< double > &H)
Assumes all corresponding points have equal weight.
contains class vgl_h_matrix_2d_compute
bool compute_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.
Represents a homogeneous 2D point.
Definition: vgl_fwd.h:8
bool compute_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.