Go to the documentation of this file.00001
00002 #ifndef vpgl_calibration_matrix_h_
00003 #define vpgl_calibration_matrix_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <vgl/vgl_fwd.h>
00019 #include <vnl/vnl_fwd.h>
00020 #include <vnl/vnl_matrix_fixed.h>
00021 #include <vsl/vsl_binary_io.h>
00022 #include <vgl/vgl_point_2d.h>
00023
00024
00025
00026
00027
00028 template <class T>
00029 class vpgl_calibration_matrix
00030 {
00031 public:
00032
00033 vpgl_calibration_matrix();
00034
00035
00036 virtual ~vpgl_calibration_matrix(){}
00037
00038
00039
00040 vpgl_calibration_matrix( T focal_length, const vgl_point_2d<T>& principal_point,
00041 T x_scale = (T)1, T y_scale = (T)1, T skew = (T)0 );
00042
00043
00044
00045 vpgl_calibration_matrix( const vnl_matrix_fixed<T,3,3>& K );
00046
00047
00048 vnl_matrix_fixed<T,3,3> get_matrix() const;
00049
00050
00051 void set_focal_length( T new_focal_length );
00052 void set_principal_point( const vgl_point_2d<T>& new_principal_point );
00053 void set_x_scale( T new_x_scale );
00054 void set_y_scale( T new_y_scale );
00055 void set_skew( T new_skew );
00056
00057 T focal_length() const { return focal_length_; }
00058 vgl_point_2d<T> principal_point() const { return principal_point_; }
00059 T x_scale() const { return x_scale_; }
00060 T y_scale() const { return y_scale_; }
00061 T skew() const { return skew_; }
00062
00063
00064 bool operator==(vpgl_calibration_matrix<T> const &that) const;
00065 bool operator!=(vpgl_calibration_matrix<T> const &that) const
00066 {return !(*this==that);}
00067
00068
00069 vgl_point_2d<T> map_to_focal_plane(vgl_point_2d<T> const& p_image) const;
00070
00071 vgl_point_2d<T> map_to_image(vgl_point_2d<T> const& p_focal_plane) const;
00072
00073
00074
00075
00076 virtual void b_write(vsl_b_ostream &os) const;
00077
00078
00079 virtual void b_read(vsl_b_istream &is);
00080
00081
00082 short version() const {return 1;}
00083
00084 protected:
00085
00086 T focal_length_;
00087 vgl_point_2d<T> principal_point_;
00088 T x_scale_, y_scale_, skew_;
00089 };
00090
00091
00092
00093
00094 template <class T>
00095 void vsl_b_write(vsl_b_ostream &os, const vpgl_calibration_matrix<T>* p);
00096
00097
00098
00099 template <class T>
00100 void vsl_b_read(vsl_b_istream &is, vpgl_calibration_matrix<T>* &p);
00101
00102
00103 #endif // vpgl_calibration_matrix_h_