Pārlūkot izejas kodu

using namespace in header entfernt...

Björn Fröhlich 13 gadi atpakaļ
vecāks
revīzija
2862d86877

+ 2 - 4
classifier/FPCnone.h

@@ -8,8 +8,6 @@
 #ifndef FPCnoneDEF
 #define FPCnoneDEF
 
-#include <objrec/nice.h>
-
 #include "vislearning/classifier/classifierbase/FeaturePoolClassifier.h"
 #include "vislearning/classifier/fpclassifier/logisticregression/SLR.h"
 #include "vislearning/cbaselib/FeaturePool.h"
@@ -25,7 +23,7 @@ protected:
   FeaturePool fp;
 
   //! config file;
-  const Config *conf;
+  const NICE::Config *conf;
 
 public:
   /**
@@ -33,7 +31,7 @@ public:
    * @param conf configfile
    * @param section section name in configfile for classifier
    */
-  FPCnone( const Config *conf, std::string section = "SMLR" );
+  FPCnone( const NICE::Config *conf, std::string section = "SMLR" );
 
 
   /**

+ 0 - 2
semseg/SemSegContextTree.cpp

@@ -25,9 +25,7 @@
 //#define LOCALFEATS
 
 using namespace OBJREC;
-
 using namespace std;
-
 using namespace NICE;
 
 class MCImageAccess: public ValueAccess

+ 4 - 4
semseg/SemSegContextTree.h

@@ -57,7 +57,7 @@ class TreeNode
 
 struct Features {
   NICE::MultiChannelImageT<double> *feats;
-  MultiChannelImageT<unsigned short int> *cfeats;
+  NICE::MultiChannelImageT<unsigned short int> *cfeats;
   int cTree;
   std::vector<TreeNode> *tree;
   NICE::MultiChannelImageT<double> *integralImg;
@@ -251,7 +251,7 @@ class SemSegContextTree : public SemanticSegmentation, public NICE::Persistent
     std::set<int> forbidden_classes;
 
     /** Configfile */
-    const Config *conf;
+    const NICE::Config *conf;
 
     /** use pixelwise labeling or regionlabeling with additional segmenation */
     bool pixelWiseLabeling;
@@ -300,7 +300,7 @@ class SemSegContextTree : public SemanticSegmentation, public NICE::Persistent
      * @param integralImage output image (must be initilized)
      * @return void
      **/
-    void computeIntegralImage ( const NICE::MultiChannelImageT<SparseVectorInt> &infeats, NICE::MultiChannelImageT<SparseVectorInt> &integralImage );
+    void computeIntegralImage ( const NICE::MultiChannelImageT<NICE::SparseVectorInt> &infeats, NICE::MultiChannelImageT<NICE::SparseVectorInt> &integralImage );
 
     /**
      * compute best split for current settings
@@ -322,7 +322,7 @@ class SemSegContextTree : public SemanticSegmentation, public NICE::Persistent
      * @param currentfeats information about the nodes
      * @return double mean value
      **/
-    inline double getMeanProb ( const int &x, const int &y, const int &channel, const MultiChannelImageT<unsigned short int> &currentfeats );
+    inline double getMeanProb ( const int &x, const int &y, const int &channel, const NICE::MultiChannelImageT<unsigned short int> &currentfeats );
 
     /**
      * @brief load all data to is stream

+ 14 - 0
semseg/SemSegCsurka.cpp

@@ -1837,6 +1837,20 @@ void SemSegCsurka::classifyregions ( CachedExample *ce, NICE::Image & segresult,
     StringTools::split ( Globals::getCurrentImgFN (), '/', list );
     out << "uncertainty/" << list.back();
     ColorImage imgrgb(xsize,ysize);
+    
+    float maxu = -numeric_limits<double>::max();
+    float minu = numeric_limits<double>::min();
+    for ( int y = 0; y < ( int ) mask.cols(); y++ )
+    {
+      for ( int x = 0; x < ( int ) mask.rows(); x++ )
+      {
+        maxu = std::max(uncert(x,y),maxu);
+        minu = std::min(uncert(x,y),minu);
+      }
+    }
+    cout << "maxv = " << maxu << " minv = " << minu << endl;
+    uncert(0,0) = 1;
+    uncert(0,1) = 0;
     ICETools::convertToRGB ( uncert, imgrgb );
     imgrgb.write(out.str());
 #endif

+ 3 - 3
semseg/SemSegCsurka.h

@@ -81,7 +81,7 @@ class SemSegCsurka : public SemanticSegmentation
     VecClassifier *vclassifier;
 
     //! Configuration File
-    const Config *conf;
+    const NICE::Config *conf;
 
 
     //! name of all classes
@@ -211,7 +211,7 @@ class SemSegCsurka : public SemanticSegmentation
       *  @param conf needs a configfile
       *  @param md and a MultiDataset (contains images and other things)
       */
-    SemSegCsurka ( const Config *conf, const MultiDataset *md );
+    SemSegCsurka ( const NICE::Config *conf, const MultiDataset *md );
 
     /** simple destructor */
     virtual ~SemSegCsurka();
@@ -243,7 +243,7 @@ class SemSegCsurka : public SemanticSegmentation
     * @param mask the positions of the regions
     */
     void classifyregions ( CachedExample *ce, NICE::Image & segresult, NICE::MultiChannelImageT<double> & probabilities, Examples &Regionen, NICE::Matrix &mask );
-    void getFeats ( NICE::Image arg1, VVector arg2, VVector arg3 );
+    void getFeats ( NICE::Image arg1, NICE::VVector arg2, NICE::VVector arg3 );
 };
 
 } //namespace

+ 20 - 19
semseg/SemSegLocal.h

@@ -1,4 +1,4 @@
-/** 
+/**
 * @file SemSegLocal.h
 * @brief semantic segmentation using image patches only
 * @author Erik Rodner
@@ -7,37 +7,38 @@
 */
 #ifndef SEMSEGLOCALINCLUDE
 #define SEMSEGLOCALINCLUDE
-  
+
 #include "vislearning/classifier/classifierbase/FeaturePoolClassifier.h"
 #include "SemanticSegmentation.h"
 
 
-namespace OBJREC {
+namespace OBJREC
+{
 
 /** abstract interface for pixelwise localization systems */
 class SemSegLocal : public SemanticSegmentation
 {
 
-    protected:
-	bool save_cache;
-	bool read_cache;
+  protected:
+    bool save_cache;
+    bool read_cache;
+
+    std::string cache;
+    FeaturePoolClassifier *fpc;
+
+  public:
 
-	std::string cache;
-	FeaturePoolClassifier *fpc;
+    /** simple constructor */
+    SemSegLocal ( const NICE::Config *conf, const MultiDataset *md );
 
-    public:
-  
-	/** simple constructor */
-	SemSegLocal( const Config *conf, const MultiDataset *md );
-      
-	/** simple destructor */
-	virtual ~SemSegLocal();
+    /** simple destructor */
+    virtual ~SemSegLocal();
 
-	void train ( const Config *conf, const MultiDataset *md );
+    void train ( const NICE::Config *conf, const MultiDataset *md );
 
-	void semanticseg ( CachedExample *ce, 
-			   NICE::Image & segresult,
-			   NICE::MultiChannelImageT<double> & probabilities );
+    void semanticseg ( CachedExample *ce,
+                       NICE::Image & segresult,
+                       NICE::MultiChannelImageT<double> & probabilities );
 
 };
 

+ 160 - 160
semseg/SemSegRegionBased.h

@@ -24,166 +24,166 @@
 
 namespace OBJREC
 {
-	class SemSegRegionBased : public SemanticSegmentation
-	{
-		protected:
-	
-			//! destination for saving intermediate steps
-			bool save_cache, read_cache;
-			std::string cache;
-			std::string classifiercache;
-			
-			//! used ClassNames
-			ClassNames cn;
-
-			//! Classifier
-			VecClassifier *vclassifier;
-			FeaturePoolClassifier *fpc;
-
-			//! Configuration File
-			const Config *conf;
-			
-			//! Segmentation Method
-			RegionSegmentationMethod *rsm;	
-			
-			//! using color Weijer features or not
-			RegionFeatures *rfc;
-			
-			//! using HoGFeatures or not
-			RegionFeatures *rfhog;
-			
-			//! using BoV or not
-			RegionFeatures *rfbov;
-			
-			//! Moosmann Codebook (alternative BoV approach)
-			RegionFeatures *rfbovcrdf;
-			
-			//! old method like used in Csurka
-			RegionFeatures *rfCsurka;
-			
-			//! features for BoV
-			LocalFeature *siftFeats;
-			
-			//! using structure feature
-			RegionFeatures *rfstruct;
-			
-			//! MRF optimization
-			PPGraphCut *gcopt;
-
-		public:
-			/** constructor
-			 *  @param conf needs a configfile
-			 *  @param md and a MultiDataset (contains images and other things)
-			 */
-			SemSegRegionBased(const Config *c, const MultiDataset *md);
-
-			/** simple destructor */
-			virtual ~SemSegRegionBased();
-
-			/** The trainingstep
-			 *  @param md and a MultiDataset (contains images and other things)
-			 */
-			void train(const MultiDataset *md);
-
-			/** The main procedure. Input: Image, Output: Segmented Image with pixelwise labeles and the probabilities
-			 * @param ce image data
-			 * @param segresult result of the semantic segmentation with a label for each pixel
-			 * @param probabilities multi-channel image with one channel for each class and corresponding probabilities for each pixel
-			 */
-			void semanticseg(CachedExample *ce, NICE::Image & segresult,  NICE::MultiChannelImageT<double> & probabilities);
-			/**
-			 * get all features for an Image and save them in Examples
-			 * @param cimg input image
-			 * @param mask region mask
-			 * @param rg region graph
-			 * @param feats output features
-			 */
-			void getFeats(const NICE::ColorImage &cimg, const NICE::Matrix &mask, const RegionGraph &rg, std::vector<std::vector< FeatureType> > &feats) const;
-
-			/**
-			 * computes or reads features and corresponding labels for learnHighLevel()
-			 * @param perm input permutation
-			 * @param feats output features
-			 * @param label output label
-			 * @param examples output examples (including label)
-			 * @param mode mode 1 for examples, mode 0 for VVector
-			 */
-			void computeLF(LabeledSet::Permutation perm, VVector &feats, std::vector<int> &label, Examples &examples, int mode);
-			
-			/**
-			 * Computes HighLevel Codebooks (i.e. GMM or PCA) if necessary
-			 * @param perm training examples
-			 */
-			void learnHighLevel(LabeledSet::Permutation perm);
-
-			/**
-			 * trains the classifier
-			 * @param feats features
-			 */
-			void trainClassifier(std::vector<std::vector<FeatureType> > &feats, Examples &examples);
-			
-			/**
-			 * Convert features into examples
-			 * @param feats input features
-			 * @param examples features as examples
-			 */
-			void getExample(const std::vector<std::vector<FeatureType> > &feats, Examples &examples);
-			
-			/**
-			 * create featurepool depending on used features
-			 * @param feats input features
-			 * @param fp feature pool
-			 */
-			void getFeaturePool( const std::vector<std::vector<FeatureType> > &feats, FeaturePool &fp);
-
-			/**
-			 * classify the given features
-			 * @param feats input features
-			 * @param examples examples
-			 * @param probs probability for each region
-			 */
-			void classify(const std::vector<std::vector<FeatureType> > &feats, Examples &examples, std::vector<std::vector<double> > &probs);
-			
-			/**
-			 * set the label of each region the to most probable class
-			 * @param rg 
-			 * @param probs 
-			 */
-			void labelRegions(RegionGraph &rg, std::vector<std::vector<double> > &probs);
-			
-			/**
-			 * set label of each pixel to label of corresponding region
-			 * @param segresult result image
-			 * @param mask region mask
-			 * @param rg region graph
-			 */
-			void labelImage(NICE::Image &segresult, NICE::Matrix &mask,RegionGraph &rg);
-			
-			/**
-			 * get the label for each region from the groundtruth for learning step and save them in rg
-			 * @param mask region mask 
-			 * @param rg region graph
-			 * @param pixelLabels Groundtruth images
-			 */
-			void getRegionLabel(NICE::Matrix &mask, RegionGraph &rg, NICE::Image &pixelLabels);
-			
-			/**
-			 * train pca
-			 * @param feats input features
-			 * @param pca pca
-			 * @param dim new dimension
-			 * @param fn destination filename
-			 */
-			void initializePCA ( const VVector &feats, PCA &pca, int dim, std::string &fn );
-			
-			/**
-			 * transform features using a given pca
-			 * @param feats input and output features
-			 * @param pca 
-			 */
-			void transformFeats(VVector &feats, PCA &pca);
-
-	};
+class SemSegRegionBased : public SemanticSegmentation
+{
+  protected:
+
+    //! destination for saving intermediate steps
+    bool save_cache, read_cache;
+    std::string cache;
+    std::string classifiercache;
+
+    //! used ClassNames
+    ClassNames cn;
+
+    //! Classifier
+    VecClassifier *vclassifier;
+    FeaturePoolClassifier *fpc;
+
+    //! Configuration File
+    const NICE::Config *conf;
+
+    //! Segmentation Method
+    RegionSegmentationMethod *rsm;
+
+    //! using color Weijer features or not
+    RegionFeatures *rfc;
+
+    //! using HoGFeatures or not
+    RegionFeatures *rfhog;
+
+    //! using BoV or not
+    RegionFeatures *rfbov;
+
+    //! Moosmann Codebook (alternative BoV approach)
+    RegionFeatures *rfbovcrdf;
+
+    //! old method like used in Csurka
+    RegionFeatures *rfCsurka;
+
+    //! features for BoV
+    LocalFeature *siftFeats;
+
+    //! using structure feature
+    RegionFeatures *rfstruct;
+
+    //! MRF optimization
+    PPGraphCut *gcopt;
+
+  public:
+    /** constructor
+     *  @param conf needs a configfile
+     *  @param md and a MultiDataset (contains images and other things)
+     */
+    SemSegRegionBased ( const NICE::Config *c, const MultiDataset *md );
+
+    /** simple destructor */
+    virtual ~SemSegRegionBased();
+
+    /** The trainingstep
+     *  @param md and a MultiDataset (contains images and other things)
+     */
+    void train ( const MultiDataset *md );
+
+    /** The main procedure. Input: Image, Output: Segmented Image with pixelwise labeles and the probabilities
+     * @param ce image data
+     * @param segresult result of the semantic segmentation with a label for each pixel
+     * @param probabilities multi-channel image with one channel for each class and corresponding probabilities for each pixel
+     */
+    void semanticseg ( CachedExample *ce, NICE::Image & segresult,  NICE::MultiChannelImageT<double> & probabilities );
+    /**
+     * get all features for an Image and save them in Examples
+     * @param cimg input image
+     * @param mask region mask
+     * @param rg region graph
+     * @param feats output features
+     */
+    void getFeats ( const NICE::ColorImage &cimg, const NICE::Matrix &mask, const RegionGraph &rg, std::vector<std::vector< FeatureType> > &feats ) const;
+
+    /**
+     * computes or reads features and corresponding labels for learnHighLevel()
+     * @param perm input permutation
+     * @param feats output features
+     * @param label output label
+     * @param examples output examples (including label)
+     * @param mode mode 1 for examples, mode 0 for VVector
+     */
+    void computeLF ( LabeledSet::Permutation perm, NICE::VVector &feats, std::vector<int> &label, Examples &examples, int mode );
+
+    /**
+     * Computes HighLevel Codebooks (i.e. GMM or PCA) if necessary
+     * @param perm training examples
+     */
+    void learnHighLevel ( LabeledSet::Permutation perm );
+
+    /**
+     * trains the classifier
+     * @param feats features
+     */
+    void trainClassifier ( std::vector<std::vector<FeatureType> > &feats, Examples &examples );
+
+    /**
+     * Convert features into examples
+     * @param feats input features
+     * @param examples features as examples
+     */
+    void getExample ( const std::vector<std::vector<FeatureType> > &feats, Examples &examples );
+
+    /**
+     * create featurepool depending on used features
+     * @param feats input features
+     * @param fp feature pool
+     */
+    void getFeaturePool ( const std::vector<std::vector<FeatureType> > &feats, FeaturePool &fp );
+
+    /**
+     * classify the given features
+     * @param feats input features
+     * @param examples examples
+     * @param probs probability for each region
+     */
+    void classify ( const std::vector<std::vector<FeatureType> > &feats, Examples &examples, std::vector<std::vector<double> > &probs );
+
+    /**
+     * set the label of each region the to most probable class
+     * @param rg
+     * @param probs
+     */
+    void labelRegions ( RegionGraph &rg, std::vector<std::vector<double> > &probs );
+
+    /**
+     * set label of each pixel to label of corresponding region
+     * @param segresult result image
+     * @param mask region mask
+     * @param rg region graph
+     */
+    void labelImage ( NICE::Image &segresult, NICE::Matrix &mask,RegionGraph &rg );
+
+    /**
+     * get the label for each region from the groundtruth for learning step and save them in rg
+     * @param mask region mask
+     * @param rg region graph
+     * @param pixelLabels Groundtruth images
+     */
+    void getRegionLabel ( NICE::Matrix &mask, RegionGraph &rg, NICE::Image &pixelLabels );
+
+    /**
+     * train pca
+     * @param feats input features
+     * @param pca pca
+     * @param dim new dimension
+     * @param fn destination filename
+     */
+    void initializePCA ( const NICE::VVector &feats, PCA &pca, int dim, std::string &fn );
+
+    /**
+     * transform features using a given pca
+     * @param feats input and output features
+     * @param pca
+     */
+    void transformFeats ( NICE::VVector &feats, PCA &pca );
+
+};
 
 } // namespace
 

+ 1 - 1
semseg/SemSegSTF.h

@@ -67,7 +67,7 @@ class SemSegSTF : public SemanticSegmentation
 
   public:
     /** simple constructor */
-    SemSegSTF ( const Config *conf,
+    SemSegSTF ( const NICE::Config *conf,
                 const MultiDataset *md );
 
     /** simple destructor */

+ 24 - 23
semseg/SemSegTools.h

@@ -1,4 +1,4 @@
-/** 
+/**
 * @file SemSegTools.h
 * @brief tools for semantic segmentation
 * @author Erik Rodner
@@ -14,33 +14,34 @@
 #include "vislearning/cbaselib/CachedExample.h"
 
 
-namespace OBJREC {
+namespace OBJREC
+{
 
 /** tools for semantic segmentation */
 class SemSegTools
 {
 
-    protected:
-
-    public:
- 
-	/** collect pixel-wise training examples 
-	    from a set of images 
-	    @param conf includes settings about grid size etc.
-	    @param section section of the config
-	    @param train set of training images with localization information
-	    @param cn classNames object
-	    @param examples resulting pixel-wise examples
-	    @param imgexamples image based caching structure referenced by pixel-wise examples
-	*/
-	static void collectTrainingExamples ( 
-			  const Config * conf,
-			  const std::string & section,
-			  const LabeledSet & train,
-			  const ClassNames & cn,
-			  Examples & examples,
-			  std::vector<CachedExample *> & imgexamples );
-    
+  protected:
+
+  public:
+
+    /** collect pixel-wise training examples
+        from a set of images
+        @param conf includes settings about grid size etc.
+        @param section section of the config
+        @param train set of training images with localization information
+        @param cn classNames object
+        @param examples resulting pixel-wise examples
+        @param imgexamples image based caching structure referenced by pixel-wise examples
+    */
+    static void collectTrainingExamples (
+      const NICE::Config * conf,
+      const std::string & section,
+      const LabeledSet & train,
+      const ClassNames & cn,
+      Examples & examples,
+      std::vector<CachedExample *> & imgexamples );
+
 };
 
 

+ 57 - 55
semseg/SemanticSegmentation.h

@@ -1,4 +1,4 @@
-/** 
+/**
 * @file SemanticSegmentation.h
 * @brief abstract interface for semantic segmentation algorithms
 * @author Erik Rodner
@@ -9,70 +9,72 @@
 #define SEMANTICSEGMENTATIONINCLUDE
 
 #include <objrec/nice.h>
- 
+
 #include "vislearning/cbaselib/MultiDataset.h"
 #include "vislearning/cbaselib/LocalizationResult.h"
 #include "vislearning/cbaselib/CachedExample.h"
 #include "vislearning/cbaselib/Example.h"
- 
 
-namespace OBJREC {
+
+namespace OBJREC
+{
 
 /** abstract interface for semantic segmentation algorithms */
 class SemanticSegmentation
 {
 
-    protected:
-	/** accessible class names and information about
-	    number of classes etc. */
-	const ClassNames *classNames;
-
-	/** enum type for imagetype */
-	enum {
-	    IMAGETYPE_RGB = 0,
-	    IMAGETYPE_GRAY
-	};
-
-	/** whether to load images with color information */
-	int imagetype;
-
-    public:
-  
-	/** simple constructor 
-	    @param conf global settings
-	    @param classNames this ClassNames object while be stored as a attribute
-	*/
-	SemanticSegmentation( const Config *conf, 
-			      const ClassNames *classNames );
-      
-	/** simple destructor */
-	virtual ~SemanticSegmentation();
-
-	/** this function has to be overloaded by all subclasses 
-	    @param ce image data
-	    @param segresult result of the semantic segmentation with a label for each
-		   pixel
-	    @param probabilities multi-channel image with one channel for each class and
-			         corresponding probabilities for each pixel
-	*/
-	virtual void semanticseg ( OBJREC::CachedExample *ce, 
-			   NICE::Image & segresult,
-			   NICE::MultiChannelImageT<double> & probabilities ) = 0;
-			   
-	/**
-	 * convert different datatypes
-	 */
-	void convertVVectorToExamples(NICE::VVector &feats,OBJREC::Examples &examples, std::vector<int> &label);
-	void convertExamplesToVVector(NICE::VVector &feats,OBJREC::Examples &examples, std::vector<int> &label);
-	void convertExamplesToLSet(OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec);
-	void convertLSetToExamples(OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec);
-	void convertLSetToSparseExamples(OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec);
-
-	
-	/** load img from file call localize(CachedExample *ce) etc. */
-	void semanticseg ( const std::string & filename,
-			   NICE::Image & segresult,
-	  NICE::MultiChannelImageT<double> & probabilities);
+  protected:
+    /** accessible class names and information about
+        number of classes etc. */
+    const ClassNames *classNames;
+
+    /** enum type for imagetype */
+    enum
+    {
+      IMAGETYPE_RGB = 0,
+      IMAGETYPE_GRAY
+    };
+
+    /** whether to load images with color information */
+    int imagetype;
+
+  public:
+
+    /** simple constructor
+        @param conf global settings
+        @param classNames this ClassNames object while be stored as a attribute
+    */
+    SemanticSegmentation ( const NICE::Config *conf,
+                           const ClassNames *classNames );
+
+    /** simple destructor */
+    virtual ~SemanticSegmentation();
+
+    /** this function has to be overloaded by all subclasses
+        @param ce image data
+        @param segresult result of the semantic segmentation with a label for each
+        pixel
+        @param probabilities multi-channel image with one channel for each class and
+               corresponding probabilities for each pixel
+    */
+    virtual void semanticseg ( OBJREC::CachedExample *ce,
+                               NICE::Image & segresult,
+                               NICE::MultiChannelImageT<double> & probabilities ) = 0;
+
+    /**
+     * convert different datatypes
+     */
+    void convertVVectorToExamples ( NICE::VVector &feats,OBJREC::Examples &examples, std::vector<int> &label );
+    void convertExamplesToVVector ( NICE::VVector &feats,OBJREC::Examples &examples, std::vector<int> &label );
+    void convertExamplesToLSet ( OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec );
+    void convertLSetToExamples ( OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec );
+    void convertLSetToSparseExamples ( OBJREC::Examples &examples, OBJREC::LabeledSetVector &lvec );
+
+
+    /** load img from file call localize(CachedExample *ce) etc. */
+    void semanticseg ( const std::string & filename,
+                       NICE::Image & segresult,
+                       NICE::MultiChannelImageT<double> & probabilities );
 
 };
 

+ 91 - 90
semseg/postsegmentation/PPGraphCut.h

@@ -25,99 +25,100 @@
 #include "objrec/mrf/mrfmin/GCoptimization.h"
 
 
-namespace OBJREC {
+namespace OBJREC
+{
 
-class PPGraphCut : public Persistent
+class PPGraphCut : public NICE::Persistent
 {
 
-	protected:	
-		//! the configfile
-		const Config *conf;
-		
-		//! count of classes
-		int classno;
-		
-		//! Shape features
-		Examples shapefeats;
-		
-		//! classifier for shape features
-		FPCRandomForests *rf;
-		
-		double *coocurence;
-				
-	public:
-  
-		/** simple constructor */
-		PPGraphCut();
-		
-		/** simple constructor */
-		PPGraphCut(const Config *_conf);
-      
-		/** simple destructor */
-		~PPGraphCut();
-
-		/**
-		 * set the count of classes
-		 * @param _classno count of classes
-		 */
-		void setClassNo(int _classno);
-     
-		/** initialize the RelativeLocationPrior Variables*/
-		void Init();
-				
-		/**
-		 * train region
-		 * @param regions input regions with size and position
-		 * @param mask
-		 */
-		void trainImage(Examples &regions, NICE::Matrix &mask);
-		
-		/**
-		 * train region
-		 * @param regions input regions with size and position
-		 */
-		void trainImage(RegionGraph &regions);
-		
-		
-		/**
-		 * finish the priors maps
-		 */
-		void finishPP(ClassNames &cn);
-					
-		/**
-		 * use shape pp
-		 * @param regions 
-		 * @param mask 
-		 * @param probabilities probability maps for each pixel
-		 */
-		void optimizeImage(Examples &regions, NICE::Matrix &mask, NICE::MultiChannelImageT<double> & probabilities);
-		
-		/**
-		 * use shape pp
-		 * @param regions 
-		 * @param mask 
-		 * @param probabilities for each region
-		 */
-		void optimizeImage(OBJREC::RegionGraph &regions, std::vector<std::vector<double> > & probabilities);
-		
-		/**
-		 * load data from an input stream
-		 * @param is input stream
-		 * @param format 
-		 */
-		void restore (std::istream & is, int format = 0);
-		
-		/**
-		 * write data to an output stream
-		 * @param os outputstream
-		 * @param format 
-		 */
-		void store (std::ostream & os, int format = 0) const;
-		
-		/**
-		 * clear all informations
-		 */
-		void clear ();
+  protected:
+    //! the configfile
+    const NICE::Config *conf;
+
+    //! count of classes
+    int classno;
+
+    //! Shape features
+    Examples shapefeats;
+
+    //! classifier for shape features
+    FPCRandomForests *rf;
+
+    double *coocurence;
+
+  public:
+
+    /** simple constructor */
+    PPGraphCut();
+
+    /** simple constructor */
+    PPGraphCut ( const NICE::Config *_conf );
+
+    /** simple destructor */
+    ~PPGraphCut();
+
+    /**
+     * set the count of classes
+     * @param _classno count of classes
+     */
+    void setClassNo ( int _classno );
+
+    /** initialize the RelativeLocationPrior Variables*/
+    void Init();
+
+    /**
+     * train region
+     * @param regions input regions with size and position
+     * @param mask
+     */
+    void trainImage ( Examples &regions, NICE::Matrix &mask );
+
+    /**
+     * train region
+     * @param regions input regions with size and position
+     */
+    void trainImage ( RegionGraph &regions );
+
+
+    /**
+     * finish the priors maps
+     */
+    void finishPP ( ClassNames &cn );
+
+    /**
+     * use shape pp
+     * @param regions
+     * @param mask
+     * @param probabilities probability maps for each pixel
+     */
+    void optimizeImage ( Examples &regions, NICE::Matrix &mask, NICE::MultiChannelImageT<double> & probabilities );
+
+    /**
+     * use shape pp
+     * @param regions
+     * @param mask
+     * @param probabilities for each region
+     */
+    void optimizeImage ( OBJREC::RegionGraph &regions, std::vector<std::vector<double> > & probabilities );
+
+    /**
+     * load data from an input stream
+     * @param is input stream
+     * @param format
+     */
+    void restore ( std::istream & is, int format = 0 );
+
+    /**
+     * write data to an output stream
+     * @param os outputstream
+     * @param format
+     */
+    void store ( std::ostream & os, int format = 0 ) const;
+
+    /**
+     * clear all informations
+     */
+    void clear ();
 };
 
 } //namespace

+ 82 - 81
semseg/postsegmentation/PPSuperregion.h

@@ -27,92 +27,93 @@
 #include <image_nonvis.h>
 #endif
 
-namespace OBJREC {
+namespace OBJREC
+{
 
-class PPSuperregion : public Persistent
+class PPSuperregion : public NICE::Persistent
 {
 
-	protected:	
-		//! the configfile
-		const Config *conf;
-		
-		//! count of classes
-		int classno;
-		
-		//! Shape features
-		Examples shapefeats;
-		
-		//! classifier for shape features
-		FPCRandomForests *rf;
-				
-	public:
-  
-		/** simple constructor */
-		PPSuperregion();
-		
-		/** simple constructor */
-		PPSuperregion(const Config *_conf);
-      
-		/** simple destructor */
-		~PPSuperregion();
-
-		/**
-		 * set the count of classes
-		 * @param _classno count of classes
-		 */
-		void setClassNo(int _classno);
-     
-		/** initialize the RelativeLocationPrior Variables*/
-		void Init();
-
-		/**
-		 * combines connected regions with the same label to superregions
-		 * @param regions the input regions
-		 * @param mask the mask for the regions
-		 * @param superregions the superregions
-		 * @param classes the classlabels of the superregions
-		 */
+  protected:
+    //! the configfile
+    const NICE::Config *conf;
+
+    //! count of classes
+    int classno;
+
+    //! Shape features
+    Examples shapefeats;
+
+    //! classifier for shape features
+    FPCRandomForests *rf;
+
+  public:
+
+    /** simple constructor */
+    PPSuperregion();
+
+    /** simple constructor */
+    PPSuperregion ( const NICE::Config *_conf );
+
+    /** simple destructor */
+    ~PPSuperregion();
+
+    /**
+     * set the count of classes
+     * @param _classno count of classes
+     */
+    void setClassNo ( int _classno );
+
+    /** initialize the RelativeLocationPrior Variables*/
+    void Init();
+
+    /**
+     * combines connected regions with the same label to superregions
+     * @param regions the input regions
+     * @param mask the mask for the regions
+     * @param superregions the superregions
+     * @param classes the classlabels of the superregions
+     */
 #ifdef NICE_USELIB_ICE
-		void getSuperregions(const Examples &regions, const NICE::Matrix &mask, std::vector<ice::Region> &superregions, std::vector<int> &classes, NICE::Matrix &smask);
+    void getSuperregions ( const Examples &regions, const NICE::Matrix &mask, std::vector<ice::Region> &superregions, std::vector<int> &classes, NICE::Matrix &smask );
 #endif
-				
-		/**
-		 * Lerne Form der Regionen an
-		 * @param regions input regions with size and position
-		 * @param mask 
-		 */
-		void trainShape(Examples &regions, NICE::Matrix &mask);
-		
-		/**
-		 * finish the priors maps
-		 */
-		void finishShape(ClassNames &cn);
-					
-		/**
-		 * use shape pp
-		 * @param regions 
-		 * @param mask 
-		 */
-		void optimizeShape(Examples &regions, NICE::Matrix &mask, NICE::MultiChannelImageT<double> & probabilities);
-		
-		/**
-		 * load data from an input stream
-		 * @param is input stream
-		 * @param format 
-		 */
-		void restore (std::istream & is, int format = 0);
-		
-		/**
-		 * write data to an output stream
-		 * @param os outputstream
-		 * @param format 
-		 */
-		void store (std::ostream & os, int format = 0) const;
-		
-		/**
-		 * clear all informations
-		 */
-		void clear ();
+
+    /**
+     * Lerne Form der Regionen an
+     * @param regions input regions with size and position
+     * @param mask
+     */
+    void trainShape ( Examples &regions, NICE::Matrix &mask );
+
+    /**
+     * finish the priors maps
+     */
+    void finishShape ( ClassNames &cn );
+
+    /**
+     * use shape pp
+     * @param regions
+     * @param mask
+     */
+    void optimizeShape ( Examples &regions, NICE::Matrix &mask, NICE::MultiChannelImageT<double> & probabilities );
+
+    /**
+     * load data from an input stream
+     * @param is input stream
+     * @param format
+     */
+    void restore ( std::istream & is, int format = 0 );
+
+    /**
+     * write data to an output stream
+     * @param os outputstream
+     * @param format
+     */
+    void store ( std::ostream & os, int format = 0 ) const;
+
+    /**
+     * clear all informations
+     */
+    void clear ();
 };
 
 } //namespace

+ 27 - 25
semseg/postsegmentation/PSSBackgroundModel.h

@@ -1,4 +1,4 @@
-/** 
+/**
 * @file PSSBackgroundModel.h
 * @brief simple background models
 * @author Erik Rodner
@@ -11,35 +11,37 @@
 #include "PostSemSeg.h"
 
 
-namespace OBJREC {
+namespace OBJREC
+{
 
 /** simple background models */
 class PSSBackgroundModel : public PostSemSeg
 {
 
-    protected:
-	int backgroundModelType;
-	double threshold;
-	int backgroundClass;
-
-    public:
-	enum {
-	    BGM_FIXED_ENTROPY_THRESHOLD = 0,
-	    BGM_ADAPTIVE_ENTROPY_THRESHOLD,
-	    BGM_NONE
-	};
-
-	/** 
-	    @param backgroundModelType select one method from the enum type of this class
-	    @param threshold some methods need a threshold or parameter
-	*/
-	PSSBackgroundModel ( int backgroundModelType, double threshold, int backgroundClass );
-      
-	/** simple destructor */
-	virtual ~PSSBackgroundModel();
-	
-	virtual void postprocess ( NICE::Image & result, NICE::MultiChannelImageT<double> & probabilities );
-     
+  protected:
+    int backgroundModelType;
+    double threshold;
+    int backgroundClass;
+
+  public:
+    enum
+    {
+      BGM_FIXED_ENTROPY_THRESHOLD = 0,
+      BGM_ADAPTIVE_ENTROPY_THRESHOLD,
+      BGM_NONE
+    };
+
+    /**
+        @param backgroundModelType select one method from the enum type of this class
+        @param threshold some methods need a threshold or parameter
+    */
+    PSSBackgroundModel ( int backgroundModelType, double threshold, int backgroundClass );
+
+    /** simple destructor */
+    virtual ~PSSBackgroundModel();
+
+    virtual void postprocess ( NICE::Image & result, NICE::MultiChannelImageT<double> & probabilities );
+
 };
 
 

+ 27 - 25
semseg/postsegmentation/PSSImageLevelPrior.h

@@ -1,4 +1,4 @@
-/** 
+/**
 * @file PSSImageLevelPrior.h
 * @brief incorporate prior from image categorization method
 * @author Erik Rodner
@@ -12,35 +12,37 @@
 #include "vislearning/math/mathbase/FullVector.h"
 
 
-namespace OBJREC {
+namespace OBJREC
+{
 
 /** incorporate prior from image categorization method */
 class PSSImageLevelPrior : public PostSemSeg
 {
 
-    protected:
-	int imagePriorMethod;
-	FullVector prior;
-
-	int priorK;
-	double alphaImagePrior;
-
-    public:
-	
-	enum {
-	    IMAGE_PRIOR_BEST_K = 0,
-	    IMAGE_PRIOR_PSEUDOPROB
-	};
-  
-	/** simple constructor */
-	PSSImageLevelPrior( int imagePriorMethod, int priorK, double alphaImagePrior );
-      
-	/** simple destructor */
-	virtual ~PSSImageLevelPrior();
-	
-	void setPrior ( FullVector & prior );
-
-	void postprocess ( NICE::Image & result, NICE::MultiChannelImageT<double> & probabilities ); 
+  protected:
+    int imagePriorMethod;
+    FullVector prior;
+
+    int priorK;
+    double alphaImagePrior;
+
+  public:
+
+    enum
+    {
+      IMAGE_PRIOR_BEST_K = 0,
+      IMAGE_PRIOR_PSEUDOPROB
+    };
+
+    /** simple constructor */
+    PSSImageLevelPrior ( int imagePriorMethod, int priorK, double alphaImagePrior );
+
+    /** simple destructor */
+    virtual ~PSSImageLevelPrior();
+
+    void setPrior ( FullVector & prior );
+
+    void postprocess ( NICE::Image & result, NICE::MultiChannelImageT<double> & probabilities );
 };
 
 

+ 13 - 12
semseg/postsegmentation/PSSQueue.h

@@ -1,4 +1,4 @@
-/** 
+/**
 * @file PSSQueue.h
 * @brief application of multiple post semantic segmentation methods
 * @author Erik Rodner
@@ -13,24 +13,25 @@
 #else
 #include <objrec/nice.h>
 #endif
-  
 
-namespace OBJREC {
+
+namespace OBJREC
+{
 
 /** application of multiple post semantic segmentation methods */
 class PSSQueue
 {
 
-    protected:
+  protected:
+
+  public:
+
+    /** simple constructor */
+    PSSQueue();
+
+    /** simple destructor */
+    virtual ~PSSQueue();
 
-    public:
-  
-	/** simple constructor */
-	PSSQueue();
-      
-	/** simple destructor */
-	virtual ~PSSQueue();
-     
 };
 
 

+ 13 - 12
semseg/postsegmentation/PostSemSeg.h

@@ -1,4 +1,4 @@
-/** 
+/**
 * @file PostSemSeg.h
 * @brief abstract interface for post processing steps concerning semantic segmentation routines
 * @author Erik Rodner
@@ -11,24 +11,25 @@
 #include "core/image/MultiChannelImageT.h"
 
 
-namespace OBJREC {
+namespace OBJREC
+{
 
 /** abstract interface for post processing steps concerning semantic segmentation routines */
 class PostSemSeg
 {
 
-    protected:
+  protected:
+
+  public:
+
+    /** simple constructor */
+    PostSemSeg();
+
+    /** simple destructor */
+    virtual ~PostSemSeg();
 
-    public:
-  
-	/** simple constructor */
-	PostSemSeg();
-      
-	/** simple destructor */
-	virtual ~PostSemSeg();
+    virtual void postprocess ( NICE::Image & result, NICE::MultiChannelImageT<double> & probabilities ) = 0;
 
-	virtual void postprocess ( NICE::Image & result, NICE::MultiChannelImageT<double> & probabilities ) = 0;
-     
 };
 
 

+ 104 - 103
semseg/postsegmentation/RelativeLocationPrior.h

@@ -21,112 +21,113 @@
 
 #include "vislearning/cbaselib/ClassNames.h"
 
-namespace OBJREC {
+namespace OBJREC
+{
 
-class RelativeLocationPrior : public Persistent
+class RelativeLocationPrior : public NICE::Persistent
 {
 
-	protected:
-		//! the priormaps
-		std::vector<NICE::MultiChannelImageT<double> *> priormaps;
-		
-		//! the configfile
-		const Config *conf;
-		
-		//! count of classes
-		int classno;
-		
-		//! size of the priormaps (mapsize x mapsize)
-		int mapsize;
-		
-		//! convert Image coordinates to priormaps coordinates
-		void convertCoords(int &x, int xsize);
-		
-		//! the trainingsdata will be added subsequently to this object
-		Examples trainingsdata;
-		
-		//! the one vs all sparse logistic classifiers
-		std::vector<SLR> classifiers;
-    
-		//! dimension of the features
-		int featdim;
-						
-	public:
-  
-		/** simple constructor */
-		RelativeLocationPrior();
-		
-		/** simple constructor */
-		RelativeLocationPrior(const Config *_conf);
-      
-		/** simple destructor */
-		~RelativeLocationPrior();
-
-		/**
-		 * set the count of classes
-		 * @param _classno count of classes
-		 */
-		void setClassNo(int _classno);
-     
-		/** initialize the RelativeLocationPrior Variables*/
-		void Init();
-		
-		/**
-		 * Bestimme aus dem Trainingsbild, die location priors maps
-		 * @param regions input regions with size, position and label
-		 */
-		void trainPriorsMaps(Examples &regions, int xsize, int ysize);
-		
-		/**
-		 * finish the priors maps
-		 */
-		void finishPriorsMaps(ClassNames &cn);
-		
-		/**
-		 * Bestimme aus dem Trainingsbild, die location priors maps
-		 * @param regions input regions with size and position
-		 * @param probabilities the probabiltiy maps
-		 */
-		void trainClassifier(Examples &regions, NICE::MultiChannelImageT<double> & probabilities);
-		
-		/**
-		 * finish the classfiers
-		 */
-		void finishClassifier();
-		
-		/**
-		 * appends the featurevector to the given example
-		 * @param regions input regions with size and position
-		 * @param probabilities the probabiltiy maps
-		 */
-		void getFeature(Examples &regions, NICE::MultiChannelImageT<double> & probabilities);
-		
-		/**
-		 * uses the rlp for reclassification
-		 * @param regions 
-		 * @param result 
-		 * @param probabilities 
-		 */
-		void postprocess ( Examples &regions, NICE::MultiChannelImageT<double> & probabilities);
-		
-		/**
-		 * load data from an input stream
-		 * @param is input stream
-		 * @param format 
-		 */
-		void restore (std::istream & is, int format = 0);
-		
-		/**
-		 * write data to an output stream
-		 * @param os outputstream
-		 * @param format 
-		 */
-		void store (std::ostream & os, int format = 0) const;
-		
-		/**
-		 * clear all informations
-		 */
-		void clear ();
+  protected:
+    //! the priormaps
+    std::vector<NICE::MultiChannelImageT<double> *> priormaps;
+
+    //! the configfile
+    const NICE::Config *conf;
+
+    //! count of classes
+    int classno;
+
+    //! size of the priormaps (mapsize x mapsize)
+    int mapsize;
+
+    //! convert Image coordinates to priormaps coordinates
+    void convertCoords ( int &x, int xsize );
+
+    //! the trainingsdata will be added subsequently to this object
+    Examples trainingsdata;
+
+    //! the one vs all sparse logistic classifiers
+    std::vector<SLR> classifiers;
+
+    //! dimension of the features
+    int featdim;
+
+  public:
+
+    /** simple constructor */
+    RelativeLocationPrior();
+
+    /** simple constructor */
+    RelativeLocationPrior ( const NICE::Config *_conf );
+
+    /** simple destructor */
+    ~RelativeLocationPrior();
+
+    /**
+     * set the count of classes
+     * @param _classno count of classes
+     */
+    void setClassNo ( int _classno );
+
+    /** initialize the RelativeLocationPrior Variables*/
+    void Init();
+
+    /**
+     * Bestimme aus dem Trainingsbild, die location priors maps
+     * @param regions input regions with size, position and label
+     */
+    void trainPriorsMaps ( Examples &regions, int xsize, int ysize );
+
+    /**
+     * finish the priors maps
+     */
+    void finishPriorsMaps ( ClassNames &cn );
+
+    /**
+     * Bestimme aus dem Trainingsbild, die location priors maps
+     * @param regions input regions with size and position
+     * @param probabilities the probabiltiy maps
+     */
+    void trainClassifier ( Examples &regions, NICE::MultiChannelImageT<double> & probabilities );
+
+    /**
+     * finish the classfiers
+     */
+    void finishClassifier();
+
+    /**
+     * appends the featurevector to the given example
+     * @param regions input regions with size and position
+     * @param probabilities the probabiltiy maps
+     */
+    void getFeature ( Examples &regions, NICE::MultiChannelImageT<double> & probabilities );
+
+    /**
+     * uses the rlp for reclassification
+     * @param regions
+     * @param result
+     * @param probabilities
+     */
+    void postprocess ( Examples &regions, NICE::MultiChannelImageT<double> & probabilities );
+
+    /**
+     * load data from an input stream
+     * @param is input stream
+     * @param format
+     */
+    void restore ( std::istream & is, int format = 0 );
+
+    /**
+     * write data to an output stream
+     * @param os outputstream
+     * @param format
+     */
+    void store ( std::ostream & os, int format = 0 ) const;
+
+    /**
+     * clear all informations
+     */
+    void clear ();
 };
 
 } //namespace