瀏覽代碼

added novelty detection interface and implementation of ND based on codebooks

Alexander Freytag 12 年之前
父節點
當前提交
d97816c036

+ 8 - 0
noveltyDetection/Makefile

@@ -0,0 +1,8 @@
+#TARGETS_FROM:=$(notdir $(patsubst %/,%,$(shell pwd)))/$(TARGETS_FROM)
+#$(info recursivly going up: $(TARGETS_FROM) ($(shell pwd)))
+
+all:
+
+%:
+	$(MAKE) TARGETS_FROM=$(notdir $(patsubst %/,%,$(shell pwd)))/$(TARGETS_FROM) -C .. $@
+

+ 103 - 0
noveltyDetection/Makefile.inc

@@ -0,0 +1,103 @@
+# LIBRARY-DIRECTORY-MAKEFILE
+# conventions:
+# - all subdirectories containing a "Makefile.inc" are considered sublibraries
+#   exception: "progs/" and "tests/" subdirectories!
+# - all ".C", ".cpp" and ".c" files in the current directory are linked to a
+#   library
+# - the library depends on all sublibraries 
+# - the library name is created with $(LIBNAME), i.e. it will be somehow
+#   related to the directory name and with the extension .a
+#   (e.g. lib1/sublib -> lib1_sublib.a)
+# - the library will be added to the default build list ALL_LIBRARIES
+
+# --------------------------------
+# - remember the last subdirectory
+#
+# set the variable $(SUBDIR) correctly to the current subdirectory. this
+# variable can be used throughout the current makefile.inc. The many 
+# SUBDIR_before, _add, and everything are only required so that we can recover
+# the previous content of SUBDIR before exitting the makefile.inc
+
+SUBDIR_add:=$(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
+SUBDIR_before:=$(SUBDIR)
+SUBDIR:=$(strip $(SUBDIR_add))
+SUBDIR_before_$(SUBDIR):=$(SUBDIR_before)
+ifeq "$(SUBDIR)" "./"
+SUBDIR:=
+endif
+
+# ------------------------
+# - include subdirectories
+#
+# note the variables $(SUBDIRS_OF_$(SUBDIR)) are required later on to recover
+# the dependencies automatically. if you handle dependencies on your own, you
+# can also dump the $(SUBDIRS_OF_$(SUBDIR)) variable, and include the
+# makefile.inc of the subdirectories on your own...
+
+SUBDIRS_OF_$(SUBDIR):=$(patsubst %/Makefile.inc,%,$(wildcard $(SUBDIR)*/Makefile.inc))
+include $(SUBDIRS_OF_$(SUBDIR):%=%/Makefile.inc)
+
+# ----------------------------
+# - include local dependencies
+#
+# you can specify libraries needed by the individual objects or by the whole
+# directory. the object specific additional libraries are only considered
+# when compiling the specific object files
+# TODO: update documentation...
+
+-include $(SUBDIR)libdepend.inc
+
+$(foreach d,$(filter-out %progs %tests,$(SUBDIRS_OF_$(SUBDIR))),$(eval $(call PKG_DEPEND_INT,$(d))))
+
+# ---------------------------
+# - objects in this directory
+#
+# the use of the variable $(OBJS) is not mandatory. it is mandatory however
+# to update $(ALL_OBJS) in a way that it contains the path and name of
+# all objects. otherwise we can not include the appropriate .d files.
+
+OBJS:=$(patsubst %.cpp,$(OBJDIR)%.o,$(notdir $(wildcard $(SUBDIR)*.cpp))) \
+      $(patsubst %.C,$(OBJDIR)%.o,$(notdir $(wildcard $(SUBDIR)*.C))) \
+	  $(shell grep -ls Q_OBJECT $(SUBDIR)*.h | sed -e's@^@/@;s@.*/@$(OBJDIR)moc_@;s@\.h$$@.o@') \
+      $(patsubst %.c,$(OBJDIR)%.o,$(notdir $(wildcard $(SUBDIR)*.c)))
+ALL_OBJS += $(OBJS)
+
+# ----------------------------
+# - binaries in this directory
+#
+# output of binaries in this directory. none of the variables has to be used.
+# but everything you add to $(ALL_LIBRARIES) and $(ALL_BINARIES) will be
+# compiled with `make all`. be sure again to add the files with full path.
+
+LIBRARY_BASENAME:=$(call LIBNAME,$(SUBDIR))
+ifneq "$(SUBDIR)" ""
+ALL_LIBRARIES+=$(LIBDIR)$(LIBRARY_BASENAME).$(LINK_FILE_EXTENSION)
+endif
+
+# ---------------------
+# - binary dependencies
+#
+# there is no way of determining the binary dependencies automatically, so we
+# follow conventions. the current library depends on all sublibraries.
+# all other dependencies have to be added manually by specifying, that the
+# current .pc file depends on some other .pc file. binaries depending on
+# libraries should exclusivelly use the .pc files as well.
+
+ifeq "$(SKIP_BUILD_$(OBJDIR))" "1"
+$(LIBDIR)$(LIBRARY_BASENAME).a:
+else
+$(LIBDIR)$(LIBRARY_BASENAME).a:$(OBJS) \
+	$(call PRINT_INTLIB_DEPS,$(PKGDIR)$(LIBRARY_BASENAME).a,.$(LINK_FILE_EXTENSION))
+endif
+
+$(PKGDIR)$(LIBRARY_BASENAME).pc: \
+	$(call PRINT_INTLIB_DEPS,$(PKGDIR)$(LIBRARY_BASENAME).pc,.pc)
+
+# -------------------
+# - subdir management
+#
+# as the last step, always add this line to correctly recover the subdirectory
+# of the makefile including this one!
+
+SUBDIR:=$(SUBDIR_before_$(SUBDIR))
+

+ 72 - 0
noveltyDetection/NDCodebookLevelImagePooling.cpp

@@ -0,0 +1,72 @@
+
+#include "NDCodebookLevelImagePooling.h"
+
+//STL
+#include <iostream>
+
+//core
+#include <core/vector/VectorT.h>
+
+using namespace std;
+using namespace NICE;
+using namespace OBJREC;
+
+  //**********************************************
+  //
+  //                 PROTECTED METHODS
+  //
+  //********************************************** 
+
+
+
+  //**********************************************
+  //
+  //                 PUBLIC METHODS
+  //
+  //********************************************** 
+
+
+NDCodebookLevelImagePooling::NDCodebookLevelImagePooling ( const Config *_conf,
+                               const MultiDataset *_md, const std::string & _section )
+    : NoveltyDetectorCodebookLevel ( _conf, _md, _section )
+{ 
+  this->section = _section;
+//   d_noveltyThreshold = conf->gD ( section , "noveltyThreshold", 0.0064 );  
+  d_noveltyThreshold = conf->gD ( section , "stupidNoveltyThreshold", 0.0064 );  
+}
+
+NDCodebookLevelImagePooling::~NDCodebookLevelImagePooling()
+{
+}
+
+bool NDCodebookLevelImagePooling::evaluateNoveltyOfImage ( const std::string & _filename )
+{
+  ROADWORKSNOVDET;
+}
+
+bool NDCodebookLevelImagePooling::evaluateNoveltyOfImage ( const NICE::FloatImage & _noveltyImage )
+{
+    double meanNovelty ( 0.0 );
+    for ( uint y = 0 ; y < ( uint ) _noveltyImage.height() ; y++ )
+    {
+      for ( uint x = 0 ; x < ( uint ) _noveltyImage.width(); x++ )
+      {
+        meanNovelty += _noveltyImage(x,y);
+      }
+    }      
+    int imageSize ( _noveltyImage.height() * _noveltyImage.width() );
+    meanNovelty /= imageSize;
+
+      std::cerr << "  NOVELTY SCORE FOR CURRENT IMAGE: " <<  meanNovelty << " -- threshold: " << d_noveltyThreshold << std::endl;    
+    
+    if ( meanNovelty < d_noveltyThreshold )
+    {
+      // --- NOT NOVEL ---
+      return false;
+    }
+    else
+    {
+      // --- NOVEL ---
+      return true;
+    }
+}

+ 97 - 0
noveltyDetection/NDCodebookLevelImagePooling.h

@@ -0,0 +1,97 @@
+/**
+ * @file NDCodebookLevelImagePooling.h
+ * @brief Compute novelty of images based on relations between extracted features and current codebook, pool novelty scores over the whole image without considering spatial information
+ * @author Alexander Freytag
+ * @date 02-05-2013 (dd-mm-yyyy)
+*/
+#ifndef _NDCODEBOOKLEVELIMAGEPOOLING
+#define _NDCODEBOOKLEVELIMAGEPOOLING
+
+#include "NoveltyDetectorCodebookLevel.h"
+
+//core
+#include <core/vector/Distance.h>
+#include <core/vector/VVector.h>
+
+// vislearning
+#include <vislearning/cbaselib/MultiDataset.h>
+// 
+#include <vislearning/features/localfeatures/GenericLocalFeatureSelection.h>
+// 
+#include <vislearning/math/cluster/ClusterAlgorithm.h>
+
+
+
+
+namespace OBJREC
+{
+
+  /**
+   * @class NDCodebookLevelImagePooling
+   * @brief Compute novelty of images based on relations between extracted features and current codebook, pool novelty scores over the whole image without considering spatial information
+   * @author Alexander Freytag
+   * @date 02-05-2013 (dd-mm-yyyy)
+  */  
+  
+  class NDCodebookLevelImagePooling : public NoveltyDetectorCodebookLevel
+  {
+
+    protected:
+      
+      /************************
+       * 
+       *   protected variables
+       * 
+       **************************/       
+      
+      //TODO ENUM HOW TO POOL
+      
+      //! this is the (stupid) global threshold for novelty within an image (i.e., if novelty scores summed over all pixels and divided by image size is larger than this score, the image is considered as "novel")      
+      double d_noveltyThreshold;
+                       
+      
+      /************************
+       * 
+       *   protected methods
+       * 
+       **************************/
+    
+
+
+    public:
+
+      /** constructor
+        * @param _conf needs a configfile
+        * @param _md and a MultiDataset (contains images and other things)
+        * @param _section section information for parsing config files
+        */
+      NDCodebookLevelImagePooling ( const NICE::Config *_conf, const OBJREC::MultiDataset *_md , const std::string & _section = "noveltyDetector");
+
+      /** simple destructor */
+      virtual ~NDCodebookLevelImagePooling();
+      
+      /** 
+       * @brief  Evaluate whether or not the image of the specified filename is novel with respect to the current known examples or not
+       * @author Alexander Freytag
+       * @date 02-05-2013 (dd-mm-yyyy)
+       * @param _filename of the new image 
+       * @return bool (true: class/content/... of image is novel, false: class/content/... of image is known)
+       * @note This function has to be overloaded by all subclasses!          
+      */
+      virtual bool evaluateNoveltyOfImage ( const std::string & _filename );
+      
+      /** 
+       * @brief  Evaluate whether or not the image of the specified filename is novel with respect to the current known examples or not
+       * @author Alexander Freytag
+       * @date 02-05-2013 (dd-mm-yyyy)
+       * @param _noveltyImage contains min distances of features to the current codebook
+       * @return bool (true: class/content/... of image is novel, false: class/content/... of image is known)
+      */      
+      virtual bool evaluateNoveltyOfImage ( const NICE::FloatImage & _noveltyImage ) ;                  
+
+  };
+
+
+} // namespace
+
+#endif

+ 24 - 0
noveltyDetection/NoveltyDetector.cpp

@@ -0,0 +1,24 @@
+/**
+* @file NoveltyDetector.cpp
+* @brief abstract interface for novelty detection algorithms
+* @author Alexander Freytag
+* @date 16-04-2013 (dd-mm-yyyy)
+
+*/
+#include <iostream>
+
+#include "NoveltyDetector.h"
+
+using namespace OBJREC;
+using namespace std;
+using namespace NICE;
+
+NoveltyDetector::NoveltyDetector ( const Config *_conf, const std::string & _section )
+{
+  this->section = _section;  
+  this->conf = _conf;  
+}
+
+NoveltyDetector::~NoveltyDetector()
+{
+}

+ 84 - 0
noveltyDetection/NoveltyDetector.h

@@ -0,0 +1,84 @@
+/**
+ * @file NoveltyDetector.h
+ * @brief abstract interface for novelty detection algorithms
+ * @author Alexander Freytag
+ * @date 02-05-2013 (dd-mm-yyyy)
+*/
+#ifndef _INCLUDENOVELTYDETECTOR
+#define _INCLUDENOVELTYDETECTOR
+
+#define ROADWORKSNOVDET fthrow(NICE::Exception, "Novelty Detector -- not yet implemented!");
+
+// STL
+#include <string>
+
+//core
+#include <core/basics/Config.h>
+
+
+namespace OBJREC
+{
+
+  /**
+   * @class NoveltyDetector
+   * @brief abstract interface for novelty detection algorithms
+   * @author Alexander Freytag
+   * @date 02-05-2013 (dd-mm-yyyy)
+  */
+  class NoveltyDetector
+  {
+
+    protected:   
+      
+      /************************
+       * 
+       *   protected variables
+       * 
+       **************************/       
+      
+      //! section information for parsing config files
+      std::string section;      
+      
+      //! Configuration File
+      const NICE::Config *conf;    
+           
+      
+      /************************
+       * 
+       *   protected methods
+       * 
+       **************************/      
+            
+
+    public:
+
+      /**
+       * @brief  simple constructor
+       * @author Alexander Freytag
+       * @date 02-05-2013 (dd-mm-yyyy)
+       * @param _conf global settings
+       * @param _section section information for parsing config files
+      */
+      NoveltyDetector ( const NICE::Config *_conf, const std::string & _section = "noveltyDetector" );
+
+      /** simple destructor */
+      virtual ~NoveltyDetector();
+
+      
+      /** 
+       * @brief  Evaluate whether or not the image of the specified filename is novel with respect to the current known examples or not
+       * @author Alexander Freytag
+       * @date 02-05-2013 (dd-mm-yyyy)
+       * @param _filename of the new image 
+       * @return bool (true: class/content/... of image is novel, false: class/content/... of image is known)
+       * @note This function has to be overloaded by all subclasses!          
+      */
+      virtual bool evaluateNoveltyOfImage ( const std::string & _filename) = 0;  
+      
+
+  };
+
+
+} // namespace
+
+#endif

+ 230 - 0
noveltyDetection/NoveltyDetectorCodebookLevel.cpp

@@ -0,0 +1,230 @@
+
+#include "NoveltyDetectorCodebookLevel.h"
+
+//STL
+#include <iostream>
+
+//core
+#include <core/vector/VectorT.h>
+
+//vislearning
+#include <vislearning/features/localfeatures/LFonHSG.h>
+#include <vislearning/features/localfeatures/LFColorSande.h>
+#include <vislearning/features/localfeatures/LFColorWeijer.h>
+#include <vislearning/features/localfeatures/LFReadCache.h>
+#include <vislearning/features/localfeatures/LFWriteCache.h>
+
+using namespace std;
+using namespace NICE;
+using namespace OBJREC;
+
+  //**********************************************
+  //
+  //                 PROTECTED METHODS
+  //
+  //********************************************** 
+
+
+void NoveltyDetectorCodebookLevel::setFeatureExtractor( const bool & _setForTraining )
+{  
+  //be careful with previously allocated memory
+  if (this->featureExtractor != NULL)
+    delete featureExtractor;  
+  
+    //feature stuff
+  // which OpponentSIFT implementation to use {NICE, VANDESANDE}
+  std::string opSiftImpl;  
+  opSiftImpl = this->conf->gS ( "Descriptor", "implementation", "VANDESANDE" );
+  // read features?
+  bool readfeat;
+  readfeat = this->conf->gB ( "Descriptor", "read", true );
+  // write features?
+  bool writefeat;  
+  writefeat = this->conf->gB ( "Descriptor", "write", true );   
+  
+  // Welche Opponentsift Implementierung soll genutzt werden ?
+  LocalFeatureRepresentation *cSIFT = NULL;
+  LocalFeatureRepresentation *writeFeats = NULL;
+  LocalFeatureRepresentation *readFeats = NULL;
+  this->featureExtractor = NULL;
+  if ( opSiftImpl == "NICE" )
+  {
+    if ( _setForTraining )
+      cSIFT = new OBJREC::LFonHSG ( this->conf, "HSGtrain" );
+    else
+      cSIFT = new OBJREC::LFonHSG ( this->conf, "HSGtest" );
+  }
+  else if ( opSiftImpl == "VANDESANDE" )
+  {
+    if ( _setForTraining )
+      cSIFT = new OBJREC::LFColorSande ( this->conf, "LFColorSandeTrain" );
+    else
+      cSIFT = new OBJREC::LFColorSande ( this->conf, "LFColorSandeTest" );
+  }
+  else
+  {
+    fthrow ( Exception, "feattype: %s not yet supported" << opSiftImpl );
+  }
+
+  this->featureExtractor = cSIFT;
+  
+  if ( writefeat )
+  {
+    // write the features to a file, if there isn't any to read
+    writeFeats = new LFWriteCache ( this->conf, cSIFT );
+    this->featureExtractor = writeFeats;
+  }
+
+  if ( readfeat )
+  {
+    // read the features from a file
+    if ( writefeat )
+    {
+      readFeats = new LFReadCache ( this->conf, writeFeats, -1 );
+    }
+    else
+    {
+      readFeats = new LFReadCache ( this->conf, cSIFT, -1 );
+    }
+    this->featureExtractor = readFeats; 
+  }  
+  
+  //only set feature stuff to NULL, deletion of the underlying object is done in the destructor
+  if ( cSIFT != NULL )
+    cSIFT = NULL;
+  if ( writeFeats != NULL )
+    writeFeats = NULL;
+  if ( readFeats != NULL )
+    readFeats  = NULL ;   
+}
+
+
+
+bool NoveltyDetectorCodebookLevel::loadInitialCodebook ( )
+{
+  if ( b_loadInitialCodebook  )
+  {
+    std::cerr << " INITIAL CODEBOOK ALREADY COMPUTED - RE-USE IT" << std::endl;    
+    std::cerr << " // WARNING - WE DO NOT VERIFY WHETHER THIS IS THE CORRECT CODEBOOK FOR THIS TRAINING SET!!!!" << std::endl;    
+    
+    prototypes->clear();
+    
+    try
+    {
+      prototypes->read(cacheInitialCodebook);
+    }
+    catch (...)
+    {
+      std::cerr << "Error while loading initial codebook" << std::endl;
+      return false;
+    }  
+    return true;
+  }
+  else
+    return false;
+}
+
+bool NoveltyDetectorCodebookLevel::writeInitialCodebook ( )
+{      
+  if (  b_saveInitialCodebook )
+  {
+    std::cerr << " SAVE INITIAL CODEBOOK " << std::endl;
+    
+    try 
+    {
+      prototypes->write( cacheInitialCodebook );
+    }
+    catch (...)
+    {
+      std::cerr << "Error while saving initial codebook" << std::endl;
+      return false;
+    }    
+    return true;
+  } 
+  else
+    return false;
+}
+
+
+  //**********************************************
+  //
+  //                 PUBLIC METHODS
+  //
+  //********************************************** 
+
+
+NoveltyDetectorCodebookLevel::NoveltyDetectorCodebookLevel ( const Config *_conf,
+                               const MultiDataset *_md, const std::string & _section )
+    : NoveltyDetector ( _conf, _section )
+{ 
+  // define the distance function to be used
+  std::string distFunctionString = conf->gS(section, "distFunction", "euclidian");    
+  
+  
+  //**********************************************
+  //
+  //      SET UP VARIABLES AND METHODS
+  //             - FEATURE TYPE
+  //             - DISTANCE FUNCTION
+  //             - ...
+  //
+  //**********************************************  
+  
+  
+  if (distFunctionString.compare("euclidian") == 0)
+  {
+    distFunction = new NICE::EuclidianDistance<double>();
+  }
+  else
+  {
+    std::cerr << "Unknown vector distance selected, use euclidian instead" << std::endl;
+    distFunction = new NICE::EuclidianDistance<double>();
+  }    
+
+  //feature extraction for comparison against codebook
+  this->featureExtractor = NULL;
+  //feature extraction for unseen images
+  this->setFeatureExtractor( false /* set for training */ );    
+  
+  this->prototypes = NULL;  
+}
+
+NoveltyDetectorCodebookLevel::~NoveltyDetectorCodebookLevel()
+{
+  // clean-up
+  if ( distFunction != NULL )
+    delete distFunction;
+  if ( featureExtractor != NULL )
+    delete featureExtractor; 
+  if ( ( ! externalCodebook ) && (prototypes != NULL) )
+    delete prototypes;
+}
+
+void NoveltyDetectorCodebookLevel::setCodebook( NICE::VVector * _prototypes)
+{
+  std::cerr << "aim to set codebook" << std::endl;
+  // if we had no codebook so far, we simply store the pointer and remember, that we use the external one
+  // such that we do not have to delete it lateron
+  if ( this->prototypes == NULL)
+  {
+    std::cerr << "previous codebook is null -- set it as external codebook" << std::endl;
+    this->prototypes = _prototypes;
+    this->externalCodebook = true;
+  }
+  else
+  {
+    std::cerr << "previous codebook is not null - do we want to treat the new one as external?" << std::endl;
+    //in case of an internal codebook, we need to copy the whole thing
+    if ( ! externalCodebook )
+    {
+      *(this->prototypes) = *_prototypes;
+      std::cerr << "new codebook treated as internal codebook" << std::endl;
+    }
+    //if we use a pointer to an external codebook, we simply renew the pointer
+    else
+    {
+      this->prototypes = _prototypes;
+      std::cerr << "new codebook treated as external codebook " << std::endl;
+    }
+  }
+}

+ 125 - 0
noveltyDetection/NoveltyDetectorCodebookLevel.h

@@ -0,0 +1,125 @@
+/**
+ * @file NoveltyDetectorCodebookLevel.h
+ * @brief Compute novelty of images based on relations between extracted features and current codebook
+ * @author Alexander Freytag
+ * @date 02-05-2013 (dd-mm-yyyy)
+*/
+#ifndef _INCLUDENOVELTYDETECTIONCODEBOOKLEVEL
+#define _INCLUDENOVELTYDETECTIONCODEBOOKLEVEL
+
+#include "NoveltyDetector.h"
+
+//core
+#include <core/vector/Distance.h>
+#include <core/vector/VVector.h>
+
+// vislearning
+#include <vislearning/cbaselib/MultiDataset.h>
+// 
+#include <vislearning/features/localfeatures/GenericLocalFeatureSelection.h>
+// 
+#include <vislearning/math/cluster/ClusterAlgorithm.h>
+
+
+
+
+namespace OBJREC
+{
+
+  /**
+   * @class NoveltyDetectorCodebookLevel
+   * @brief Compute novelty of images based on relations between extracted features and current codebook
+   * @author Alexander Freytag
+   * @date 02-05-2013 (dd-mm-yyyy)
+  */  
+  
+  class NoveltyDetectorCodebookLevel : public NoveltyDetector
+  {
+
+    protected:
+      
+      /************************
+       * 
+       *   protected variables
+       * 
+       **************************/       
+             
+      NICE::VectorDistance<double> * distFunction;
+
+      LocalFeatureRepresentation * featureExtractor;
+      
+      //! The currently known "cluster" centers, which are used for BoW histogram computation  (i.e., the codebook)
+      NICE::VVector * prototypes;   
+      
+      //! was an initial codebook already computed?
+      bool b_loadInitialCodebook;
+      //!shall the initially computed codebook be stored somewhere?
+      bool  b_saveInitialCodebook; 
+      //! where should an initial codebook be located, i.e., read from and written to?
+      std::string cacheInitialCodebook;  
+      
+      //! did we compute a codebook on our own or do we use simply a pointer to an external codebook?
+      bool externalCodebook;
+                       
+      
+      /************************
+       * 
+       *   protected methods
+       * 
+       **************************/
+            
+      void setFeatureExtractor( const bool & _setForTraining = false);
+      
+      void extractFeaturesFromTrainingImages(  const OBJREC::MultiDataset *_md,  NICE::VVector & examplesTraining  ); 
+      
+      virtual bool loadInitialCodebook ( );
+      virtual bool writeInitialCodebook ( );      
+
+
+    public:
+
+      /** constructor
+        * @param _conf needs a configfile
+        * @param _md and a MultiDataset (contains images and other things)
+        * @param _section section information for parsing config files
+        */
+      NoveltyDetectorCodebookLevel ( const NICE::Config *_conf, const OBJREC::MultiDataset *_md , const std::string & _section = "noveltyDetector");
+
+      /** simple destructor */
+      virtual ~NoveltyDetectorCodebookLevel();
+      
+      /** 
+       * @brief  Evaluate whether or not the image of the specified filename is novel with respect to the current known examples or not
+       * @author Alexander Freytag
+       * @date 02-05-2013 (dd-mm-yyyy)
+       * @param _filename of the new image 
+       * @return bool (true: class/content/... of image is novel, false: class/content/... of image is known)
+       * @note This function has to be overloaded by all subclasses!          
+      */
+      virtual bool evaluateNoveltyOfImage ( const std::string & _filename ) = 0;
+      
+      /** 
+       * @brief  Evaluate whether or not the image of the specified filename is novel with respect to the current known examples or not
+       * @author Alexander Freytag
+       * @date 02-05-2013 (dd-mm-yyyy)
+       * @param _noveltyImage contains min distances of features to the current codebook
+       * @return bool (true: class/content/... of image is novel, false: class/content/... of image is known)
+      */      
+      virtual bool evaluateNoveltyOfImage ( const NICE::FloatImage & _noveltyImage ) = 0;
+      
+      /** 
+       * @brief  Hand over a previously computed codebook
+       * @author Alexander Freytag
+       * @date 02-05-2013 (dd-mm-yyyy)
+       * @param _prototypes pointer to a codebook
+       * @note we check whether we just use the pointer to the external codebook, or alternatively copy it and have it as internal codebook available lateron
+      */            
+      virtual void setCodebook( NICE::VVector * _prototypes);
+            
+
+  };
+
+
+} // namespace
+
+#endif

+ 6 - 0
noveltyDetection/libdepend.inc

@@ -0,0 +1,6 @@
+$(call PKG_DEPEND_INT,core/)
+$(call PKG_DEPEND_INT,vislearning/baselib/)
+$(call PKG_DEPEND_INT,vislearning/cbaselib/)
+$(call PKG_DEPEND_INT,vislearning/features/)
+$(call PKG_DEPEND_INT,vislearning/math/)
+$(call PKG_DEPEND_INT,segmentation/)

+ 8 - 0
noveltyDetection/progs/Makefile

@@ -0,0 +1,8 @@
+#TARGETS_FROM:=$(notdir $(patsubst %/,%,$(shell pwd)))/$(TARGETS_FROM)
+#$(info recursivly going up: $(TARGETS_FROM) ($(shell pwd)))
+
+all:
+
+%:
+	$(MAKE) TARGETS_FROM=$(notdir $(patsubst %/,%,$(shell pwd)))/$(TARGETS_FROM) -C .. $@
+

+ 5 - 0
noveltyDetection/progs/libdepend.inc

@@ -0,0 +1,5 @@
+$(call PKG_DEPEND_INT,vislearning/baselib/)
+$(call PKG_DEPEND_INT,vislearning/cbaselib/)
+$(call PKG_DEPEND_INT,vislearning/features/)
+$(call PKG_DEPEND_INT,vislearning/math/)
+$(call PKG_DEPEND_INT,segmentation/)