vpgl_lens_distortion.hxx
Go to the documentation of this file.
1 // This is core/vpgl/vpgl_lens_distortion.hxx
2 #ifndef vpgl_lens_distortion_hxx_
3 #define vpgl_lens_distortion_hxx_
4 //:
5 // \file
6 
7 #include "vpgl_lens_distortion.h"
9 #include <vgl/vgl_point_2d.h>
10 #if 0
11 #include <vgl/vgl_vector_2d.h>
12 #endif
13 #include <cassert>
14 #ifdef _MSC_VER
15 # include <vcl_msvc_warnings.h>
16 #endif
17 
18 //: Return the original point that was distorted to this location (inverse of distort)
19 // \param init is an initial guess at the solution for the iterative solver
20 // if \p init is NULL then \p point is used as the initial guess
21 template <class T>
24  const vgl_homg_point_2d<T>* init ) const
25 {
26 #if 0 // Not yet implemented ...
27  vgl_point_2d<T> pt = point;
28  vgl_homg_point_2d<T> result = point;
29  if (init)
30  result = *init;
31 
32  vgl_vector_2d<T> e = pt - vgl_point_2d<T>(distort(result));
33  // FIXME Do some iteration here to solve for result
34  assert(false);
35 
36  return result;
37 #else
38  assert(!"Not yet implemented");
39  return point;
40 #endif
41 }
42 
43 // Code for easy instantiation.
44 #undef vpgl_LENS_DISTORTION_INSTANTIATE
45 #define vpgl_LENS_DISTORTION_INSTANTIATE(T) \
46 template class vpgl_lens_distortion<T >
47 
48 #endif // vpgl_lens_distortion_hxx_
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).
An abstract base class for all lens distortions.