Global image counting

Is useful later for when we want to know our progress
This commit is contained in:
Mark Hoekveen
2019-03-03 11:20:18 +01:00
parent aed05f694c
commit aa31c1f513
2 changed files with 4 additions and 2 deletions
+3 -2
View File
@@ -46,15 +46,16 @@ void DescriptorManager::Init() {
}
fs::ifstream ifs;
fs::ofstream ofs;
int cnt = std::count_if(
numImages = std::count_if(
fs::directory_iterator(img_path),
fs::directory_iterator(),
static_cast<bool(*)(const fs::path&)>(fs::is_regular_file));
//foreach image in directory (non-recursive)
int filecount = 0;
for (fs::directory_iterator itr(img_path); itr != fs::directory_iterator(); ++itr) {
cout << "\r" << "Progress: " << filecount++*100/cnt << "% - (" << filecount << "/" << cnt << ")" << flush;
cout << "\r" << "Progress: " << filecount*100/numImages << "% - (" << filecount << "/" << numImages << ")" << flush;
if (!itr->path().has_extension()) continue; //skip directories and such
filecount++;
string image_name = itr->path().filename().generic_string();
Image* image = new Image;
image->read(itr->path().string());