contrib/rpl/rgrl/rgrl_matcher_k_nearest_adv.h
Go to the documentation of this file.
00001 #ifndef rgrl_matcher_k_nearest_adv_h_
00002 #define rgrl_matcher_k_nearest_adv_h_
00003 //:
00004 // \file
00005 // \author Gehua Yang
00006 // \date   Dec 2006
00007 
00008 #include <rgrl/rgrl_matcher_k_nearest.h>
00009 #include <rgrl/rgrl_transformation_sptr.h>
00010 
00011 //: For each "from" feature, match the k nearest "to" features.
00012 //
00013 // This will map the "from" feature via the current transform and
00014 // select the k nearest "to" features to the mapped "from" feature.
00015 //
00016 // The some of the nearest features can optionally be discarded if it
00017 // is further than some threshold distance.
00018 //
00019 class rgrl_matcher_k_nearest_adv
00020   : public rgrl_matcher_k_nearest
00021 {
00022  public:
00023   //: Initialize the matcher to select \a k correspondences per "from" feature.
00024   //
00025   rgrl_matcher_k_nearest_adv( unsigned int k );
00026 
00027   //: Select at most \a k correspondences within the threshold.
00028   //
00029   // The matcher will select \a k correspondences from the list of
00030   // correspondences with Euclidean distance within the threshold
00031   // \a dist_thres.
00032   //
00033   rgrl_matcher_k_nearest_adv( unsigned int k, double dist_thres, double min_mapped_scale = -1, double thres_reuse_match = -1 );
00034 
00035   rgrl_match_set_sptr
00036   compute_matches( rgrl_feature_set const&       from_features,
00037                    rgrl_feature_set const&       to_features,
00038                    rgrl_view const&              current_view,
00039                    rgrl_transformation const&    current_xform,
00040                    rgrl_scale const&             /* current_scale */,
00041                    rgrl_match_set_sptr const&    old_matches = 0 );
00042 
00043 
00044   // Defines type-related functions
00045   rgrl_type_macro( rgrl_matcher_k_nearest_adv, rgrl_matcher_k_nearest);
00046 
00047  protected:
00048 
00049   //: validate the mapped feature
00050   inline
00051   bool validate( rgrl_feature_sptr const& mapped, rgrl_mask_sptr const& roi_sptr ) const;
00052 
00053  protected:
00054   double min_mapped_scale_;
00055   double sqr_thres_for_reuse_match_;
00056   rgrl_transformation_sptr prev_xform_;
00057 };
00058 
00059 #endif // rgrl_matcher_k_nearest_adv_h_