contrib/rpl/rrel/rrel_ransac_obj.cxx
Go to the documentation of this file.
00001 // This is rpl/rrel/rrel_ransac_obj.cxx
00002 #include "rrel_ransac_obj.h"
00003 
00004 rrel_ransac_obj::rrel_ransac_obj( double scale_mult )
00005   : scale_mult_( scale_mult )
00006 {
00007 }
00008 
00009 rrel_ransac_obj::~rrel_ransac_obj( )
00010 {
00011 }
00012 
00013 
00014 double
00015 rrel_ransac_obj::fcn( vect_const_iter res_begin, vect_const_iter res_end,
00016                       vect_const_iter scale_begin,
00017                       vnl_vector<double>* /*param_vector*/ ) const
00018 {
00019   double sum = 0;
00020 
00021   for ( ; res_begin != res_end; ++res_begin, ++scale_begin ) {
00022     double thres = *scale_begin * scale_mult_;
00023     if ( *res_begin < -thres || *res_begin > thres )
00024       sum += 1.0;
00025   }
00026 
00027   return sum;
00028 }
00029 
00030 double
00031 rrel_ransac_obj::fcn( vect_const_iter begin, vect_const_iter end,
00032                       double scale,
00033                       vnl_vector<double>* /*param_vector*/ ) const
00034 {
00035   double sum = 0;
00036   double thres = scale * scale_mult_;
00037 
00038   for ( ; begin != end; ++begin ) {
00039     if ( *begin < -thres || *begin > thres )
00040       sum += 1.0;
00041   }
00042 
00043   return sum;
00044 }