contrib/rpl/rgrl/rgrl_est_homography2d.h
Go to the documentation of this file.
00001 #ifndef rgrl_est_homography2d_h_
00002 #define rgrl_est_homography2d_h_
00003 
00004 //:
00005 // \file
00006 // \author Charlene Tsai
00007 // \date   Oct 2004
00008 
00009 #include <rgrl/rgrl_estimator.h>
00010 
00011 //: homography2D transform estimator
00012 //
00013 class rgrl_est_homography2d
00014   : public rgrl_linear_estimator
00015 {
00016  public:
00017   //: Default constructor
00018   //
00019   rgrl_est_homography2d( double condition_num_thrd = 0.0 );
00020 
00021   //: Estimates a quadratic transform.
00022   //
00023   // The return pointer is to a rgrl_trans_quadratic object.
00024   //
00025   // \sa rgrl_estimator::estimate
00026   //
00027   rgrl_transformation_sptr
00028   estimate( rgrl_set_of<rgrl_match_set_sptr> const& matches,
00029             rgrl_transformation const& cur_transform ) const;
00030 
00031   //: Estimates a quadratic transform.
00032   //
00033   // The return pointer is to a rgrl_trans_quadratic object.
00034   //
00035   // \sa rgrl_estimator::estimate
00036   //
00037   // The estimation technique is the normalized DLT (Direct Linear
00038   // Transformation) algorithm.
00039   rgrl_transformation_sptr
00040   estimate( rgrl_match_set_sptr matches,
00041             rgrl_transformation const& cur_transform ) const;
00042 
00043   //: Type of transformation estimated by this estimator.
00044   const vcl_type_info& transformation_type() const;
00045 
00046   // Defines type-related functions
00047   rgrl_type_macro( rgrl_est_homography2d, rgrl_linear_estimator );
00048 
00049  private:
00050   bool normalize( rgrl_set_of<rgrl_match_set_sptr> const& matches,
00051                   vcl_vector< vnl_vector<double> >& norm_froms,
00052                   vcl_vector< vnl_vector<double> >& norm_tos,
00053                   vcl_vector< double >& wgts,
00054                   double& from_scale,
00055                   double& to_scale,
00056                   vnl_vector< double > & from_center,
00057                   vnl_vector< double > & to_center ) const;
00058   void estimate_covariance( const vcl_vector< vnl_vector<double> >& norm_froms,
00059                             const vcl_vector< vnl_vector<double> >& norm_tos,
00060                             const vcl_vector< double >& wgts,
00061                             double from_scale,
00062                             double to_scale,
00063                             vnl_matrix<double>& covar ) const;
00064 
00065  private:
00066   double condition_num_thrd_;
00067 };
00068 
00069 #endif