Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes
vpgl_bundle_adj_lsqr Class Reference

Computes the residuals for bundle adjustment given that the cameras share a fixed internal calibration. More...

#include <vpgl_bundle_adjust.h>

Inheritance diagram for vpgl_bundle_adj_lsqr:
Inheritance graph
[legend]

List of all members.

Public Types

enum  UseGradient

Public Member Functions

 vpgl_bundle_adj_lsqr (const vcl_vector< vpgl_calibration_matrix< double > > &K, const vcl_vector< vgl_point_2d< double > > &image_points, const vcl_vector< vcl_vector< bool > > &mask, bool use_confidence_weights=true)
 Constructor.
 vpgl_bundle_adj_lsqr (const vcl_vector< vpgl_calibration_matrix< double > > &K, const vcl_vector< vgl_point_2d< double > > &image_points, const vcl_vector< vnl_matrix< double > > &inv_covars, const vcl_vector< vcl_vector< bool > > &mask, bool use_confidence_weights=true)
 Constructor.
virtual ~vpgl_bundle_adj_lsqr ()
virtual void f (vnl_vector< double > const &a, vnl_vector< double > const &b, vnl_vector< double > &e)
 Compute all the reprojection errors.
virtual void fij (int i, int j, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_vector< double > &fij)
 Compute the residuals from the ith component of a and the jth component of b.
virtual void jac_blocks (vnl_vector< double > const &a, vnl_vector< double > const &b, vcl_vector< vnl_matrix< double > > &A, vcl_vector< vnl_matrix< double > > &B)
 Compute the sparse Jacobian in block form.
void jac_Aij (vnl_double_3x4 const &Pi, vnl_double_3x3 const &K, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_matrix< double > &Aij)
 compute the Jacobian Aij.
void jac_Bij (vnl_double_3x4 const &Pi, vnl_vector< double > const &bj, vnl_matrix< double > &Bij)
 compute the Jacobian Bij.
vgl_homg_point_3d< double > param_to_point (int j, const vnl_vector< double > &b) const
 construct the jth 3D point from parameter vector b.
vpgl_perspective_camera< double > param_to_cam (int i, const vnl_vector< double > &a) const
 construct the ith perspective camera from parameter vector a.
vpgl_perspective_camera< double > param_to_cam (int i, const double *d) const
vnl_double_3x4 param_to_cam_matrix (int i, const vnl_vector< double > &a) const
 construct the ith perspective camera matrix from parameter vector
vnl_double_3x4 param_to_cam_matrix (int i, const double *d) const
vnl_matrix_fixed< double, 3, 3 > rod_to_matrix (const double *r) const
 Fast conversion of rotation from Rodrigues vector to matrix.
void reset ()
vcl_vector< double > weights () const
 return the current weights.
void throw_failure ()
void clear_failure ()
virtual void fd_jac_blocks (vnl_vector< double > const &a, vnl_vector< double > const &b, vcl_vector< vnl_matrix< double > > &A, vcl_vector< vnl_matrix< double > > &B, double stepsize)
virtual void jac_Aij (int i, int j, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_matrix< double > &Aij)
virtual void jac_Bij (int i, int j, vnl_vector< double > const &ai, vnl_vector< double > const &bj, vnl_matrix< double > &Bij)
void fd_jac_Aij (int i, int j, vnl_vector< double > const &ai, vnl_vector< double > const &bj, 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_matrix< double > &Bij, double stepsize)
virtual void trace (int iteration, vcl_vector< vnl_vector< double > > const &a, vcl_vector< vnl_vector< double > > const &b, vcl_vector< 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_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
const vnl_crs_indexresidual_indices () const

Static Public Member Functions

static vnl_vector< double > create_param_vector (const vcl_vector< vpgl_perspective_camera< double > > &cameras)
 Create the parameter vector a from a vector of cameras.
static vnl_vector< double > create_param_vector (const vcl_vector< vgl_point_3d< double > > &world_points)
 Create the parameter vector b from a vector of 3D points.

Public Attributes

 no_gradient
 use_gradient
bool failure

Protected Attributes

vcl_vector
< vpgl_calibration_matrix
< double > > 
K_
 The fixed internal camera calibration.
vcl_vector< vnl_double_3x3Km_
 The fixed internal camera calibration in matrix form.
vcl_vector< vgl_point_2d
< double > > 
image_points_
 The corresponding points in the image.
vcl_vector< vnl_matrix< double > > factored_inv_covars_
 The Cholesky factored inverse covariances for each image point.
bool use_covars_
 Flag to enable covariance weighted errors.
bool use_weights_
 Flag to enable confidence weighting.
vcl_vector< double > weights_
 The corresponding points in the image.
int iteration_count_
vnl_crs_index residual_indices_
vcl_vector< unsigned int > indices_a_
vcl_vector< unsigned int > indices_b_
vcl_vector< unsigned int > indices_e_
bool use_gradient_

Detailed Description

Computes the residuals for bundle adjustment given that the cameras share a fixed internal calibration.

Definition at line 21 of file vpgl_bundle_adjust.h.


Constructor & Destructor Documentation

vpgl_bundle_adj_lsqr::vpgl_bundle_adj_lsqr ( const vcl_vector< vpgl_calibration_matrix< double > > &  K,
const vcl_vector< vgl_point_2d< double > > &  image_points,
const vcl_vector< vcl_vector< bool > > &  mask,
bool  use_confidence_weights = true 
)

Constructor.

Note:
image points are not homogeneous because they require finite points to measure projection error

Definition at line 21 of file vpgl_bundle_adjust.cxx.

vpgl_bundle_adj_lsqr::vpgl_bundle_adj_lsqr ( const vcl_vector< vpgl_calibration_matrix< double > > &  K,
const vcl_vector< vgl_point_2d< double > > &  image_points,
const vcl_vector< vnl_matrix< double > > &  inv_covars,
const vcl_vector< vcl_vector< bool > > &  mask,
bool  use_confidence_weights = true 
)

Constructor.

Each image point is assigned an inverse covariance (error projector) matrix

Note:
image points are not homogeneous because they require finite points to measure projection error

Definition at line 42 of file vpgl_bundle_adjust.cxx.

virtual vpgl_bundle_adj_lsqr::~vpgl_bundle_adj_lsqr ( ) [inline, virtual]

Definition at line 41 of file vpgl_bundle_adjust.h.


Member Function Documentation

vnl_vector< double > vpgl_bundle_adj_lsqr::create_param_vector ( const vcl_vector< vpgl_perspective_camera< double > > &  cameras) [static]

Create the parameter vector a from a vector of cameras.

Definition at line 408 of file vpgl_bundle_adjust.cxx.

vnl_vector< double > vpgl_bundle_adj_lsqr::create_param_vector ( const vcl_vector< vgl_point_3d< double > > &  world_points) [static]

Create the parameter vector b from a vector of 3D points.

Definition at line 430 of file vpgl_bundle_adjust.cxx.

void vpgl_bundle_adj_lsqr::f ( vnl_vector< double > const &  a,
vnl_vector< double > const &  b,
vnl_vector< double > &  e 
) [virtual]

Compute all the reprojection errors.

Given the parameter vectors a and b, 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 92 of file vpgl_bundle_adjust.cxx.

void vpgl_bundle_adj_lsqr::fij ( int  i,
int  j,
vnl_vector< double > const &  ai,
vnl_vector< double > const &  bj,
vnl_vector< double > &  fij 
) [virtual]

Compute the residuals from the ith component of a and the jth component of b.

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 156 of file vpgl_bundle_adjust.cxx.

void vpgl_bundle_adj_lsqr::jac_Aij ( vnl_double_3x4 const &  Pi,
vnl_double_3x3 const &  K,
vnl_vector< double > const &  ai,
vnl_vector< double > const &  bj,
vnl_matrix< double > &  Aij 
)

compute the Jacobian Aij.

Definition at line 228 of file vpgl_bundle_adjust.cxx.

void vpgl_bundle_adj_lsqr::jac_Bij ( vnl_double_3x4 const &  Pi,
vnl_vector< double > const &  bj,
vnl_matrix< double > &  Bij 
)

compute the Jacobian Bij.

Definition at line 340 of file vpgl_bundle_adjust.cxx.

void vpgl_bundle_adj_lsqr::jac_blocks ( vnl_vector< double > const &  a,
vnl_vector< double > const &  b,
vcl_vector< vnl_matrix< double > > &  A,
vcl_vector< vnl_matrix< double > > &  B 
) [virtual]

Compute the sparse Jacobian in block form.

Construct the ith camera.

Reimplemented from vnl_sparse_lst_sqr_function.

Definition at line 187 of file vpgl_bundle_adjust.cxx.

vpgl_perspective_camera<double> vpgl_bundle_adj_lsqr::param_to_cam ( int  i,
const vnl_vector< double > &  a 
) const [inline]

construct the ith perspective camera from parameter vector a.

Definition at line 82 of file vpgl_bundle_adjust.h.

vpgl_perspective_camera<double> vpgl_bundle_adj_lsqr::param_to_cam ( int  i,
const double *  d 
) const [inline]

Definition at line 86 of file vpgl_bundle_adjust.h.

vnl_double_3x4 vpgl_bundle_adj_lsqr::param_to_cam_matrix ( int  i,
const vnl_vector< double > &  a 
) const [inline]

construct the ith perspective camera matrix from parameter vector

Parameters:
a.Bypass vpgl for efficiency

Definition at line 95 of file vpgl_bundle_adjust.h.

vnl_double_3x4 vpgl_bundle_adj_lsqr::param_to_cam_matrix ( int  i,
const double *  d 
) const [inline]

Definition at line 99 of file vpgl_bundle_adjust.h.

vgl_homg_point_3d<double> vpgl_bundle_adj_lsqr::param_to_point ( int  j,
const vnl_vector< double > &  b 
) const [inline]

construct the jth 3D point from parameter vector b.

Definition at line 75 of file vpgl_bundle_adjust.h.

void vpgl_bundle_adj_lsqr::reset ( ) [inline]

Definition at line 121 of file vpgl_bundle_adjust.h.

vnl_matrix_fixed< double, 3, 3 > vpgl_bundle_adj_lsqr::rod_to_matrix ( const double *  r) const

Fast conversion of rotation from Rodrigues vector to matrix.

Definition at line 372 of file vpgl_bundle_adjust.cxx.

vcl_vector<double> vpgl_bundle_adj_lsqr::weights ( ) const [inline]

return the current weights.

Definition at line 124 of file vpgl_bundle_adjust.h.


Member Data Documentation

vcl_vector<vnl_matrix<double> > vpgl_bundle_adj_lsqr::factored_inv_covars_ [protected]

The Cholesky factored inverse covariances for each image point.

Definition at line 134 of file vpgl_bundle_adjust.h.

vcl_vector<vgl_point_2d<double> > vpgl_bundle_adj_lsqr::image_points_ [protected]

The corresponding points in the image.

Definition at line 132 of file vpgl_bundle_adjust.h.

Definition at line 141 of file vpgl_bundle_adjust.h.

vcl_vector<vpgl_calibration_matrix<double> > vpgl_bundle_adj_lsqr::K_ [protected]

The fixed internal camera calibration.

Definition at line 128 of file vpgl_bundle_adjust.h.

vcl_vector<vnl_double_3x3> vpgl_bundle_adj_lsqr::Km_ [protected]

The fixed internal camera calibration in matrix form.

Definition at line 130 of file vpgl_bundle_adjust.h.

Flag to enable covariance weighted errors.

Definition at line 136 of file vpgl_bundle_adjust.h.

Flag to enable confidence weighting.

Definition at line 138 of file vpgl_bundle_adjust.h.

vcl_vector<double> vpgl_bundle_adj_lsqr::weights_ [protected]

The corresponding points in the image.

Definition at line 140 of file vpgl_bundle_adjust.h.


The documentation for this class was generated from the following files: