Go to the documentation of this file.00001 #ifndef rgrl_trans_homography2d_h_
00002 #define rgrl_trans_homography2d_h_
00003
00004
00005
00006
00007
00008 #include "rgrl_transformation.h"
00009 #include <vnl/vnl_matrix_fixed.h>
00010 #include <vnl/vnl_vector_fixed.h>
00011 #include <vcl_iosfwd.h>
00012
00013
00014
00015
00016
00017 class rgrl_trans_homography2d
00018 : public rgrl_transformation
00019 {
00020 public:
00021
00022 rgrl_trans_homography2d();
00023
00024
00025
00026 rgrl_trans_homography2d( vnl_matrix<double> const& H,
00027 vnl_matrix<double> const& covar );
00028
00029
00030
00031
00032 rgrl_trans_homography2d( vnl_matrix<double> const& H );
00033
00034
00035
00036 rgrl_trans_homography2d( vnl_matrix<double> const& H,
00037 vnl_matrix<double> const& covar,
00038 vnl_vector<double> const& from_centre,
00039 vnl_vector<double> const& to_centre );
00040
00041 vnl_matrix<double> transfer_error_covar( vnl_vector<double> const& p ) const;
00042
00043
00044 void inv_map( const vnl_vector<double>& to,
00045 vnl_vector<double>& from ) const;
00046
00047
00048 void inv_map( const vnl_vector<double>& to,
00049 bool initialize_next,
00050 const vnl_vector<double>& to_delta,
00051 vnl_vector<double>& from,
00052 vnl_vector<double>& from_next_est) const;
00053
00054
00055 bool is_invertible() const { return true; }
00056
00057
00058 rgrl_transformation_sptr inverse_transform() const;
00059
00060
00061 virtual void jacobian_wrt_loc( vnl_matrix<double>& jac, vnl_vector<double> const& from_loc ) const;
00062
00063
00064 vnl_matrix_fixed<double,2,3> homo_jacobian( vnl_vector_fixed<double,2> const& from_loc ) const;
00065
00066
00067 rgrl_transformation_sptr scale_by( double scale ) const;
00068
00069
00070 virtual double
00071 log_det_covar() const
00072 { return log_det_covar_deficient( 8 ); }
00073
00074
00075 rgrl_type_macro( rgrl_trans_homography2d, rgrl_transformation );
00076
00077
00078 void write(vcl_ostream& os ) const;
00079
00080
00081 bool read(vcl_istream& is );
00082
00083
00084 rgrl_transformation_sptr clone() const;
00085
00086
00087 vnl_matrix_fixed<double, 3, 3> H() const;
00088
00089
00090 vnl_matrix_fixed<double,3,3> uncenter_H_matrix() const;
00091
00092 protected:
00093 void map_loc( vnl_vector<double> const& from,
00094 vnl_vector<double> & to ) const;
00095
00096 void map_dir( vnl_vector<double> const& from_loc,
00097 vnl_vector<double> const& from_dir,
00098 vnl_vector<double> & to_dir ) const;
00099
00100 private:
00101 vnl_matrix_fixed<double,3,3> H_;
00102 vnl_vector_fixed<double,2> from_centre_;
00103 vnl_vector_fixed<double,2> to_centre_;
00104 };
00105
00106 #endif