contrib/rpl/rgrl/rgrl_scale_est_closest.h
Go to the documentation of this file.
00001 #ifndef rgrl_scale_est_closest_h_
00002 #define rgrl_scale_est_closest_h_
00003 //:
00004 // \file
00005 // \brief  Implementation of unweighted scale estimator using the closest of the match points.
00006 // \author Chuck Stewart
00007 // \date   25 Nov 2002
00008 
00009 #include "rgrl_scale_estimator.h"
00010 
00011 #include <vcl_memory.h>
00012 #include <vnl/vnl_matrix.h>
00013 
00014 class rrel_objective;
00015 
00016 //: Unweighted scale estimator using closest of the match points.
00017 //
00018 // This can also be used as a weighted scale estimator, albeit one
00019 // that just ignores the weights.
00020 //
00021 // The scale estimator is able to estimate both the geometric scale
00022 // and the signature error in the form of the covariance matrix. The
00023 // latter is optional (do_signature_scale). In practice, if other
00024 // components for the registration engine require the use of
00025 // signature_error_vector, the do_signature_scale should be set to
00026 // true for the constructor.
00027 //
00028 class rgrl_scale_est_closest
00029   : public rgrl_scale_estimator
00030 {
00031  public:
00032   //:
00033   //\a obj is the objective function that will be used to estimate a
00034   //robust scale.  The one that is commonly used is the MUSE objective
00035   //function. The flag \a do_signature_scale determines whether a signature
00036   //covariance will be estimated.
00037   rgrl_scale_est_closest( vcl_auto_ptr<rrel_objective>  obj,
00038                           bool                          do_signature_scale = false );
00039 
00040   ~rgrl_scale_est_closest();
00041 
00042   rgrl_scale_sptr
00043   estimate_unweighted( rgrl_match_set const& match_set,
00044                        rgrl_scale_sptr const& current_scales,
00045                        bool penalize_scaling = false ) const;
00046 
00047   rgrl_scale_sptr
00048   estimate_weighted( rgrl_match_set const& match_set,
00049                      rgrl_scale_sptr const& current_scales,
00050                      bool use_signature_only = false,
00051                      bool penalize_scaling = false) const;
00052 
00053   // Defines type-related functions
00054   rgrl_type_macro( rgrl_scale_est_closest, rgrl_scale_estimator );
00055 
00056  private:
00057   //disabled
00058   rgrl_scale_est_closest( rgrl_scale_est_closest const& );
00059   rgrl_scale_est_closest& operator=( rgrl_scale_est_closest const& );
00060 
00061   bool
00062   compute_geometric_scale( double& scale,
00063                            rgrl_match_set const& match_set,
00064                            bool penalize_scaling ) const;
00065 
00066   bool
00067   compute_signature_inv_covar( vnl_matrix<double>&covar, 
00068                                rgrl_match_set const& match_set ) const;
00069 
00070  protected:
00071   bool do_signature_scale_;
00072   vcl_auto_ptr<rrel_objective> obj_;
00073 };
00074 
00075 #endif // rgrl_scale_est_closest_h_