Selaa lähdekoodia

added function to print probability maps

Sven Sickert 11 vuotta sitten
vanhempi
commit
0f897bbacf
2 muutettua tiedostoa jossa 27 lisäystä ja 0 poistoa
  1. 20 0
      semseg/SemanticSegmentation.cpp
  2. 7 0
      semseg/SemanticSegmentation.h

+ 20 - 0
semseg/SemanticSegmentation.cpp

@@ -289,3 +289,23 @@ void SemanticSegmentation::make3DImage ( const std::vector<std::string> & fileli
   }
 }
 
+void SemanticSegmentation::getProbabilityMap ( const NICE::MultiChannelImage3DT<double> & prob )
+{
+  std::string s;
+
+  for ( int cl = 0; cl < prob.channels(); cl++ )
+    for ( int z = 0; z < prob.depth(); z++ )
+    {
+      NICE::ColorImage img( prob.width(),prob.height() );
+      NICE::ImageT<double> m = prob.getChannelT(z, cl);
+      imageToPseudoColor(m, img);
+
+      std::stringstream out;
+      out << "probmap_s" << z << "_c" << cl << ".ppm";
+      s = out.str();
+      img.write( s );
+
+      //showImage(img, "Probability map");
+      //getchar();
+    }
+}

+ 7 - 0
semseg/SemanticSegmentation.h

@@ -90,6 +90,13 @@ public:
   void make3DImage ( const std::vector<std::string> & filelist,
                      NICE::MultiChannelImage3DT<double> & imgData );
 
+  /**
+   * @brief show a probability map for a given class
+   * @param prob  class probabilites for each pixel
+   * @param cl    class number
+   */
+  void getProbabilityMap( const NICE::MultiChannelImage3DT<double> & prob );
+
 };