contrib/gel/mrc/vpgl/vpgl_lens_distortion.txx
Go to the documentation of this file.
00001 // This is gel/mrc/vpgl/vpgl_lens_distortion.txx
00002 #ifndef vpgl_lens_distortion_txx_
00003 #define vpgl_lens_distortion_txx_
00004 //:
00005 // \file
00006 
00007 #include "vpgl_lens_distortion.h"
00008 #include <vgl/vgl_homg_point_2d.h>
00009 #include <vgl/vgl_point_2d.h>
00010 #if 0
00011 #include <vgl/vgl_vector_2d.h>
00012 #endif
00013 #include <vcl_cassert.h>
00014 
00015 //: Return the original point that was distorted to this location (inverse of distort)
00016 // \param init is an initial guess at the solution for the iterative solver
00017 // if \p init is NULL then \p point is used as the initial guess
00018 template <class T>
00019 vgl_homg_point_2d<T>
00020 vpgl_lens_distortion<T>::undistort( const vgl_homg_point_2d<T>& point,
00021                                     const vgl_homg_point_2d<T>* init ) const
00022 {
00023 #if 0 // Not yet implemented ...
00024   vgl_point_2d<T> pt = point;
00025   vgl_homg_point_2d<T> result = point;
00026   if (init)
00027     result = *init;
00028 
00029   vgl_vector_2d<T> e = pt - vgl_point_2d<T>(distort(result));
00030   // FIXME Do some iteration here to solve for result
00031   assert(false);
00032 
00033   return result;
00034 #else
00035   assert(!"Not yet implemented");
00036   return point;
00037 #endif
00038 }
00039 
00040 // Code for easy instantiation.
00041 #undef vpgl_LENS_DISTORTION_INSTANTIATE
00042 #define vpgl_LENS_DISTORTION_INSTANTIATE(T) \
00043 template class vpgl_lens_distortion<T >
00044 
00045 #endif // vpgl_lens_distortion_txx_