contrib/oxl/mvl/HMatrix2DComputeRobust.h
Go to the documentation of this file.
00001 #ifndef HMatrix2DComputeRobust_h
00002 #define HMatrix2DComputeRobust_h
00003 //:
00004 // \file
00005 // \brief Robust HMatrix computation
00006 //
00007 // \verbatim
00008 //  Modifications
00009 //   22 Oct 2002 - Peter Vanroose - added vgl_homg_point_2d interface
00010 // \endverbatim
00011 
00012 #include <vgl/vgl_fwd.h>
00013 #include <mvl/HMatrix2DCompute4Point.h>
00014 #include <mvl/HMatrix2D.h>
00015 #include <mvl/AffineMetric.h>
00016 #include <mvl/HomgPoint2D.h>
00017 #include <vcl_vector.h>
00018 
00019 class HMatrix2DComputeRobust
00020 {
00021  public:
00022   HMatrix2DComputeRobust();
00023   virtual ~HMatrix2DComputeRobust();
00024 
00025   bool compute(PairMatchSetCorner& matches, HMatrix2D* H);
00026 
00027   // Return a HMatrix2D computed as above.
00028   HMatrix2D compute(PairMatchSetCorner& matches);
00029   HMatrix2D compute(vcl_vector<HomgPoint2D>& points1, vcl_vector<HomgPoint2D>& points2);
00030   HMatrix2D compute(vcl_vector<vgl_homg_point_2d<double> >& points1,
00031                     vcl_vector<vgl_homg_point_2d<double> >& points2);
00032 
00033   // Data Access
00034   vcl_vector<int> get_basis() const { return basis_; }
00035   vcl_vector<double> get_residuals() const { return residuals_; }
00036   vcl_vector<bool> get_inliers() const { return inliers_; }
00037 
00038   virtual double calculate_term(vcl_vector<double>& residuals, vcl_vector<bool>& inlier_list, int& count);
00039   virtual double calculate_residual(HomgPoint2D& one, HomgPoint2D& two, HMatrix2D* H);
00040   virtual double calculate_residual(vgl_homg_point_2d<double>& one,
00041                                     vgl_homg_point_2d<double>& two,
00042                                     HMatrix2D* H);
00043   vcl_vector<double> calculate_residuals(vcl_vector<HomgPoint2D>& one, vcl_vector<HomgPoint2D>& two, HMatrix2D* H);
00044   vcl_vector<double> calculate_residuals(vcl_vector<vgl_homg_point_2d<double> >& one,
00045                                          vcl_vector<vgl_homg_point_2d<double> >& two,
00046                                          HMatrix2D* H);
00047   double stdev(vcl_vector<double>& residuals);
00048 
00049   double std_;
00050   vcl_vector<int> basis_;
00051   int data_size_;
00052   vcl_vector<double> residuals_;
00053   vcl_vector<bool> inliers_;
00054   //  AffineMetric metric_;
00055 };
00056 
00057 #endif // HMatrix2DComputeRobust_h