vpgl_ba_fixed_k_lsqr.h
Go to the documentation of this file.
1 // This is vpgl/algo/vpgl_ba_fixed_k_lsqr.h
2 #ifndef vpgl_ba_fixed_k_lsqr_h_
3 #define vpgl_ba_fixed_k_lsqr_h_
4 //:
5 // \file
6 // \brief Bundle adjustment sparse least squares class for fixed intrinsics
7 // \author Matt Leotta
8 // \date April 18, 2005
9 // \verbatim
10 // Modifications
11 // Mar 23, 2010 MJL - Split off base class and moved to its own file
12 // \endverbatim
13 
15 
16 
17 //: a class for bundle adjustment with fixed intrinsic parameters
19 {
20  public:
21  //: Constructor
22  // \note image points are not homogeneous because they require finite points
23  // to measure projection error
25  const std::vector<vgl_point_2d<double> >& image_points,
26  const std::vector<std::vector<bool> >& mask);
27 
28  //: Constructor
29  // Each image point is assigned an inverse covariance (error projector) matrix
30  // \note image points are not homogeneous because they require finite points
31  // to measure projection error
33  const std::vector<vgl_point_2d<double> >& image_points,
34  const std::vector<vnl_matrix<double> >& inv_covars,
35  const std::vector<std::vector<bool> >& mask);
36 
37  // Destructor
38  ~vpgl_ba_fixed_k_lsqr() override = default;
39 
40 
41  //: compute the Jacobian Aij
42  void jac_Aij(unsigned int i,
43  unsigned int j,
44  vnl_double_3x4 const& Pi,
45  vnl_vector<double> const& ai,
46  vnl_vector<double> const& bj,
47  vnl_vector<double> const& c,
48  vnl_matrix<double>& Aij) override;
49 
50  //: compute the Jacobian Bij
51  void jac_Bij(unsigned int i,
52  unsigned int j,
53  vnl_double_3x4 const& Pi,
54  vnl_vector<double> const& ai,
55  vnl_vector<double> const& bj,
56  vnl_vector<double> const& c,
57  vnl_matrix<double>& Bij) override;
58 
59  //: compute the Jacobian Cij
60  void jac_Cij(unsigned int i,
61  unsigned int j,
62  vnl_double_3x4 const& Pi,
63  vnl_vector<double> const& ai,
64  vnl_vector<double> const& bj,
65  vnl_vector<double> const& c,
66  vnl_matrix<double>& Cij) override;
67 
68 
69  //: construct the \param j-th perspective camera from a pointer to the j-th parameters of \param b and parameters \param c
71  param_to_point(int j,
72  const double* bj,
73  const vnl_vector<double>& c) const override;
74 
75  //: construct the \param j-th perspective camera from a pointer to the j-th parameters of \param b and parameters \param c
77  param_to_pt_vector(int j,
78  const double* bj,
79  const vnl_vector<double>& c) const override;
80 
81  //: construct the \param i-th perspective camera from a pointer to the i-th parameters of \param a and parameters \param c
83  param_to_cam(int i,
84  const double* ai,
85  const vnl_vector<double>& c) const override;
86 
87  //: compute a 3x4 camera matrix of camera \param i from a pointer to the i-th parameters of \param a and parameters \param c
89  param_to_cam_matrix(int i,
90  const double* ai,
91  const vnl_vector<double>& c) const override;
92 
93 
94  //: Create the parameter vector \p a from a vector of cameras
95  static vnl_vector<double>
96  create_param_vector(const std::vector<vpgl_perspective_camera<double> >& cameras);
97 
98  //: Create the parameter vector \p b from a vector of 3D points
99  static vnl_vector<double>
100  create_param_vector(const std::vector<vgl_point_3d<double> >& world_points);
101 
102 
103  protected:
104  //: The fixed internal camera calibration
105  std::vector<vpgl_calibration_matrix<double> > K_;
106  //: The fixed internal camera calibration in matrix form
107  std::vector<vnl_double_3x3> Km_;
108 };
109 
110 
111 #endif // vpgl_ba_fixed_k_lsqr_h_
void jac_Aij(unsigned int i, unsigned int j, vnl_double_3x4 const &Pi, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_vector< double > const &c, vnl_matrix< double > &Aij) override
compute the Jacobian Aij.
vnl_double_3x4 param_to_cam_matrix(int i, const double *ai, const vnl_vector< double > &c) const override
compute a 3x4 camera matrix of camera
std::vector< vpgl_calibration_matrix< double > > K_
The fixed internal camera calibration.
vgl_homg_point_3d< double > param_to_point(int j, const double *bj, const vnl_vector< double > &c) const override
construct the
std::vector< vnl_double_3x3 > Km_
The fixed internal camera calibration in matrix form.
void jac_Bij(unsigned int i, unsigned int j, vnl_double_3x4 const &Pi, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_vector< double > const &c, vnl_matrix< double > &Bij) override
compute the Jacobian Bij.
Bundle adjustment sparse least squares base class.
~vpgl_ba_fixed_k_lsqr() override=default
base class bundle adjustment sparse least squares function.
a class for bundle adjustment with fixed intrinsic parameters.
vnl_vector_fixed< double, 4 > param_to_pt_vector(int j, const double *bj, const vnl_vector< double > &c) const override
construct the
void jac_Cij(unsigned int i, unsigned int j, vnl_double_3x4 const &Pi, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_vector< double > const &c, vnl_matrix< double > &Cij) override
compute the Jacobian Cij.
This class implements the perspective camera class as described in Hartley & Zisserman as a finite ca...
vpgl_ba_fixed_k_lsqr(std::vector< vpgl_calibration_matrix< double > > K, const std::vector< vgl_point_2d< double > > &image_points, const std::vector< std::vector< bool > > &mask)
Constructor.
static vnl_vector< double > create_param_vector(const std::vector< vpgl_perspective_camera< double > > &cameras)
Create the parameter vector a from a vector of cameras.
vpgl_perspective_camera< double > param_to_cam(int i, const double *ai, const vnl_vector< double > &c) const override
construct the