vpgl_lens_distortion.h
Go to the documentation of this file.
1 // This is core/vpgl/vpgl_lens_distortion.h
2 #ifndef vpgl_lens_distortion_h_
3 #define vpgl_lens_distortion_h_
4 //:
5 // \file
6 // \brief An abstract base class for all lens distortions.
7 // \author Matt Leotta
8 // \date August 19, 2005
9 //
10 // A lens distortion is a 2D warping of the image plane to account for lens effects
11 // not accounted for by the simple camera models. It is assumed that the map is
12 // bijective, though a closed form solution for the inverse may not exist in general.
13 // A default iterative solver is provided to solve for the inverse mapping.
14 // Currently the iterative solver has only been implemented for the specialized
15 // radial symmetric case in derived class vpgl_radial_distortion.
16 
17 //: forward declare vgl_homg_point_2d<T> and vgl_vector_2d<T>
18 #include <vgl/vgl_fwd.h>
19 #include "vcl_compiler_detection.h"
20 
21 //: A base class for lens distortions
22 template <class T>
24 {
25  public:
26 
27  virtual ~vpgl_lens_distortion()= default;
28 
29  //: Distort a projected point on the image plane
30  virtual vgl_homg_point_2d<T> distort( const vgl_homg_point_2d<T>& point ) const = 0;
31 
32  //: Return the original point that was distorted to this location (inverse of distort)
33  // \param init is an initial guess at the solution for the iterative solver
34  // if \p init is NULL then \p point is used as the initial guess
36  const vgl_homg_point_2d<T>* init=nullptr) const;
37 
38  //: Set a translation to apply before of after distortion
39  // This is needed when distorting an image to translate the resulting image
40  // such that all points have positive indices
41  virtual void set_translation(const vgl_vector_2d<T>& offset, bool after = true) = 0;
42 };
43 
44 
45 #endif // vpgl_lens_distortion_h_
virtual vgl_homg_point_2d< T > undistort(const vgl_homg_point_2d< T > &point, const vgl_homg_point_2d< T > *init=nullptr) const
Return the original point that was distorted to this location (inverse of distort).
virtual vgl_homg_point_2d< T > distort(const vgl_homg_point_2d< T > &point) const =0
Distort a projected point on the image plane.
forward declare vgl_homg_point_2d<T> and vgl_vector_2d<T>.
virtual void set_translation(const vgl_vector_2d< T > &offset, bool after=true)=0
Set a translation to apply before of after distortion.
virtual ~vpgl_lens_distortion()=default