vpgl_ba_shared_k_lsqr.h
Go to the documentation of this file.
1 // This is vpgl/algo/vpgl_ba_shared_k_lsqr.h
2 #ifndef vpgl_ba_shared_k_lsqr_h_
3 #define vpgl_ba_shared_k_lsqr_h_
4 //:
5 // \file
6 // \brief Bundle adjustment sparse least squares class for shared unknown intrinsics
7 // \author Matt Leotta
8 // \date March 24, 2010
9 // \verbatim
10 
12 
13 
14 //: a class for bundle adjustment with shared intrinsic parameters
15 // Some shared intrinsic parameters can be estimated
16 // currently only focal length is estimated
17 class vpgl_ba_shared_k_lsqr : public vpgl_bundle_adjust_lsqr
18 {
19  public:
20  //: Constructor
21  // \note image points are not homogeneous because they require finite points
22  // to measure projection error
23  vpgl_ba_shared_k_lsqr(const vpgl_calibration_matrix<double>& K,
24  const std::vector<vgl_point_2d<double> >& image_points,
25  const std::vector<std::vector<bool> >& mask);
26 
27  //: Constructor
28  // Each image point is assigned an inverse covariance (error projector) matrix
29  // \note image points are not homogeneous because they require finite points
30  // to measure projection error
31  vpgl_ba_shared_k_lsqr(const vpgl_calibration_matrix<double>& K,
32  const std::vector<vgl_point_2d<double> >& image_points,
33  const std::vector<vnl_matrix<double> >& inv_covars,
34  const std::vector<std::vector<bool> >& mask);
35 
36  // Destructor
37  ~vpgl_ba_shared_k_lsqr() override = default;
38 
39 
40  //: compute the Jacobian Aij
41  void jac_Aij(unsigned int i,
42  unsigned int j,
43  vnl_double_3x4 const& Pi,
44  vnl_vector<double> const& ai,
45  vnl_vector<double> const& bj,
46  vnl_vector<double> const& c,
47  vnl_matrix<double>& Aij) override;
48 
49  //: compute the Jacobian Bij
50  void jac_Bij(unsigned int i,
51  unsigned int j,
52  vnl_double_3x4 const& Pi,
53  vnl_vector<double> const& ai,
54  vnl_vector<double> const& bj,
55  vnl_vector<double> const& c,
56  vnl_matrix<double>& Bij) override;
57 
58  //: compute the Jacobian Cij
59  void jac_Cij(unsigned int i,
60  unsigned int j,
61  vnl_double_3x4 const& Pi,
62  vnl_vector<double> const& ai,
63  vnl_vector<double> const& bj,
64  vnl_vector<double> const& c,
65  vnl_matrix<double>& Cij) override;
66 
67 
68  //: construct the \param j-th perspective camera from a pointer to the j-th parameters of \param b and parameters \param c
70  param_to_point(int j,
71  const double* bj,
72  const vnl_vector<double>& c) const override;
73 
74  //: construct the \param j-th perspective camera from a pointer to the j-th parameters of \param b and parameters \param c
76  param_to_pt_vector(int j,
77  const double* bj,
78  const vnl_vector<double>& c) const override;
79 
80  //: construct the \param i-th perspective camera from a pointer to the i-th parameters of \param a and parameters \param c
82  param_to_cam(int i,
83  const double* ai,
84  const vnl_vector<double>& c) const override;
85 
86  //: compute a 3x4 camera matrix of camera \param i from a pointer to the i-th parameters of \param a and parameters \param c
88  param_to_cam_matrix(int i,
89  const double* ai,
90  const vnl_vector<double>& c) const override;
91 
92  //: Create the parameter vectors \p a and \p c from a vector of cameras
93  static void
94  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 shared internal camera calibration
106  //: The shared internal camera calibration in matrix form
107  mutable vnl_double_3x3 Km_;
108 };
109 
110 
111 #endif // vpgl_ba_shared_k_lsqr_h_
vnl_vector_fixed< double, 4 > param_to_pt_vector(int j, const vnl_vector< double > &b, const vnl_vector< double > &c) const
construct the
virtual 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)=0
compute the Jacobian Cij.
vnl_double_3x4 param_to_cam_matrix(int i, const vnl_vector< double > &a, const vnl_vector< double > &c) const
construct the
virtual 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)=0
compute the Jacobian Aij.
Bundle adjustment sparse least squares base class.
base class bundle adjustment sparse least squares function.
vgl_homg_point_3d< double > param_to_point(int j, const vnl_vector< double > &b, const vnl_vector< double > &c) const
construct the
This class implements the perspective camera class as described in Hartley & Zisserman as a finite ca...
virtual 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)=0
compute the Jacobian Bij.
vpgl_perspective_camera< double > param_to_cam(int i, const vnl_vector< double > &a, const vnl_vector< double > &c) const
construct the