contrib/oxl/mvl/ComputeGRIC.h
Go to the documentation of this file.
00001 #ifndef ComputeGRIC_h
00002 #define ComputeGRIC_h
00003 
00004 #include <mvl/PairMatchSetCorner.h>
00005 #include <mvl/FMatrix.h>
00006 #include <mvl/HMatrix2D.h>
00007 #include <vcl_vector.h>
00008 #include <vcl_memory.h>
00009 
00010 class ComputeGRIC
00011 {
00012  public:
00013   ComputeGRIC(double std);
00014   ~ComputeGRIC();
00015 
00016   // Computations
00017   // Compute the GRIC score and indicate which model
00018   // is the best match for the set of point matches
00019   // Returning a 0 for a HMatrix2D and a 1 for FMatrix
00020   bool compute(PairMatchSetCorner* matches);
00021 
00022   // Data Access
00023   FMatrix* get_F() const { return F_.get(); }
00024   HMatrix2D* get_H() const { return H_.get(); }
00025 
00026   // Is Degenerate ?
00027   bool degenerate() const { return degenerate_; }
00028 
00029   // Return inliers after the computation
00030   vcl_vector<bool>& get_inliers() { return degenerate_ ? inliersH_ : inliersF_; }
00031 
00032   // Get the 4 and 7 points bases for the resulting relations
00033   vcl_vector<int>& get_basisF() { return basisF_; }
00034   vcl_vector<int>& get_basisH() { return basisH_; }
00035 
00036  protected:
00037   double std_;
00038   vcl_auto_ptr<FMatrix> F_;
00039   vcl_auto_ptr<HMatrix2D> H_;
00040   vcl_vector<double> residualsF_;
00041   vcl_vector<double> residualsH_;
00042   vcl_vector<bool> inliersF_;
00043   vcl_vector<bool> inliersH_;
00044   vcl_vector<int> basisF_;
00045   vcl_vector<int> basisH_;
00046   bool degenerate_;
00047 };
00048 
00049 #endif // ComputeGRIC_h