00001 // This is gel/mrc/vpgl/algo/vpgl_construct_cameras.h 00002 #ifndef vpgl_construct_cameras_h_ 00003 #define vpgl_construct_cameras_h_ 00004 //: 00005 // \file 00006 // \brief This class creates a pair of cameras from a set of corresponding points from a pair of images. 00007 // \author Vishal Jain, (vj@lems.brown.edu) 00008 // \date Aug 31, 2004 00009 // 00010 // The first camera is assumed to be identity with supplied calibration matrix. 00011 // The second camera's center is unique up to a scale. 00012 // 00013 // \verbatim 00014 // Modifications 00015 // 9/01/2006 Thomas Pollard Converted to vpgl, changed image origin to be UL corner. 00016 // 3/04/2007 J.L. Mundy This implementation is now deprecated, use 00017 // camera extraction defined on vpgl_essential_matrix. 00018 // \endverbatim 00019 00020 #include <vgl/vgl_point_2d.h> 00021 #include <vcl_vector.h> 00022 #include <vgl/vgl_point_3d.h> 00023 #include <vnl/vnl_double_3x3.h> 00024 #include <vpgl/vpgl_calibration_matrix.h> 00025 #include <vpgl/vpgl_perspective_camera.h> 00026 00027 class vpgl_construct_cameras 00028 { 00029 public: 00030 00031 //: constructor 00032 vpgl_construct_cameras(); 00033 00034 //: constructor initializing the set of points 00035 vpgl_construct_cameras( 00036 vcl_vector<vgl_point_2d<double> > p0, 00037 vcl_vector<vgl_point_2d<double> > p1, 00038 const vpgl_calibration_matrix<double>* K = NULL ); 00039 00040 ~vpgl_construct_cameras(); 00041 00042 //: function to construct cameras 00043 // \deprecated in favour of vpgl_essential_matrix public function 00044 bool construct(); 00045 00046 //: returns the projection matrix for the cameras 00047 const vpgl_perspective_camera<double>& get_camera1(){return P1_;} 00048 const vpgl_perspective_camera<double>& get_camera2(){return P2_;} 00049 00050 //: gets the world points 00051 void get_world_points( vcl_vector< vgl_point_3d<double> >& world_points ); 00052 00053 private: 00054 00055 // Lifted from brct_algos, since don't want to link vsol. 00056 vgl_point_3d<double> triangulate_3d_point( 00057 const vgl_point_2d<double>& x1, 00058 const vnl_double_3x4& P1, 00059 const vgl_point_2d<double>& x2, 00060 const vnl_double_3x4& P2 ); 00061 00062 //: set of points 00063 vcl_vector<vgl_point_2d<double> > points0_; 00064 vcl_vector<vgl_point_2d<double> > points1_; 00065 00066 vnl_double_3x3 K_; 00067 vnl_double_3x3 E_; 00068 vpgl_perspective_camera<double> P1_,P2_; 00069 }; 00070 00071 #endif // vpgl_construct_cameras_h_
1.7.5.1