Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated frontend logger intialisation #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions src/logging/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,28 @@ FrontendLogger::FrontendLogger()
output_frontend_img_path_(FLAGS_output_path + "/frontend_images/") {
namespace fs = std::filesystem;
const fs::path logger_dir(output_frontend_img_path_);
fs::create_directory(logger_dir);
fs::create_directory(logger_dir / "monoFeatureTracksLeftImg");
fs::create_directory(logger_dir / "monoTrackingUnrectifiedImg");
fs::create_directory(logger_dir / "monoTrackingRectifiedImg");
fs::create_directory(logger_dir / "stereoMatchingUnrectifiedImg");
fs::create_directory(logger_dir / "stereoMatchingRectifiedImg");
fs::create_directory(logger_dir / "rgbdDepthFeaturesImg");
fs::create_directory(logger_dir); // Create parent directory.
std::vector<std::string> sub_directories = { // Initialise list of directory names to create
"monoFeatureTracksLeftImg",
"monoTrackingUnrectifiedImg",
"monoTrackingRectifiedImg",
"stereoMatchingUnrectifiedImg",
"stereoMatchingRectifiedImg",
"rgbdDepthFeaturesImg"
};

// Loop through the directory names and create each directory if it doesn't exist.
for (const auto& sub_directory : sub_directories) {
std::string full_sub_dir_path = logger_dir / sub_directory;
if (fs::exists(full_sub_dir_path)) { // Iterate over the contents of the directory and remove each file.
for (const auto& entry : fs::directory_iterator(full_sub_dir_path)) {
fs::remove(entry);
}
}
else {
fs::create_directory(full_sub_dir_path);
}
}
}

void FrontendLogger::logFrontendStats(
Expand Down