Go to the documentation of this file.00001 #ifndef rrel_homography2d_est_h_
00002 #define rrel_homography2d_est_h_
00003
00004
00005
00006
00007
00008
00009
00010 #include <vcl_vector.h>
00011 #include <vgl/vgl_fwd.h>
00012 #include <vnl/vnl_fwd.h>
00013
00014 #include <rrel/rrel_estimation_problem.h>
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 class rrel_homography2d_est : public rrel_estimation_problem
00039 {
00040 public:
00041
00042
00043
00044 rrel_homography2d_est( const vcl_vector< vgl_homg_point_2d<double> > & from_pts,
00045 const vcl_vector< vgl_homg_point_2d<double> > & to_pts,
00046 unsigned int homog_dof = 8 );
00047
00048
00049
00050 rrel_homography2d_est( const vcl_vector< vnl_vector<double> > & from_pts,
00051 const vcl_vector< vnl_vector<double> > & to_pts,
00052 unsigned int homog_dof = 8 );
00053
00054
00055 virtual ~rrel_homography2d_est();
00056
00057
00058 unsigned int num_samples( ) const;
00059
00060
00061
00062
00063 unsigned int residual_dof() const { return 4; }
00064
00065
00066 bool fit_from_minimal_set( const vcl_vector<int>& point_indices,
00067 vnl_vector<double>& params ) const;
00068
00069
00070 void compute_residuals( const vnl_vector<double>& params,
00071 vcl_vector<double>& residuals ) const;
00072
00073
00074 bool weighted_least_squares_fit( vnl_vector<double>& params,
00075 vnl_matrix<double>& norm_covar,
00076 const vcl_vector<double>* weights=0 ) const;
00077
00078
00079
00080 virtual void homog_to_params(const vnl_matrix<double>& m,
00081 vnl_vector<double>& p) const;
00082
00083
00084
00085 virtual void params_to_homog(const vnl_vector<double>& p,
00086 vnl_matrix<double>& m) const;
00087
00088 public:
00089
00090 void print_points() const;
00091
00092 protected:
00093 void normalize( const vcl_vector< vnl_vector<double> >& pts,
00094 const vcl_vector< double >& wgts,
00095 vcl_vector< vnl_vector<double> > & norm_pts,
00096 vnl_matrix< double > & norm_matrix ) const;
00097
00098 protected:
00099 vcl_vector< vnl_vector<double> > from_pts_;
00100 vcl_vector< vnl_vector<double> > to_pts_;
00101 unsigned int homog_dof_;
00102 unsigned int min_num_pts_;
00103 };
00104
00105 #endif // rrel_homography2d_est_h_