Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
vpgl_orientation_position_focal_lsqr Class Reference

this class optimizes the rotation/translation/focal length of a perspective camera given an initial estimate. More...

#include <vpgl_optimize_camera.h>

Inheritance diagram for vpgl_orientation_position_focal_lsqr:
Inheritance graph
[legend]

Public Types

enum  UseGradient
 

Public Member Functions

 vpgl_orientation_position_focal_lsqr (const vpgl_calibration_matrix< double > &K_init, const std::vector< vgl_homg_point_3d< double > > &world_points, std::vector< vgl_point_2d< double > > image_points)
 Constructor. More...
 
 ~vpgl_orientation_position_focal_lsqr () override=default
 Destructor. More...
 
void f (vnl_vector< double > const &x, vnl_vector< double > &fx) override
 The main function. More...
 
void gradf (vnl_vector< double > const &x, vnl_matrix< double > &jacobian) override
 Gradients of the cost-function w.r.t. to the 7 free parameters of x. More...
 
void throw_failure ()
 
void clear_failure ()
 
void fdgradf (vnl_vector< double > const &x, vnl_matrix< double > &jacobian, double stepsize)
 
void ffdgradf (vnl_vector< double > const &x, vnl_matrix< double > &jacobian, double stepsize)
 
virtual void trace (int iteration, vnl_vector< double > const &x, vnl_vector< double > const &fx)
 
double rms (vnl_vector< double > const &x)
 
unsigned int get_number_of_unknowns () const
 
unsigned int get_number_of_residuals () const
 
bool has_gradient () const
 
bool VNL_ALGO_EXPORT vnl_discrete_diff_fwd (vnl_least_squares_function *lsf, double h, vnl_vector< double > const &x, vnl_matrix< double > &J)
 
bool VNL_ALGO_EXPORT vnl_discrete_diff_fwd (vnl_least_squares_function *lsf, vnl_vector< double > const &h, vnl_vector< double > const &x, vnl_matrix< double > &J)
 
bool VNL_ALGO_EXPORT vnl_discrete_diff_fwd (vnl_least_squares_function *lsf, vnl_vector< double > const &h, vnl_vector< double > const &x, vnl_vector< double > const &y, vnl_matrix< double > &J)
 
bool VNL_ALGO_EXPORT vnl_discrete_diff_sym (vnl_least_squares_function *lsf, double h, vnl_vector< double > const &x, vnl_matrix< double > &J)
 
bool VNL_ALGO_EXPORT vnl_discrete_diff_sym (vnl_least_squares_function *lsf, vnl_vector< double > const &h, vnl_vector< double > const &x, vnl_matrix< double > &J)
 

Public Attributes

 no_gradient
 
 use_gradient
 
bool failure
 

Protected Member Functions

void init (unsigned int number_of_unknowns, unsigned int number_of_residuals)
 

Protected Attributes

vpgl_calibration_matrix< double > K_init_
 The initial calibration matrix. More...
 
std::vector< vgl_homg_point_3d< double > > world_points_
 The known points in the world. More...
 
std::vector< vgl_point_2d< double > > image_points_
 The corresponding points in the image. More...
 
unsigned int p_
 
unsigned int n_
 
bool use_gradient_
 

Detailed Description

this class optimizes the rotation/translation/focal length of a perspective camera given an initial estimate.

Definition at line 117 of file vpgl_optimize_camera.h.

Constructor & Destructor Documentation

◆ vpgl_orientation_position_focal_lsqr()

vpgl_orientation_position_focal_lsqr::vpgl_orientation_position_focal_lsqr ( const vpgl_calibration_matrix< double > &  K_init,
const std::vector< vgl_homg_point_3d< double > > &  world_points,
std::vector< vgl_point_2d< double > >  image_points 
)

Constructor.

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

Definition at line 160 of file vpgl_optimize_camera.cxx.

◆ ~vpgl_orientation_position_focal_lsqr()

vpgl_orientation_position_focal_lsqr::~vpgl_orientation_position_focal_lsqr ( )
overridedefault

Destructor.

Member Function Documentation

◆ f()

void vpgl_orientation_position_focal_lsqr::f ( vnl_vector< double > const &  x,
vnl_vector< double > &  fx 
)
overridevirtual

The main function.

Given the parameter vector x, compute the vector of residuals fx. Fx has been sized appropriately before the call. The parameters in x are really two three component vectors {wx, wy, wz, tx, ty, tz} where w is the Rodrigues vector of the rotation and t is the translation.

Given the parameter vector x, compute the vector of residuals fx. Fx has been sized appropriately before the call. The parameters in x are quaternion, translation, focal length {q: x, y, z, r | t: t1, t2, t3 | f}

Implements vnl_least_squares_function.

Definition at line 177 of file vpgl_optimize_camera.cxx.

◆ gradf()

void vpgl_orientation_position_focal_lsqr::gradf ( vnl_vector< double > const &  xvec,
vnl_matrix< double > &  jacobian 
)
overridevirtual

Gradients of the cost-function w.r.t. to the 7 free parameters of x.

Gradients of the cost-function w.r.t. to the 8 free parameters of x.

The seven parameters are rotation(wx, wy, wz), translation(tx, ty, tz) and focal length (Fx)

The eight parameters are quaternions(wx, wy, wz), translation(tx, ty, tz) and focal length (Fx)

Reimplemented from vnl_least_squares_function.

Definition at line 207 of file vpgl_optimize_camera.cxx.

Member Data Documentation

◆ image_points_

std::vector<vgl_point_2d<double> > vpgl_orientation_position_focal_lsqr::image_points_
protected

The corresponding points in the image.

Definition at line 150 of file vpgl_optimize_camera.h.

◆ K_init_

vpgl_calibration_matrix<double> vpgl_orientation_position_focal_lsqr::K_init_
protected

The initial calibration matrix.

Definition at line 146 of file vpgl_optimize_camera.h.

◆ world_points_

std::vector<vgl_homg_point_3d<double> > vpgl_orientation_position_focal_lsqr::world_points_
protected

The known points in the world.

Definition at line 148 of file vpgl_optimize_camera.h.


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