Bjoern Froehlich 13 жил өмнө
parent
commit
c7fc0826ce

+ 11 - 11
semseg/SemSegContextTree.cpp

@@ -114,13 +114,12 @@ SemSegContextTree::SemSegContextTree ( const Config *conf, const MultiDataset *m
  
   // geometric features of hoiem
   useHoiemFeatures = conf->gB( featsec, "use_hoiem_features", false );
-  if ( useHoiemFeatures ) {
+  if ( useHoiemFeatures )
+  {
     hoiemDirectory = conf->gS( featsec, "hoiem_directory" );
-    // FIXME: do we have to change colorchannels
-    // or change channelType??
   }
 
-    opOverview = vector<int> ( NBOPERATIONS, 0 );
+  opOverview = vector<int> ( NBOPERATIONS, 0 );
   contextOverview = vector<vector<double> > ( maxDepth, vector<double> ( 2, 0.0 ) );
 
   calcVal.push_back ( new MCImageAccess() );
@@ -1189,7 +1188,7 @@ void SemSegContextTree::extractBasicFeatures ( NICE::MultiChannelImageT<double>
     // we could also give the following set as a config option
     string hoiemClasses_s = "sky 000 090-045 090-090 090-135 090 090-por 090-sol";
     vector<string> hoiemClasses;
-    StringTools.split ( hoiemClasses, ' ', hoiemClasses );
+    StringTools::split ( hoiemClasses_s, ' ', hoiemClasses );
 
     // Now we have to do some fancy regular expressions :)
     // Original image filename: basel_000083.jpg
@@ -1201,7 +1200,7 @@ void SemSegContextTree::extractBasicFeatures ( NICE::MultiChannelImageT<double>
     FileName fnBase = fn.extractFileName();
 
     // counter for the channel index, starts with the current size of the destination multi-channel image
-    int currentChannel = feats.size();
+    int currentChannel = feats.channels();
 
     // add a channel for each feature in advance
     feats.addChannel ( hoiemClasses.size() );
@@ -1210,22 +1209,23 @@ void SemSegContextTree::extractBasicFeatures ( NICE::MultiChannelImageT<double>
     for ( vector<string>::const_iterator i = hoiemClasses.begin(); i != hoiemClasses.end(); i++, currentChannel++ )
     {
       string hoiemClass = *i;
-      FileName fnConfidenceImage ( hoiemDirectory + fnBase() + "_c_" + hoiemClass + ".png" );
+      FileName fnConfidenceImage ( hoiemDirectory + fnBase.str() + "_c_" + hoiemClass + ".png" );
       if ( ! fnConfidenceImage.fileExists() )
       {
-        fthrow(Exception, "Unable to read the Hoiem geometric confidence image: " << fnConfidenceImage() << " (original image is " << currentFile << ")" );
+        fthrow(Exception, "Unable to read the Hoiem geometric confidence image: " << fnConfidenceImage.str() << " (original image is " << currentFile << ")" );
       } else {
-        Image confidenceImage ( fnConfidenceImage() );
+        Image confidenceImage ( fnConfidenceImage.str() );
         // check whether the image size is consistent
         if ( confidenceImage.width() != feats.width() || confidenceImage.height() != feats.height() )
         {
-          fthrow(Exception, "The size of the geometric confidence image does not match with the original image size: " << fnConfidenceImage());
+          fthrow(Exception, "The size of the geometric confidence image does not match with the original image size: " << fnConfidenceImage.str());
         }
         ImageT<double> dst = feats[currentChannel];
+        
         // copy standard image to double image
         for ( uint y = 0 ; y < confidenceImage.height(); y++ )
           for ( uint x = 0 ; x < confidenceImage.width(); x++ )
-            dst.setPixel ( x, y, (double)confidenceImage.getPixel(x,y) );
+            feats(x, y, currentChannel) = (double)confidenceImage(x,y);
       }
     }
   }

+ 1 - 5
semseg/SemSegContextTree.h

@@ -112,20 +112,16 @@ class SemSegContextTree : public SemanticSegmentation, public NICE::Persistent
 
     /** how to handle each channel */
     std::vector<int> channelType;
-<<<<<<< HEAD
-    
+
     /** list of channels per feature type */
     std::vector<std::vector<int> > channelsPerType;
     
-=======
-
     /** whether we should use the geometric features of Hoeim (only offline computation with MATLAB supported) */
     bool useHoiemFeatures;
 
     /** directory of the geometric features */
     std::string hoiemDirectory; 
 
->>>>>>> 2db79f8343d0109ee6cadd926b6b17f0a1c6b880
   public:
     /** simple constructor */
     SemSegContextTree ( const NICE::Config *conf, const MultiDataset *md );