core/vpgl/algo/vpgl_backproject.h
Go to the documentation of this file.
00001 // This is core/vpgl/algo/vpgl_backproject.h
00002 #ifndef vpgl_backproject_h_
00003 #define vpgl_backproject_h_
00004 //:
00005 // \file
00006 // \brief Methods for back_projecting from cameras to 3-d geometric structures
00007 // \author J. L. Mundy
00008 // \date Oct 29, 2006
00009 
00010 #include <vpgl/vpgl_rational_camera.h>
00011 #include <vpgl/vpgl_local_rational_camera.h>
00012 #include <vpgl/vpgl_proj_camera.h>
00013 #include <vgl/vgl_fwd.h>
00014 #include <vnl/vnl_double_2.h>
00015 #include <vnl/vnl_double_3.h>
00016 #include <vnl/vnl_double_4.h>
00017 
00018 class vpgl_backproject
00019 {
00020  public:
00021   ~vpgl_backproject();
00022 
00023   //: Generic camera interfaces (pointer for abstract class)
00024   // An iterative solution using forward projection
00025   // vnl interface
00026 
00027   //:Backproject an image point onto a plane, start with initial_guess
00028   static bool bproj_plane(const vpgl_camera<double>* cam,
00029                           vnl_double_2 const& image_point,
00030                           vnl_double_4 const& plane,
00031                           vnl_double_3 const& initial_guess,
00032                           vnl_double_3& world_point,
00033                           double error_tol = 0.05);
00034 
00035        // === vgl interface ===
00036 
00037   //:Backproject an image point onto a plane, start with initial_guess
00038   static bool bproj_plane(const vpgl_camera<double>*  cam,
00039                           vgl_point_2d<double> const& image_point,
00040                           vgl_plane_3d<double> const& plane,
00041                           vgl_point_3d<double> const& initial_guess,
00042                           vgl_point_3d<double>& world_point,
00043                           double error_tol = 0.05);
00044 
00045             // +++ concrete rational camera interfaces +++
00046 
00047        // === vnl interface ===
00048 
00049   //:Backproject an image point onto a plane, start with initial_guess
00050   static bool bproj_plane(vpgl_rational_camera<double> const& rcam,
00051                           vnl_double_2 const& image_point,
00052                           vnl_double_4 const& plane,
00053                           vnl_double_3 const& initial_guess,
00054                           vnl_double_3& world_point,
00055                           double error_tol = 0.05);
00056 
00057        // ==== vgl interface ===
00058 
00059   //:Backproject an image point onto a plane, start with initial_guess
00060   static bool bproj_plane(vpgl_rational_camera<double> const& rcam,
00061                           vgl_point_2d<double> const& image_point,
00062                           vgl_plane_3d<double> const& plane,
00063                           vgl_point_3d<double> const& initial_guess,
00064                           vgl_point_3d<double>& world_point,
00065                           double error_tol = 0.05);
00066 
00067   //:Backproject a point with associated direction vector in the image to a plane in 3-d, passing through the center of projection and containing the point and vector.
00068   //  ** Defined only for a projective camera **
00069   static bool bproj_point_vector(vpgl_proj_camera<double> const& cam,
00070                                  vgl_point_2d<double> const& point,
00071                                  vgl_vector_2d<double> const& vect,
00072                                  vgl_plane_3d<double>& plane);
00073 
00074   //: Use backprojection to determine direction to camera from 3-d point
00075   static bool direction_to_camera(vpgl_local_rational_camera<double> const& cam,
00076                                   vgl_point_3d<double> const& point,
00077                                   vgl_vector_3d<double> &to_camera);
00078 
00079  private:
00080   //: constructor private - static methods only
00081   vpgl_backproject();
00082 };
00083 
00084 #endif // vpgl_backproject_h_