From 5b49135cf303fa63409475234fdb4d6037985ba6 Mon Sep 17 00:00:00 2001 From: Alex Bailo Date: Thu, 12 Sep 2024 21:34:11 +0200 Subject: [PATCH 1/4] boost::filesystem to std::filesystem --- CMakeLists.txt | 12 +------- McCalib/CMakeLists.txt | 2 +- McCalib/include/McCalib.hpp | 7 +++-- McCalib/src/Board.cpp | 10 ++++--- McCalib/src/McCalib.cpp | 29 +++++++++---------- apps/calibrate/CMakeLists.txt | 2 +- apps/calibrate/src/calibrate.cpp | 3 +- apps/create_charuco_boards/CMakeLists.txt | 2 +- .../src/create_charuco_boards.cpp | 4 +-- tests/CMakeLists.txt | 2 +- tests/test_calibration.cpp | 23 ++++++++------- 11 files changed, 45 insertions(+), 51 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4137fe09..d3ad2c86 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,19 +16,9 @@ find_package(Ceres REQUIRED) # boost related setup set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) -find_package(Boost COMPONENTS log system filesystem REQUIRED) +find_package(Boost COMPONENTS log system REQUIRED) message(STATUS "Boost version: ${Boost_VERSION}") -# This is needed if your Boost version is newer than your CMake version -# or if you have an old version of CMake (<3.5) -if(NOT TARGET Boost::filesystem) - add_library(Boost::filesystem IMPORTED INTERFACE) - set_property(TARGET Boost::filesystem PROPERTY - INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR}) - set_property(TARGET Boost::filesystem PROPERTY - INTERFACE_LINK_LIBRARIES ${Boost_LIBRARIES}) -endif() - IF(SSSE3_FOUND) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3") ENDIF(SSSE3_FOUND) diff --git a/McCalib/CMakeLists.txt b/McCalib/CMakeLists.txt index fcaa6dcc..8f87ea42 100644 --- a/McCalib/CMakeLists.txt +++ b/McCalib/CMakeLists.txt @@ -5,4 +5,4 @@ add_library(McCalib STATIC ${MC_CALIB_HEADERS} ${MC_CALIB_SOURCES}) set_target_properties(McCalib PROPERTIES VERSION ${PROJECT_VERSION}) target_include_directories(McCalib PUBLIC include) target_include_directories(McCalib PUBLIC src) -target_link_libraries(McCalib PUBLIC -L/usr/local/lib ${OpenCV_LIBS} ${CERES_LIBRARIES} Boost::log Boost::system Boost::filesystem) \ No newline at end of file +target_link_libraries(McCalib PUBLIC -L/usr/local/lib ${OpenCV_LIBS} ${CERES_LIBRARIES} Boost::log Boost::system) \ No newline at end of file diff --git a/McCalib/include/McCalib.hpp b/McCalib/include/McCalib.hpp index ea27ebf6..50caaee1 100644 --- a/McCalib/include/McCalib.hpp +++ b/McCalib/include/McCalib.hpp @@ -1,14 +1,15 @@ #pragma once -#include "boost/filesystem.hpp" -#include "opencv2/core/core.hpp" +#include #include #include #include +#include + +#include "opencv2/core/core.hpp" #include #include #include -#include #include "Board.hpp" #include "BoardObs.hpp" diff --git a/McCalib/src/Board.cpp b/McCalib/src/Board.cpp index 7e939b8d..75821db1 100644 --- a/McCalib/src/Board.cpp +++ b/McCalib/src/Board.cpp @@ -1,10 +1,12 @@ -#include "boost/filesystem.hpp" -#include "opencv2/core/core.hpp" + +#include #include #include +#include + +#include "opencv2/core/core.hpp" #include #include -#include #include "Board.hpp" #include "Frame.hpp" @@ -23,7 +25,7 @@ Board::Board(const std::string config_path, const int board_idx) { int nb_board; cv::FileStorage fs; // FileStorage object to read calibration params from file const bool is_file_available = - boost::filesystem::exists(config_path) && config_path.length() > 0; + std::filesystem::exists(config_path) && config_path.length() > 0; if (!is_file_available) { LOG_FATAL << "Config path '" << config_path << "' doesn't exist."; return; diff --git a/McCalib/src/McCalib.cpp b/McCalib/src/McCalib.cpp index 8d0f3ad1..d9e464e8 100644 --- a/McCalib/src/McCalib.cpp +++ b/McCalib/src/McCalib.cpp @@ -28,7 +28,7 @@ Calibration::Calibration(const std::string config_path) { int nb_x_square, nb_y_square; float length_square, length_marker; const bool is_file_available = - boost::filesystem::exists(config_path) && config_path.length() > 0; + std::filesystem::exists(config_path) && config_path.length() > 0; if (!is_file_available) { LOG_FATAL << "Config path '" << config_path << "' doesn't exist."; return; @@ -94,8 +94,8 @@ Calibration::Calibration(const std::string config_path) { << " Distortion mode : " << distortion_model; // check if the save dir exist and create it if it does not - if (!boost::filesystem::exists(save_path_) && save_path_.length() > 0) { - boost::filesystem::create_directories(save_path_); + if (!std::filesystem::exists(save_path_) && save_path_.length() > 0) { + std::filesystem::create_directories(save_path_); } // prepare the distortion type per camera @@ -229,7 +229,7 @@ void Calibration::loadDetectedKeypoints() { */ void Calibration::boardExtraction() { if (!keypoints_path_.empty() && keypoints_path_ != "None" && - boost::filesystem::exists(keypoints_path_)) { + std::filesystem::exists(keypoints_path_)) { loadDetectedKeypoints(); } else { detectBoards(); @@ -657,9 +657,8 @@ void Calibration::insertNewObjectObservation( void Calibration::initializeCalibrationAllCam() { if (!cam_params_path_.empty() && cam_params_path_ != "None") { cv::FileStorage fs; - const bool is_file_available = - boost::filesystem::exists(cam_params_path_) && - cam_params_path_.length() > 0; + const bool is_file_available = std::filesystem::exists(cam_params_path_) && + cam_params_path_.length() > 0; if (!is_file_available) { LOG_FATAL << "Camera parameters path '" << cam_params_path_ << "' doesn't exist."; @@ -1892,11 +1891,11 @@ void Calibration::saveReprojectionImages(const int cam_id) { std::string path_save = path_root + cam_folder + "/"; // check if the file exist and create it if it does not - if (!boost::filesystem::exists(path_root) && path_root.length() > 0) { - boost::filesystem::create_directories(path_root); + if (!std::filesystem::exists(path_root) && path_root.length() > 0) { + std::filesystem::create_directories(path_root); } - if (!boost::filesystem::exists(path_save) && path_root.length() > 0) { - boost::filesystem::create_directory(path_save); + if (!std::filesystem::exists(path_save) && path_root.length() > 0) { + std::filesystem::create_directory(path_save); } std::shared_ptr cam = cams_[cam_id]; @@ -2004,11 +2003,11 @@ void Calibration::saveDetectionImages(const int cam_id) { std::string path_save = path_root + cam_folder + "/"; // check if the file exist and create it if it does not - if (!boost::filesystem::exists(path_root) && path_root.length() > 0) { - boost::filesystem::create_directories(path_root); + if (!std::filesystem::exists(path_root) && path_root.length() > 0) { + std::filesystem::create_directories(path_root); } - if (!boost::filesystem::exists(path_save) && path_root.length() > 0) { - boost::filesystem::create_directory(path_save); + if (!std::filesystem::exists(path_save) && path_root.length() > 0) { + std::filesystem::create_directory(path_save); } std::shared_ptr cam = cams_[cam_id]; diff --git a/apps/calibrate/CMakeLists.txt b/apps/calibrate/CMakeLists.txt index cb5c5294..fa7d2c22 100644 --- a/apps/calibrate/CMakeLists.txt +++ b/apps/calibrate/CMakeLists.txt @@ -3,4 +3,4 @@ set(SOURCES ) add_executable(calibrate ${SOURCES}) -target_link_libraries(calibrate -L/usr/local/lib ${OpenCV_LIBS} ${CERES_LIBRARIES} Boost::log Boost::system Boost::filesystem McCalib) +target_link_libraries(calibrate -L/usr/local/lib ${OpenCV_LIBS} ${CERES_LIBRARIES} Boost::log Boost::system McCalib) diff --git a/apps/calibrate/src/calibrate.cpp b/apps/calibrate/src/calibrate.cpp index 412e5fde..97a45751 100644 --- a/apps/calibrate/src/calibrate.cpp +++ b/apps/calibrate/src/calibrate.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -87,7 +88,7 @@ int main(int argc, char *argv[]) { (void)argc; // casting to fix -Werror=unused-parameter const std::string config_path = argv[1]; const bool is_file_available = - boost::filesystem::exists(config_path) && config_path.length() > 0; + std::filesystem::exists(config_path) && config_path.length() > 0; if (!is_file_available) { LOG_FATAL << "Config path '" << config_path << "' doesn't exist."; return -1; diff --git a/apps/create_charuco_boards/CMakeLists.txt b/apps/create_charuco_boards/CMakeLists.txt index f9c3cb1b..3b01910d 100644 --- a/apps/create_charuco_boards/CMakeLists.txt +++ b/apps/create_charuco_boards/CMakeLists.txt @@ -3,4 +3,4 @@ set(SOURCES ) add_executable(generate_charuco ${SOURCES}) -target_link_libraries(generate_charuco -L/usr/local/lib ${OpenCV_LIBS} Boost::filesystem) \ No newline at end of file +target_link_libraries(generate_charuco -L/usr/local/lib ${OpenCV_LIBS}) \ No newline at end of file diff --git a/apps/create_charuco_boards/src/create_charuco_boards.cpp b/apps/create_charuco_boards/src/create_charuco_boards.cpp index 85c5905d..8c1be101 100644 --- a/apps/create_charuco_boards/src/create_charuco_boards.cpp +++ b/apps/create_charuco_boards/src/create_charuco_boards.cpp @@ -1,7 +1,7 @@ +#include #include #include -#include "boost/filesystem.hpp" #include #include @@ -23,7 +23,7 @@ int main(int argc, char *argv[]) { std::vector square_size_per_board; cv::FileStorage fs; // FileStorage to read calibration params from file const bool is_file_available = - boost::filesystem::exists(pathInt) && pathInt.length() > 0; + std::filesystem::exists(pathInt) && pathInt.length() > 0; if (!is_file_available) { std::cout << "Config path '" << pathInt << "' doesn't exist." << std::endl; return -1; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1b51190b..55c4d432 100755 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package (Boost REQUIRED COMPONENTS unit_test_framework log_setup log filesystem REQUIRED) +find_package (Boost REQUIRED COMPONENTS unit_test_framework log_setup log REQUIRED) set(SOURCES main.cpp test_graph.cpp test_calibration.cpp test_geometrytools.cpp simple_unit_tests_example.cpp diff --git a/tests/test_calibration.cpp b/tests/test_calibration.cpp index 21679d14..3a3952b0 100644 --- a/tests/test_calibration.cpp +++ b/tests/test_calibration.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -121,7 +122,7 @@ BOOST_AUTO_TEST_SUITE(CheckCalibration) BOOST_AUTO_TEST_CASE(CheckBlenderDatasetIsPlacedCorrectly) { std::string blender_images_path = "../data/Blender_Images"; - bool is_path_existent = boost::filesystem::exists(blender_images_path); + bool is_path_existent = std::filesystem::exists(blender_images_path); BOOST_REQUIRE_EQUAL(is_path_existent, true); } @@ -129,8 +130,8 @@ BOOST_AUTO_TEST_CASE(CheckCalibrationSyntheticScenario1) { std::string config_path = "../tests/configs_for_end2end_tests/calib_param_synth_Scenario1.yml"; std::string gt_path = "../data/Blender_Images/Scenario_1/GroundTruth.yml"; - BOOST_REQUIRE_EQUAL(boost::filesystem::exists(config_path), true); - BOOST_REQUIRE_EQUAL(boost::filesystem::exists(gt_path), true); + BOOST_REQUIRE_EQUAL(std::filesystem::exists(config_path), true); + BOOST_REQUIRE_EQUAL(std::filesystem::exists(gt_path), true); calibrateAndCheckGt(config_path, gt_path); } @@ -138,8 +139,8 @@ BOOST_AUTO_TEST_CASE(CheckCalibrationSyntheticScenario2) { std::string config_path = "../tests/configs_for_end2end_tests/calib_param_synth_Scenario2.yml"; std::string gt_path = "../data/Blender_Images/Scenario_2/GroundTruth.yml"; - BOOST_REQUIRE_EQUAL(boost::filesystem::exists(config_path), true); - BOOST_REQUIRE_EQUAL(boost::filesystem::exists(gt_path), true); + BOOST_REQUIRE_EQUAL(std::filesystem::exists(config_path), true); + BOOST_REQUIRE_EQUAL(std::filesystem::exists(gt_path), true); calibrateAndCheckGt(config_path, gt_path); } @@ -147,8 +148,8 @@ BOOST_AUTO_TEST_CASE(CheckCalibrationSyntheticScenario3) { std::string config_path = "../tests/configs_for_end2end_tests/calib_param_synth_Scenario3.yml"; std::string gt_path = "../data/Blender_Images/Scenario_3/GroundTruth.yml"; - BOOST_REQUIRE_EQUAL(boost::filesystem::exists(config_path), true); - BOOST_REQUIRE_EQUAL(boost::filesystem::exists(gt_path), true); + BOOST_REQUIRE_EQUAL(std::filesystem::exists(config_path), true); + BOOST_REQUIRE_EQUAL(std::filesystem::exists(gt_path), true); calibrateAndCheckGt(config_path, gt_path); } @@ -156,8 +157,8 @@ BOOST_AUTO_TEST_CASE(CheckCalibrationSyntheticScenario4) { std::string config_path = "../tests/configs_for_end2end_tests/calib_param_synth_Scenario4.yml"; std::string gt_path = "../data/Blender_Images/Scenario_4/GroundTruth.yml"; - BOOST_REQUIRE_EQUAL(boost::filesystem::exists(config_path), true); - BOOST_REQUIRE_EQUAL(boost::filesystem::exists(gt_path), true); + BOOST_REQUIRE_EQUAL(std::filesystem::exists(config_path), true); + BOOST_REQUIRE_EQUAL(std::filesystem::exists(gt_path), true); calibrateAndCheckGt(config_path, gt_path); } @@ -165,8 +166,8 @@ BOOST_AUTO_TEST_CASE(CheckCalibrationSyntheticScenario5) { std::string config_path = "../tests/configs_for_end2end_tests/calib_param_synth_Scenario5.yml"; std::string gt_path = "../data/Blender_Images/Scenario_5/GroundTruth.yml"; - BOOST_REQUIRE_EQUAL(boost::filesystem::exists(config_path), true); - BOOST_REQUIRE_EQUAL(boost::filesystem::exists(gt_path), true); + BOOST_REQUIRE_EQUAL(std::filesystem::exists(config_path), true); + BOOST_REQUIRE_EQUAL(std::filesystem::exists(gt_path), true); calibrateAndCheckGt(config_path, gt_path); } From 089ebf80d58c458c89d74225449d294adbc5070f Mon Sep 17 00:00:00 2001 From: Alex Bailo Date: Thu, 12 Sep 2024 21:43:46 +0200 Subject: [PATCH 2/4] Upgrade clang-lint version --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e3ae3bd5..2d907e89 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,7 +25,7 @@ jobs: uses: actions/checkout@v2 # required to mount the Github Workspace to a volume - name: Run clang-format-lint - uses: DoozyX/clang-format-lint-action@v0.11 + uses: DoozyX/clang-format-lint-action@v0.18.1 with: source: '.' exclude: './third_party ./external .git' From 0d038815c3327b364667ea7b02f1651a8804d007 Mon Sep 17 00:00:00 2001 From: Alex Bailo Date: Sat, 14 Sep 2024 09:09:08 +0200 Subject: [PATCH 3/4] std::string -> std::filesystem::path for paths --- McCalib/include/Board.hpp | 6 +- McCalib/include/Frame.hpp | 11 ++- McCalib/include/McCalib.hpp | 32 +++---- McCalib/include/utilities.hpp | 12 +++ McCalib/src/Board.cpp | 8 +- McCalib/src/Frame.cpp | 7 +- McCalib/src/McCalib.cpp | 87 ++++++++++--------- McCalib/src/utilities.cpp | 21 +++++ apps/calibrate/src/calibrate.cpp | 9 +- .../src/create_charuco_boards.cpp | 7 +- .../calib_param_synth_Scenario1.yml | 4 +- .../calib_param_synth_Scenario2.yml | 4 +- .../calib_param_synth_Scenario3.yml | 4 +- .../calib_param_synth_Scenario4.yml | 4 +- .../calib_param_synth_Scenario5.yml | 4 +- tests/test_calibration.cpp | 30 ++++--- 16 files changed, 154 insertions(+), 96 deletions(-) create mode 100644 McCalib/include/utilities.hpp create mode 100644 McCalib/src/utilities.cpp diff --git a/McCalib/include/Board.hpp b/McCalib/include/Board.hpp index e69e5a1f..d4df609c 100644 --- a/McCalib/include/Board.hpp +++ b/McCalib/include/Board.hpp @@ -1,7 +1,9 @@ #pragma once -#include "opencv2/core/core.hpp" +#include #include + +#include "opencv2/core/core.hpp" #include #include #include @@ -45,7 +47,7 @@ class Board final { // Functions Board() = delete; ~Board(){}; - Board(const std::string config, const int board_idx); + Board(const std::filesystem::path &config, const int board_idx); void insertNewBoard(std::shared_ptr new_board); void insertNewFrame(std::shared_ptr new_frame); }; diff --git a/McCalib/include/Frame.hpp b/McCalib/include/Frame.hpp index 8ae282c9..2903ee00 100644 --- a/McCalib/include/Frame.hpp +++ b/McCalib/include/Frame.hpp @@ -1,10 +1,12 @@ #pragma once -#include "opencv2/core/core.hpp" +#include #include +#include + +#include "opencv2/core/core.hpp" #include #include -#include #include "BoardObs.hpp" #include "CameraGroupObs.hpp" @@ -44,12 +46,13 @@ class Frame final { cam_group_observations_; // cam group stored // Image - std::map frame_path_; // camera_id // path + std::map frame_path_; // camera_id // path // Functions Frame() = delete; ~Frame(){}; - Frame(const int frame_idx, const int cam_idx, const std::string frame_path); + Frame(const int frame_idx, const int cam_idx, + const std::filesystem::path &frame_path); void insertNewBoard(std::shared_ptr newBoard); void insertNewCamObs(std::shared_ptr newCamObs); void insertNewObject(std::shared_ptr new_object); diff --git a/McCalib/include/McCalib.hpp b/McCalib/include/McCalib.hpp index 50caaee1..98f99533 100644 --- a/McCalib/include/McCalib.hpp +++ b/McCalib/include/McCalib.hpp @@ -44,14 +44,17 @@ class Calibration final { float min_perc_pts_; // images path - std::string root_dir_, cam_prefix_; + std::filesystem::path root_path_; + std::string cam_prefix_; // intput/output path - std::string cam_params_path_; // path to precalibrated cameras intrinsics - std::string keypoints_path_; // path to predetected keypoints - std::string save_path_; // path to save calibrated cameras parameter - std::string camera_params_file_name_; // file name with cameras params - int save_repro_, save_detect_; // flag to save or not the images + std::filesystem::path + cam_params_path_; // path to precalibrated cameras intrinsics + std::filesystem::path keypoints_path_; // path to predetected keypoints + std::filesystem::path save_path_; // path to save calibrated cameras parameter + std::filesystem::path + camera_params_file_name_; // file name with cameras params + int save_repro_, save_detect_; // flag to save or not the images // various boards size parameters std::vector number_x_square_per_board_, number_y_square_per_board_; @@ -142,9 +145,9 @@ class Calibration final { // Functions Calibration() = delete; ~Calibration(){}; - Calibration( - const std::string config_path); // initialize the charuco pattern, nb - // of cameras, nb of boards etc. + Calibration(const std::filesystem::path + &config_path); // initialize the charuco pattern, nb + // of cameras, nb of boards etc. Calibration(const Calibration &) = delete; Calibration &operator=(const Calibration &) = delete; @@ -161,12 +164,11 @@ class Calibration final { // re-used to save time in detection stage void displayBoards(const cv::Mat image, const int cam_idx, const int frame_idx); - void - insertNewBoard(const int cam_idx, const int frame_idx, const int board_idx, - const std::vector pts_2d, - const std::vector charuco_idx, - const std::string frame_path); // insert a new board in all the - // different datastructure + void insertNewBoard( + const int cam_idx, const int frame_idx, const int board_idx, + const std::vector pts_2d, const std::vector charuco_idx, + const std::filesystem::path frame_path); // insert a new board in all the + // different datastructure void insertNewObjectObservation(std::shared_ptr new_obj_obs); // insert new object observation diff --git a/McCalib/include/utilities.hpp b/McCalib/include/utilities.hpp new file mode 100644 index 00000000..e10aea32 --- /dev/null +++ b/McCalib/include/utilities.hpp @@ -0,0 +1,12 @@ + +#include +#include +#include + +namespace McCalib { + +std::filesystem::path convertStrToPath(const std::string &item_name); +std::vector +convertVecStrToVecPath(const std::vector &input); + +} // namespace McCalib \ No newline at end of file diff --git a/McCalib/src/Board.cpp b/McCalib/src/Board.cpp index 75821db1..eb159de1 100644 --- a/McCalib/src/Board.cpp +++ b/McCalib/src/Board.cpp @@ -1,5 +1,4 @@ -#include #include #include #include @@ -18,14 +17,15 @@ * @param config_path path to the configuration file * @param board_idx index of the board */ -Board::Board(const std::string config_path, const int board_idx) { +Board::Board(const std::filesystem::path &config_path, const int board_idx) { std::vector number_x_square_per_board, number_y_square_per_board; std::vector square_size_per_board; std::vector boards_index; int nb_board; cv::FileStorage fs; // FileStorage object to read calibration params from file - const bool is_file_available = - std::filesystem::exists(config_path) && config_path.length() > 0; + const bool is_file_available = std::filesystem::exists(config_path) && + config_path.has_filename() && + config_path.extension() == ".yml"; if (!is_file_available) { LOG_FATAL << "Config path '" << config_path << "' doesn't exist."; return; diff --git a/McCalib/src/Frame.cpp b/McCalib/src/Frame.cpp index 98ad0e48..e902d75d 100644 --- a/McCalib/src/Frame.cpp +++ b/McCalib/src/Frame.cpp @@ -1,13 +1,14 @@ -#include "opencv2/core/core.hpp" #include +#include + +#include "opencv2/core/core.hpp" #include #include -#include #include "Frame.hpp" Frame::Frame(const int frame_idx, const int cam_idx, - const std::string frame_path) { + const std::filesystem::path &frame_path) { frame_idx_ = frame_idx; frame_path_[cam_idx] = frame_path; } diff --git a/McCalib/src/McCalib.cpp b/McCalib/src/McCalib.cpp index d9e464e8..dfe59101 100644 --- a/McCalib/src/McCalib.cpp +++ b/McCalib/src/McCalib.cpp @@ -8,6 +8,7 @@ #include "McCalib.hpp" #include "logger.h" #include "point_refinement.h" +#include "utilities.hpp" #include #include @@ -20,15 +21,17 @@ namespace McCalib { * * @param config_path path to the configuration file */ -Calibration::Calibration(const std::string config_path) { +Calibration::Calibration(const std::filesystem::path &config_path) { cv::FileStorage fs; // cv::FileStorage to read calibration params from file int distortion_model; std::vector distortion_per_camera; std::vector boards_index; int nb_x_square, nb_y_square; float length_square, length_marker; - const bool is_file_available = - std::filesystem::exists(config_path) && config_path.length() > 0; + const bool is_file_available = std::filesystem::exists(config_path) && + config_path.has_filename() && + config_path.extension() == ".yml"; + if (!is_file_available) { LOG_FATAL << "Config path '" << config_path << "' doesn't exist."; return; @@ -49,7 +52,7 @@ Calibration::Calibration(const std::string config_path) { fs["min_perc_pts"] >> min_perc_pts_; fs["number_x_square"] >> nb_x_square; fs["number_y_square"] >> nb_y_square; - fs["root_path"] >> root_dir_; + root_path_ = convertStrToPath(fs["root_path"]); fs["cam_prefix"] >> cam_prefix_; fs["quaternion_averaging:"] >> quaternion_averaging_; fs["ransac_threshold"] >> ransac_thresh_; @@ -59,10 +62,10 @@ Calibration::Calibration(const std::string config_path) { fs["boards_index"] >> boards_index; fs["length_square"] >> length_square; fs["length_marker"] >> length_marker; - fs["save_path"] >> save_path_; - fs["camera_params_file_name"] >> camera_params_file_name_; - fs["cam_params_path"] >> cam_params_path_; - fs["keypoints_path"] >> keypoints_path_; + save_path_ = convertStrToPath(fs["save_path"]); + camera_params_file_name_ = convertStrToPath(fs["camera_params_file_name"]); + cam_params_path_ = convertStrToPath(fs["cam_params_path"]); + keypoints_path_ = convertStrToPath(fs["keypoints_path"]); fs["save_reprojection"] >> save_repro_; fs["save_detection"] >> save_detect_; fs["square_size_per_board"] >> square_size_per_board_; @@ -94,7 +97,7 @@ Calibration::Calibration(const std::string config_path) { << " Distortion mode : " << distortion_model; // check if the save dir exist and create it if it does not - if (!std::filesystem::exists(save_path_) && save_path_.length() > 0) { + if (!std::filesystem::exists(save_path_) && save_path_.has_filename()) { std::filesystem::create_directories(save_path_); } @@ -162,12 +165,12 @@ void Calibration::detectBoards() { std::stringstream ss; ss << std::setw(3) << std::setfill('0') << cam + 1; const std::string cam_nb = ss.str(); - const std::string cam_path = root_dir_ + cam_prefix_ + cam_nb; + const std::filesystem::path cam_path = root_path_ / (cam_prefix_ + cam_nb); LOG_INFO << "Extraction camera " << cam_nb; // iterate through the images for corner extraction std::vector fn; - cv::glob(cam_path + "/*.*", fn, true); + cv::glob(cam_path / "*.*", fn, true); // filter based on allowed extensions std::vector fn_filtered; @@ -195,7 +198,7 @@ void Calibration::loadDetectedKeypoints() { int img_cols; int img_rows; std::vector frame_idxs; - std::vector frame_paths; + std::vector frame_paths; std::vector board_idxs; std::vector> points; std::vector> charuco_idxs; @@ -203,7 +206,11 @@ void Calibration::loadDetectedKeypoints() { data_per_camera["img_width"] >> img_cols; data_per_camera["img_height"] >> img_rows; data_per_camera["frame_idxs"] >> frame_idxs; - data_per_camera["frame_paths"] >> frame_paths; + + std::vector frame_paths_str; + data_per_camera["frame_paths"] >> frame_paths_str; + frame_paths = convertVecStrToVecPath(frame_paths_str); + data_per_camera["board_idxs"] >> board_idxs; data_per_camera["pts_2d"] >> points; data_per_camera["charuco_idxs"] >> charuco_idxs; @@ -369,10 +376,10 @@ void Calibration::detectBoardsInImageWithCamera(const std::string frame_path, */ void Calibration::saveCamerasParams() { - std::string save_path_camera_params = + const std::filesystem::path save_path_camera_params = (!camera_params_file_name_.empty()) - ? save_path_ + camera_params_file_name_ - : save_path_ + "calibrated_cameras_data.yml"; + ? save_path_ / camera_params_file_name_ + : save_path_ / "calibrated_cameras_data.yml"; cv::FileStorage fs(save_path_camera_params, cv::FileStorage::WRITE); for (const auto &it_cam_group : cam_group_) { std::shared_ptr cur_cam_group = it_cam_group.second; @@ -407,7 +414,8 @@ void Calibration::saveCamerasParams() { * Format: X Y Z board_id pts_id */ void Calibration::save3DObj() { - std::string save_path_object = save_path_ + "calibrated_objects_data.yml"; + const std::filesystem::path save_path_object = + save_path_ / "calibrated_objects_data.yml"; cv::FileStorage fs(save_path_object, cv::FileStorage::WRITE); for (const auto &it_obj : object_3d_) { @@ -448,8 +456,8 @@ void Calibration::save3DObj() { * */ void Calibration::save3DObjPose() { - std::string save_path_object_pose = - save_path_ + "calibrated_objects_pose_data.yml"; + const std::filesystem::path save_path_object_pose = + save_path_ / "calibrated_objects_pose_data.yml"; cv::FileStorage fs(save_path_object_pose, cv::FileStorage::WRITE); for (const auto &it_obj : object_3d_) { std::shared_ptr cur_object = it_obj.second; @@ -486,8 +494,8 @@ void Calibration::save3DObjPose() { * */ void Calibration::saveDetectedKeypoints() const { - const std::string save_keypoint_path = - save_path_ + "detected_keypoints_data.yml"; + const std::filesystem::path save_keypoint_path = + save_path_ / "detected_keypoints_data.yml"; cv::FileStorage fs(save_keypoint_path, cv::FileStorage::WRITE); fs << "nb_camera" << static_cast(cams_.size()); @@ -590,7 +598,7 @@ void Calibration::insertNewBoard(const int cam_idx, const int frame_idx, const int board_idx, const std::vector pts_2d, const std::vector charuco_idx, - const std::string frame_path) { + const std::filesystem::path frame_path) { std::shared_ptr new_board = std::make_shared( cam_idx, frame_idx, board_idx, pts_2d, charuco_idx, cams_[cam_idx], boards_3d_[board_idx]); @@ -658,7 +666,8 @@ void Calibration::initializeCalibrationAllCam() { if (!cam_params_path_.empty() && cam_params_path_ != "None") { cv::FileStorage fs; const bool is_file_available = std::filesystem::exists(cam_params_path_) && - cam_params_path_.length() > 0; + cam_params_path_.has_filename() && + cam_params_path_.extension() == ".yml"; if (!is_file_available) { LOG_FATAL << "Camera parameters path '" << cam_params_path_ << "' doesn't exist."; @@ -1884,17 +1893,17 @@ void Calibration::refineAllCameraGroupAndObjects() { */ void Calibration::saveReprojectionImages(const int cam_id) { // Prepare the path to save the images - std::string path_root = save_path_ + "Reprojection/"; + const std::filesystem::path path_root = save_path_ / "Reprojection"; std::stringstream ss; ss << std::setw(3) << std::setfill('0') << cam_id; - std::string cam_folder = ss.str(); - std::string path_save = path_root + cam_folder + "/"; + const std::string cam_folder = ss.str(); + const std::filesystem::path path_save = path_root / cam_folder; // check if the file exist and create it if it does not - if (!std::filesystem::exists(path_root) && path_root.length() > 0) { + if (!std::filesystem::exists(path_root) && path_root.has_filename()) { std::filesystem::create_directories(path_root); } - if (!std::filesystem::exists(path_save) && path_root.length() > 0) { + if (!std::filesystem::exists(path_save) && path_root.has_filename()) { std::filesystem::create_directory(path_save); } @@ -1903,7 +1912,7 @@ void Calibration::saveReprojectionImages(const int cam_id) { // Iterate through the frames where this camera has visibility for (const auto &it_frame : frames_) { // Open the image - std::string im_path = it_frame.second->frame_path_[cam_id]; + const std::filesystem::path im_path = it_frame.second->frame_path_[cam_id]; cv::Mat image = cv::imread(im_path); // Iterate through the camera group observations @@ -1975,8 +1984,8 @@ void Calibration::saveReprojectionImages(const int cam_id) { // Save image std::stringstream ss1; ss1 << std::setw(6) << std::setfill('0') << it_frame.second->frame_idx_; - std::string image_name = ss1.str() + ".jpg"; - cv::imwrite(path_save + image_name, image); + const std::string image_name = ss1.str() + ".jpg"; + cv::imwrite(path_save / image_name, image); } } } @@ -1996,17 +2005,17 @@ void Calibration::saveReprojectionImagesAllCam() { */ void Calibration::saveDetectionImages(const int cam_id) { // Prepare the path to save the images - std::string path_root = save_path_ + "Detection/"; + const std::filesystem::path path_root = save_path_ / "Detection"; std::stringstream ss; ss << std::setw(3) << std::setfill('0') << cam_id; std::string cam_folder = ss.str(); - std::string path_save = path_root + cam_folder + "/"; + const std::filesystem::path path_save = path_root / cam_folder; // check if the file exist and create it if it does not - if (!std::filesystem::exists(path_root) && path_root.length() > 0) { + if (!std::filesystem::exists(path_root) && path_root.has_filename()) { std::filesystem::create_directories(path_root); } - if (!std::filesystem::exists(path_save) && path_root.length() > 0) { + if (!std::filesystem::exists(path_save) && path_root.has_filename()) { std::filesystem::create_directory(path_save); } @@ -2015,7 +2024,7 @@ void Calibration::saveDetectionImages(const int cam_id) { // Iterate through the frames where this camera has visibility for (const auto &it_frame : frames_) { // Open the image - std::string im_path = it_frame.second->frame_path_[cam_id]; + const std::filesystem::path im_path = it_frame.second->frame_path_[cam_id]; cv::Mat image = cv::imread(im_path); // Iterate through the camera group observations @@ -2055,7 +2064,7 @@ void Calibration::saveDetectionImages(const int cam_id) { std::stringstream ss1; ss1 << std::setw(6) << std::setfill('0') << it_frame.second->frame_idx_; std::string image_name = ss1.str() + ".jpg"; - cv::imwrite(path_save + image_name, image); + cv::imwrite(path_save / image_name, image); } } } @@ -2241,8 +2250,8 @@ double Calibration::computeAvgReprojectionError() { * */ void Calibration::saveReprojectionErrorToFile() { - std::string save_reprojection_error = - save_path_ + "reprojection_error_data.yml"; + const std::filesystem::path save_reprojection_error = + save_path_ / "reprojection_error_data.yml"; cv::FileStorage fs(save_reprojection_error, cv::FileStorage::WRITE); cv::Mat frame_list; int nb_cam_group = cam_group_.size(); diff --git a/McCalib/src/utilities.cpp b/McCalib/src/utilities.cpp new file mode 100644 index 00000000..468df8f5 --- /dev/null +++ b/McCalib/src/utilities.cpp @@ -0,0 +1,21 @@ +#include "utilities.hpp" + +namespace McCalib { + +std::filesystem::path convertStrToPath(const std::string &item_name) { + const std::filesystem::path path(item_name); + return path; +} + +std::vector +convertVecStrToVecPath(const std::vector &input) { + std::vector out; + out.reserve(input.size()); + for (const std::string &item : input) { + const std::filesystem::path path(item); + out.push_back(path); + } + return out; +} + +} // namespace McCalib \ No newline at end of file diff --git a/apps/calibrate/src/calibrate.cpp b/apps/calibrate/src/calibrate.cpp index 97a45751..38346629 100644 --- a/apps/calibrate/src/calibrate.cpp +++ b/apps/calibrate/src/calibrate.cpp @@ -6,7 +6,7 @@ #include "McCalib.hpp" #include "logger.h" -void runCalibrationWorkflow(std::string config_path) { +void runCalibrationWorkflow(const std::filesystem::path &config_path) { // Instantiate the calibration and initialize the parameters McCalib::Calibration Calib(config_path); Calib.boardExtraction(); @@ -86,9 +86,10 @@ void runCalibrationWorkflow(std::string config_path) { int main(int argc, char *argv[]) { (void)argc; // casting to fix -Werror=unused-parameter - const std::string config_path = argv[1]; - const bool is_file_available = - std::filesystem::exists(config_path) && config_path.length() > 0; + const std::filesystem::path config_path = argv[1]; + const bool is_file_available = std::filesystem::exists(config_path) && + config_path.has_filename() && + config_path.extension() == ".yml"; if (!is_file_available) { LOG_FATAL << "Config path '" << config_path << "' doesn't exist."; return -1; diff --git a/apps/create_charuco_boards/src/create_charuco_boards.cpp b/apps/create_charuco_boards/src/create_charuco_boards.cpp index 8c1be101..2aedec0b 100644 --- a/apps/create_charuco_boards/src/create_charuco_boards.cpp +++ b/apps/create_charuco_boards/src/create_charuco_boards.cpp @@ -14,7 +14,7 @@ int main(int argc, char *argv[]) { } // path of the configuration file - std::string pathInt = argv[1]; + std::filesystem::path pathInt = argv[1]; // Read the parameters from the configuration file int num_x_square, num_y_square, res_x, res_y, NbBoard; float length_square, length_marker; @@ -22,8 +22,9 @@ int main(int argc, char *argv[]) { std::vector resolution_x_per_board, resolution_y_per_board; std::vector square_size_per_board; cv::FileStorage fs; // FileStorage to read calibration params from file - const bool is_file_available = - std::filesystem::exists(pathInt) && pathInt.length() > 0; + const bool is_file_available = std::filesystem::exists(pathInt) && + pathInt.has_filename() && + pathInt.extension() == ".yml"; if (!is_file_available) { std::cout << "Config path '" << pathInt << "' doesn't exist." << std::endl; return -1; diff --git a/tests/configs_for_end2end_tests/calib_param_synth_Scenario1.yml b/tests/configs_for_end2end_tests/calib_param_synth_Scenario1.yml index 3638a08b..a3bd0079 100755 --- a/tests/configs_for_end2end_tests/calib_param_synth_Scenario1.yml +++ b/tests/configs_for_end2end_tests/calib_param_synth_Scenario1.yml @@ -27,7 +27,7 @@ cam_params_path: "../data/Blender_Images/Scenario_1/initial_values.yml" # file fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Blender_Images/Scenario_1/Images/" +root_path: "../data/Blender_Images/Scenario_1/Images" cam_prefix: "Cam_" ######################################## Optimization Parameters ############################################# @@ -38,7 +38,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Blender_Images/Scenario_1/Results/" +save_path: "../data/Blender_Images/Scenario_1/Results" save_detection: 0 save_reprojection: 0 camera_params_file_name: "" # "name.yml" diff --git a/tests/configs_for_end2end_tests/calib_param_synth_Scenario2.yml b/tests/configs_for_end2end_tests/calib_param_synth_Scenario2.yml index 0786dc86..47fd86e9 100755 --- a/tests/configs_for_end2end_tests/calib_param_synth_Scenario2.yml +++ b/tests/configs_for_end2end_tests/calib_param_synth_Scenario2.yml @@ -27,7 +27,7 @@ cam_params_path: "None" # file with cameras intrinsics to initialize the intri fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Blender_Images/Scenario_2/Images/" +root_path: "../data/Blender_Images/Scenario_2/Images" cam_prefix: "Cam_" ######################################## Optimization Parameters ############################################# @@ -38,7 +38,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Blender_Images/Scenario_2/Results/" +save_path: "../data/Blender_Images/Scenario_2/Results" save_detection: 0 save_reprojection: 0 camera_params_file_name: "" # "name.yml" diff --git a/tests/configs_for_end2end_tests/calib_param_synth_Scenario3.yml b/tests/configs_for_end2end_tests/calib_param_synth_Scenario3.yml index 73ed157c..d0c40e5c 100755 --- a/tests/configs_for_end2end_tests/calib_param_synth_Scenario3.yml +++ b/tests/configs_for_end2end_tests/calib_param_synth_Scenario3.yml @@ -28,7 +28,7 @@ cam_params_path: "None" # file with cameras intrinsics to initialize the intri fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Blender_Images/Scenario_3/Images/" +root_path: "../data/Blender_Images/Scenario_3/Images" cam_prefix: "Cam_" ######################################## Optimization Parameters ############################################# @@ -39,7 +39,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Blender_Images/Scenario_3/Results/" +save_path: "../data/Blender_Images/Scenario_3/Results" save_detection: 0 save_reprojection: 0 camera_params_file_name: "" # "name.yml" diff --git a/tests/configs_for_end2end_tests/calib_param_synth_Scenario4.yml b/tests/configs_for_end2end_tests/calib_param_synth_Scenario4.yml index 32d01ba9..cf3f66e8 100755 --- a/tests/configs_for_end2end_tests/calib_param_synth_Scenario4.yml +++ b/tests/configs_for_end2end_tests/calib_param_synth_Scenario4.yml @@ -28,7 +28,7 @@ cam_params_path: "None" # file with cameras intrinsics to initialize the intri fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Blender_Images/Scenario_4/Images/" +root_path: "../data/Blender_Images/Scenario_4/Images" cam_prefix: "Cam_" ######################################## Optimization Parameters ############################################# @@ -39,7 +39,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Blender_Images/Scenario_4/Results/" +save_path: "../data/Blender_Images/Scenario_4/Results" save_detection: 0 save_reprojection: 0 camera_params_file_name: "" # "name.yml" diff --git a/tests/configs_for_end2end_tests/calib_param_synth_Scenario5.yml b/tests/configs_for_end2end_tests/calib_param_synth_Scenario5.yml index e7705171..7f39e0b5 100755 --- a/tests/configs_for_end2end_tests/calib_param_synth_Scenario5.yml +++ b/tests/configs_for_end2end_tests/calib_param_synth_Scenario5.yml @@ -27,7 +27,7 @@ cam_params_path: "None" # file with cameras intrinsics to initialize the intri fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Blender_Images/Scenario_5/Images/" +root_path: "../data/Blender_Images/Scenario_5/Images" cam_prefix: "Cam_" ######################################## Optimization Parameters ############################################# @@ -38,7 +38,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Blender_Images/Scenario_5/Results/" +save_path: "../data/Blender_Images/Scenario_5/Results" save_detection: 0 save_reprojection: 0 camera_params_file_name: "" # "name.yml" diff --git a/tests/test_calibration.cpp b/tests/test_calibration.cpp index 3a3952b0..3fdaceb1 100644 --- a/tests/test_calibration.cpp +++ b/tests/test_calibration.cpp @@ -59,7 +59,8 @@ void calibrate(McCalib::Calibration &Calib) { Calib.saveDetectedKeypoints(); } -void calibrateAndCheckGt(std::string config_path, std::string gt_path) { +void calibrateAndCheckGt(const std::filesystem::path &config_path, + const std::filesystem::path >_path) { McCalib::Calibration Calib(config_path); calibrate(Calib); @@ -121,51 +122,56 @@ void calibrateAndCheckGt(std::string config_path, std::string gt_path) { BOOST_AUTO_TEST_SUITE(CheckCalibration) BOOST_AUTO_TEST_CASE(CheckBlenderDatasetIsPlacedCorrectly) { - std::string blender_images_path = "../data/Blender_Images"; + const std::filesystem::path blender_images_path = "../data/Blender_Images"; bool is_path_existent = std::filesystem::exists(blender_images_path); BOOST_REQUIRE_EQUAL(is_path_existent, true); } BOOST_AUTO_TEST_CASE(CheckCalibrationSyntheticScenario1) { - std::string config_path = + const std::filesystem::path config_path = "../tests/configs_for_end2end_tests/calib_param_synth_Scenario1.yml"; - std::string gt_path = "../data/Blender_Images/Scenario_1/GroundTruth.yml"; + const std::filesystem::path gt_path = + "../data/Blender_Images/Scenario_1/GroundTruth.yml"; BOOST_REQUIRE_EQUAL(std::filesystem::exists(config_path), true); BOOST_REQUIRE_EQUAL(std::filesystem::exists(gt_path), true); calibrateAndCheckGt(config_path, gt_path); } BOOST_AUTO_TEST_CASE(CheckCalibrationSyntheticScenario2) { - std::string config_path = + const std::filesystem::path config_path = "../tests/configs_for_end2end_tests/calib_param_synth_Scenario2.yml"; - std::string gt_path = "../data/Blender_Images/Scenario_2/GroundTruth.yml"; + const std::filesystem::path gt_path = + "../data/Blender_Images/Scenario_2/GroundTruth.yml"; BOOST_REQUIRE_EQUAL(std::filesystem::exists(config_path), true); BOOST_REQUIRE_EQUAL(std::filesystem::exists(gt_path), true); calibrateAndCheckGt(config_path, gt_path); } BOOST_AUTO_TEST_CASE(CheckCalibrationSyntheticScenario3) { - std::string config_path = + const std::filesystem::path config_path = "../tests/configs_for_end2end_tests/calib_param_synth_Scenario3.yml"; - std::string gt_path = "../data/Blender_Images/Scenario_3/GroundTruth.yml"; + const std::filesystem::path gt_path = + "../data/Blender_Images/Scenario_3/GroundTruth.yml"; BOOST_REQUIRE_EQUAL(std::filesystem::exists(config_path), true); BOOST_REQUIRE_EQUAL(std::filesystem::exists(gt_path), true); calibrateAndCheckGt(config_path, gt_path); } BOOST_AUTO_TEST_CASE(CheckCalibrationSyntheticScenario4) { - std::string config_path = + const std::filesystem::path config_path = "../tests/configs_for_end2end_tests/calib_param_synth_Scenario4.yml"; - std::string gt_path = "../data/Blender_Images/Scenario_4/GroundTruth.yml"; + const std::filesystem::path gt_path = + "../data/Blender_Images/Scenario_4/GroundTruth.yml"; BOOST_REQUIRE_EQUAL(std::filesystem::exists(config_path), true); BOOST_REQUIRE_EQUAL(std::filesystem::exists(gt_path), true); calibrateAndCheckGt(config_path, gt_path); } BOOST_AUTO_TEST_CASE(CheckCalibrationSyntheticScenario5) { - std::string config_path = + const std::filesystem::path config_path = "../tests/configs_for_end2end_tests/calib_param_synth_Scenario5.yml"; - std::string gt_path = "../data/Blender_Images/Scenario_5/GroundTruth.yml"; + const std::filesystem::path gt_path = + "../data/Blender_Images/Scenario_5/GroundTruth.yml"; BOOST_REQUIRE_EQUAL(std::filesystem::exists(config_path), true); BOOST_REQUIRE_EQUAL(std::filesystem::exists(gt_path), true); calibrateAndCheckGt(config_path, gt_path); From f0d1db10a2699cf030f32a310d4dda9ad0ef9e04 Mon Sep 17 00:00:00 2001 From: Alex Bailo Date: Sat, 14 Sep 2024 09:09:22 +0200 Subject: [PATCH 4/4] Update configs --- README.md | 4 ++-- configs/Blender_Images/calib_param_synth_Scenario1.yml | 4 ++-- configs/Blender_Images/calib_param_synth_Scenario2.yml | 4 ++-- configs/Blender_Images/calib_param_synth_Scenario3.yml | 4 ++-- configs/Blender_Images/calib_param_synth_Scenario4.yml | 4 ++-- configs/Blender_Images/calib_param_synth_Scenario5.yml | 4 ++-- configs/Blender_Images/calib_param_synth_diff_size.yml | 4 ++-- configs/Blender_Images/calib_param_synth_non_square.yml | 4 ++-- configs/Real_images/calib_param_Seq00_Stereo_vision.yml | 4 ++-- configs/Real_images/calib_param_Seq01_Non-overlapping.yml | 4 ++-- .../Real_images/calib_param_Seq02_Overlapping_multicamera.yml | 4 ++-- configs/Real_images/calib_param_Seq03_hybrid.yml | 4 ++-- configs/Real_images/calib_param_Seq04_Converging_vision.yml | 4 ++-- .../Real_images/calib_param_Seq05_Non_overlapping_6Cam.yml | 4 ++-- 14 files changed, 28 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 916a31e6..0df511e0 100755 --- a/README.md +++ b/README.md @@ -160,7 +160,7 @@ min_perc_pts: 0.5 # min percentage of points visible to assume a good cam_params_path: "None" # file with cameras intrinsics to initialize the intrinsic, write "None" if no initialization available ######################################## Images Parameters ################################################### -root_path: "../data/Synthetic_calibration_image/Scenario_1/Images/" +root_path: "../data/Synthetic_calibration_image/Scenario_1/Images" cam_prefix: "Cam_" keypoints_path: "None" # "path_to/detected_keypoints_data.yml" to save time on keypoint detection @@ -173,7 +173,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refine he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "experiments/Synthetic_calibration_image/Scenario_1/" +save_path: "experiments/Synthetic_calibration_image/Scenario_1" save_detection: 1 save_reprojection: 1 camera_params_file_name: "" # "name.yml" diff --git a/configs/Blender_Images/calib_param_synth_Scenario1.yml b/configs/Blender_Images/calib_param_synth_Scenario1.yml index 4cb9799e..5e21ba49 100755 --- a/configs/Blender_Images/calib_param_synth_Scenario1.yml +++ b/configs/Blender_Images/calib_param_synth_Scenario1.yml @@ -27,7 +27,7 @@ cam_params_path: "../data/Blender_Images/Scenario_1/initial_values.yml" # file fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Blender_Images/Scenario_1/Images/" +root_path: "../data/Blender_Images/Scenario_1/Images" cam_prefix: "Cam_" keypoints_path: "../data/Blender_Images/Scenario_1/Results/detected_keypoints_data.yml" # "None" # @@ -40,7 +40,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Blender_Images/Scenario_1/Results/" +save_path: "../data/Blender_Images/Scenario_1/Results" save_detection: 0 save_reprojection: 0 camera_params_file_name: "" # "name.yml" diff --git a/configs/Blender_Images/calib_param_synth_Scenario2.yml b/configs/Blender_Images/calib_param_synth_Scenario2.yml index dcf672e3..0f52a866 100755 --- a/configs/Blender_Images/calib_param_synth_Scenario2.yml +++ b/configs/Blender_Images/calib_param_synth_Scenario2.yml @@ -27,7 +27,7 @@ cam_params_path: "None" # file with cameras intrinsics to initialize the intri fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Blender_Images/Scenario_2/Images/" +root_path: "../data/Blender_Images/Scenario_2/Images" cam_prefix: "Cam_" keypoints_path: "../data/Blender_Images/Scenario_2/Results/detected_keypoints_data.yml" # "None" # @@ -40,7 +40,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Blender_Images/Scenario_2/Results/" +save_path: "../data/Blender_Images/Scenario_2/Results" save_detection: 0 save_reprojection: 0 camera_params_file_name: "" # "name.yml" diff --git a/configs/Blender_Images/calib_param_synth_Scenario3.yml b/configs/Blender_Images/calib_param_synth_Scenario3.yml index fb2b1d55..05e705a9 100755 --- a/configs/Blender_Images/calib_param_synth_Scenario3.yml +++ b/configs/Blender_Images/calib_param_synth_Scenario3.yml @@ -28,7 +28,7 @@ cam_params_path: "None" # file with cameras intrinsics to initialize the intri fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Blender_Images/Scenario_3/Images/" +root_path: "../data/Blender_Images/Scenario_3/Images" cam_prefix: "Cam_" keypoints_path: "../data/Blender_Images/Scenario_3/Results/detected_keypoints_data.yml" @@ -41,7 +41,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Blender_Images/Scenario_3/Results/" +save_path: "../data/Blender_Images/Scenario_3/Results" save_detection: 0 save_reprojection: 0 camera_params_file_name: "" # "name.yml" diff --git a/configs/Blender_Images/calib_param_synth_Scenario4.yml b/configs/Blender_Images/calib_param_synth_Scenario4.yml index a73f5bbd..785408cf 100755 --- a/configs/Blender_Images/calib_param_synth_Scenario4.yml +++ b/configs/Blender_Images/calib_param_synth_Scenario4.yml @@ -28,7 +28,7 @@ cam_params_path: "None" # file with cameras intrinsics to initialize the intri fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Blender_Images/Scenario_4/Images/" +root_path: "../data/Blender_Images/Scenario_4/Images" cam_prefix: "Cam_" keypoints_path: "../data/Blender_Images/Scenario_4/Results/detected_keypoints_data.yml" @@ -41,7 +41,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Blender_Images/Scenario_4/Results/" +save_path: "../data/Blender_Images/Scenario_4/Results" save_detection: 0 save_reprojection: 0 camera_params_file_name: "" # "name.yml" diff --git a/configs/Blender_Images/calib_param_synth_Scenario5.yml b/configs/Blender_Images/calib_param_synth_Scenario5.yml index b2467093..b61038f2 100755 --- a/configs/Blender_Images/calib_param_synth_Scenario5.yml +++ b/configs/Blender_Images/calib_param_synth_Scenario5.yml @@ -27,7 +27,7 @@ cam_params_path: "None" # file with cameras intrinsics to initialize the intri fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Blender_Images/Scenario_5/Images/" +root_path: "../data/Blender_Images/Scenario_5/Images" cam_prefix: "Cam_" keypoints_path: "../data/Blender_Images/Scenario_5/Results/detected_keypoints_data.yml" @@ -40,7 +40,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Blender_Images/Scenario_5/Results/" +save_path: "../data/Blender_Images/Scenario_5/Results" save_detection: 0 save_reprojection: 0 camera_params_file_name: "" # "name.yml" diff --git a/configs/Blender_Images/calib_param_synth_diff_size.yml b/configs/Blender_Images/calib_param_synth_diff_size.yml index d0b3186b..33a2c5bb 100755 --- a/configs/Blender_Images/calib_param_synth_diff_size.yml +++ b/configs/Blender_Images/calib_param_synth_diff_size.yml @@ -29,7 +29,7 @@ cam_params_path: "None" # file with cameras intrinsics to initialize the intri fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../../Data/Blender_Images/Scenario_Diff_Size/Images/" +root_path: "../../Data/Blender_Images/Scenario_Diff_Size/Images" cam_prefix: "Cam_" ######################################## Optimization Parameters ############################################# @@ -40,7 +40,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../../Data/Blender_Images/Scenario_Diff_Size/Results/" +save_path: "../../Data/Blender_Images/Scenario_Diff_Size/Results" save_detection: 1 save_reprojection: 1 camera_params_file_name: "" # "name.yml" diff --git a/configs/Blender_Images/calib_param_synth_non_square.yml b/configs/Blender_Images/calib_param_synth_non_square.yml index 4bdb2599..3ec02f0c 100755 --- a/configs/Blender_Images/calib_param_synth_non_square.yml +++ b/configs/Blender_Images/calib_param_synth_non_square.yml @@ -27,7 +27,7 @@ cam_params_path: "None" # file with cameras intrinsics to initialize the intri fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../../Data/Blender_Images/Scenario_Non_Square/Images/" +root_path: "../../Data/Blender_Images/Scenario_Non_Square/Images" cam_prefix: "Cam_" ######################################## Optimization Parameters ############################################# @@ -38,7 +38,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../../Data/Blender_Images/Scenario_Non_Square/Results/" +save_path: "../../Data/Blender_Images/Scenario_Non_Square/Results" save_detection: 1 save_reprojection: 1 camera_params_file_name: "" # "name.yml" diff --git a/configs/Real_images/calib_param_Seq00_Stereo_vision.yml b/configs/Real_images/calib_param_Seq00_Stereo_vision.yml index 405dbf17..c895fc61 100755 --- a/configs/Real_images/calib_param_Seq00_Stereo_vision.yml +++ b/configs/Real_images/calib_param_Seq00_Stereo_vision.yml @@ -29,7 +29,7 @@ cam_params_path: "None" # "../../Images_Plan/calibrated_cameras_data.yml" # fil fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Real_Images/Seq00_Stereo_vision/" #"../../Images_Sim1Cam3Board/" # "../../Images_NonOver3/" "../../Images_Cube/" "../../Images_Plan/" "../../Images_NonOver6Cam/" +root_path: "../data/Real_Images/Seq00_Stereo_vision" #"../../Images_Sim1Cam3Board/" # "../../Images_NonOver3/" "../../Images_Cube/" "../../Images_Plan/" "../../Images_NonOver6Cam/" cam_prefix: "Cam_" keypoints_path: "../data/Real_Images/Seq00_Stereo_vision/detected_keypoints_data.yml" @@ -42,7 +42,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Real_Images/Seq00_Stereo_vision/" +save_path: "../data/Real_Images/Seq00_Stereo_vision" save_detection: 0 save_reprojection: 0 camera_params_file_name: "" diff --git a/configs/Real_images/calib_param_Seq01_Non-overlapping.yml b/configs/Real_images/calib_param_Seq01_Non-overlapping.yml index 6293e50f..28b29855 100755 --- a/configs/Real_images/calib_param_Seq01_Non-overlapping.yml +++ b/configs/Real_images/calib_param_Seq01_Non-overlapping.yml @@ -29,7 +29,7 @@ cam_params_path: "None" # "../../Images_Plan/calibrated_cameras_data.yml" # fil fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Real_Images/Seq01_Non-overlapping/" #"../../Images_Sim1Cam3Board/" # "../../Images_NonOver3/" "../../Images_Cube/" "../../Images_Plan/" "../../Images_NonOver6Cam/" +root_path: "../data/Real_Images/Seq01_Non-overlapping" #"../../Images_Sim1Cam3Board/" # "../../Images_NonOver3/" "../../Images_Cube/" "../../Images_Plan/" "../../Images_NonOver6Cam/" cam_prefix: "Cam_" keypoints_path: "../data/Real_Images/Seq01_Non-overlapping/detected_keypoints_data.yml" @@ -42,7 +42,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Real_Images/Seq01_Non-overlapping/" +save_path: "../data/Real_Images/Seq01_Non-overlapping" save_detection: 0 save_reprojection: 0 camera_params_file_name: "" diff --git a/configs/Real_images/calib_param_Seq02_Overlapping_multicamera.yml b/configs/Real_images/calib_param_Seq02_Overlapping_multicamera.yml index f0655ac9..e7f519c6 100755 --- a/configs/Real_images/calib_param_Seq02_Overlapping_multicamera.yml +++ b/configs/Real_images/calib_param_Seq02_Overlapping_multicamera.yml @@ -29,7 +29,7 @@ cam_params_path: "None" # "../../Images_Plan/calibrated_cameras_data.yml" # fil fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Real_Images/Seq02_Overlapping_multicamera/" #"../../Images_Sim1Cam3Board/" # "../../Images_NonOver3/" "../../Images_Cube/" "../../Images_Plan/" "../../Images_NonOver6Cam/" +root_path: "../data/Real_Images/Seq02_Overlapping_multicamera" #"../../Images_Sim1Cam3Board/" # "../../Images_NonOver3/" "../../Images_Cube/" "../../Images_Plan/" "../../Images_NonOver6Cam/" cam_prefix: "Cam_" keypoints_path: "../data/Real_Images/Seq02_Overlapping_multicamera/detected_keypoints_data.yml" @@ -42,7 +42,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Real_Images/Seq02_Overlapping_multicamera/" +save_path: "../data/Real_Images/Seq02_Overlapping_multicamera" save_detection: 0 save_reprojection: 0 camera_params_file_name: "" diff --git a/configs/Real_images/calib_param_Seq03_hybrid.yml b/configs/Real_images/calib_param_Seq03_hybrid.yml index c1d30248..e5f23889 100755 --- a/configs/Real_images/calib_param_Seq03_hybrid.yml +++ b/configs/Real_images/calib_param_Seq03_hybrid.yml @@ -29,7 +29,7 @@ cam_params_path: "None" # "../../Images_Plan/calibrated_cameras_data.yml" # fil fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Real_Images/Seq03_hybrid/" #"../../Images_Sim1Cam3Board/" # "../../Images_NonOver3/" "../../Images_Cube/" "../../Images_Plan/" "../../Images_NonOver6Cam/" +root_path: "../data/Real_Images/Seq03_hybrid" #"../../Images_Sim1Cam3Board/" # "../../Images_NonOver3/" "../../Images_Cube/" "../../Images_Plan/" "../../Images_NonOver6Cam/" cam_prefix: "Cam_" keypoints_path: "../data/Real_Images/Seq03_hybrid/detected_keypoints_data.yml" @@ -42,7 +42,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Real_Images/Seq03_hybrid/" +save_path: "../data/Real_Images/Seq03_hybrid" save_detection: 0 save_reprojection: 0 camera_params_file_name: "" diff --git a/configs/Real_images/calib_param_Seq04_Converging_vision.yml b/configs/Real_images/calib_param_Seq04_Converging_vision.yml index a8fe8d04..70549fa3 100755 --- a/configs/Real_images/calib_param_Seq04_Converging_vision.yml +++ b/configs/Real_images/calib_param_Seq04_Converging_vision.yml @@ -29,7 +29,7 @@ cam_params_path: "None" # "../../Images_Plan/calibrated_cameras_data.yml" # fil fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Real_Images/Seq04_Converging_vision/" #"../../Images_Sim1Cam3Board/" # "../../Images_NonOver3/" "../../Images_Cube/" "../../Images_Plan/" "../../Images_NonOver6Cam/" +root_path: "../data/Real_Images/Seq04_Converging_vision" #"../../Images_Sim1Cam3Board/" # "../../Images_NonOver3/" "../../Images_Cube/" "../../Images_Plan/" "../../Images_NonOver6Cam/" cam_prefix: "Cam_" keypoints_path: "../data/Real_Images/Seq04_Converging_vision/detected_keypoints_data.yml" @@ -42,7 +42,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Real_Images/Seq04_Converging_vision/" +save_path: "../data/Real_Images/Seq04_Converging_vision" save_detection: 0 save_reprojection: 0 camera_params_file_name: "" diff --git a/configs/Real_images/calib_param_Seq05_Non_overlapping_6Cam.yml b/configs/Real_images/calib_param_Seq05_Non_overlapping_6Cam.yml index 52d4982b..9566631f 100755 --- a/configs/Real_images/calib_param_Seq05_Non_overlapping_6Cam.yml +++ b/configs/Real_images/calib_param_Seq05_Non_overlapping_6Cam.yml @@ -29,7 +29,7 @@ cam_params_path: "None" # "../../Images_Plan/calibrated_cameras_data.yml" # fil fix_intrinsic: 0 #if 1 then the intrinsic parameters will not be estimated nor refined (initial value needed) ######################################## Images Parameters ################################################### -root_path: "../data/Real_Images/Seq05_Non_overlapping_6Cam/" #"../../Images_Sim1Cam3Board/" # "../../Images_NonOver3/" "../../Images_Cube/" "../../Images_Plan/" "../../Images_NonOver6Cam/" +root_path: "../data/Real_Images/Seq05_Non_overlapping_6Cam" #"../../Images_Sim1Cam3Board/" # "../../Images_NonOver3/" "../../Images_Cube/" "../../Images_Plan/" "../../Images_NonOver6Cam/" cam_prefix: "Cam_" keypoints_path: "../data/Real_Images/Seq05_Non_overlapping_6Cam/detected_keypoints_data.yml" @@ -42,7 +42,7 @@ number_iterations: 1000 # Max number of iterations for the non linear refinem he_approach: 0 #0: bootstrapped he technique, 1: traditional he ######################################## Output Parameters ################################################### -save_path: "../data/Real_Images/Seq05_Non_overlapping_6Cam/" +save_path: "../data/Real_Images/Seq05_Non_overlapping_6Cam" save_detection: 0 save_reprojection: 0 camera_params_file_name: ""