Просмотр исходного кода

additional comments and bugfixes

Erik Rodner 13 лет назад
Родитель
Сommit
68dbcdb9f4

+ 0 - 1
classifier/kernelclassifier/progs/laplaceTests.cpp

@@ -75,7 +75,6 @@ int main (int argc, char **argv)
 
 	ColorImage img;
 	ICETools::convertToRGB ( predictions, img );
-	uint k = 0;
 	LOOP_ALL(train)
 	{
 		EACH(classno,vec);

+ 0 - 1
classifier/progs/toyExampleUnsupervisedGP.cpp

@@ -90,7 +90,6 @@ int main (int argc, char **argv)
  
     int xsize = conf.gI("main", "xsize", 300 );
     int ysize = conf.gI("main", "ysize", 300 );
-    int numClasses = 3;
     
     NICE::Image img (xsize, ysize);
     img.set(255);

+ 1 - 1
features/gradientfeatures/progs/testPHOGFeatures.cpp

@@ -42,7 +42,7 @@ int main(int argc, char **argv)
 	
 	PHOG.sayYourName();
 	
-	std::cerr << "Concatenating NONE histograms resulting in \sum_{i=0}{level} 4^i histograms." << std::endl;
+	std::cerr << "Concatenating NONE histograms resulting in \\sum_{i=0}{level} 4^i histograms." << std::endl;
 	PHOG.set_histrogram_concatenation(OBJREC::PHOGFeature::NONE);
 	std::vector<std::vector<float> > resulting_feature = PHOG.createOneFeatureVector(imgfilename);
 	for (std::vector<std::vector<float> >::const_iterator i = resulting_feature.begin(); i != resulting_feature.end(); i++)

+ 1 - 1
features/localfeatures/LFSiftPP.h

@@ -1,6 +1,6 @@
 /** 
 * @file LFSiftPP.h
-* @brief Sift++ interface
+* @brief Sift++ interface (with detector!)
 * @author Erik Rodner
 * @date 11/19/2007
 

+ 1 - 1
features/localfeatures/LFonHSG.h

@@ -83,7 +83,7 @@ namespace OBJREC
 			int extractFeatures ( const NICE::Image & img, NICE::VVector & features, NICE::VVector & positions ) const;
 
 			//! Extract the descriptor-Values from a given color-Image.
-		        int extractFeatures ( const NICE::ColorImage & cimg, NICE::VVector & features, NICE::VVector & positions ) const;
+      int extractFeatures ( const NICE::ColorImage & cimg, NICE::VVector & features, NICE::VVector & positions ) const;
 			
 			//! Visualisierung
 			void visualizeFeatures ( NICE::Image & mark, const NICE::VVector & positions, size_t color ) const;

+ 1 - 1
features/localfeatures/LocalFeatureSift.h

@@ -1,6 +1,6 @@
 /** 
 * @file LocalFeatureSift.h
-* @brief local feature with sift
+* @brief local feature with sift (without detector)
 * @author Erik Rodner
 * @date 02/05/2008
 

+ 1 - 1
features/localfeatures/progs/sift-driver.cpp

@@ -385,7 +385,7 @@ main(int argc, char** argv)
 
     // check for argument consistency
     if(argc == 0) VL_THROW("No input image specfied.") ;
-    if(outputFilename.size() != 0 && (argc > 1 | binary)) {
+    if(outputFilename.size() != 0 && ((argc > 1) | binary)) {
       VL_THROW("--output cannot be used with multiple images or --binary.") ;
     }
 

+ 71 - 30
features/simplefeatures/FCCodebookHistBin.h

@@ -1,6 +1,6 @@
 /** 
 * @file FCCodebookHistBin.h
-* @brief create features with codebook
+* @brief create features with a predefined codebook
 * @author Erik Rodner
 * @date 02/05/2008
 
@@ -24,45 +24,86 @@ namespace OBJREC {
 class FCCodebookHistBin : public FeatureFactory
 {
 
-    protected:
-	int n_method;
+  protected:
+    //! normalization method used (enum type)
+    int n_method;
 
-	const LocalFeatureRepresentation *lfrep;
-	const Codebook *codebook;
+    //! local feature method
+  	const LocalFeatureRepresentation *lfrep;
 
-	void calcHistogram ( const NICE::VVector & features,
-			     NICE::Vector & histogram );
+    //! pointer to our codebook
+	  const Codebook *codebook;
 
-	void calcHistogram ( const NICE::VVector & features,
-			     NICE::Vector & histogram,
-			     NICE::Matrix & assignments);
+    void calcHistogram ( const NICE::VVector & features,
+             NICE::Vector & histogram );
 
-	void normalizeHistogram ( NICE::Vector & histogram );
+    void calcHistogram ( const NICE::VVector & features,
+             NICE::Vector & histogram,
+             NICE::Matrix & assignments);
 
-    public:
+  	void normalizeHistogram ( NICE::Vector & histogram );
+
+  public:
+    //! enum type used for normalization method
   	enum {
 	    NORMALIZE_RAW = 0,
 	    NORMALIZE_BINZERO,
 	    NORMALIZE_SUM,
 	    NORMALIZE_THRESH
-	};
-
-
-	/** simple constructor */
-	FCCodebookHistBin( const NICE::Config *conf,
-	    const LocalFeatureRepresentation *lfrep,
-	    const std::string & normalizationMethod,
-	    const Codebook *codebook );
-      
-	/** simple destructor */
-	virtual ~FCCodebookHistBin();
-	
-	int convert ( const NICE::Image & img, NICE::Vector & vec );
-	
-	int calcAssignments ( const NICE::VVector & features, NICE::Vector & vec, NICE::Matrix & assignments );
-
-	void setNormalizationMethod ( int normalizationMethod );
-	int getNormalizationMethod () const;
+	  };
+
+
+    /**
+    * @brief standard constructor 
+    *
+    * @param conf pointer to a Config object with some parameter settings (currently not used)
+    * @param lfrep local feature extraction method (keep the pointer!)
+    * @param normalizationMethod name of the normalization method (sum, binzero, raw, thresh)
+    * @param codebook pointer to the codebook (keep the pointer!)
+    */
+    FCCodebookHistBin( const NICE::Config *conf,
+        const LocalFeatureRepresentation *lfrep,
+        const std::string & normalizationMethod,
+        const Codebook *codebook );
+        
+    /** simple destructor */
+    virtual ~FCCodebookHistBin();
+    
+    /**
+    * @brief calculate a BoV histogram vector (no local information, only global)
+    *
+    * @param img input image
+    * @param vec resulting feature vector
+    *
+    * @return -1 if something fails (no local features found for example) and zero if everything was okay 
+    */
+    int convert ( const NICE::Image & img, NICE::Vector & vec );
+    
+    /**
+    * @brief calculate a BoV histogram vector and also store the assignments of each local feature to a BoV cluster (codebook element)
+    *
+    * @param features input local features (size is N)
+    * @param vec resulting BoV feature vector
+    * @param assignments assignments of local features to BoV clusters given as a 3xN matrix, with assignments(0,*) representing the distance
+    * of a local feature to the nearest BoV cluster, assignments(1,*) storing the BoV cluster index, and assignments(2,*) being the index of the local feature
+    *
+    * @return 
+    */
+    int calcAssignments ( const NICE::VVector & features, NICE::Vector & vec, NICE::Matrix & assignments );
+
+    /**
+    * @brief set the type of the normalization method (see the enum of the class)
+    *
+    * @param normalizationMethod see enum type
+    */
+    void setNormalizationMethod ( int normalizationMethod );
+
+    /**
+    * @brief get the currently used normalization method
+    *
+    * @return see enum type
+    */
+    int getNormalizationMethod () const;
      
 };
 

+ 1 - 1
math/cluster/GSCluster.h

@@ -1,6 +1,6 @@
 /** 
 * @file GSCluster.h
-* @brief Generate Signature by Clustering Local Features
+* @brief Generate Signature by Clustering Local Features (image-specific codebook!). The class can be used for the EMD kernel, but not for usual BoV approaches.
 * @author Erik Rodner
 * @date 10/30/2007
 

+ 0 - 1
math/cluster/progs/testKMeans.cpp

@@ -43,7 +43,6 @@ int main(int argc, char **argv)
 
 	char c;
 	const int noClasses = 2;
-	const double alpha = 1.0;
 
 	do
 	{