Browse Source

moved run3Dseg boolean to abstract class

Sven Sickert 9 năm trước cách đây
mục cha
commit
33bbac6231

+ 1 - 1
progs/testSemanticSegmentation3D.cpp

@@ -46,7 +46,7 @@ void startClassification (SemanticSegmentation *semseg,
     if (cvRuns > 1)
         write_results = false;
 
-    bool run_3Dseg = conf.gB( "SSContextTree", "run_3dseg", false);
+    bool run_3Dseg = semseg->isMode3D();
     string output_type = conf.gS ( "debug", "output_type", "ppm" );
 
     vector< int > zsizeVec;

+ 0 - 1
semseg/SemSegContextTree3D.cpp

@@ -89,7 +89,6 @@ SemSegContextTree3D::SemSegContextTree3D (
 
     this->lfcw                = NULL;
     this->firstiteration      = true;
-    this->run3Dseg            = conf->gB ( section, "run_3dseg", false );
     this->maxSamples          = conf->gI ( section, "max_samples", 2000 );
     this->minFeats            = conf->gI ( section, "min_feats", 50 );
     this->maxDepth            = conf->gI ( section, "max_depth", 10 );

+ 0 - 3
semseg/SemSegContextTree3D.h

@@ -41,9 +41,6 @@ private:
   /** local features */
   LocalFeatureColorWeijer *lfcw;
 
-  /** whether to run in 3D mode or not */
-  bool run3Dseg;
-
   /** whether to use a particular feature type or not */
   bool useFeat0, useFeat1, useFeat2, useFeat3, useFeat4;
 

+ 3 - 2
semseg/SemanticSegmentation.cpp

@@ -24,9 +24,9 @@ SemanticSegmentation::SemanticSegmentation ( )
     : iterationCountSuffix(1)
 {
     this->imagetype = IMAGETYPE_RGB;
-
     this->classNames = new ClassNames();
-
+    this->run3Dseg = false;
+    this->coarseMode = false;
 }
 
 SemanticSegmentation::SemanticSegmentation ( const Config *conf,
@@ -54,6 +54,7 @@ void SemanticSegmentation::initFromConfig(const Config* conf, const string& s_co
 {
     std::string imagetype_s = conf->gS ( "main", "imagetype", "rgb" );
     coarseMode = conf->gB( "main", "coarse_mode", false );
+    run3Dseg = conf->gB( "main", "run_3dseg", false );
 
     if ( imagetype_s == "rgb" )
         imagetype = IMAGETYPE_RGB;

+ 12 - 0
semseg/SemanticSegmentation.h

@@ -65,6 +65,9 @@ class SemanticSegmentation : public NICE::Persistent
     /** whether to do a coarse segmentation or not */
     bool coarseMode;
 
+    /** whether to run in 3D mode or not */
+    bool run3Dseg;
+
     /////////////////////////
     /////////////////////////
     //  PROTECTED METHODS  //
@@ -105,6 +108,15 @@ class SemanticSegmentation : public NICE::Persistent
     //                      SEGMENTATION STUFF
     ///////////////////// ///////////////////// /////////////////////
 
+    /**
+     * @brief return whether 3D mode is activated or not
+     * @return bool 3d mode status
+     */
+    bool isMode3D ()
+    {
+        return run3Dseg;
+    }
+
     /** load img from file call localize(CachedExample *ce) etc. */
     void semanticseg ( const std::string & filename,
                        NICE::ImageT<int> & segresult,