Go to the documentation of this file.00001
00002 #ifndef vpgl_optimize_camera_h_
00003 #define vpgl_optimize_camera_h_
00004
00005
00006
00007
00008
00009
00010 #include <vnl/vnl_least_squares_function.h>
00011 #include <vgl/vgl_point_2d.h>
00012 #include <vgl/vgl_point_3d.h>
00013 #include <vgl/vgl_homg_point_3d.h>
00014 #include <vpgl/vpgl_perspective_camera.h>
00015
00016
00017 class vpgl_orientation_lsqr : public vnl_least_squares_function
00018 {
00019 public:
00020
00021
00022 vpgl_orientation_lsqr(const vpgl_calibration_matrix<double>& K,
00023 const vgl_point_3d<double>& c,
00024 const vcl_vector<vgl_homg_point_3d<double> >& world_points,
00025 const vcl_vector<vgl_point_2d<double> >& image_points );
00026
00027 virtual ~vpgl_orientation_lsqr() {}
00028
00029
00030
00031
00032
00033
00034 virtual void f(vnl_vector<double> const& x, vnl_vector<double>& fx);
00035
00036 #if 0
00037
00038 virtual void trace(int iteration, vnl_vector<double> const& x, vnl_vector<double> const& fx);
00039 #endif
00040
00041 protected:
00042
00043 vpgl_calibration_matrix<double> K_;
00044
00045 vgl_point_3d<double> c_;
00046
00047 vcl_vector<vgl_homg_point_3d<double> > world_points_;
00048
00049 vcl_vector<vgl_point_2d<double> > image_points_;
00050 };
00051
00052
00053
00054 class vpgl_orientation_position_lsqr : public vnl_least_squares_function
00055 {
00056 public:
00057
00058
00059 vpgl_orientation_position_lsqr(const vpgl_calibration_matrix<double>& K,
00060 const vcl_vector<vgl_homg_point_3d<double> >& world_points,
00061 const vcl_vector<vgl_point_2d<double> >& image_points );
00062
00063 virtual ~vpgl_orientation_position_lsqr() {}
00064
00065
00066
00067
00068
00069
00070 virtual void f(vnl_vector<double> const& x, vnl_vector<double>& fx);
00071
00072 #if 0
00073
00074 virtual void trace(int iteration, vnl_vector<double> const& x, vnl_vector<double> const& fx);
00075 #endif
00076
00077 protected:
00078
00079 vpgl_calibration_matrix<double> K_;
00080
00081 vcl_vector<vgl_homg_point_3d<double> > world_points_;
00082
00083 vcl_vector<vgl_point_2d<double> > image_points_;
00084 };
00085
00086
00087 class vpgl_orientation_position_calibration_lsqr : public vnl_least_squares_function
00088 {
00089 public:
00090
00091
00092 vpgl_orientation_position_calibration_lsqr(const vcl_vector<vgl_homg_point_3d<double> >& world_points,
00093 const vcl_vector<vgl_point_2d<double> >& image_points );
00094
00095 virtual ~vpgl_orientation_position_calibration_lsqr() {}
00096
00097
00098
00099
00100
00101
00102 virtual void f(vnl_vector<double> const& x, vnl_vector<double>& fx);
00103
00104 #if 0
00105
00106 virtual void trace(int iteration, vnl_vector<double> const& x, vnl_vector<double> const& fx);
00107 #endif
00108
00109 protected:
00110
00111 vcl_vector<vgl_homg_point_3d<double> > world_points_;
00112
00113 vcl_vector<vgl_point_2d<double> > image_points_;
00114 };
00115
00116
00117 class vpgl_optimize_camera
00118 {
00119 public:
00120 ~vpgl_optimize_camera();
00121
00122
00123 static vpgl_perspective_camera<double>
00124 opt_orient(const vpgl_perspective_camera<double>& camera,
00125 const vcl_vector<vgl_homg_point_3d<double> >& world_points,
00126 const vcl_vector<vgl_point_2d<double> >& image_points );
00127
00128
00129 static vpgl_perspective_camera<double>
00130 opt_orient_pos(const vpgl_perspective_camera<double>& camera,
00131 const vcl_vector<vgl_homg_point_3d<double> >& world_points,
00132 const vcl_vector<vgl_point_2d<double> >& image_points );
00133
00134
00135 static vpgl_perspective_camera<double>
00136 opt_orient_pos_cal(const vpgl_perspective_camera<double>& camera,
00137 const vcl_vector<vgl_homg_point_3d<double> >& world_points,
00138 const vcl_vector<vgl_point_2d<double> >& image_points,
00139 const double xtol = 0.0001, const unsigned nevals=10000);
00140
00141
00142 private:
00143
00144 vpgl_optimize_camera();
00145 };
00146
00147 #endif // vpgl_optimize_camera_h_