/** * @file GenericLocalFeatureSelection.h * @brief This class provides a generic chooser function for different descriptors, which are derived from LocalFeature. * @author Eric Bach * @date 26.10.2011 */ #ifndef _NICE_OBJREC_LOCALFEATURESELECTION_INCLUDE #define _NICE_OBJREC_LOCALFEATURESELECTION_INCLUDE #include "vislearning/features/localfeatures/LocalFeatureRepresentation.h" // color-descriptor #include "vislearning/features/localfeatures/LocalFeatureRGBSift.h" #include "vislearning/features/localfeatures/LocalFeatureOpponnentSift.h" // non-color-descriptor #include "vislearning/features/localfeatures/LocalFeatureSift.h" /** NOTE: This class only returns Descriptors, which NEED given positions. NO Descriptors calculate there own positions. **/ namespace OBJREC { class GenericLocalFeatureSelection { public: /** LocalFeature Selector * @brief This methode switches between the different LocalFeature-Types. One has to set the "localfeature_type" on a valid value and the methode returns a LocalFeatureRepresentation derived Object. * @param[in] Config* - A pointer to the given configfile, which must contain "section" - "localfeature_type" * @param[in] string - This string defines the value for "section" in the configfile. * @return LocalFeatureRepresentation* - The LocalFeatureRepresentation which contains the selected LocalFeature-Type. */ static LocalFeature *selectLocalFeature ( const NICE::Config *conf, std::string section = "Features" ) { // return Value LocalFeature *lf = NULL; // string which defines the localfeature_type (for Ex. RGB, OppSift, Sift...) std::string localfeature_type = conf->gS ( section, "localfeature_type", "not defined" ); // The prefix NICE_* indicates that this implementation comes from a NICE-Developer. // Extern implementations can be added without NICE_* in this selection-class. if ( localfeature_type == "NICE_SIFT" ) { lf = new LocalFeatureSift ( conf ); } else if ( localfeature_type == "NICE_RGBSIFT" ) { lf = new LocalFeatureRGBSift ( conf ); } else if ( localfeature_type == "NICE_OPPSIFT" ) { lf = new LocalFeatureOpponnentSift ( conf ); } // no correct localfeature_type was given if ( lf == NULL ) fthrow ( NICE::Exception, "Local feature type not found: " << localfeature_type ); return lf; } }; } #endif