Parcourir la source

enable recreation of reconstruction files

Jérôme BUISINE il y a 3 ans
Parent
commit
30501228da
1 fichiers modifiés avec 13 ajouts et 0 suppressions
  1. 13 0
      main/rawls_merge_mean_incr_v2.cpp

+ 13 - 0
main/rawls_merge_mean_incr_v2.cpp

@@ -9,6 +9,11 @@
 #include <filesystem>
 #include <regex>
 
+#include <bits/stdc++.h> 
+#include <iostream> 
+#include <sys/stat.h> 
+#include <sys/types.h> 
+
 void writeProgress(float progress, bool moveUp = false){
     int barWidth = 200;
 
@@ -86,6 +91,9 @@ int main(int argc, char *argv[]){
         }
     }
 
+    // create output directory
+    mkdir(outputFolder.c_str(), 0755);
+
     std::vector<std::string> imagesPath;
 
     for (const auto & entry : std::filesystem::directory_iterator(folderName)){
@@ -95,6 +103,11 @@ int main(int argc, char *argv[]){
         }
     }
 
+    // check number of files
+    if (maxSamples > imagesPath.size()) {
+        maxSamples = imagesPath.size();
+    }
+
     // sort or shuffle the images path
     if (!random){
         std::sort(imagesPath.begin(), imagesPath.end(), std::less<std::string>());