2 #ifndef vpgl_bundle_adjust_lsqr_h_ 3 #define vpgl_bundle_adjust_lsqr_h_ 25 # include <vcl_msvc_warnings.h> 37 unsigned int num_params_per_b,
38 unsigned int num_params_c,
40 const std::vector<std::vector<bool> >& mask);
47 unsigned int num_params_per_b,
48 unsigned int num_params_c,
51 const std::vector<std::vector<bool> >& mask);
71 void fij(
int i,
int j,
92 virtual void jac_Aij(
unsigned int i,
101 virtual void jac_Bij(
unsigned int i,
110 virtual void jac_Cij(
unsigned int i,
124 double& weight)
override;
235 #endif // vpgl_bundle_adjust_lsqr_h_ 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.
unsigned int index_a(int i) const
A class for the perspective camera model.
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)
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.
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*r...
vnl_vector_fixed< double, 4 > param_to_pt_vector(int j, const vnl_vector< double > &b, const vnl_vector< double > &c) const
construct the
unsigned int index_b(int j) const
static vnl_double_3x3 rod_to_matrix(vnl_vector< double > const &r)
Fast conversion of rotation from Rodrigues vector to matrix.
double scale2_
The square of the scale of the robust estimator.
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 | ...
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.
~vpgl_bundle_adjust_lsqr() override=default
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.
double const * data_block() const
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.
std::vector< vgl_point_2d< double > > image_points_
The corresponding points in the image.
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)
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.
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
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*...
This class implements the perspective camera class as described in Hartley & Zisserman as a finite ca...
bool use_covars_
Flag to enable covariance weighted errors.
std::vector< vnl_matrix< double > > factored_inv_covars_
The Cholesky factored inverse covariances for each image point.
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.
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)
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.
void set_residual_scale(double scale)
set the residual scale for the robust estimation.
vpgl_perspective_camera< double > param_to_cam(int i, const vnl_vector< double > &a, const vnl_vector< double > &c) const
construct the
void reset()
reset the weights.