Jelajahi Sumber

added ability to use ray features

Sven Sickert 11 tahun lalu
induk
melakukan
f7b3e96945
3 mengubah file dengan 509 tambahan dan 192 penghapusan
  1. 1 1
      progs/testSemanticSegmentation.cpp
  2. 466 183
      semseg/SemSegContextTree.cpp
  3. 42 8
      semseg/SemSegContextTree.h

+ 1 - 1
progs/testSemanticSegmentation.cpp

@@ -377,7 +377,7 @@ int main ( int argc, char **argv )
     {
       std::string classname = classNames.text ( r );
       fout << classname.c_str() << ": " << M ( r, r ) << endl;
-      fprintf ( stderr, "%s: %f\n", classname.c_str(), M ( r, r ) );
+      cout << classname.c_str() << ": " << M ( r, r ) << endl;
     }
   }
   fout.close();

File diff ditekan karena terlalu besar
+ 466 - 183
semseg/SemSegContextTree.cpp


+ 42 - 8
semseg/SemSegContextTree.h

@@ -35,8 +35,11 @@ private:
   /** local features */
   LFColorWeijer *lfcw;
 
-  /** number of featuretype -> currently: local and context features = 2 */
-  int ftypes;
+  /** whether to use a particular feature type or not */
+  bool useFeat0, useFeat1, useFeat2, useFeat3, useFeat4, useFeat5;
+
+  /** array of usable feature types*/
+  std::vector<int> featTypes;
 
   /** maximum samples for tree  */
   int maxSamples;
@@ -104,9 +107,6 @@ private:
   /** use additional input Layer or not */
   bool useAdditionalLayer;
 
-  /** use Regions as extra feature channel or not */
-  bool useRegionFeature;
-
   /** use external image categorization to avoid some classes */
   bool useCategorization;
 
@@ -150,13 +150,39 @@ private:
   int uniquenumber;
   
   /**
-   * the actual training method
+   * @brief initOperations initialize the operation types
+   */
+  void initOperations();
+
+  /**
+   * @brief train the actual training method
    * @param trainp pointer to training data
    */
   void train ( const LabeledSet * trainp );
 
+  /**
+   * @brief compute closest contour point in given direction
+   * @param B     contour image (canny)
+   * @param G     gradient image
+   * @param D     distances
+   * @param N     norms
+   * @param x     current x coordinate
+   * @param y     current y coordinate
+   * @param dir   direction
+   */
+  void closestContourPoint ( const NICE::Image &B,
+                             const NICE::Image &G,
+                             NICE::Matrix &D,
+                             NICE::Matrix &N,
+                             int x,
+                             int y,
+                             const int &dir);
+
 public:
   /** simple constructor */
+  SemSegContextTree ();
+
+  /** constructor */
   SemSegContextTree ( const NICE::Config *conf, const MultiDataset *md );
 
   /** simple destructor */
@@ -183,11 +209,19 @@ public:
    * @brief computes integral image of given feats
    *
    * @param nodeIndices matrix with current node for each feature
-   * @param integralImage output image (must be initilized)
+   * @param feats output image (must be initilized)
    * @param firstChannel index of the first channel
    * @return void
    **/
-  void computeIntegralImage ( const NICE::MultiChannelImage3DT<unsigned short int> &nodeIndices, NICE::MultiChannelImage3DT<double> &integralImage, int firstChannel );
+  void computeIntegralImage ( const NICE::MultiChannelImage3DT<unsigned short int> &nodeIndices, NICE::MultiChannelImage3DT<double> &feats, int firstChannel );
+
+  /**
+   * @brief computes ray feature images using canny filter
+   * @param feats
+   * @param channel
+   * @return void
+   */
+  void computeRayFeatImage ( NICE::MultiChannelImage3DT<double> &feats, int firstChannel );
 
   /**
    * @brief reads image and does some simple convertions

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini