cgv
Loading...
Searching...
No Matches
cgv::math::distorted_pinhole< T > Class Template Reference

pinhole camera including distortion according to Brown-Conrady model More...

#include <camera.h>

Inheritance diagram for cgv::math::distorted_pinhole< T >:
cgv::math::pinhole< T > cgv::math::distorted_pinhole_types cgv::math::camera< T >

Public Member Functions

 distorted_pinhole ()
 standard constructor initializes to no distortion
 
template<typename S >
 distorted_pinhole (const distorted_pinhole< S > &dp)
 copy constructor
 
distortion_result apply_distortion_model (const fvec< T, 2 > &xd, fvec< T, 2 > &xu, fmat< T, 2, 2 > *J_ptr=0, T epsilon=distortion_inversion_epsilon< T >()) const
 apply distortion model from distorted to undistorted image coordinates used in projection direction and return whether successful
 
distortion_inversion_result invert_distortion_model (const fvec< T, 2 > &xu, fvec< T, 2 > &xd, bool use_xd_as_initial_guess=false, unsigned *iteration_ptr=0, T epsilon=distortion_inversion_epsilon< T >(), unsigned max_nr_iterations=get_standard_max_nr_iterations(), T slow_down=get_standard_slow_down()) const
 invert model for image coordinate inversion
 
template<typename S >
void compute_distortion_map (std::vector< cgv::math::fvec< S, 2 > > &map, unsigned sub_sample=1, const cgv::math::fvec< S, 2 > &invalid_point=cgv::math::fvec< S, 2 >(S(-10000)), T epsilon=distortion_inversion_epsilon< T >(), unsigned max_nr_iterations=get_standard_max_nr_iterations(), T slow_down=get_standard_slow_down()) const
 compute for all pixels the distorted image coordinates with the invert_distortion_model() function and store it in a distortion map
 
- Public Member Functions inherited from cgv::math::pinhole< T >
 pinhole ()
 standard constructor
 
template<typename S >
 pinhole (const pinhole< S > &ph)
 copy constructor
 
fmat< T, 2, 3 > get_camera_matrix () const
 
fmat< T, 3, 3 > get_squared_camera_matrix () const
 
fmat< T, 4, 4 > get_homogeneous_camera_matrix () const
 
fvec< T, 2 > image_to_pixel_coordinates (const fvec< T, 2 > &x) const
 
fvec< T, 2 > pixel_to_image_coordinates (const fvec< T, 2 > &p) const
 
bool estimate_parameters (const std::vector< fmat< T, 3, 3 > > &Hs, bool quadratic_pixels=true, bool no_skew=true)
 

Static Public Member Functions

static T get_standard_slow_down ()
 slow down factor [0,1] to decrease step size during inverse Jacobian stepping
 
- Static Public Member Functions inherited from cgv::math::distorted_pinhole_types
static unsigned get_standard_max_nr_iterations ()
 default maximum number of iterations used for inversion of distortion models
 

Public Attributes

fvec< T, 2 > dc
 
k [6]
 
p [2]
 
max_radius_for_projection = T(10)
 
- Public Attributes inherited from cgv::math::pinhole< T >
unsigned w
 
unsigned h
 
fvec< T, 2 > s
 
fvec< T, 2 > c
 
skew = 0.0f
 

Additional Inherited Members

- Public Types inherited from cgv::math::distorted_pinhole_types
enum class  distortion_result { success , out_of_bounds , division_by_zero }
 possible results of applying distortion model More...
 
enum class  distortion_inversion_result {
  convergence , max_iterations_reached , divergence , out_of_bounds ,
  division_by_zero
}
 possible results of inverting distortion model More...
 

Detailed Description

template<typename T>
class cgv::math::distorted_pinhole< T >

pinhole camera including distortion according to Brown-Conrady model

Definition at line 399 of file camera.h.

Constructor & Destructor Documentation

◆ distorted_pinhole() [1/2]

template<typename T >
cgv::math::distorted_pinhole< T >::distorted_pinhole ( )
inline

standard constructor initializes to no distortion

Definition at line 411 of file camera.h.

◆ distorted_pinhole() [2/2]

template<typename T >
template<typename S >
cgv::math::distorted_pinhole< T >::distorted_pinhole ( const distorted_pinhole< S > &  dp)
inline

copy constructor

Definition at line 416 of file camera.h.

Member Function Documentation

◆ apply_distortion_model()

template<typename T >
distortion_result cgv::math::distorted_pinhole< T >::apply_distortion_model ( const fvec< T, 2 > &  xd,
fvec< T, 2 > &  xu,
fmat< T, 2, 2 > *  J_ptr = 0,
epsilon = distortion_inversion_epsilon<T>() 
) const
inline

apply distortion model from distorted to undistorted image coordinates used in projection direction and return whether successful

Failure cases are zero denominator in distortion formula or radius larger than max projection radius.

Definition at line 427 of file camera.h.

Referenced by cgv::math::distorted_pinhole< T >::invert_distortion_model().

◆ compute_distortion_map()

template<typename T >
template<typename S >
void cgv::math::distorted_pinhole< T >::compute_distortion_map ( std::vector< cgv::math::fvec< S, 2 > > &  map,
unsigned  sub_sample = 1,
const cgv::math::fvec< S, 2 > &  invalid_point = cgv::math::fvec<S, 2>(S(-10000)),
epsilon = distortion_inversion_epsilon<T>(),
unsigned  max_nr_iterations = get_standard_max_nr_iterations(),
slow_down = get_standard_slow_down() 
) const
inline

compute for all pixels the distorted image coordinates with the invert_distortion_model() function and store it in a distortion map

The distortion map can be computed to speed up distortion model inversion if these are used multiple times per pixel. Given the pixel coordinates x and y and the image width w the distorted image coordinate is looked up via distortion_map[w*y+x]. For pixels where the inversion of the distortion model failed, the invalid_point is stored. Further parameters are passed on the the invert_distortion_model() function.

Definition at line 529 of file camera.h.

References cgv::math::distorted_pinhole< T >::invert_distortion_model().

◆ get_standard_slow_down()

template<typename T >
static T cgv::math::distorted_pinhole< T >::get_standard_slow_down ( )
inlinestatic

slow down factor [0,1] to decrease step size during inverse Jacobian stepping

Definition at line 403 of file camera.h.

◆ invert_distortion_model()

template<typename T >
distortion_inversion_result cgv::math::distorted_pinhole< T >::invert_distortion_model ( const fvec< T, 2 > &  xu,
fvec< T, 2 > &  xd,
bool  use_xd_as_initial_guess = false,
unsigned *  iteration_ptr = 0,
epsilon = distortion_inversion_epsilon<T>(),
unsigned  max_nr_iterations = get_standard_max_nr_iterations(),
slow_down = get_standard_slow_down() 
) const
inline

invert model for image coordinate inversion

Parameters
xuinput ... undistorted image coordinates
xdoutput ... distorted image coordinates
use_xd_as_initial_guessif true the passed values in xd are used as initial guess, otherwise a pseudo inversion of the distortion model is used as initial guess
iteration_ptrif provided, the passed index is used as iteration counter and indicates after the call how many iterations have been performed
epsilonepsilon used to detect division by zero and convergence
max_nr_iterationsmaximum number of to be taken iterations
slow_downfactor in [0,1] to decrease step estimated by Jacobian inverse
Returns
reason of termination where in all case a best guess for xd is provided

Definition at line 469 of file camera.h.

References cgv::math::distorted_pinhole< T >::apply_distortion_model(), and cgv::math::fvec< T, N >::sqr_length().

Referenced by cgv::math::distorted_pinhole< T >::compute_distortion_map().

Member Data Documentation

◆ dc

template<typename T >
fvec<T,2> cgv::math::distorted_pinhole< T >::dc

Definition at line 405 of file camera.h.

◆ k

template<typename T >
T cgv::math::distorted_pinhole< T >::k[6]

Definition at line 407 of file camera.h.

◆ max_radius_for_projection

template<typename T >
T cgv::math::distorted_pinhole< T >::max_radius_for_projection = T(10)

Definition at line 409 of file camera.h.

◆ p

template<typename T >
T cgv::math::distorted_pinhole< T >::p[2]

Definition at line 407 of file camera.h.


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