00001 #ifndef rrel_lts_obj_h_ 00002 #define rrel_lts_obj_h_ 00003 //: 00004 // \file 00005 // \author Chuck Stewart (stewart@cs.rpi.edu) 00006 // \brief The Least-Trimmed-Squares (LTS) objective function 00007 00008 #include <rrel/rrel_objective.h> 00009 00010 //: The Least-Trimmed-Squares (LTS) objective function. 00011 // The Least-Trimmed-of-Squares algorithm was defined in a 1984 00012 // Journal of the American Statistical Association paper by Peter 00013 // Rousseeuw (vol 79, pp 871-880). (See Stewart, "Robust Parameter 00014 // Estimation in Computer Vision", SIAM Reviews 41, Sept 1999.) The 00015 // class implemented here gives the objective function for that 00016 // algorithm. It is computed from a set of (signed) residuals. The 00017 // objective function is the sum of the squares of the first 00018 // (increased order) inlier_frac squared residuals. The default 00019 // inlier_frac is 0.5, but it could be any value. The search 00020 // algorithm is implemented in rrel_ran_sam_search. 00021 00022 class rrel_lts_obj : public rrel_objective 00023 { 00024 public: 00025 //: Constructor. 00026 // \a num_sam_inst is the minimum number of samples needed for 00027 // a unique parameter estimate. That is, num_sam_inst should be set 00028 // to rrel_estimation_problem::num_samples_to_instantiate(). \a 00029 // inlier_frac is the minimum expected number of inlier 00030 // residuals. In general, \a inlier_frac should be 1 minus the 00031 // maximum expected fraction of outliers. If the maximum expected 00032 // fraction of outliers is not known, then the MUSE objective 00033 // function should be used. 00034 rrel_lts_obj( unsigned int num_sam_inst, double inlier_frac=0.5 ); 00035 00036 ~rrel_lts_obj(); 00037 00038 //: Evaluate the objective function on heteroscedastic residuals. 00039 // \sa rrel_objective::fcn. 00040 virtual double fcn( vect_const_iter res_begin, vect_const_iter res_end, 00041 vect_const_iter /* scale is unused */, 00042 vnl_vector<double>* = 0 /* param vector is unused */ ) const; 00043 00044 //: Evaluate the objective function on homoscedastic residuals. 00045 // \sa rrel_objective::fcn. 00046 virtual double fcn( vect_const_iter begin, vect_const_iter end, 00047 double = 0 /* scale is unused */, 00048 vnl_vector<double>* = 0 /* param vector is unused */ ) const; 00049 00050 //: False. 00051 // The LTS objective is based on order statistics, and does not 00052 // require any scale parameter, estimated or otherwise. 00053 virtual bool requires_prior_scale() const 00054 { return false; } 00055 00056 protected: 00057 //: Number of samples needed for a unique fit = number of dependent residuals. 00058 unsigned int num_sam_inst_; 00059 double inlier_frac_; 00060 }; 00061 00062 #endif