00001 // This is gel/mrc/vpgl/algo/vpgl_adjust_rational_trans_onept.h 00002 #ifndef vpgl_adjust_rational_trans_onept_h_ 00003 #define vpgl_adjust_rational_trans_onept_h_ 00004 //: 00005 // \file 00006 // \brief Adust image offsets to register a set of rational cameras 00007 // \author J. L. Mundy 00008 // \date July 29, 2007 00009 // 00010 00011 #include <vcl_vector.h> 00012 #include <vnl/vnl_vector.h> 00013 #include <vnl/vnl_least_squares_function.h> 00014 #include <vpgl/vpgl_rational_camera.h> 00015 #include <vpgl/vpgl_comp_rational_camera.h> 00016 #include <vgl/vgl_vector_2d.h> 00017 #include <vgl/vgl_point_2d.h> 00018 #include <vgl/vgl_point_3d.h> 00019 00020 //: 00021 // The image offsets of rational cameras typically must be adjusted to 00022 // compensate for errors in geographic alignment. This algorithm finds 00023 // a set of minium translations that registers the input set of images. 00024 // After registration, the images have geographically corresponding rational 00025 // cameras. That is, a visible 3-d point will project into its corresponding 00026 // image location in all the images. 00027 00028 class vpgl_z_search_lsqr : public vnl_least_squares_function 00029 { 00030 public: 00031 //: Constructor 00032 vpgl_z_search_lsqr(vcl_vector<vpgl_rational_camera<double> > const& cams, 00033 vcl_vector<vgl_point_2d<double> > const& image_pts, 00034 vgl_point_3d<double> const& initial_pt); 00035 //: Destructor 00036 virtual ~vpgl_z_search_lsqr() {} 00037 00038 //: The main function. 00039 // Given the parameter vector x, compute the vector of residuals fx. 00040 // fx has been sized appropriately before the call. 00041 virtual void f(vnl_vector<double> const& elevation, 00042 vnl_vector<double>& projection_error); 00043 double xm() const {return xm_;} 00044 double ym() const {return ym_;} 00045 protected: 00046 vpgl_z_search_lsqr();//not valid 00047 vgl_point_3d<double> initial_pt_; 00048 vcl_vector<vpgl_rational_camera<double> > cameras_; //cameras 00049 vcl_vector<vgl_point_2d<double> > image_pts_; //image points 00050 double xm_, ym_; 00051 }; 00052 00053 00054 class vpgl_adjust_rational_trans_onept 00055 { 00056 public: 00057 ~vpgl_adjust_rational_trans_onept() {} 00058 00059 static bool adjust(vcl_vector<vpgl_rational_camera<double> > const& cams, 00060 vcl_vector<vgl_point_2d<double> > const& corrs, 00061 vcl_vector<vgl_vector_2d<double> >& cam_translations, 00062 vgl_point_3d<double>& intersection); 00063 00064 protected: 00065 vpgl_adjust_rational_trans_onept(); 00066 }; 00067 00068 00069 #endif // vpgl_adjust_rational_trans_onept_h_
1.7.5.1