|
@@ -1,100 +0,0 @@
|
|
|
-/**
|
|
|
-* @file GenericLocalFeatureSelection.h
|
|
|
-* @brief This class provides a generic chooser function for different descriptors, which are derived from LocalFeatureRepresentation.
|
|
|
-* @date 26.10.2011
|
|
|
-*/
|
|
|
-
|
|
|
-#ifndef _NICE_OBJREC_LF_SELECTION_INCLUDE
|
|
|
-#define _NICE_OBJREC_LF_SELECTION_INCLUDE
|
|
|
-
|
|
|
-#include "vislearning/features/localfeatures/LocalFeatureRepresentation.h"
|
|
|
-#include "vislearning/features/localfeatures/LFMikolajczyk.h"
|
|
|
-#include "vislearning/features/localfeatures/LFPatches.h"
|
|
|
-#include "vislearning/features/localfeatures/LFGenericLocal.h"
|
|
|
-#include "vislearning/features/localfeatures/LFSiftPP.h"
|
|
|
-// #include "vislearning/features/localfeatures/LFSegmentation.h" //located in objrec, please move this to ensure its functionality
|
|
|
-#include "vislearning/features/localfeatures/LFWriteCache.h"
|
|
|
-#include "vislearning/features/localfeatures/LFReadCache.h"
|
|
|
-// #include "vislearning/features/localfeatures/LFSegContour.h"
|
|
|
-#include "vislearning/features/localfeatures/LFColorSande.h"
|
|
|
-#include "vislearning/features/localfeatures/LFonHSG.h"
|
|
|
-
|
|
|
-/** NOTE: This class only returns Descriptors, which NOT need any given positions. All Descriptors calculate there own positions, on DIFFERENT ways. **/
|
|
|
-
|
|
|
-
|
|
|
-namespace OBJREC {
|
|
|
-
|
|
|
-class GenericLFSelection
|
|
|
-{
|
|
|
- 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
|
|
|
- LocalFeatureRepresentation *selectLocalFeatureRep ( const NICE::Config *conf, std::string section = "features" )
|
|
|
- {
|
|
|
- // return Value
|
|
|
- LocalFeatureRepresentation *lfrep = NULL;
|
|
|
-
|
|
|
- // string which defines the localfeature_type (for Ex. Sande, ...)
|
|
|
- std::string localfeature_type = conf->gS(section, "localfeature_type", "");
|
|
|
-
|
|
|
- if ( localfeature_type == "mikolajczyk" )
|
|
|
- {
|
|
|
- lfrep = new LFMikolajczyk ( conf );
|
|
|
- }
|
|
|
- else if ( localfeature_type == "color" )
|
|
|
- {
|
|
|
- lfrep = new LFColorSande ( conf );
|
|
|
- }
|
|
|
- else if ( ( localfeature_type == "sift" ) || ( localfeature_type == "siftpp" ) )
|
|
|
- {
|
|
|
- lfrep = new LFSiftPP ( conf );
|
|
|
- }
|
|
|
- else if ( ( localfeature_type == "generic_local" ) || ( localfeature_type == "generic" ) )
|
|
|
- {
|
|
|
- int numFeatures = conf->gI(section, "localfeature_count");
|
|
|
- lfrep = new LFGenericLocal ( conf, numFeatures );
|
|
|
- }
|
|
|
- else if ( ( localfeature_type == "grey" ) || ( localfeature_type == "patches" ) )
|
|
|
- {
|
|
|
- int numFeatures = conf->gI(section, "localfeature_count");
|
|
|
- lfrep = new LFPatches ( conf, numFeatures );
|
|
|
- }
|
|
|
- else if( ( localfeature_type == "onHSG" ) )
|
|
|
- {
|
|
|
- lfrep = new LFonHSG( conf);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- lfrep = NULL;
|
|
|
- }
|
|
|
-
|
|
|
- if ( conf->gB(section, "localfeature_cache_read", false) )
|
|
|
- {
|
|
|
- int numFeatures = conf->gI(section, "localfeature_count", -1);
|
|
|
- LocalFeatureRepresentation *lfrep_read = new LFReadCache ( conf, lfrep, numFeatures );
|
|
|
- lfrep = lfrep_read;
|
|
|
- }
|
|
|
-
|
|
|
- // no correct localfeature_type was given
|
|
|
- if ( lfrep == NULL )
|
|
|
- fthrow(Exception, "Local feature type not found: " << localfeature_type );
|
|
|
-
|
|
|
- if ( conf->gB(section, "localfeature_cache_save", false) )
|
|
|
- {
|
|
|
- LocalFeatureRepresentation *lfrep_save = new LFWriteCache ( conf, lfrep );
|
|
|
- lfrep = lfrep_save;
|
|
|
- }
|
|
|
-
|
|
|
- return lfrep;
|
|
|
- }
|
|
|
-};
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-#endif
|