contrib/rpl/rgrl/rgrl_matcher.h
Go to the documentation of this file.
00001 #ifndef rgrl_matcher_h_
00002 #define rgrl_matcher_h_
00003 //:
00004 // \file
00005 // \brief  Abstract base class to compute matches for a particular feature type. Multiple matches are allowed for each feature.
00006 // \author Chuck Stewart
00007 // \date   12 Nov 2002
00008 
00009 #include <rgrl/rgrl_match_set_sptr.h>
00010 #include <rgrl/rgrl_mask.h>
00011 #include <rgrl/rgrl_object.h>
00012 #include <rgrl/rgrl_feature_sptr.h>
00013 
00014 #include <vcl_stlfwd.h>
00015 
00016 class rgrl_feature_set;
00017 class rgrl_view;
00018 class rgrl_transformation;
00019 class rgrl_scale;
00020 
00021 //: Interface for the routines that compute matches.
00022 //
00023 class rgrl_matcher
00024   : public rgrl_object
00025 {
00026  public:
00027   virtual ~rgrl_matcher();
00028 
00029   //: Build the matches with a view (old interface)
00030   //
00031   virtual
00032   rgrl_match_set_sptr
00033   compute_matches( rgrl_feature_set const&    from_features,
00034                    rgrl_feature_set const&    to_features,
00035                    rgrl_view const&           current_view,
00036                    rgrl_transformation const& current_xform,
00037                    rgrl_scale const&          current_scale,
00038                    rgrl_match_set_sptr const& old_matches = 0 ) = 0;
00039 
00040   //: Build the matches with a view (new interface)
00041   //
00042   //  Current xform is embedded in the view
00043   rgrl_match_set_sptr
00044   compute_matches( rgrl_feature_set const&    from_features,
00045                    rgrl_feature_set const&    to_features,
00046                    rgrl_view const&           current_view,
00047                    rgrl_scale const&          current_scale,
00048                    rgrl_match_set_sptr const& old_matches = 0 );
00049 
00050   //: Build the matches without a view
00051   //
00052   rgrl_match_set_sptr
00053   compute_matches( rgrl_feature_set const&    from_features,
00054                    rgrl_feature_set const&    to_features,
00055                    rgrl_transformation const& current_xform,
00056                    rgrl_mask_box const&       from_region,
00057                    rgrl_mask_box const&       to_region,
00058                    rgrl_scale const&          current_scale,
00059                    rgrl_match_set_sptr const& old_matches = 0 );
00060 
00061   //: invert the matches according to inverse transformation
00062   virtual
00063   rgrl_match_set_sptr
00064   invert_matches( rgrl_match_set const&    current_set,
00065                   rgrl_view const&         current_view );
00066 
00067   // Defines type-related functions
00068   rgrl_type_macro( rgrl_matcher, rgrl_object );
00069 
00070  protected:
00071 
00072   //: this struct is used in invert_matches
00073   struct flip_node{
00074     rgrl_feature_sptr from_, to_;
00075     double            sig_wgt_;
00076 
00077     // less than operator
00078     bool operator<( flip_node const& other ) const;
00079   };
00080 
00081   typedef vcl_vector<flip_node>::const_iterator nodes_vec_iterator;
00082 
00083   virtual
00084   void
00085   add_one_flipped_match( rgrl_match_set_sptr& inv_set,
00086                          rgrl_view const& current_view,
00087                          nodes_vec_iterator const& begin_iter,
00088                          nodes_vec_iterator const& end_iter );
00089 };
00090 
00091 #endif