base class bundle adjustment sparse least squares function. More...
#include <vpgl_bundle_adjust_lsqr.h>

Public Types | |
| enum | UseGradient |
| enum | UseWeights |
Public Member Functions | |
| vpgl_bundle_adjust_lsqr (unsigned int num_params_per_a, unsigned int num_params_per_b, unsigned int num_params_c, std::vector< vgl_point_2d< double > > image_points, const std::vector< std::vector< bool > > &mask) | |
| Constructor. More... | |
| vpgl_bundle_adjust_lsqr (unsigned int num_params_per_a, unsigned int num_params_per_b, unsigned int num_params_c, const std::vector< vgl_point_2d< double > > &image_points, const std::vector< vnl_matrix< double > > &inv_covars, const std::vector< std::vector< bool > > &mask) | |
| Constructor. More... | |
| ~vpgl_bundle_adjust_lsqr () override=default | |
| void | f (vnl_vector< double > const &a, vnl_vector< double > const &b, vnl_vector< double > const &c, vnl_vector< double > &e) override |
| Compute all the reprojection errors. More... | |
| void | fij (int i, int j, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_vector< double > const &c, vnl_vector< double > &fij) override |
| Compute the residuals from the ith component of a, the jth component of b, and all of c. More... | |
| void | jac_blocks (vnl_vector< double > const &a, vnl_vector< double > const &b, vnl_vector< double > const &c, std::vector< vnl_matrix< double > > &A, std::vector< vnl_matrix< double > > &B, std::vector< vnl_matrix< double > > &C) override |
| Compute the sparse Jacobian in block form. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| void | compute_weight_ij (int i, int j, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_vector< double > const &c, vnl_vector< double > const &fij, double &weight) override |
| Use an M-estimator to compute weights. More... | |
| void | set_residual_scale (double scale) |
| set the residual scale for the robust estimation. More... | |
| vgl_homg_point_3d< double > | param_to_point (int j, const vnl_vector< double > &b, const vnl_vector< double > &c) const |
| construct the More... | |
| virtual vgl_homg_point_3d< double > | param_to_point (int j, const double *bj, const vnl_vector< double > &c) const =0 |
| construct the More... | |
| vnl_vector_fixed< double, 4 > | param_to_pt_vector (int j, const vnl_vector< double > &b, const vnl_vector< double > &c) const |
| construct the More... | |
| virtual vnl_vector_fixed< double, 4 > | param_to_pt_vector (int j, const double *bj, const vnl_vector< double > &c) const =0 |
| construct the More... | |
| vpgl_perspective_camera< double > | param_to_cam (int i, const vnl_vector< double > &a, const vnl_vector< double > &c) const |
| construct the More... | |
| virtual vpgl_perspective_camera< double > | param_to_cam (int i, const double *ai, const vnl_vector< double > &c) const =0 |
| construct the More... | |
| vnl_double_3x4 | param_to_cam_matrix (int i, const vnl_vector< double > &a, const vnl_vector< double > &c) const |
| construct the More... | |
| virtual vnl_double_3x4 | param_to_cam_matrix (int i, const double *ai, const vnl_vector< double > &c) const =0 |
| compute the 3x4 matrix of camera More... | |
| void | reset () |
| reset the weights. More... | |
| virtual void | jac_Aij (unsigned int i, unsigned int j, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_vector< double > const &c, vnl_matrix< double > &Aij) |
| virtual void | jac_Bij (unsigned int i, unsigned int j, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_vector< double > const &c, vnl_matrix< double > &Bij) |
| virtual void | jac_Cij (unsigned int i, unsigned int j, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_vector< double > const &c, vnl_matrix< double > &Cij) |
| void | throw_failure () |
| void | clear_failure () |
| virtual void | fd_jac_blocks (vnl_vector< double > const &a, vnl_vector< double > const &b, vnl_vector< double > const &c, std::vector< vnl_matrix< double > > &A, std::vector< vnl_matrix< double > > &B, std::vector< vnl_matrix< double > > &C, double stepsize) |
| virtual void | compute_weights (vnl_vector< double > const &a, vnl_vector< double > const &b, vnl_vector< double > const &c, vnl_vector< double > const &f, vnl_vector< double > &weights) |
| virtual void | apply_weights (vnl_vector< double > const &weights, vnl_vector< double > &f) |
| virtual void | apply_weights (vnl_vector< double > const &weights, std::vector< vnl_matrix< double > > &A, std::vector< vnl_matrix< double > > &B, std::vector< vnl_matrix< double > > &C) |
| virtual void | jac_Aij (unsigned int i, unsigned int j, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_vector< double > const &c, vnl_matrix< double > &Aij) |
| virtual void | jac_Bij (unsigned int i, unsigned int j, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_vector< double > const &c, vnl_matrix< double > &Bij) |
| virtual void | jac_Cij (unsigned int i, unsigned int j, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_vector< double > const &c, vnl_matrix< double > &Cij) |
| void | fd_jac_Aij (int i, int j, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_vector< double > const &c, vnl_matrix< double > &Aij, double stepsize) |
| void | fd_jac_Bij (int i, int j, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_vector< double > const &c, vnl_matrix< double > &Bij, double stepsize) |
| void | fd_jac_Cij (int i, int j, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_vector< double > const &c, vnl_matrix< double > &Cij, double stepsize) |
| virtual void | apply_weight_ij (int i, int j, double const &weight, vnl_vector< double > &fij) |
| virtual void | apply_weight_ij (int i, int j, double const &weight, vnl_matrix< double > &Aij, vnl_matrix< double > &Bij, vnl_matrix< double > &Cij) |
| virtual void | trace (int iteration, vnl_vector< double > const &a, vnl_vector< double > const &b, vnl_vector< double > const &c, vnl_vector< double > const &e) |
| unsigned int | number_of_params_a (int i) const |
| unsigned int | number_of_params_b (int j) const |
| unsigned int | number_of_params_c () const |
| unsigned int | number_of_residuals (int k) const |
| unsigned int | number_of_residuals (int i, int j) const |
| unsigned int | index_a (int i) const |
| unsigned int | index_b (int j) const |
| unsigned int | index_e (int k) const |
| unsigned int | number_of_a () const |
| unsigned int | number_of_b () const |
| unsigned int | number_of_e () const |
| bool | has_gradient () const |
| bool | has_weights () const |
| const vnl_crs_index & | residual_indices () const |
Static Public Member Functions | |
| static vnl_double_3x3 | rod_to_matrix (vnl_vector< double > const &r) |
| Fast conversion of rotation from Rodrigues vector to matrix. More... | |
| static void | jac_inhomg_3d_point (vnl_double_3x4 const &P, vnl_vector< double > const &pt, vnl_matrix< double > &J) |
| compute the 2x3 Jacobian of camera projection with respect to point location df/dpt where $f(pt) = P*pt$. More... | |
| static void | jac_camera_center (vnl_double_3x3 const &M, vnl_vector< double > const &C, vnl_vector< double > const &pt, vnl_matrix< double > &J) |
| compute the 2x3 Jacobian of camera projection with respect to camera center df/dC where $f(C) = [M | -M*C]*pt$. More... | |
| static void | jac_camera_rotation (vnl_double_3x3 const &K, vnl_vector< double > const &C, vnl_vector< double > const &r, vnl_vector< double > const &pt, vnl_matrix< double > &J) |
| compute the 2x3 Jacobian of camera projection with respect to camera rotation df/dr where $f(r) = K*rod_to_matrix(r)*[I | -C]*pt$. More... | |
Public Attributes | |
| no_gradient | |
| use_gradient | |
| no_weights | |
| use_weights | |
| bool | failure |
Protected Attributes | |
| std::vector< vgl_point_2d< double > > | image_points_ |
| The corresponding points in the image. More... | |
| std::vector< vnl_matrix< double > > | factored_inv_covars_ |
| The Cholesky factored inverse covariances for each image point. More... | |
| bool | use_covars_ |
| Flag to enable covariance weighted errors. More... | |
| double | scale2_ |
| The square of the scale of the robust estimator. More... | |
| int | iteration_count_ |
| vnl_crs_index | residual_indices_ |
| std::vector< unsigned int > | indices_a_ |
| std::vector< unsigned int > | indices_b_ |
| unsigned int | num_params_c_ |
| std::vector< unsigned int > | indices_e_ |
| bool | use_gradient_ |
| bool | use_weights_ |
base class bundle adjustment sparse least squares function.
Definition at line 30 of file vpgl_bundle_adjust_lsqr.h.
| vpgl_bundle_adjust_lsqr::vpgl_bundle_adjust_lsqr | ( | unsigned int | num_params_per_a, |
| unsigned int | num_params_per_b, | ||
| unsigned int | num_params_c, | ||
| std::vector< vgl_point_2d< double > > | image_points, | ||
| const std::vector< std::vector< bool > > & | mask | ||
| ) |
Constructor.
Definition at line 20 of file vpgl_bundle_adjust_lsqr.cxx.
| vpgl_bundle_adjust_lsqr::vpgl_bundle_adjust_lsqr | ( | unsigned int | num_params_per_a, |
| unsigned int | num_params_per_b, | ||
| unsigned int | num_params_c, | ||
| const std::vector< vgl_point_2d< double > > & | image_points, | ||
| const std::vector< vnl_matrix< double > > & | inv_covars, | ||
| const std::vector< std::vector< bool > > & | mask | ||
| ) |
Constructor.
Each image point is assigned an inverse covariance (error projector) matrix
Definition at line 41 of file vpgl_bundle_adjust_lsqr.cxx.
|
overridedefault |
|
overridevirtual |
Use an M-estimator to compute weights.
Reimplemented from vnl_sparse_lst_sqr_function.
Definition at line 199 of file vpgl_bundle_adjust_lsqr.cxx.
|
overridevirtual |
Compute all the reprojection errors.
Given the parameter vectors a, b, and c, compute the vector of residuals e. e has been sized appropriately before the call. The parameters in for each camera are in a. The 3D point parameters are in b. Global parameters are in c.
Given the parameter vectors a, b, and c, compute the vector of residuals e. e has been sized appropriately before the call. The parameters in a for each camera are {wx, wy, wz, tx, ty, tz} where w is the Rodrigues vector of the rotation and t is the translation. The parameters in b for each 3D point are {px, py, pz} the non-homogeneous position.
Construct the ith camera.
Reimplemented from vnl_sparse_lst_sqr_function.
Definition at line 88 of file vpgl_bundle_adjust_lsqr.cxx.
|
overridevirtual |
Compute the residuals from the ith component of a, the jth component of b, and all of c.
Compute the residuals from the ith component of a and the jth component of b.
This function is not normally used because f() has a self-contained efficient implementation. It is used for finite-differencing if the gradient is marked as unavailable
This is not normally used because f() has a self-contained efficient implementation It is used for finite-differencing if the gradient is marked as unavailable
Construct the ith camera.
Reimplemented from vnl_sparse_lst_sqr_function.
Definition at line 129 of file vpgl_bundle_adjust_lsqr.cxx.
| virtual void vnl_sparse_lst_sqr_function::jac_Aij |
|
pure virtual |
compute the Jacobian Aij.
Implemented in vpgl_ba_fixed_k_lsqr.
| virtual void vnl_sparse_lst_sqr_function::jac_Bij |
|
pure virtual |
compute the Jacobian Bij.
Implemented in vpgl_ba_fixed_k_lsqr.
|
overridevirtual |
Compute the sparse Jacobian in block form.
Construct the ith camera.
Reimplemented from vnl_sparse_lst_sqr_function.
Definition at line 159 of file vpgl_bundle_adjust_lsqr.cxx.
|
static |
compute the 2x3 Jacobian of camera projection with respect to camera center df/dC where $f(C) = [M | -M*C]*pt$.
Definition at line 250 of file vpgl_bundle_adjust_lsqr.cxx.
|
static |
compute the 2x3 Jacobian of camera projection with respect to camera rotation df/dr where $f(r) = K*rod_to_matrix(r)*[I | -C]*pt$.
Here r is a Rodrigues vector, K is an upper triangular calibration matrix
Definition at line 266 of file vpgl_bundle_adjust_lsqr.cxx.
| virtual void vnl_sparse_lst_sqr_function::jac_Cij |
|
pure virtual |
compute the Jacobian Cij.
Implemented in vpgl_ba_fixed_k_lsqr.
|
static |
compute the 2x3 Jacobian of camera projection with respect to point location df/dpt where $f(pt) = P*pt$.
Definition at line 218 of file vpgl_bundle_adjust_lsqr.cxx.
|
inline |
construct the
| i-th | perspective camera from parameter vector |
| a. |
Definition at line 162 of file vpgl_bundle_adjust_lsqr.h.
|
pure virtual |
construct the
| i-th | perspective camera from a pointer to the i-th parameter of |
| ai | and parameters |
| c. |
Implemented in vpgl_ba_fixed_k_lsqr.
|
inline |
construct the
| i-th | perspective camera matrix from parameter vectors |
| a | and |
| c. |
Definition at line 176 of file vpgl_bundle_adjust_lsqr.h.
|
pure virtual |
compute the 3x4 matrix of camera
| i | from a pointer to the i-th parameter of |
| ai | and parameters |
| c. |
Implemented in vpgl_ba_fixed_k_lsqr.
|
inline |
construct the
| j-th | 3D point from parameter vector |
| b | and |
| c. |
Definition at line 132 of file vpgl_bundle_adjust_lsqr.h.
|
pure virtual |
construct the
| j-th | perspective camera from a pointer to the j-th parameter of |
| bj | and parameters |
| c. |
Implemented in vpgl_ba_fixed_k_lsqr.
|
inline |
construct the
| j-th | 3D point from parameter vector |
| b | and |
| c. |
Definition at line 147 of file vpgl_bundle_adjust_lsqr.h.
|
pure virtual |
construct the
| j-th | perspective camera from a pointer to the j-th parameter of |
| bj | and parameters |
| c. |
Implemented in vpgl_ba_fixed_k_lsqr.
|
inline |
reset the weights.
Definition at line 189 of file vpgl_bundle_adjust_lsqr.h.
|
static |
Fast conversion of rotation from Rodrigues vector to matrix.
Definition at line 360 of file vpgl_bundle_adjust_lsqr.cxx.
|
inline |
set the residual scale for the robust estimation.
Definition at line 127 of file vpgl_bundle_adjust_lsqr.h.
|
protected |
The Cholesky factored inverse covariances for each image point.
Definition at line 225 of file vpgl_bundle_adjust_lsqr.h.
|
protected |
The corresponding points in the image.
Definition at line 223 of file vpgl_bundle_adjust_lsqr.h.
|
protected |
Definition at line 231 of file vpgl_bundle_adjust_lsqr.h.
|
protected |
The square of the scale of the robust estimator.
Definition at line 229 of file vpgl_bundle_adjust_lsqr.h.
|
protected |
Flag to enable covariance weighted errors.
Definition at line 227 of file vpgl_bundle_adjust_lsqr.h.
1.8.15