contrib/rpl/rgrl/rgrl_invariant_match.h
Go to the documentation of this file.
00001 #ifndef rgrl_invariant_match_h_
00002 #define rgrl_invariant_match_h_
00003 //:
00004 // \file
00005 // \brief A match based on the similarity of the invariant features
00006 // \author Charlene Tsai
00007 // \date March 2004
00008 
00009 #include "rgrl_invariant_sptr.h"
00010 #include "rgrl_transformation_sptr.h"
00011 #include "rgrl_scale_sptr.h"
00012 #include "rgrl_mask.h"
00013 
00014 #include "rgrl_invariant.h"
00015 #include "rgrl_transformation.h"
00016 #include "rgrl_scale.h"
00017 #include "rgrl_object.h"
00018 
00019 class rgrl_scale;
00020 
00021 class rgrl_invariant_match
00022   : public rgrl_object
00023 {
00024  public:
00025   //: Constructor
00026   rgrl_invariant_match(rgrl_invariant_sptr from,
00027                        rgrl_invariant_sptr to);
00028 
00029   //: Destructor
00030   ~rgrl_invariant_match(){}
00031 
00032   //: Returns a smart pointer to the "from" invariant
00033   rgrl_invariant_sptr from() const {return from_;}
00034 
00035   //: Returns a smart pointer to the "to" invariant
00036   rgrl_invariant_sptr to() const {return to_;}
00037 
00038   //: Returns the distance between the constellations in the match
00039   //  \note distance is calculated as the Euclidean distance in the
00040   //  "invariant space"
00041   double distance() const {return distance_;}
00042 
00043   //: Returns a transform smart pointer to the estimated transform
00044   rgrl_transformation_sptr transform() const;
00045 
00046   //: Return a scale smart pointer to the estimated similarity transform
00047   rgrl_scale_sptr scale() const;
00048 
00049   //: Computes the initial ROI where the initial transformation is valid
00050   rgrl_mask_box initial_region() const;
00051 
00052   //: Return true if the match is associated with an initial ROI
00053   //  The initial ROI is where the initial transformation is valid
00054   bool has_initial_region() const;
00055 
00056   //: Trigger the \a estimate() function of the \a to_ feature
00057   bool estimate();
00058 
00059   // Defines type-related functions
00060   rgrl_type_macro( rgrl_invariant_match, rgrl_object );
00061 
00062  private:
00063   rgrl_invariant_sptr from_;
00064   rgrl_invariant_sptr to_;
00065   double distance_;
00066   rgrl_transformation_sptr xform_;
00067   rgrl_scale_sptr          scale_;
00068   bool is_estimate_set_;
00069 };
00070 
00071 //: Compares two matches on the basis of invariance distance
00072 bool operator < (const rgrl_invariant_match& left,
00073                  const rgrl_invariant_match& right);
00074 
00075 //: Compares two matches on the basis of invariance distance
00076 bool operator > (const rgrl_invariant_match& left,
00077                  const rgrl_invariant_match& right);
00078 
00079 //: Same as operator <, but operates on smart pointers to constellation matches
00080 //  \note This function is used to in vcl_sort to sort vectors of smart
00081 //        pointers to pregl_constellation_match objects
00082 bool dist_less (const vbl_smart_ptr<rgrl_invariant_match>& left,
00083                 const vbl_smart_ptr<rgrl_invariant_match>& right);
00084 
00085 //: Same as operator >, but operates on smart pointers to constellation matches
00086 //  \note This function is used to in vcl_sort to sort vectors of smart
00087 //        pointers to pregl_constellation_match objects
00088 bool dist_greater (const vbl_smart_ptr<rgrl_invariant_match>& left,
00089                    const vbl_smart_ptr<rgrl_invariant_match>& right);
00090 
00091 #endif