From cb75ee84481824225d529d268b079acb4cb107d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Fri, 5 Jan 2024 15:30:17 +0100 Subject: [PATCH 01/17] [software] Replace calls to `boost::filesystem` by `std::filesystem` This commit removes Boost::filesystem from all the executables. For executables that included modules that are still using Boost::filesystem, the specific included files in these modules have been modified to also replace Boost::filesystem calls by std::filesystem ones. --- src/aliceVision/image/io.cpp | 4 +-- src/aliceVision/mvsUtils/MultiViewParams.cpp | 4 +-- .../ReconstructionEngine_sequentialSfM.hpp | 6 ++-- src/aliceVision/sfmDataIO/viewIO.cpp | 4 +-- .../sphereDetection/sphereDetection.cpp | 1 - .../sphereDetection/sphereDetection.hpp | 9 +++--- src/aliceVision/utils/filesIO.hpp | 12 +++---- src/software/convert/CMakeLists.txt | 2 -- src/software/convert/main_convertMesh.cpp | 4 +-- .../convert/main_convertSfMFormat.cpp | 4 +-- .../convert/main_importKnownPoses.cpp | 5 ++- src/software/export/CMakeLists.txt | 13 -------- .../export/main_exportAnimatedCamera.cpp | 4 +-- src/software/export/main_exportColmap.cpp | 4 +-- src/software/export/main_exportDistortion.cpp | 2 -- src/software/export/main_exportKeypoints.cpp | 4 +-- src/software/export/main_exportMVE2.cpp | 8 ++--- .../export/main_exportMVSTexturing.cpp | 4 +-- src/software/export/main_exportMatches.cpp | 8 ++--- src/software/export/main_exportMatlab.cpp | 4 +-- src/software/export/main_exportMeshlab.cpp | 4 +-- .../export/main_exportMeshroomMaya.cpp | 4 +-- src/software/export/main_exportPMVS.cpp | 8 ++--- src/software/export/main_exportTracks.cpp | 5 +-- src/software/export/main_exportUSD.cpp | 19 +++++------ src/software/pipeline/CMakeLists.txt | 32 ------------------- .../pipeline/main_LdrToHdrCalibration.cpp | 8 ++--- src/software/pipeline/main_LdrToHdrMerge.cpp | 11 ++++--- .../pipeline/main_LdrToHdrSampling.cpp | 5 ++- .../pipeline/main_cameraCalibration.cpp | 9 +++--- src/software/pipeline/main_cameraInit.cpp | 6 ++-- .../pipeline/main_cameraLocalization.cpp | 12 +++---- .../pipeline/main_checkerboardDetection.cpp | 2 -- .../main_computeStructureFromKnownPoses.cpp | 7 ++-- .../pipeline/main_featureExtraction.cpp | 4 +-- .../pipeline/main_featureMatching.cpp | 4 +-- src/software/pipeline/main_globalSfM.cpp | 4 +-- src/software/pipeline/main_imageMasking.cpp | 5 +-- src/software/pipeline/main_imageMatching.cpp | 4 +-- src/software/pipeline/main_incrementalSfM.cpp | 4 +-- .../pipeline/main_lightingCalibration.cpp | 4 +-- src/software/pipeline/main_meshDecimate.cpp | 11 ++++--- src/software/pipeline/main_meshDenoising.cpp | 11 ++++--- src/software/pipeline/main_meshFiltering.cpp | 11 ++++--- src/software/pipeline/main_meshMasking.cpp | 4 +-- src/software/pipeline/main_meshResampling.cpp | 11 ++++--- src/software/pipeline/main_meshing.cpp | 4 +-- src/software/pipeline/main_nodalSfM.cpp | 6 ++-- .../pipeline/main_normalIntegration.cpp | 2 -- .../pipeline/main_panoramaCompositing.cpp | 4 +-- .../pipeline/main_panoramaEstimation.cpp | 4 +-- src/software/pipeline/main_panoramaInit.cpp | 12 +++---- .../pipeline/main_panoramaMerging.cpp | 4 +-- .../pipeline/main_panoramaPostProcessing.cpp | 5 ++- .../pipeline/main_panoramaPrepareImages.cpp | 8 ++--- src/software/pipeline/main_panoramaSeams.cpp | 6 ++-- .../pipeline/main_panoramaWarping.cpp | 5 +-- .../pipeline/main_photometricStereo.cpp | 4 +-- .../pipeline/main_prepareDenseScene.cpp | 4 +-- .../pipeline/main_relativePoseEstimating.cpp | 2 -- src/software/pipeline/main_rigCalibration.cpp | 8 ++--- .../pipeline/main_rigLocalization.cpp | 10 +++--- .../pipeline/main_sfmBootstraping.cpp | 6 ++-- .../pipeline/main_sfmTriangulation.cpp | 4 +-- .../pipeline/main_sphereDetection.cpp | 4 +-- src/software/pipeline/main_texturing.cpp | 7 ++-- src/software/pipeline/main_tracksBuilding.cpp | 2 -- src/software/utils/CMakeLists.txt | 8 ----- .../utils/main_colorCheckerCorrection.cpp | 6 ++-- .../utils/main_colorCheckerDetection.cpp | 6 ++-- src/software/utils/main_frustumFiltering.cpp | 4 +-- .../utils/main_generateSampleScene.cpp | 4 +-- src/software/utils/main_imageProcessing.cpp | 10 +++--- src/software/utils/main_importMiddlebury.cpp | 8 ++--- src/software/utils/main_keyframeSelection.cpp | 4 +-- .../utils/main_lightingEstimation.cpp | 4 +-- src/software/utils/main_mergeMeshes.cpp | 4 +-- src/software/utils/main_qualityEvaluation.cpp | 4 +-- src/software/utils/main_sfmColorHarmonize.cpp | 4 +-- src/software/utils/main_sfmDistances.cpp | 4 +-- src/software/utils/main_split360Images.cpp | 6 ++-- .../utils/main_voctreeQueryUtility.cpp | 3 +- .../utils/precisionEvaluationToGt.hpp | 5 ++- .../colorHarmonizeEngineGlobal.cpp | 3 +- 84 files changed, 227 insertions(+), 286 deletions(-) diff --git a/src/aliceVision/image/io.cpp b/src/aliceVision/image/io.cpp index dd523eb1cb..5e83ba0072 100644 --- a/src/aliceVision/image/io.cpp +++ b/src/aliceVision/image/io.cpp @@ -26,11 +26,11 @@ #include #include -namespace fs = boost::filesystem; - namespace aliceVision { namespace image { +namespace fs = boost::filesystem; + EImageColorSpace getImageColorSpace(const std::string& imagePath) { oiio::ImageSpec metadataSpec; diff --git a/src/aliceVision/mvsUtils/MultiViewParams.cpp b/src/aliceVision/mvsUtils/MultiViewParams.cpp index 714f5f1423..244424fa58 100644 --- a/src/aliceVision/mvsUtils/MultiViewParams.cpp +++ b/src/aliceVision/mvsUtils/MultiViewParams.cpp @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -26,13 +25,14 @@ #include #include +#include #include #include namespace aliceVision { namespace mvsUtils { -namespace fs = boost::filesystem; +namespace fs = std::filesystem; MultiViewParams::MultiViewParams(const sfmData::SfMData& sfmData, const std::string& imagesFolder, diff --git a/src/aliceVision/sfm/pipeline/sequential/ReconstructionEngine_sequentialSfM.hpp b/src/aliceVision/sfm/pipeline/sequential/ReconstructionEngine_sequentialSfM.hpp index f593aeff5a..49162e3193 100644 --- a/src/aliceVision/sfm/pipeline/sequential/ReconstructionEngine_sequentialSfM.hpp +++ b/src/aliceVision/sfm/pipeline/sequential/ReconstructionEngine_sequentialSfM.hpp @@ -18,15 +18,17 @@ #include #include -#include #include -namespace fs = boost::filesystem; +#include + namespace pt = boost::property_tree; namespace aliceVision { namespace sfm { +namespace fs = std::filesystem; + /// Image score contains typedef std::tuple ViewConnectionScore; diff --git a/src/aliceVision/sfmDataIO/viewIO.cpp b/src/aliceVision/sfmDataIO/viewIO.cpp index 932292e6c2..e5b7ee4c2e 100644 --- a/src/aliceVision/sfmDataIO/viewIO.cpp +++ b/src/aliceVision/sfmDataIO/viewIO.cpp @@ -319,8 +319,8 @@ std::shared_ptr getViewIntrinsic(const sfmData::View& vie std::vector viewPathsFromFolders(const sfmData::View& view, const std::vector& folders) { - return utils::getFilesPathsFromFolders(folders, [&view](const boost::filesystem::path& path) { - const boost::filesystem::path stem = path.stem(); + return utils::getFilesPathsFromFolders(folders, [&view](const std::filesystem::path& path) { + const std::filesystem::path stem = path.stem(); return (stem == std::to_string(view.getViewId()) || stem == fs::path(view.getImage().getImagePath()).stem()); }); } diff --git a/src/aliceVision/sphereDetection/sphereDetection.cpp b/src/aliceVision/sphereDetection/sphereDetection.cpp index e53efb0712..3e5bfa75e3 100644 --- a/src/aliceVision/sphereDetection/sphereDetection.cpp +++ b/src/aliceVision/sphereDetection/sphereDetection.cpp @@ -43,7 +43,6 @@ #include // namespaces -namespace fs = boost::filesystem; namespace bpt = boost::property_tree; namespace aliceVision { diff --git a/src/aliceVision/sphereDetection/sphereDetection.hpp b/src/aliceVision/sphereDetection/sphereDetection.hpp index 07f7f32115..d244d97420 100644 --- a/src/aliceVision/sphereDetection/sphereDetection.hpp +++ b/src/aliceVision/sphereDetection/sphereDetection.hpp @@ -16,15 +16,14 @@ #include #include -// Boost -#include - -// namespaces -namespace fs = boost::filesystem; +#include namespace aliceVision { namespace sphereDetection { +// namespaces +namespace fs = std::filesystem; + struct Prediction { std::vector> bboxes; diff --git a/src/aliceVision/utils/filesIO.hpp b/src/aliceVision/utils/filesIO.hpp index 3eed8825d4..8577059bdf 100644 --- a/src/aliceVision/utils/filesIO.hpp +++ b/src/aliceVision/utils/filesIO.hpp @@ -6,16 +6,16 @@ #pragma once -#include "boost/filesystem.hpp" - +#include #include #include #include -namespace fs = boost::filesystem; - namespace aliceVision { namespace utils { + +namespace fs = std::filesystem; + /** * @brief Allows to retrieve the files paths that validates a specific predicate by searching in a folder. * @param[in] the folders path @@ -23,7 +23,7 @@ namespace utils { * @return the paths list to the corresponding files if they validate the predicate, otherwise it returns an empty list. */ inline std::vector getFilesPathsFromFolder(const std::string& folder, - const std::function& predicate) + const std::function& predicate) { // Get all files paths in folder std::vector paths; @@ -49,7 +49,7 @@ inline std::vector getFilesPathsFromFolder(const std::string& folde * @return the paths list to the corresponding files if they validate the predicate, otherwise it returns an empty list. */ inline std::vector getFilesPathsFromFolders(const std::vector& folders, - const std::function& predicate) + const std::function& predicate) { std::vector paths; for (const std::string& folder : folders) diff --git a/src/software/convert/CMakeLists.txt b/src/software/convert/CMakeLists.txt index 46f6eb898b..0cd42bca73 100644 --- a/src/software/convert/CMakeLists.txt +++ b/src/software/convert/CMakeLists.txt @@ -15,7 +15,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem Boost::system ) @@ -28,7 +27,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmDataIO aliceVision_cmdline Boost::program_options - Boost::filesystem Boost::boost Boost::timer ) diff --git a/src/software/convert/main_convertMesh.cpp b/src/software/convert/main_convertMesh.cpp index fec6caabf2..7110638e6e 100644 --- a/src/software/convert/main_convertMesh.cpp +++ b/src/software/convert/main_convertMesh.cpp @@ -12,8 +12,8 @@ #include #include -#include +#include #include #include #include @@ -27,7 +27,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; /** * @brief Convert Mesh diff --git a/src/software/convert/main_convertSfMFormat.cpp b/src/software/convert/main_convertSfMFormat.cpp index 3c7308f61d..a79979edc0 100644 --- a/src/software/convert/main_convertSfMFormat.cpp +++ b/src/software/convert/main_convertSfMFormat.cpp @@ -16,8 +16,8 @@ #include #include -#include +#include #include #include #include @@ -31,7 +31,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; // convert from a SfMData format to another int aliceVision_main(int argc, char **argv) diff --git a/src/software/convert/main_importKnownPoses.cpp b/src/software/convert/main_importKnownPoses.cpp index 6abbda3c9a..595e666c76 100644 --- a/src/software/convert/main_importKnownPoses.cpp +++ b/src/software/convert/main_importKnownPoses.cpp @@ -14,12 +14,11 @@ #include #include -#include #include +#include #include #include - #include #include @@ -37,7 +36,7 @@ using namespace aliceVision; namespace po = boost::program_options; namespace json = boost::property_tree; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; struct XMPData diff --git a/src/software/export/CMakeLists.txt b/src/software/export/CMakeLists.txt index 7dc1ccb0b9..2a081fa52c 100644 --- a/src/software/export/CMakeLists.txt +++ b/src/software/export/CMakeLists.txt @@ -15,7 +15,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem Boost::boost Boost::timer ) @@ -32,7 +31,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem Boost::boost Boost::timer ) @@ -48,7 +46,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem Boost::boost Boost::timer ) @@ -64,7 +61,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem Boost::boost Boost::timer ) @@ -80,7 +76,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem Boost::boost Boost::timer ) @@ -96,7 +91,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem Boost::boost Boost::timer ) @@ -127,7 +121,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem Boost::boost Boost::timer ${OPENIMAGEIO_LIBRARIES} @@ -145,7 +138,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem Boost::boost Boost::timer ) @@ -161,7 +153,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem Boost::boost Boost::timer ) @@ -177,7 +168,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) # Export a SfM aliceVision scene to Matlab @@ -191,7 +181,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem Boost::boost Boost::timer ) @@ -204,7 +193,6 @@ if(ALICEVISION_BUILD_SFM) LINKS aliceVision_system aliceVision_cmdline aliceVision_mesh - Boost::filesystem Boost::program_options usd usdGeom @@ -224,6 +212,5 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmDataIO aliceVision_image Boost::program_options - Boost::filesystem ) endif() diff --git a/src/software/export/main_exportAnimatedCamera.cpp b/src/software/export/main_exportAnimatedCamera.cpp index 6b65a97c29..ce9c2220fc 100644 --- a/src/software/export/main_exportAnimatedCamera.cpp +++ b/src/software/export/main_exportAnimatedCamera.cpp @@ -16,8 +16,8 @@ #include #include -#include +#include #include #include #include @@ -31,7 +31,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; oiio::ROI computeRod(const camera::IntrinsicBase* intrinsic, bool correctPrincipalPoint) { diff --git a/src/software/export/main_exportColmap.cpp b/src/software/export/main_exportColmap.cpp index 60cc860feb..3d94d2a286 100644 --- a/src/software/export/main_exportColmap.cpp +++ b/src/software/export/main_exportColmap.cpp @@ -12,9 +12,9 @@ #include #include -#include #include +#include // These constants define the current software version. @@ -25,7 +25,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; int aliceVision_main(int argc, char* argv[]) diff --git a/src/software/export/main_exportDistortion.cpp b/src/software/export/main_exportDistortion.cpp index b426a876cd..b71b5a7134 100644 --- a/src/software/export/main_exportDistortion.cpp +++ b/src/software/export/main_exportDistortion.cpp @@ -13,7 +13,6 @@ #include #include -#include #include #include @@ -26,7 +25,6 @@ #define ALICEVISION_SOFTWARE_VERSION_MINOR 0 namespace po = boost::program_options; -namespace fs = boost::filesystem; using namespace aliceVision; using namespace aliceVision::camera; diff --git a/src/software/export/main_exportKeypoints.cpp b/src/software/export/main_exportKeypoints.cpp index 3172ca37f1..1277582906 100644 --- a/src/software/export/main_exportKeypoints.cpp +++ b/src/software/export/main_exportKeypoints.cpp @@ -20,9 +20,9 @@ #include #include -#include #include +#include #include #include #include @@ -40,7 +40,7 @@ using namespace aliceVision::sfmData; using namespace svg; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; int aliceVision_main(int argc, char ** argv) { diff --git a/src/software/export/main_exportMVE2.cpp b/src/software/export/main_exportMVE2.cpp index 05431e305f..26f35b2b3b 100644 --- a/src/software/export/main_exportMVE2.cpp +++ b/src/software/export/main_exportMVE2.cpp @@ -12,8 +12,8 @@ #include #include #include -#include +#include #include #include #include @@ -34,7 +34,7 @@ using namespace aliceVision::sfmData; using namespace aliceVision::feature; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; /// Naive image bilinear resampling of an image for thumbnail generation template @@ -148,8 +148,8 @@ bool exportToMVE2Format( else // (no distortion) { // If extensions match, copy the PNG image - if (fs::extension(srcImage) == ".PNG" || - fs::extension(srcImage) == ".png") + if (fs::path(srcImage).extension() == ".PNG" || + fs::path(srcImage).extension() == ".png") { fs::copy_file(srcImage, dstImage); } diff --git a/src/software/export/main_exportMVSTexturing.cpp b/src/software/export/main_exportMVSTexturing.cpp index 3279482d95..f3e97d2f9d 100644 --- a/src/software/export/main_exportMVSTexturing.cpp +++ b/src/software/export/main_exportMVSTexturing.cpp @@ -11,8 +11,8 @@ #include #include #include -#include +#include #include // These constants define the current software version. @@ -26,7 +26,7 @@ using namespace aliceVision::geometry; using namespace aliceVision::sfmData; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; int aliceVision_main(int argc, char **argv) { diff --git a/src/software/export/main_exportMatches.cpp b/src/software/export/main_exportMatches.cpp index 500bc499a7..32789bb69a 100644 --- a/src/software/export/main_exportMatches.cpp +++ b/src/software/export/main_exportMatches.cpp @@ -21,8 +21,8 @@ #include #include -#include +#include #include #include #include @@ -42,7 +42,7 @@ using namespace aliceVision::sfmData; using namespace svg; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; // Convert HUE color to RGB inline float hue2rgb(float p, float q, float t){ @@ -163,7 +163,7 @@ int aliceVision_main(int argc, char ** argv) std::string destFilename_I; std::string destFilename_J; { - boost::filesystem::path origImgPath(viewImagePathI); + fs::path origImgPath(viewImagePathI); std::string origFilename = origImgPath.stem().string(); image::Image originalImage; image::readImage(viewImagePathI, originalImage, image::EImageColorSpace::LINEAR); @@ -173,7 +173,7 @@ int aliceVision_main(int argc, char ** argv) } { - boost::filesystem::path origImgPath(viewImagePathJ); + fs::path origImgPath(viewImagePathJ); std::string origFilename = origImgPath.stem().string(); image::Image originalImage; image::readImage(viewImagePathJ, originalImage, image::EImageColorSpace::LINEAR); diff --git a/src/software/export/main_exportMatlab.cpp b/src/software/export/main_exportMatlab.cpp index 9eeecb0009..8258d93e1a 100644 --- a/src/software/export/main_exportMatlab.cpp +++ b/src/software/export/main_exportMatlab.cpp @@ -11,8 +11,8 @@ #include #include #include -#include +#include #include #include #include @@ -33,7 +33,7 @@ using namespace aliceVision::image; using namespace aliceVision::sfmData; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; bool exportToMatlab( const SfMData & sfm_data, diff --git a/src/software/export/main_exportMeshlab.cpp b/src/software/export/main_exportMeshlab.cpp index c1610d14f3..fc8613f684 100644 --- a/src/software/export/main_exportMeshlab.cpp +++ b/src/software/export/main_exportMeshlab.cpp @@ -12,8 +12,8 @@ #include #include #include -#include +#include #include // These constants define the current software version. @@ -28,7 +28,7 @@ using namespace aliceVision::image; using namespace aliceVision::sfmData; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; int aliceVision_main(int argc, char **argv) { diff --git a/src/software/export/main_exportMeshroomMaya.cpp b/src/software/export/main_exportMeshroomMaya.cpp index 3ec1013b55..005a357ce5 100644 --- a/src/software/export/main_exportMeshroomMaya.cpp +++ b/src/software/export/main_exportMeshroomMaya.cpp @@ -11,10 +11,10 @@ #include #include #include -#include #include +#include #include // These constants define the current software version. @@ -25,7 +25,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace oiio = OIIO; int aliceVision_main(int argc, char **argv) diff --git a/src/software/export/main_exportPMVS.cpp b/src/software/export/main_exportPMVS.cpp index cfd6ffbf21..f9db690aaf 100644 --- a/src/software/export/main_exportPMVS.cpp +++ b/src/software/export/main_exportPMVS.cpp @@ -12,8 +12,8 @@ #include #include #include -#include +#include #include #include #include @@ -33,7 +33,7 @@ using namespace aliceVision::image; using namespace aliceVision::sfmData; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; bool exportToPMVSFormat( const SfMData & sfm_data, @@ -134,8 +134,8 @@ bool exportToPMVSFormat( else // (no distortion) { // copy the image if extension match - if (fs::extension(srcImage) == ".JPG" || - fs::extension(srcImage) == ".jpg") + if (fs::path(srcImage).extension() == ".JPG" || + fs::path(srcImage).extension() == ".jpg") { fs::copy_file(srcImage, dstImage); } diff --git a/src/software/export/main_exportTracks.cpp b/src/software/export/main_exportTracks.cpp index 58d16aab35..6f94ed03e9 100644 --- a/src/software/export/main_exportTracks.cpp +++ b/src/software/export/main_exportTracks.cpp @@ -26,7 +26,8 @@ #include #include -#include + +#include // These constants define the current software version. // They must be updated when the command line is changed. @@ -41,7 +42,7 @@ using namespace aliceVision::track; using namespace svg; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; int aliceVision_main(int argc, char ** argv) { diff --git a/src/software/export/main_exportUSD.cpp b/src/software/export/main_exportUSD.cpp index 4c362aafdc..6f5b93e0ac 100644 --- a/src/software/export/main_exportUSD.cpp +++ b/src/software/export/main_exportUSD.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include @@ -28,13 +27,15 @@ #include #include +#include + #define ALICEVISION_SOFTWARE_VERSION_MAJOR 1 #define ALICEVISION_SOFTWARE_VERSION_MINOR 0 using namespace aliceVision; namespace bpo = boost::program_options; -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; PXR_NAMESPACE_USING_DIRECTIVE @@ -144,7 +145,7 @@ int aliceVision_main(int argc, char **argv) } const std::string extension = fileType == EUSDFileType::USDC || fileType == EUSDFileType::USDZ ? "usdc" : "usda"; - const bfs::path stagePath = bfs::canonical(outputFolderPath) / ("texturedMesh." + extension); + const fs::path stagePath = fs::canonical(outputFolderPath) / ("texturedMesh." + extension); UsdStageRefPtr stage = UsdStage::CreateNew(stagePath.string()); if (!stage) { @@ -341,16 +342,16 @@ int aliceVision_main(int argc, char **argv) stage->GetRootLayer()->Save(); // Copy textures to output folder - const bfs::path sourceFolder = bfs::path(inputMeshPath).parent_path(); - const bfs::path destinationFolder = bfs::canonical(outputFolderPath); + const fs::path sourceFolder = fs::path(inputMeshPath).parent_path(); + const fs::path destinationFolder = fs::canonical(outputFolderPath); for (int i = 0; i < texturing.material.numAtlases(); ++i) { for (const auto& texture : texturing.material.getAllTextures()) { - if (bfs::exists(sourceFolder / texture)) + if (fs::exists(sourceFolder / texture)) { - bfs::copy_file(sourceFolder / texture, destinationFolder / texture, bfs::copy_options::update_existing); + fs::copy_file(sourceFolder / texture, destinationFolder / texture, fs::copy_options::update_existing); } } } @@ -358,7 +359,7 @@ int aliceVision_main(int argc, char **argv) // write out usdz if requested if (fileType == EUSDFileType::USDZ) { - const bfs::path usdzPath = bfs::canonical(outputFolderPath) / "texturedMesh.usdz"; + const fs::path usdzPath = fs::canonical(outputFolderPath) / "texturedMesh.usdz"; UsdZipFileWriter writer = UsdZipFileWriter::CreateNew(usdzPath.string()); if (!writer) @@ -372,7 +373,7 @@ int aliceVision_main(int argc, char **argv) { for (const auto& texture : texturing.material.getAllTextures()) { - if (bfs::exists(destinationFolder / texture)) + if (fs::exists(destinationFolder / texture)) { writer.AddFile((destinationFolder / texture).string(), texture); } diff --git a/src/software/pipeline/CMakeLists.txt b/src/software/pipeline/CMakeLists.txt index 3b07d86b6a..b315e0e88b 100644 --- a/src/software/pipeline/CMakeLists.txt +++ b/src/software/pipeline/CMakeLists.txt @@ -20,7 +20,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmDataIO aliceVision_lensCorrectionProfile Boost::program_options - Boost::filesystem Boost::boost ) @@ -55,7 +54,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmDataIO vlsift Boost::program_options - Boost::filesystem Boost::boost Boost::timer ) @@ -74,7 +72,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmDataIO aliceVision_voctree Boost::program_options - Boost::filesystem ) # Feature matching @@ -91,7 +88,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) # Track builder @@ -105,7 +101,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_track Boost::program_options - Boost::filesystem Boost::json ) @@ -120,7 +115,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_track Boost::program_options - Boost::filesystem Boost::json ) @@ -135,7 +129,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_track Boost::program_options - Boost::filesystem Boost::json ) @@ -151,7 +144,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) # Incremental SFM for pure rotation @@ -166,7 +158,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) # SfM Triangulation @@ -181,7 +172,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) # Global SfM @@ -196,7 +186,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) # Compute structure from known camera poses @@ -210,7 +199,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) # Calibrate a camera @@ -224,7 +212,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_system aliceVision_cmdline Boost::program_options - Boost::filesystem Boost::boost ) endif() @@ -239,7 +226,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_cmdline aliceVision_sfmDataIO Boost::program_options - Boost::filesystem Boost::boost Boost::json ) @@ -271,7 +257,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_feature aliceVision_cmdline Boost::program_options - Boost::filesystem Boost::boost Boost::timer ) @@ -286,7 +271,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmDataIO aliceVision_cmdline Boost::program_options - Boost::filesystem Boost::boost Boost::json ) @@ -305,7 +289,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_feature aliceVision_cmdline Boost::program_options - Boost::filesystem Boost::boost Boost::timer ) @@ -325,7 +308,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_feature aliceVision_cmdline Boost::program_options - Boost::filesystem Boost::boost Boost::timer ) @@ -345,7 +327,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem Boost::boost Boost::timer ) @@ -365,7 +346,6 @@ if(ALICEVISION_BUILD_PANORAMA) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem Boost::boost ) @@ -466,7 +446,6 @@ if(ALICEVISION_BUILD_MVS) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) # Depth Map Filtering @@ -482,7 +461,6 @@ if(ALICEVISION_BUILD_MVS) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) endif() @@ -499,7 +477,6 @@ if(ALICEVISION_BUILD_MVS) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) if(ALICEVISION_HAVE_MESHSDFILTER) @@ -514,7 +491,6 @@ if(ALICEVISION_BUILD_MVS) MeshSDLibrary Eigen3::Eigen Boost::program_options - Boost::filesystem ) # Mesh Decimate @@ -526,7 +502,6 @@ if(ALICEVISION_BUILD_MVS) aliceVision_mvsUtils OpenMesh Boost::program_options - Boost::filesystem ) endif() @@ -539,7 +514,6 @@ if(ALICEVISION_BUILD_MVS) aliceVision_mvsUtils aliceVision_mesh Boost::program_options - Boost::filesystem ) # Mesh Masking @@ -554,7 +528,6 @@ if(ALICEVISION_BUILD_MVS) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) # Mesh Resampling @@ -566,7 +539,6 @@ if(ALICEVISION_BUILD_MVS) aliceVision_mvsUtils Geogram::geogram Boost::program_options - Boost::filesystem ) # Texturing @@ -582,7 +554,6 @@ if(ALICEVISION_BUILD_MVS) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) endif() # if(ALICEVISION_BUILD_MVS) @@ -658,7 +629,6 @@ if(ALICEVISION_BUILD_HDR) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) alicevision_add_software(aliceVision_LdrToHdrCalibration @@ -671,7 +641,6 @@ if(ALICEVISION_BUILD_HDR) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) alicevision_add_software(aliceVision_LdrToHdrMerge @@ -684,7 +653,6 @@ if(ALICEVISION_BUILD_HDR) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) endif() diff --git a/src/software/pipeline/main_LdrToHdrCalibration.cpp b/src/software/pipeline/main_LdrToHdrCalibration.cpp index fb05927a2d..d32a3ed169 100644 --- a/src/software/pipeline/main_LdrToHdrCalibration.cpp +++ b/src/software/pipeline/main_LdrToHdrCalibration.cpp @@ -29,13 +29,11 @@ // Command line parameters #include #include -#include - -#include +#include #include #include - +#include // These constants define the current software version. // They must be updated when the command line is changed. @@ -46,7 +44,7 @@ using namespace aliceVision; using namespace aliceVision::hdr; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; struct luminanceInfo { diff --git a/src/software/pipeline/main_LdrToHdrMerge.cpp b/src/software/pipeline/main_LdrToHdrMerge.cpp index ef5f6635ca..74360859b8 100644 --- a/src/software/pipeline/main_LdrToHdrMerge.cpp +++ b/src/software/pipeline/main_LdrToHdrMerge.cpp @@ -23,7 +23,8 @@ // Command line parameters #include -#include + +#include #include #include @@ -35,7 +36,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; std::string getHdrImagePath(const std::string& outputPath, std::size_t g, const std::string& rootname = "") { @@ -161,7 +162,7 @@ int aliceVision_main(int argc, char** argv) omp_set_num_threads(hwc.getMaxThreads()); // Analyze path - boost::filesystem::path path(sfmOutputDataFilepath); + fs::path path(sfmOutputDataFilepath); std::string outputPath = path.parent_path().string(); // Read SfMData @@ -369,7 +370,7 @@ int aliceVision_main(int argc, char** argv) } if (!byPass) { - boost::filesystem::path p(targetViews[g]->getImage().getImagePath()); + fs::path p(targetViews[g]->getImage().getImagePath()); const std::string hdrImagePath = getHdrImagePath(outputPath, pos, keepSourceImageName ? p.stem().string() : ""); hdrView->getImage().setImagePath(hdrImagePath); } @@ -496,7 +497,7 @@ int aliceVision_main(int argc, char** argv) HDRimage = images[0]; } - boost::filesystem::path p(targetView->getImage().getImagePath()); + fs::path p(targetView->getImage().getImagePath()); const std::string hdrImagePath = getHdrImagePath(outputPath, pos, keepSourceImageName ? p.stem().string() : ""); // Write an image with parameters from the target view diff --git a/src/software/pipeline/main_LdrToHdrSampling.cpp b/src/software/pipeline/main_LdrToHdrSampling.cpp index 08b0784e43..ef1ed2d8f0 100644 --- a/src/software/pipeline/main_LdrToHdrSampling.cpp +++ b/src/software/pipeline/main_LdrToHdrSampling.cpp @@ -29,13 +29,12 @@ // Command line parameters #include -#include #include #include #include - +#include #include @@ -48,7 +47,7 @@ using namespace aliceVision; using namespace aliceVision::hdr; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; int aliceVision_main(int argc, char** argv) { diff --git a/src/software/pipeline/main_cameraCalibration.cpp b/src/software/pipeline/main_cameraCalibration.cpp index ecc25723d2..8dc7f8a20f 100644 --- a/src/software/pipeline/main_cameraCalibration.cpp +++ b/src/software/pipeline/main_cameraCalibration.cpp @@ -18,8 +18,6 @@ #include #include -#include -#include #include #include @@ -28,6 +26,7 @@ #include #include +#include #include #include #include @@ -45,13 +44,13 @@ #define ALICEVISION_SOFTWARE_VERSION_MAJOR 1 #define ALICEVISION_SOFTWARE_VERSION_MINOR 0 -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; namespace po = boost::program_options; int aliceVision_main(int argc, char** argv) { // Command line arguments - bfs::path inputPath; + fs::path inputPath; std::string outputFilename; std::string debugSelectedImgFolder; std::string debugRejectedImgFolder; @@ -67,7 +66,7 @@ int aliceVision_main(int argc, char** argv) po::options_description requiredParams("Required parameters"); requiredParams.add_options() - ("input,i", po::value(&inputPath)->required(), + ("input,i", po::value(&inputPath)->required(), "Input images in one of the following form:\n" " - folder containing images\n" " - image sequence like /path/to/seq.@.jpg\n" diff --git a/src/software/pipeline/main_cameraInit.cpp b/src/software/pipeline/main_cameraInit.cpp index 205135a380..28a0e90322 100644 --- a/src/software/pipeline/main_cameraInit.cpp +++ b/src/software/pipeline/main_cameraInit.cpp @@ -18,12 +18,12 @@ #include #include -#include #include #include #include #include +#include #include #include #include @@ -44,7 +44,7 @@ using namespace aliceVision; using namespace aliceVision::sfmDataIO; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; /** @@ -60,7 +60,7 @@ bool listFiles(const fs::path& folderOrFile, { if(fs::is_regular_file(folderOrFile)) { - std::string fileExtension = fs::extension(folderOrFile); + std::string fileExtension = fs::path(folderOrFile).extension().string(); std::transform(fileExtension.begin(), fileExtension.end(), fileExtension.begin(), ::tolower); for(const std::string& extension: extensions) { diff --git a/src/software/pipeline/main_cameraLocalization.cpp b/src/software/pipeline/main_cameraLocalization.cpp index 8688c92bbe..25cd53a6a5 100644 --- a/src/software/pipeline/main_cameraLocalization.cpp +++ b/src/software/pipeline/main_cameraLocalization.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include #include @@ -33,6 +32,7 @@ #include #include +#include #include #include #include @@ -50,7 +50,7 @@ using namespace aliceVision; -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; namespace bacc = boost::accumulators; namespace po = boost::program_options; @@ -269,20 +269,20 @@ int aliceVision_main(int argc, char** argv) // if the provided folder for visual debugging does not exist create it // recursively - if((!visualDebug.empty()) && (!bfs::exists(visualDebug))) + if((!visualDebug.empty()) && (!fs::exists(visualDebug))) { - bfs::create_directories(visualDebug); + fs::create_directories(visualDebug); } // this contains the full path and the root name of the file without the extension const bool wantsJsonOutput = exportJsonFile.empty(); #if ALICEVISION_IS_DEFINED(ALICEVISION_HAVE_ALEMBIC) - std::string basenameAlembic = (bfs::path(exportJsonFile).parent_path() / bfs::path(exportJsonFile).stem()).string(); + std::string basenameAlembic = (fs::path(exportJsonFile).parent_path() / fs::path(exportJsonFile).stem()).string(); #endif std::string basenameJson; if(wantsJsonOutput) { - basenameJson = (bfs::path(exportJsonFile).parent_path() / bfs::path(exportJsonFile).stem()).string(); + basenameJson = (fs::path(exportJsonFile).parent_path() / fs::path(exportJsonFile).stem()).string(); } // load SfMData diff --git a/src/software/pipeline/main_checkerboardDetection.cpp b/src/software/pipeline/main_checkerboardDetection.cpp index 21ec1cd23e..b19014677e 100644 --- a/src/software/pipeline/main_checkerboardDetection.cpp +++ b/src/software/pipeline/main_checkerboardDetection.cpp @@ -17,7 +17,6 @@ #include #include -#include #include // These constants define the current software version. @@ -26,7 +25,6 @@ #define ALICEVISION_SOFTWARE_VERSION_MINOR 0 namespace po = boost::program_options; -namespace fs = boost::filesystem; using namespace aliceVision; diff --git a/src/software/pipeline/main_computeStructureFromKnownPoses.cpp b/src/software/pipeline/main_computeStructureFromKnownPoses.cpp index 372a722fca..add1d8e5be 100644 --- a/src/software/pipeline/main_computeStructureFromKnownPoses.cpp +++ b/src/software/pipeline/main_computeStructureFromKnownPoses.cpp @@ -17,7 +17,8 @@ #include #include -#include + +#include // These constants define the current software version. // They must be updated when the command line is changed. @@ -27,7 +28,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; /// Compute the structure of a scene according existing camera poses. int aliceVision_main(int argc, char **argv) @@ -144,7 +145,7 @@ int aliceVision_main(int argc, char **argv) ALICEVISION_LOG_INFO("Structure estimation took (s): " << timer.elapsed() << "." << std::endl << "\t- # landmarks found: " << sfmData.getLandmarks().size()); - if(fs::extension(outSfMDataFilename) != ".ply") + if(fs::path(outSfMDataFilename).extension() != ".ply") { sfmDataIO::Save(sfmData, (fs::path(outSfMDataFilename).parent_path() / (fs::path(outSfMDataFilename).stem().string() + ".ply")).string(), diff --git a/src/software/pipeline/main_featureExtraction.cpp b/src/software/pipeline/main_featureExtraction.cpp index 0ec937614a..ec649b3d34 100644 --- a/src/software/pipeline/main_featureExtraction.cpp +++ b/src/software/pipeline/main_featureExtraction.cpp @@ -22,8 +22,8 @@ #include #include -#include +#include #include #include #include @@ -37,7 +37,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; /// - Compute view image description (feature & descriptor extraction) /// - Export computed data diff --git a/src/software/pipeline/main_featureMatching.cpp b/src/software/pipeline/main_featureMatching.cpp index 31bb297e78..a9c8f74d31 100644 --- a/src/software/pipeline/main_featureMatching.cpp +++ b/src/software/pipeline/main_featureMatching.cpp @@ -34,8 +34,8 @@ #include #include -#include +#include #include #include #include @@ -55,7 +55,7 @@ using namespace aliceVision::sfmData; using namespace aliceVision::matchingImageCollection; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; void getStatsMap(const PairwiseMatches& map) { diff --git a/src/software/pipeline/main_globalSfM.cpp b/src/software/pipeline/main_globalSfM.cpp index 77c266046f..3f975ca21c 100644 --- a/src/software/pipeline/main_globalSfM.cpp +++ b/src/software/pipeline/main_globalSfM.cpp @@ -16,8 +16,8 @@ #include #include -#include +#include #include // These constants define the current software version. @@ -28,7 +28,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; int aliceVision_main(int argc, char **argv) { diff --git a/src/software/pipeline/main_imageMasking.cpp b/src/software/pipeline/main_imageMasking.cpp index 2360c9d87a..cb1e5a1c90 100644 --- a/src/software/pipeline/main_imageMasking.cpp +++ b/src/software/pipeline/main_imageMasking.cpp @@ -17,9 +17,10 @@ #include #include -#include #include +#include + // These constants define the current software version. // They must be updated when the command line is changed. #define ALICEVISION_SOFTWARE_VERSION_MAJOR 1 @@ -28,7 +29,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; enum class EAlgorithm { HSV, diff --git a/src/software/pipeline/main_imageMatching.cpp b/src/software/pipeline/main_imageMatching.cpp index 7692d64e01..ac01e636db 100644 --- a/src/software/pipeline/main_imageMatching.cpp +++ b/src/software/pipeline/main_imageMatching.cpp @@ -18,9 +18,9 @@ #include #include -#include #include +#include #include #include #include @@ -37,7 +37,7 @@ using namespace aliceVision::voctree; using namespace aliceVision::imageMatching; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; int aliceVision_main(int argc, char** argv) { diff --git a/src/software/pipeline/main_incrementalSfM.cpp b/src/software/pipeline/main_incrementalSfM.cpp index 1273d97105..b01a10ea2f 100644 --- a/src/software/pipeline/main_incrementalSfM.cpp +++ b/src/software/pipeline/main_incrementalSfM.cpp @@ -21,9 +21,9 @@ #include #include -#include #include +#include // These constants define the current software version. // They must be updated when the command line is changed. @@ -33,7 +33,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; using namespace aliceVision::track; using namespace aliceVision::sfm; diff --git a/src/software/pipeline/main_lightingCalibration.cpp b/src/software/pipeline/main_lightingCalibration.cpp index ca33ac9ba4..539ea875b0 100644 --- a/src/software/pipeline/main_lightingCalibration.cpp +++ b/src/software/pipeline/main_lightingCalibration.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include @@ -30,6 +29,7 @@ #include #include #include +#include // These constants define the current software version. // They must be updated when the command line is changed. @@ -38,7 +38,7 @@ // Namespaces namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; using namespace aliceVision; diff --git a/src/software/pipeline/main_meshDecimate.cpp b/src/software/pipeline/main_meshDecimate.cpp index 131f6c1db3..14069782c5 100644 --- a/src/software/pipeline/main_meshDecimate.cpp +++ b/src/software/pipeline/main_meshDecimate.cpp @@ -19,7 +19,8 @@ #include #include -#include + +#include // These constants define the current software version. // They must be updated when the command line is changed. @@ -28,7 +29,7 @@ using namespace aliceVision; -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; namespace po = boost::program_options; int aliceVision_main(int argc, char* argv[]) @@ -73,9 +74,9 @@ int aliceVision_main(int argc, char* argv[]) } - bfs::path outDirectory = bfs::path(outputMeshPath).parent_path(); - if(!bfs::is_directory(outDirectory)) - bfs::create_directory(outDirectory); + fs::path outDirectory = fs::path(outputMeshPath).parent_path(); + if(!fs::is_directory(outDirectory)) + fs::create_directory(outDirectory); // Mesh type typedef OpenMesh::TriMesh_ArrayKernelT<> Mesh; diff --git a/src/software/pipeline/main_meshDenoising.cpp b/src/software/pipeline/main_meshDenoising.cpp index 377c35bdf6..dd2e623ef1 100644 --- a/src/software/pipeline/main_meshDenoising.cpp +++ b/src/software/pipeline/main_meshDenoising.cpp @@ -21,7 +21,8 @@ #include #include -#include + +#include // These constants define the current software version. // They must be updated when the command line is changed. @@ -30,7 +31,7 @@ using namespace aliceVision; -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; namespace po = boost::program_options; int aliceVision_main(int argc, char* argv[]) @@ -83,9 +84,9 @@ int aliceVision_main(int argc, char* argv[]) } - bfs::path outDirectory = bfs::path(outputMeshPath).parent_path(); - if(!bfs::is_directory(outDirectory)) - bfs::create_directory(outDirectory); + fs::path outDirectory = fs::path(outputMeshPath).parent_path(); + if(!fs::is_directory(outDirectory)) + fs::create_directory(outDirectory); TriMesh inMesh; diff --git a/src/software/pipeline/main_meshFiltering.cpp b/src/software/pipeline/main_meshFiltering.cpp index e749dbe7f9..73070783eb 100644 --- a/src/software/pipeline/main_meshFiltering.cpp +++ b/src/software/pipeline/main_meshFiltering.cpp @@ -13,7 +13,8 @@ #include #include -#include + +#include // These constants define the current software version. // They must be updated when the command line is changed. @@ -22,7 +23,7 @@ using namespace aliceVision; -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; namespace po = boost::program_options; enum class ESubsetType : unsigned char @@ -158,9 +159,9 @@ int aliceVision_main(int argc, char* argv[]) // check and set filtering subset type const ESubsetType filteringSubsetType = ESubsetType_stringToEnum(filteringSubsetTypeName); - bfs::path outDirectory = bfs::path(outputMeshPath).parent_path(); - if(!bfs::is_directory(outDirectory)) - bfs::create_directory(outDirectory); + fs::path outDirectory = fs::path(outputMeshPath).parent_path(); + if(!fs::is_directory(outDirectory)) + fs::create_directory(outDirectory); mesh::Texturing texturing; texturing.loadWithAtlas(inputMeshPath); diff --git a/src/software/pipeline/main_meshMasking.cpp b/src/software/pipeline/main_meshMasking.cpp index e605a85abd..1a7045165f 100644 --- a/src/software/pipeline/main_meshMasking.cpp +++ b/src/software/pipeline/main_meshMasking.cpp @@ -16,8 +16,8 @@ #include #include -#include +#include #include @@ -29,7 +29,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; /** * @brief Basic cache system to manage masks. diff --git a/src/software/pipeline/main_meshResampling.cpp b/src/software/pipeline/main_meshResampling.cpp index 7dc2dfe50e..e39b632995 100644 --- a/src/software/pipeline/main_meshResampling.cpp +++ b/src/software/pipeline/main_meshResampling.cpp @@ -21,7 +21,8 @@ #include #include -#include + +#include // These constants define the current software version. // They must be updated when the command line is changed. @@ -30,7 +31,7 @@ using namespace aliceVision; -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; namespace po = boost::program_options; int aliceVision_main(int argc, char* argv[]) @@ -76,9 +77,9 @@ int aliceVision_main(int argc, char* argv[]) return EXIT_FAILURE; } - bfs::path outDirectory = bfs::path(outputMeshPath).parent_path(); - if(!bfs::is_directory(outDirectory)) - bfs::create_directory(outDirectory); + fs::path outDirectory = fs::path(outputMeshPath).parent_path(); + if(!fs::is_directory(outDirectory)) + fs::create_directory(outDirectory); GEO::initialize(); diff --git a/src/software/pipeline/main_meshing.cpp b/src/software/pipeline/main_meshing.cpp index da68ecc9f2..8a2ab1ad32 100644 --- a/src/software/pipeline/main_meshing.cpp +++ b/src/software/pipeline/main_meshing.cpp @@ -25,8 +25,8 @@ #include #include -#include +#include #include // These constants define the current software version. @@ -36,7 +36,7 @@ using namespace aliceVision; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace po = boost::program_options; enum EPartitioningMode diff --git a/src/software/pipeline/main_nodalSfM.cpp b/src/software/pipeline/main_nodalSfM.cpp index ca64845759..3628891818 100644 --- a/src/software/pipeline/main_nodalSfM.cpp +++ b/src/software/pipeline/main_nodalSfM.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include @@ -34,6 +33,7 @@ #include #include +#include #include #include @@ -50,7 +50,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; std::vector readJsons(std::istream& is, boost::json::error_code& ec) { @@ -458,7 +458,7 @@ int aliceVision_main(int argc, char** argv) std::vector reconstructedPairs; //Assuming the filename is pairs_ + a number with json extension const std::regex regex("pairs\\_[0-9]+\\.json"); - for(fs::directory_entry & file : boost::make_iterator_range(fs::directory_iterator(pairsDirectory), {})) + for(auto const& file : fs::directory_iterator{pairsDirectory}) { if (!std::regex_search(file.path().string(), regex)) { diff --git a/src/software/pipeline/main_normalIntegration.cpp b/src/software/pipeline/main_normalIntegration.cpp index 18e3566bda..e02a4e4a0d 100644 --- a/src/software/pipeline/main_normalIntegration.cpp +++ b/src/software/pipeline/main_normalIntegration.cpp @@ -22,7 +22,6 @@ #include #include -#include // Eigen #include @@ -51,7 +50,6 @@ using namespace aliceVision; int aliceVision_main(int argc, char **argv) { namespace po = boost::program_options; - namespace fs = boost::filesystem; system::Timer timer; diff --git a/src/software/pipeline/main_panoramaCompositing.cpp b/src/software/pipeline/main_panoramaCompositing.cpp index b590e3a4da..4a5f95aef8 100644 --- a/src/software/pipeline/main_panoramaCompositing.cpp +++ b/src/software/pipeline/main_panoramaCompositing.cpp @@ -29,11 +29,11 @@ #include // IO +#include #include #include #include #include -#include // These constants define the current software version. // They must be updated when the command line is changed. @@ -44,7 +44,7 @@ using namespace aliceVision; namespace po = boost::program_options; namespace bpt = boost::property_tree; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; size_t getCompositingOptimalScale(int width, int height) { diff --git a/src/software/pipeline/main_panoramaEstimation.cpp b/src/software/pipeline/main_panoramaEstimation.cpp index 8cca66e611..fe783f4f25 100644 --- a/src/software/pipeline/main_panoramaEstimation.cpp +++ b/src/software/pipeline/main_panoramaEstimation.cpp @@ -18,13 +18,13 @@ #include #include -#include #include #include #include #include +#include // These constants define the current software version. // They must be updated when the command line is changed. @@ -34,7 +34,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; int aliceVision_main(int argc, char** argv) { diff --git a/src/software/pipeline/main_panoramaInit.cpp b/src/software/pipeline/main_panoramaInit.cpp index 7202da00cd..5101b123ba 100644 --- a/src/software/pipeline/main_panoramaInit.cpp +++ b/src/software/pipeline/main_panoramaInit.cpp @@ -15,9 +15,9 @@ #include #include +#include #include -#include #include #include @@ -48,7 +48,7 @@ std::istream& operator>>(std::istream& in, std::pair& v) } // namespace std namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace pt = boost::property_tree; /** @@ -642,8 +642,8 @@ class CircleDetector if(_debugDirectory.empty()) return; - boost::filesystem::path filepath = - boost::filesystem::path(_debugDirectory) / + fs::path filepath = + fs::path(_debugDirectory) / (name + "_" + std::to_string(pyramid_id) + "_" + std::to_string(level) + ".exr"); image::writeImage(filepath.string(), toSave, image::ImageWriteOptions()); } @@ -1196,7 +1196,7 @@ int main(int argc, char* argv[]) std::vector> namesWithRank; for(const auto& v : sfmData.getViews()) { - boost::filesystem::path path_image(v.second->getImage().getImagePath()); + fs::path path_image(v.second->getImage().getImagePath()); namesWithRank.push_back(std::make_pair(path_image.stem().string(), v.first)); } std::sort(namesWithRank.begin(), namesWithRank.end()); @@ -1320,7 +1320,7 @@ int main(int argc, char* argv[]) CircleDetector detector(intrinsic->w(), intrinsic->h(), 256); if(debugFisheyeCircleEstimation) { - boost::filesystem::path path(sfmOutputDataFilepath); + fs::path path(sfmOutputDataFilepath); detector.setDebugDirectory(path.parent_path().string()); } for(const auto& v : sfmData.getViews()) diff --git a/src/software/pipeline/main_panoramaMerging.cpp b/src/software/pipeline/main_panoramaMerging.cpp index 3fd2776f3a..4f62f938b7 100644 --- a/src/software/pipeline/main_panoramaMerging.cpp +++ b/src/software/pipeline/main_panoramaMerging.cpp @@ -23,9 +23,9 @@ // IO #include #include +#include #include #include -#include // These constants define the current software version. // They must be updated when the command line is changed. @@ -36,7 +36,7 @@ using namespace aliceVision; namespace po = boost::program_options; namespace bpt = boost::property_tree; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; int aliceVision_main(int argc, char** argv) { diff --git a/src/software/pipeline/main_panoramaPostProcessing.cpp b/src/software/pipeline/main_panoramaPostProcessing.cpp index ace61228d4..540dbbeb11 100644 --- a/src/software/pipeline/main_panoramaPostProcessing.cpp +++ b/src/software/pipeline/main_panoramaPostProcessing.cpp @@ -18,12 +18,11 @@ #include +#include #include #include #include #include -#include - #include #include @@ -39,7 +38,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; bool downscaleTriangle(image::Image & smaller, const image::Image & source) { diff --git a/src/software/pipeline/main_panoramaPrepareImages.cpp b/src/software/pipeline/main_panoramaPrepareImages.cpp index d824025084..12edb93d28 100644 --- a/src/software/pipeline/main_panoramaPrepareImages.cpp +++ b/src/software/pipeline/main_panoramaPrepareImages.cpp @@ -25,7 +25,7 @@ /*Command line parameters*/ #include -#include +#include #include // These constants define the current software version. @@ -36,7 +36,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; Eigen::Matrix3d getRotationForCode(int code) { @@ -87,7 +87,7 @@ int aliceVision_main(int argc, char* argv[]) } // Analyze path - boost::filesystem::path path(sfmOutputDataFilename); + fs::path path(sfmOutputDataFilename); std::string outputPath = path.parent_path().string(); // Read sfm data @@ -244,7 +244,7 @@ int aliceVision_main(int argc, char* argv[]) // Prepare output file image::Image output; - const boost::filesystem::path origImgPath(v.second->getImage().getImagePath()); + const fs::path origImgPath(v.second->getImage().getImagePath()); const std::string origFilename = origImgPath.stem().string(); const std::string rotatedImagePath = (fs::path(outputPath) / (origFilename + ".exr")).string(); oiio::ParamValueList metadata = image::readImageMetadata(v.second->getImage().getImagePath()); diff --git a/src/software/pipeline/main_panoramaSeams.cpp b/src/software/pipeline/main_panoramaSeams.cpp index 6cd0c63452..4c0e3b77d7 100644 --- a/src/software/pipeline/main_panoramaSeams.cpp +++ b/src/software/pipeline/main_panoramaSeams.cpp @@ -25,11 +25,11 @@ #include // IO +#include #include #include #include #include -#include #include // These constants define the current software version. @@ -41,7 +41,7 @@ using namespace aliceVision; namespace po = boost::program_options; namespace bpt = boost::property_tree; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; bool computeWTALabels(image::Image & labels, const std::vector> & views, const std::string & inputPath, const std::pair & panoramaSize, int downscale) { @@ -226,7 +226,7 @@ int aliceVision_main(int argc, char** argv) const std::regex pattern("([0-9]+)_([0-9]+).exr"); std::map> paths_per_view; - for (auto & iter : boost::filesystem::directory_iterator(p)) + for (auto & iter : fs::directory_iterator(p)) { if (!fs::is_regular_file(iter)) { diff --git a/src/software/pipeline/main_panoramaWarping.cpp b/src/software/pipeline/main_panoramaWarping.cpp index 4c5272f7b2..085a34470c 100644 --- a/src/software/pipeline/main_panoramaWarping.cpp +++ b/src/software/pipeline/main_panoramaWarping.cpp @@ -6,7 +6,6 @@ // Reading command line options #include -#include #include #include @@ -23,6 +22,8 @@ #include #include +#include + // These constants define the current software version. // They must be updated when the command line is changed. #define ALICEVISION_SOFTWARE_VERSION_MAJOR 1 @@ -31,7 +32,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; bool computeOptimalPanoramaSize(std::pair& optimalSize, const sfmData::SfMData& sfmData, const float ratioUpscale) diff --git a/src/software/pipeline/main_photometricStereo.cpp b/src/software/pipeline/main_photometricStereo.cpp index 0e2e54d817..abf280ad4a 100644 --- a/src/software/pipeline/main_photometricStereo.cpp +++ b/src/software/pipeline/main_photometricStereo.cpp @@ -22,7 +22,6 @@ #include #include -#include // Eigen #include @@ -33,6 +32,7 @@ #include #include +#include #include #include #include @@ -47,7 +47,7 @@ #define ALICEVISION_SOFTWARE_VERSION_MINOR 0 namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; using namespace aliceVision; diff --git a/src/software/pipeline/main_prepareDenseScene.cpp b/src/software/pipeline/main_prepareDenseScene.cpp index 8f6a99ba06..2bdb11af26 100644 --- a/src/software/pipeline/main_prepareDenseScene.cpp +++ b/src/software/pipeline/main_prepareDenseScene.cpp @@ -15,11 +15,11 @@ #include #include -#include #include #include #include +#include #include #include #include @@ -39,7 +39,7 @@ using namespace aliceVision::sfmData; using namespace aliceVision::sfmDataIO; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; template void process(const std::string &dstColorImage, const IntrinsicBase* cam, const oiio::ParamValueList & metadata, const std::string & srcImage, bool evCorrection, float exposureCompensation, MaskFuncT && maskFunc) diff --git a/src/software/pipeline/main_relativePoseEstimating.cpp b/src/software/pipeline/main_relativePoseEstimating.cpp index 15d07ee00c..d1e9443b31 100644 --- a/src/software/pipeline/main_relativePoseEstimating.cpp +++ b/src/software/pipeline/main_relativePoseEstimating.cpp @@ -34,7 +34,6 @@ #include #include -#include #include #include @@ -50,7 +49,6 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; bool getPoseStructure(Mat3& R, Vec3& t, std::vector& structure, std::vector& newVecInliers, const Mat3& E, diff --git a/src/software/pipeline/main_rigCalibration.cpp b/src/software/pipeline/main_rigCalibration.cpp index 2750fea2e0..2366550964 100644 --- a/src/software/pipeline/main_rigCalibration.cpp +++ b/src/software/pipeline/main_rigCalibration.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -30,6 +29,7 @@ #include #include +#include #include #include #include @@ -47,7 +47,7 @@ using namespace aliceVision; -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; namespace bacc = boost::accumulators; namespace po = boost::program_options; @@ -309,9 +309,9 @@ int aliceVision_main(int argc, char** argv) const std::string &feedPath = mediaPath[idCamera]; // contains the folder where the video, the images or the filelist is const std::string subMediaFilepath = - bfs::is_directory(bfs::path(mediaPath[idCamera])) ? + fs::is_directory(fs::path(mediaPath[idCamera])) ? (mediaPath[idCamera]) : - (bfs::path(mediaPath[idCamera]).parent_path().string()); + (fs::path(mediaPath[idCamera]).parent_path().string()); // create the feedProvider dataio::FeedProvider feed(feedPath, calibFile); diff --git a/src/software/pipeline/main_rigLocalization.cpp b/src/software/pipeline/main_rigLocalization.cpp index fa53360c6a..385852acc4 100644 --- a/src/software/pipeline/main_rigLocalization.cpp +++ b/src/software/pipeline/main_rigLocalization.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -31,6 +30,7 @@ #include #include +#include #include #include #include @@ -49,7 +49,7 @@ using namespace aliceVision; -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; namespace bacc = boost::accumulators; namespace po = boost::program_options; @@ -306,7 +306,7 @@ int aliceVision_main(int argc, char** argv) cameraExporters.reserve(numCameras); // this contains the full path and the root name of the file without the extension - const std::string basename = (bfs::path(exportAlembicFile).parent_path() / bfs::path(exportAlembicFile).stem()).string(); + const std::string basename = (fs::path(exportAlembicFile).parent_path() / fs::path(exportAlembicFile).stem()).string(); for(std::size_t i = 0; i < numCameras; ++i) { @@ -326,9 +326,9 @@ int aliceVision_main(int argc, char** argv) const std::string &feedPath = mediaPath[idCamera]; // contains the folder where the video, the images or the filelist is subMediaFilepath[idCamera] = - bfs::is_directory(bfs::path(mediaPath[idCamera])) ? + fs::is_directory(fs::path(mediaPath[idCamera])) ? (mediaPath[idCamera]) : - (bfs::path(mediaPath[idCamera]).parent_path().string()); + (fs::path(mediaPath[idCamera]).parent_path().string()); // create the feedProvider feeders[idCamera] = new dataio::FeedProvider(feedPath, calibFile); diff --git a/src/software/pipeline/main_sfmBootstraping.cpp b/src/software/pipeline/main_sfmBootstraping.cpp index 79e41b104c..d8dfec6794 100644 --- a/src/software/pipeline/main_sfmBootstraping.cpp +++ b/src/software/pipeline/main_sfmBootstraping.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include @@ -28,6 +27,7 @@ #include #include +#include #include #include @@ -39,7 +39,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; std::vector readJsons(std::istream& is, boost::json::error_code& ec) { @@ -382,7 +382,7 @@ int aliceVision_main(int argc, char** argv) //Result of pair estimations are stored in multiple files std::vector reconstructedPairs; const std::regex regex("pairs\\_[0-9]+\\.json"); - for(fs::directory_entry & file : boost::make_iterator_range(fs::directory_iterator(pairsDirectory), {})) + for(auto const& file : fs::directory_iterator{pairsDirectory}) { if (!std::regex_search(file.path().string(), regex)) { diff --git a/src/software/pipeline/main_sfmTriangulation.cpp b/src/software/pipeline/main_sfmTriangulation.cpp index ea841bcf7d..17c3cb4406 100644 --- a/src/software/pipeline/main_sfmTriangulation.cpp +++ b/src/software/pipeline/main_sfmTriangulation.cpp @@ -19,9 +19,9 @@ #include #include -#include #include +#include // These constants define the current software version. // They must be updated when the command line is changed. @@ -31,7 +31,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; using namespace aliceVision::track; using namespace aliceVision::sfm; diff --git a/src/software/pipeline/main_sphereDetection.cpp b/src/software/pipeline/main_sphereDetection.cpp index a9036406d1..3aee3ce5d3 100644 --- a/src/software/pipeline/main_sphereDetection.cpp +++ b/src/software/pipeline/main_sphereDetection.cpp @@ -17,8 +17,8 @@ #include #include -#include +#include #include #include @@ -32,7 +32,7 @@ #define ALICEVISION_SOFTWARE_VERSION_MAJOR 1 #define ALICEVISION_SOFTWARE_VERSION_MINOR 0 -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace po = boost::program_options; using namespace aliceVision; diff --git a/src/software/pipeline/main_texturing.cpp b/src/software/pipeline/main_texturing.cpp index 650a73ab39..0aec2edf21 100644 --- a/src/software/pipeline/main_texturing.cpp +++ b/src/software/pipeline/main_texturing.cpp @@ -23,7 +23,8 @@ #include #include -#include + +#include // These constants define the current software version. // They must be updated when the command line is changed. @@ -32,10 +33,10 @@ using namespace aliceVision; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace po = boost::program_options; -bfs::path absolutePathNoExt(const bfs::path& p) +fs::path absolutePathNoExt(const fs::path& p) { return p.parent_path() / p.stem(); } diff --git a/src/software/pipeline/main_tracksBuilding.cpp b/src/software/pipeline/main_tracksBuilding.cpp index 55c2a60fdb..59289a1680 100644 --- a/src/software/pipeline/main_tracksBuilding.cpp +++ b/src/software/pipeline/main_tracksBuilding.cpp @@ -21,7 +21,6 @@ #include #include -#include #include @@ -33,7 +32,6 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; int aliceVision_main(int argc, char** argv) diff --git a/src/software/utils/CMakeLists.txt b/src/software/utils/CMakeLists.txt index a10ef72983..6dd4ff54af 100644 --- a/src/software/utils/CMakeLists.txt +++ b/src/software/utils/CMakeLists.txt @@ -122,7 +122,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) # Transform rig @@ -138,7 +137,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_system aliceVision_cmdline Boost::program_options - Boost::filesystem ) endif() @@ -153,7 +151,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ) # SfM alignment @@ -259,7 +256,6 @@ if(ALICEVISION_BUILD_SFM) Coin::CoinUtils Coin::Osi Boost::program_options - Boost::filesystem Boost::boost Boost::timer ${LEMON_LIBRARY} @@ -277,7 +273,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_keyframe ${OPENIMAGEIO_LIBRARIES} Boost::program_options - Boost::filesystem ) endif() @@ -304,7 +299,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ${OpenCV_LIBS} # opencv_core opencv_imgproc opencv_video opencv_imgcodecs opencv_videoio opencv_features2d opencv_xfeatures2d opencv_mcc ) @@ -333,7 +327,6 @@ if(ALICEVISION_BUILD_SFM) aliceVision_sfmData aliceVision_sfmDataIO Boost::program_options - Boost::filesystem ${OpenCV_LIBS} # opencv_core opencv_imgproc opencv_video opencv_imgcodecs opencv_videoio opencv_features2d opencv_xfeatures2d opencv_mcc ) @@ -356,7 +349,6 @@ if (ALICEVISION_BUILD_PANORAMA) aliceVision_camera ${OPENIMAGEIO_LIBRARIES} Boost::program_options - Boost::filesystem ) endif() diff --git a/src/software/utils/main_colorCheckerCorrection.cpp b/src/software/utils/main_colorCheckerCorrection.cpp index 885a91164f..a72bec9148 100644 --- a/src/software/utils/main_colorCheckerCorrection.cpp +++ b/src/software/utils/main_colorCheckerCorrection.cpp @@ -15,7 +15,6 @@ #include #include -#include #include #include #include @@ -25,6 +24,7 @@ #include #include +#include #include #include #include @@ -37,7 +37,7 @@ using namespace aliceVision; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace bpt = boost::property_tree; namespace po = boost::program_options; @@ -280,7 +280,7 @@ int aliceVision_main(int argc, char** argv) const std::regex regex = utils::filterToRegex(inputExpression); // Get supported files in inputPath directory which matches our regex filter filesStrPaths = utils::getFilesPathsFromFolder( - inputPath.parent_path().generic_string(), [®ex](const boost::filesystem::path& path) { + inputPath.parent_path().generic_string(), [®ex](const fs::path& path) { return image::isSupported(path.extension().string()) && std::regex_match(path.generic_string(), regex); }); diff --git a/src/software/utils/main_colorCheckerDetection.cpp b/src/software/utils/main_colorCheckerDetection.cpp index da0aaf011f..c054fa733c 100644 --- a/src/software/utils/main_colorCheckerDetection.cpp +++ b/src/software/utils/main_colorCheckerDetection.cpp @@ -16,7 +16,6 @@ #include -#include #include #include #include @@ -26,6 +25,7 @@ #include #include +#include #include #include #include @@ -38,7 +38,7 @@ using namespace aliceVision; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace bpt = boost::property_tree; namespace po = boost::program_options; @@ -487,7 +487,7 @@ int aliceVision_main(int argc, char** argv) const std::regex regex = utils::filterToRegex(inputExpression); // Get supported files in inputPath directory which matches our regex filter filesStrPaths = utils::getFilesPathsFromFolder(inputPath.parent_path().generic_string(), - [®ex](const boost::filesystem::path& path) { + [®ex](const fs::path& path) { return image::isSupported(path.extension().string()) && std::regex_match(path.generic_string(), regex); } ); diff --git a/src/software/utils/main_frustumFiltering.cpp b/src/software/utils/main_frustumFiltering.cpp index 59f5df0a53..30f1f80d1c 100644 --- a/src/software/utils/main_frustumFiltering.cpp +++ b/src/software/utils/main_frustumFiltering.cpp @@ -15,8 +15,8 @@ #include #include -#include +#include #include // These constants define the current software version. @@ -28,7 +28,7 @@ using namespace aliceVision; using namespace aliceVision::sfm; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; /// Build a list of pair that share visibility content from the SfMData structure PairSet BuildPairsFromStructureObservations(const sfmData::SfMData& sfmData) diff --git a/src/software/utils/main_generateSampleScene.cpp b/src/software/utils/main_generateSampleScene.cpp index 4577d459d0..36d35cc654 100644 --- a/src/software/utils/main_generateSampleScene.cpp +++ b/src/software/utils/main_generateSampleScene.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include // These constants define the current software version. @@ -21,7 +21,7 @@ using namespace aliceVision; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace po = boost::program_options; int aliceVision_main(int argc, char** argv) diff --git a/src/software/utils/main_imageProcessing.cpp b/src/software/utils/main_imageProcessing.cpp index 6650c922fe..097c80261f 100644 --- a/src/software/utils/main_imageProcessing.cpp +++ b/src/software/utils/main_imageProcessing.cpp @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -34,6 +33,7 @@ #include #include +#include #include #include #include @@ -49,7 +49,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; struct LensCorrectionParams { @@ -920,7 +920,7 @@ void saveImage(image::Image& image, const std::string& inputP { // The file must match the file name and extension to be used as a metadata replacement. const std::vector metadataFilePaths = utils::getFilesPathsFromFolders( - metadataFolders, [&filename](const boost::filesystem::path& path) + metadataFolders, [&filename](const fs::path& path) { return path.filename().string() == filename; } @@ -1481,7 +1481,7 @@ int aliceVision_main(int argc, char * argv[]) if(inputExpression.empty()) { // Get supported files - filesStrPaths = utils::getFilesPathsFromFolders(inputFolders, [](const boost::filesystem::path& path) { + filesStrPaths = utils::getFilesPathsFromFolders(inputFolders, [](const fs::path& path) { return image::isSupported(path.extension().string()); }); } @@ -1504,7 +1504,7 @@ int aliceVision_main(int argc, char * argv[]) const std::regex regex = utils::filterToRegex(inputExpression); // Get supported files in inputPath directory which matches our regex filter filesStrPaths = utils::getFilesPathsFromFolder(inputPath.parent_path().generic_string(), - [®ex](const boost::filesystem::path& path) { + [®ex](const fs::path& path) { return image::isSupported(path.extension().string()) && std::regex_match(path.generic_string(), regex); } ); diff --git a/src/software/utils/main_importMiddlebury.cpp b/src/software/utils/main_importMiddlebury.cpp index 1f7191f32f..334f7ea015 100644 --- a/src/software/utils/main_importMiddlebury.cpp +++ b/src/software/utils/main_importMiddlebury.cpp @@ -13,8 +13,8 @@ #include #include -#include +#include #include #include #include @@ -30,7 +30,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; /* @@ -77,14 +77,14 @@ int aliceVision_main(int argc, char** argv) } // check input file exist - if(!exists(bfs::path(middleburyFile))) + if(!exists(fs::path(middleburyFile))) { ALICEVISION_LOG_ERROR("File " << middleburyFile << " does not exist"); return EXIT_FAILURE; } // get the base path - const auto basePath = bfs::path(middleburyFile).parent_path().string(); + const auto basePath = fs::path(middleburyFile).parent_path().string(); // parse file const auto sfmData = diff --git a/src/software/utils/main_keyframeSelection.cpp b/src/software/utils/main_keyframeSelection.cpp index c3b2b09b16..db53e7a28e 100644 --- a/src/software/utils/main_keyframeSelection.cpp +++ b/src/software/utils/main_keyframeSelection.cpp @@ -11,8 +11,8 @@ #include #include -#include +#include #include #include @@ -24,7 +24,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; const std::string supportedExtensions = "none, exr, jpg, png"; diff --git a/src/software/utils/main_lightingEstimation.cpp b/src/software/utils/main_lightingEstimation.cpp index 91de23e416..7035cc3451 100644 --- a/src/software/utils/main_lightingEstimation.cpp +++ b/src/software/utils/main_lightingEstimation.cpp @@ -18,8 +18,8 @@ #include #include -#include +#include #include #include @@ -31,7 +31,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; enum class EAlbedoEstimation { diff --git a/src/software/utils/main_mergeMeshes.cpp b/src/software/utils/main_mergeMeshes.cpp index 41a9ce8edf..cb8cac21ed 100644 --- a/src/software/utils/main_mergeMeshes.cpp +++ b/src/software/utils/main_mergeMeshes.cpp @@ -10,7 +10,6 @@ #include #include -#include #include #include @@ -23,6 +22,7 @@ #include #include +#include #include #include #include @@ -35,7 +35,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; enum class EOperationType : unsigned char { diff --git a/src/software/utils/main_qualityEvaluation.cpp b/src/software/utils/main_qualityEvaluation.cpp index 691954e599..655c449aed 100644 --- a/src/software/utils/main_qualityEvaluation.cpp +++ b/src/software/utils/main_qualityEvaluation.cpp @@ -18,8 +18,8 @@ #include #include -#include +#include #include #include @@ -31,7 +31,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; int aliceVision_main(int argc, char **argv) { diff --git a/src/software/utils/main_sfmColorHarmonize.cpp b/src/software/utils/main_sfmColorHarmonize.cpp index fc3675eb2e..b6e3622610 100644 --- a/src/software/utils/main_sfmColorHarmonize.cpp +++ b/src/software/utils/main_sfmColorHarmonize.cpp @@ -13,9 +13,9 @@ #include #include -#include #include +#include #include // These constants define the current software version. @@ -26,7 +26,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; int aliceVision_main( int argc, char **argv ) { diff --git a/src/software/utils/main_sfmDistances.cpp b/src/software/utils/main_sfmDistances.cpp index fd18bb794a..94551cd2f6 100644 --- a/src/software/utils/main_sfmDistances.cpp +++ b/src/software/utils/main_sfmDistances.cpp @@ -14,8 +14,8 @@ #include #include #include -#include +#include #include #include #include @@ -29,7 +29,7 @@ using namespace aliceVision; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; /** * @brief Alignment method enum diff --git a/src/software/utils/main_split360Images.cpp b/src/software/utils/main_split360Images.cpp index f65e1f8a67..de6911514a 100644 --- a/src/software/utils/main_split360Images.cpp +++ b/src/software/utils/main_split360Images.cpp @@ -18,7 +18,6 @@ #include #include -#include #include #include @@ -29,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -40,7 +40,7 @@ using namespace aliceVision; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace po = boost::program_options; namespace oiio = OIIO; @@ -490,7 +490,7 @@ int aliceVision_main(int argc, char** argv) // - a SfMData file (in that case we split the views) if (fs::is_directory(path)) { - for (fs::directory_entry& entry : boost::make_iterator_range(fs::directory_iterator(path), {})) + for (auto const& entry : fs::directory_iterator{path}) { imagePaths.push_back(entry.path().string()); } diff --git a/src/software/utils/main_voctreeQueryUtility.cpp b/src/software/utils/main_voctreeQueryUtility.cpp index 17a3d5a5d8..d7bdcefba6 100644 --- a/src/software/utils/main_voctreeQueryUtility.cpp +++ b/src/software/utils/main_voctreeQueryUtility.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -40,7 +41,7 @@ static const int DIMENSION = 128; using namespace boost::accumulators; namespace po = boost::program_options; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; using namespace aliceVision; using namespace aliceVision::feature; diff --git a/src/software/utils/precisionEvaluationToGt.hpp b/src/software/utils/precisionEvaluationToGt.hpp index e584434828..8ae448f097 100644 --- a/src/software/utils/precisionEvaluationToGt.hpp +++ b/src/software/utils/precisionEvaluationToGt.hpp @@ -14,12 +14,11 @@ #include #include -#include - +#include #include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { diff --git a/src/software/utils/sfmColorHarmonize/colorHarmonizeEngineGlobal.cpp b/src/software/utils/sfmColorHarmonize/colorHarmonizeEngineGlobal.cpp index 31e716efdd..ce2d6846a3 100644 --- a/src/software/utils/sfmColorHarmonize/colorHarmonizeEngineGlobal.cpp +++ b/src/software/utils/sfmColorHarmonize/colorHarmonizeEngineGlobal.cpp @@ -36,9 +36,10 @@ #include #include #include +#include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { From 98ba123151251b1f98fa8fa952e73ea6fae0ab5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Fri, 5 Jan 2024 18:08:33 +0100 Subject: [PATCH 02/17] [utils] Add utilitary function to generate a unique random filename This is meant to be used as a replacement for `boost::filesystem::unique_path()` as it is not part of `std::filesystem` yet because of a potential exploit (https://stackoverflow.com/a/43318175). --- src/aliceVision/utils/filesIO.hpp | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/aliceVision/utils/filesIO.hpp b/src/aliceVision/utils/filesIO.hpp index 8577059bdf..935e288b0f 100644 --- a/src/aliceVision/utils/filesIO.hpp +++ b/src/aliceVision/utils/filesIO.hpp @@ -7,9 +7,12 @@ #pragma once #include -#include -#include #include +#include +#include +#include +#include + namespace aliceVision { namespace utils { @@ -61,5 +64,29 @@ inline std::vector getFilesPathsFromFolders(const std::vector randomDist(0, nbChars - 1); + + std::string filename; + filename.resize(length); + + for (int i = 0; i < length; ++i) + filename[i] = characters[randomDist(randomTwEngine)]; + + return filename; +} + } // namespace utils } // namespace aliceVision \ No newline at end of file From 71340508bc742645281049920bc5daad84470a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 8 Jan 2024 17:09:44 +0100 Subject: [PATCH 03/17] [utils] Add utilitary function to retrieve a file's last write time --- src/aliceVision/utils/filesIO.hpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/aliceVision/utils/filesIO.hpp b/src/aliceVision/utils/filesIO.hpp index 935e288b0f..b0230739c6 100644 --- a/src/aliceVision/utils/filesIO.hpp +++ b/src/aliceVision/utils/filesIO.hpp @@ -6,11 +6,13 @@ #pragma once +#include #include #include #include #include #include +#include #include @@ -88,5 +90,33 @@ inline std::string generateUniqueFilename(const int length = 16) return filename; } + +/** + * @brief Returns the last time a file was modified (based on OIIO's implementation). + * @param[in] path The path to get the last write time from + * @return The last time the file was modified as an std::time_t if it exists, 0 otherwise + */ +inline std::time_t getLastWriteTime(const std::string& path) +{ + #ifdef _WIN32 + struct __stat64 st; + std::wstring_convert, wchar_t> conv; + std::wstring str = conv.from_bytes(path.data(), path.data() + path.size()); + auto r = _wstat64(std::filesystem::path(str).c_str(), &st); + #else + struct stat st; + auto r = stat(std::filesystem::path(path).c_str(), &st); + #endif + + if (r == 0) // success + { + return st.st_mtime; + } + else // failure + { + return 0; + } +} + } // namespace utils } // namespace aliceVision \ No newline at end of file From 55d25686faf5be433ae4f77c55dced54d4db39cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 8 Jan 2024 08:44:37 +0000 Subject: [PATCH 04/17] [voctree][system] Replace calls to `boost::filesystem` with `std::filesystem` --- src/aliceVision/system/nvtx.cpp | 4 ++-- src/aliceVision/voctree/CMakeLists.txt | 2 -- src/aliceVision/voctree/descriptorLoader.cpp | 8 +++++--- src/aliceVision/voctree/descriptorLoader.tcc | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/aliceVision/system/nvtx.cpp b/src/aliceVision/system/nvtx.cpp index 3f8b085f66..c47fb5a3ab 100644 --- a/src/aliceVision/system/nvtx.cpp +++ b/src/aliceVision/system/nvtx.cpp @@ -2,13 +2,13 @@ #include #include - #include + #include #include "aliceVision/system/nvtx.hpp" void nvtxPushA(const char* label, const char* file, int line) { - boost::filesystem::path in(file); + std::filesystem::path in(file); std::ostringstream ostr; ostr << label << " " << in.filename() << ":" << line; diff --git a/src/aliceVision/voctree/CMakeLists.txt b/src/aliceVision/voctree/CMakeLists.txt index c290a63f6a..0985e1db5a 100644 --- a/src/aliceVision/voctree/CMakeLists.txt +++ b/src/aliceVision/voctree/CMakeLists.txt @@ -26,8 +26,6 @@ alicevision_add_library(aliceVision_voctree aliceVision_sfmData aliceVision_system Boost::boost - PRIVATE_LINKS - Boost::filesystem ) # Unit tests diff --git a/src/aliceVision/voctree/descriptorLoader.cpp b/src/aliceVision/voctree/descriptorLoader.cpp index 22d2b72c07..22cadd2a74 100644 --- a/src/aliceVision/voctree/descriptorLoader.cpp +++ b/src/aliceVision/voctree/descriptorLoader.cpp @@ -10,6 +10,8 @@ #include +#include + namespace aliceVision { namespace voctree { @@ -59,7 +61,7 @@ void getListOfDescriptorFiles(const sfmData::SfMData& sfmData, const std::vector& featuresFolders, std::map& descriptorsFiles) { - namespace bfs = boost::filesystem; + namespace fs = std::filesystem; descriptorsFiles.clear(); @@ -88,11 +90,11 @@ void getListOfDescriptorFiles(const sfmData::SfMData& sfmData, for (const feature::EImageDescriberType descType : descTypes) { // generate the equivalent .desc file path - const std::string filepath = bfs::path(bfs::path(featureFolder) / (std::to_string(view.first) + "." + + const std::string filepath = fs::path(fs::path(featureFolder) / (std::to_string(view.first) + "." + feature::EImageDescriberType_enumToString(descType) + ".desc")) .string(); - if (bfs::exists(filepath)) + if (fs::exists(filepath)) { descriptorsFiles[view.first] = filepath; found = true; diff --git a/src/aliceVision/voctree/descriptorLoader.tcc b/src/aliceVision/voctree/descriptorLoader.tcc index 2cda001899..64592f6dfe 100644 --- a/src/aliceVision/voctree/descriptorLoader.tcc +++ b/src/aliceVision/voctree/descriptorLoader.tcc @@ -8,11 +8,11 @@ #include #include -#include #include -#include +#include #include +#include namespace aliceVision { namespace voctree { @@ -23,7 +23,7 @@ std::size_t readDescFromFiles(const sfmData::SfMData& sfmData, std::vector& descriptors, std::vector &numFeatures) { - namespace bfs = boost::filesystem; + namespace fs = std::filesystem; std::map descriptorsFiles; getListOfDescriptorFiles(sfmData, featuresFolders, descriptorsFiles); std::size_t numDescriptors = 0; @@ -48,7 +48,7 @@ std::size_t readDescFromFiles(const sfmData::SfMData& sfmData, else { // get the file size in byte and estimate the number of features without opening the file - numDescriptors += (bfs::file_size(currentFile.second) / bytesPerElement) / DescriptorT::static_size; + numDescriptors += (fs::file_size(currentFile.second) / bytesPerElement) / DescriptorT::static_size; } ++display; } From 7f2cbbf98e6ce4b012e704407b9d68f1a1d07645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 8 Jan 2024 08:45:12 +0000 Subject: [PATCH 05/17] [sfmDataIO] Replace calls to `boost::filesystem` with `std::filesystem` --- src/aliceVision/sfmDataIO/AlembicExporter.cpp | 5 ++--- src/aliceVision/sfmDataIO/CMakeLists.txt | 2 -- src/aliceVision/sfmDataIO/bafIO.cpp | 5 ++--- src/aliceVision/sfmDataIO/colmap.cpp | 7 +++---- .../compatibilityData/scene_v1.2.6.abc | Bin 421271 -> 421271 bytes src/aliceVision/sfmDataIO/gtIO.cpp | 14 +++++++------- src/aliceVision/sfmDataIO/middlebury.cpp | 7 +++---- src/aliceVision/sfmDataIO/sfmDataIO.cpp | 9 +++++---- .../sfmDataIO/sfmDataIOCompatibility_test.cpp | 4 ++-- src/aliceVision/sfmDataIO/sfmDataIO_test.cpp | 5 ++--- src/aliceVision/sfmDataIO/viewIO.cpp | 4 ++-- src/aliceVision/sfmDataIO/viewIO.hpp | 2 +- 12 files changed, 29 insertions(+), 35 deletions(-) diff --git a/src/aliceVision/sfmDataIO/AlembicExporter.cpp b/src/aliceVision/sfmDataIO/AlembicExporter.cpp index abf6785700..27126ddb9c 100644 --- a/src/aliceVision/sfmDataIO/AlembicExporter.cpp +++ b/src/aliceVision/sfmDataIO/AlembicExporter.cpp @@ -12,11 +12,10 @@ #include #include -#include - #include +#include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace sfmDataIO { diff --git a/src/aliceVision/sfmDataIO/CMakeLists.txt b/src/aliceVision/sfmDataIO/CMakeLists.txt index 4e4e873f08..5c596658ba 100644 --- a/src/aliceVision/sfmDataIO/CMakeLists.txt +++ b/src/aliceVision/sfmDataIO/CMakeLists.txt @@ -40,10 +40,8 @@ alicevision_add_library(aliceVision_sfmDataIO PUBLIC_LINKS aliceVision_sfmData aliceVision_camera - Boost::filesystem PRIVATE_LINKS aliceVision_image - Boost::filesystem Boost::regex Boost::boost ) diff --git a/src/aliceVision/sfmDataIO/bafIO.cpp b/src/aliceVision/sfmDataIO/bafIO.cpp index 521e87916b..c4e2855853 100644 --- a/src/aliceVision/sfmDataIO/bafIO.cpp +++ b/src/aliceVision/sfmDataIO/bafIO.cpp @@ -7,11 +7,10 @@ #include "bafIO.hpp" -#include - +#include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace sfmDataIO { diff --git a/src/aliceVision/sfmDataIO/colmap.cpp b/src/aliceVision/sfmDataIO/colmap.cpp index acc9fb0993..125c1be87a 100644 --- a/src/aliceVision/sfmDataIO/colmap.cpp +++ b/src/aliceVision/sfmDataIO/colmap.cpp @@ -8,12 +8,11 @@ #include #include -#include - -#include +#include #include +#include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace sfmDataIO { diff --git a/src/aliceVision/sfmDataIO/compatibilityData/scene_v1.2.6.abc b/src/aliceVision/sfmDataIO/compatibilityData/scene_v1.2.6.abc index fda94a48d53aa75d98a7b452dc6f69100f386d63..b42c79671ba5bd05c141c82263b860bf825b83af 100644 GIT binary patch delta 98 zcmV-o0G*{A8JALW3k(Z!nySx$0{{R31A&2sfdPeq0)>GCg@FWx zfd#dJ1}SL}&4t3@`v4#a^Uj1EVdj}Tx4LNt8UYYN6FDjJ8YjRs$GGvoYH;GWGCg@FWx zfd#dJ1}SL}N(1%p&Y%*qH@D;E;8VXRx4LNt8UYYq;e6jXF>!t@g #include -#include +#include #include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace sfmDataIO { @@ -23,7 +23,7 @@ namespace sfmDataIO { bool read_aliceVision_Camera(const std::string& camName, camera::Pinhole& cam, geometry::Pose3& pose) { std::vector val; - if (fs::extension(camName) == ".bin") + if (fs::path(camName).extension() == ".bin") { std::ifstream in(camName, std::ios::in | std::ios::binary); if (!in.is_open()) @@ -59,7 +59,7 @@ bool read_aliceVision_Camera(const std::string& camName, camera::Pinhole& cam, g // Update the camera from file value Mat34 P; - if (fs::extension(camName) == ".bin") + if (fs::path(camName).extension() == ".bin") { P << val[0], val[3], val[6], val[9], val[1], val[4], val[7], val[10], val[2], val[5], val[8], val[11]; } @@ -141,10 +141,10 @@ bool readGt(const std::string& rootPath, sfmData::SfMData& sfmData, bool useUID) std::vector binFiles; std::vector camFiles; - boost::filesystem::directory_iterator endItr; - for (boost::filesystem::directory_iterator i(sGTPath); i != endItr; ++i) + fs::directory_iterator endItr; + for (fs::directory_iterator i(sGTPath); i != endItr; ++i) { - if (!boost::filesystem::is_regular_file(i->status())) + if (!fs::is_regular_file(i->status())) continue; boost::smatch what; diff --git a/src/aliceVision/sfmDataIO/middlebury.cpp b/src/aliceVision/sfmDataIO/middlebury.cpp index dcdd204f22..27d2a069e5 100644 --- a/src/aliceVision/sfmDataIO/middlebury.cpp +++ b/src/aliceVision/sfmDataIO/middlebury.cpp @@ -8,14 +8,13 @@ #include #include -#include - +#include #include namespace aliceVision { namespace sfmDataIO { -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; Mat3 extractMat3FromVec(const std::vector& entries, std::size_t offset) { @@ -106,7 +105,7 @@ sfmData::SfMData middleburySceneToSfmData(const std::string& filename, Vec3 translation; parseMiddleburyCamera(line, imageName, matK, rotation, translation); - const auto imagePath = (bfs::path(basePath) / bfs::path(imageName)).string(); + const auto imagePath = (fs::path(basePath) / fs::path(imageName)).string(); int imageWidth{}; int imageHeight{}; image::readImageSize(imagePath, imageWidth, imageHeight); diff --git a/src/aliceVision/sfmDataIO/sfmDataIO.cpp b/src/aliceVision/sfmDataIO/sfmDataIO.cpp index fd1aa002d7..71cf4b4ccc 100644 --- a/src/aliceVision/sfmDataIO/sfmDataIO.cpp +++ b/src/aliceVision/sfmDataIO/sfmDataIO.cpp @@ -12,15 +12,16 @@ #include #include #include +#include #if ALICEVISION_IS_DEFINED(ALICEVISION_HAVE_ALEMBIC) #include #include #endif -#include +#include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace sfmDataIO { @@ -107,7 +108,7 @@ bool ValidIds(const sfmData::SfMData& sfmData, ESfMData partFlag) bool Load(sfmData::SfMData& sfmData, const std::string& filename, ESfMData partFlag) { - const std::string extension = fs::extension(filename); + const std::string extension = fs::path(filename).extension().string(); bool status = false; if (extension == ".sfm" || extension == ".json") // JSON File @@ -147,7 +148,7 @@ bool Save(const sfmData::SfMData& sfmData, const std::string& filename, ESfMData { const fs::path bPath = fs::path(filename); const std::string extension = bPath.extension().string(); - const std::string tmpPath = (bPath.parent_path() / bPath.stem()).string() + "." + fs::unique_path().string() + extension; + const std::string tmpPath = (bPath.parent_path() / bPath.stem()).string() + "." + utils::generateUniqueFilename() + extension; bool status = false; if (extension == ".sfm" || extension == ".json") // JSON File diff --git a/src/aliceVision/sfmDataIO/sfmDataIOCompatibility_test.cpp b/src/aliceVision/sfmDataIO/sfmDataIOCompatibility_test.cpp index 3a816acd7e..f48684e40c 100644 --- a/src/aliceVision/sfmDataIO/sfmDataIOCompatibility_test.cpp +++ b/src/aliceVision/sfmDataIO/sfmDataIOCompatibility_test.cpp @@ -9,9 +9,9 @@ #include #include -#include #include +#include #include #define BOOST_TEST_MODULE sfmDataIO @@ -21,7 +21,7 @@ using namespace aliceVision; using namespace aliceVision::sfmDataIO; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; BOOST_AUTO_TEST_CASE(Compatibility_generate_files_current_version) { diff --git a/src/aliceVision/sfmDataIO/sfmDataIO_test.cpp b/src/aliceVision/sfmDataIO/sfmDataIO_test.cpp index 0cf4c0757c..ef21277d30 100644 --- a/src/aliceVision/sfmDataIO/sfmDataIO_test.cpp +++ b/src/aliceVision/sfmDataIO/sfmDataIO_test.cpp @@ -10,8 +10,7 @@ #include #include -#include - +#include #include #define BOOST_TEST_MODULE sfmDataIO @@ -24,7 +23,7 @@ using namespace aliceVision::camera; using namespace aliceVision::geometry; using namespace aliceVision::sfmDataIO; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; // Create a SfM scene with desired count of views & poses & intrinsic (shared or not) // Add a 3D point with observation in 2 view (just in order to have non empty data) diff --git a/src/aliceVision/sfmDataIO/viewIO.cpp b/src/aliceVision/sfmDataIO/viewIO.cpp index e5b7ee4c2e..c4b61df5bf 100644 --- a/src/aliceVision/sfmDataIO/viewIO.cpp +++ b/src/aliceVision/sfmDataIO/viewIO.cpp @@ -15,7 +15,7 @@ #include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace sfmDataIO { @@ -53,7 +53,7 @@ void updateIncompleteView(sfmData::View& view, EViewIdMethod viewIdMethod, const } // Get view image filename without extension - const std::string filename = boost::filesystem::path(view.getImage().getImagePath()).stem().string(); + const std::string filename = fs::path(view.getImage().getImagePath()).stem().string(); std::smatch match; std::regex_search(filename, match, re); diff --git a/src/aliceVision/sfmDataIO/viewIO.hpp b/src/aliceVision/sfmDataIO/viewIO.hpp index 31e89d440f..0581598d96 100644 --- a/src/aliceVision/sfmDataIO/viewIO.hpp +++ b/src/aliceVision/sfmDataIO/viewIO.hpp @@ -10,9 +10,9 @@ #include #include -#include #include +#include #include namespace aliceVision { From baae183de4e5ee237dc227417ef7684fcf16a401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 8 Jan 2024 09:07:43 +0000 Subject: [PATCH 06/17] [sfm][sfmData] Replace calls to `boost::filesystem` with `std::filesystem` --- src/aliceVision/sfm/CMakeLists.txt | 1 - src/aliceVision/sfm/LocalBundleAdjustmentGraph.cpp | 4 ++-- src/aliceVision/sfm/bundle/BundleAdjustmentCeres.cpp | 5 ++--- .../sfm/bundle/BundleAdjustmentSymbolicCeres.cpp | 4 ++-- src/aliceVision/sfm/generateReport.cpp | 4 ++-- src/aliceVision/sfm/pipeline/global/globalSfM_test.cpp | 4 ---- src/aliceVision/sfm/pipeline/regionsIO.cpp | 4 ++-- src/aliceVision/sfmData/CMakeLists.txt | 1 - src/aliceVision/sfmData/SfMData.cpp | 6 +++--- src/aliceVision/sfmData/sfmData_test.cpp | 6 +++--- src/aliceVision/sfmData/uid.cpp | 10 ++++++---- src/aliceVision/sfmData/view_test.cpp | 3 --- 12 files changed, 22 insertions(+), 30 deletions(-) diff --git a/src/aliceVision/sfm/CMakeLists.txt b/src/aliceVision/sfm/CMakeLists.txt index b02e585b6e..e3e49ab948 100644 --- a/src/aliceVision/sfm/CMakeLists.txt +++ b/src/aliceVision/sfm/CMakeLists.txt @@ -74,7 +74,6 @@ alicevision_add_library(aliceVision_sfm aliceVision_linearProgramming aliceVision_sfmData aliceVision_sfmDataIO - Boost::filesystem Boost::boost ${CERES_LIBRARIES} PRIVATE_LINKS diff --git a/src/aliceVision/sfm/LocalBundleAdjustmentGraph.cpp b/src/aliceVision/sfm/LocalBundleAdjustmentGraph.cpp index 0fd5fc6b75..7b23017696 100644 --- a/src/aliceVision/sfm/LocalBundleAdjustmentGraph.cpp +++ b/src/aliceVision/sfm/LocalBundleAdjustmentGraph.cpp @@ -7,14 +7,14 @@ #include "LocalBundleAdjustmentGraph.hpp" #include #include -#include #include #include +#include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace sfm { diff --git a/src/aliceVision/sfm/bundle/BundleAdjustmentCeres.cpp b/src/aliceVision/sfm/bundle/BundleAdjustmentCeres.cpp index bbbfb936df..c70968a637 100644 --- a/src/aliceVision/sfm/bundle/BundleAdjustmentCeres.cpp +++ b/src/aliceVision/sfm/bundle/BundleAdjustmentCeres.cpp @@ -14,14 +14,13 @@ #include #include -#include - #include +#include #include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace sfm { diff --git a/src/aliceVision/sfm/bundle/BundleAdjustmentSymbolicCeres.cpp b/src/aliceVision/sfm/bundle/BundleAdjustmentSymbolicCeres.cpp index 70a4226ba6..9138052598 100644 --- a/src/aliceVision/sfm/bundle/BundleAdjustmentSymbolicCeres.cpp +++ b/src/aliceVision/sfm/bundle/BundleAdjustmentSymbolicCeres.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -25,9 +24,10 @@ #include #include +#include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace sfm { diff --git a/src/aliceVision/sfm/generateReport.cpp b/src/aliceVision/sfm/generateReport.cpp index 3a9529eebb..9d83bdbe41 100644 --- a/src/aliceVision/sfm/generateReport.cpp +++ b/src/aliceVision/sfm/generateReport.cpp @@ -12,9 +12,9 @@ #include #include -#include +#include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace sfm { diff --git a/src/aliceVision/sfm/pipeline/global/globalSfM_test.cpp b/src/aliceVision/sfm/pipeline/global/globalSfM_test.cpp index eef630fcd5..50918cc32a 100644 --- a/src/aliceVision/sfm/pipeline/global/globalSfM_test.cpp +++ b/src/aliceVision/sfm/pipeline/global/globalSfM_test.cpp @@ -11,8 +11,6 @@ #include #include -#include - #include #include #include @@ -28,8 +26,6 @@ using namespace aliceVision::geometry; using namespace aliceVision::sfm; using namespace aliceVision::sfmData; -namespace fs = boost::filesystem; - // Test summary: // - Create features points and matching from the synthetic dataset // - Init a SfMData scene VIew and Intrinsic from a synthetic dataset diff --git a/src/aliceVision/sfm/pipeline/regionsIO.cpp b/src/aliceVision/sfm/pipeline/regionsIO.cpp index f808ed9e62..a3daaf1dca 100644 --- a/src/aliceVision/sfm/pipeline/regionsIO.cpp +++ b/src/aliceVision/sfm/pipeline/regionsIO.cpp @@ -8,12 +8,12 @@ #include "regionsIO.hpp" #include -#include #include #include +#include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace sfm { diff --git a/src/aliceVision/sfmData/CMakeLists.txt b/src/aliceVision/sfmData/CMakeLists.txt index 71a51dd5a7..aaa0f9781a 100644 --- a/src/aliceVision/sfmData/CMakeLists.txt +++ b/src/aliceVision/sfmData/CMakeLists.txt @@ -35,7 +35,6 @@ alicevision_add_library(aliceVision_sfmData aliceVision_camera aliceVision_sensorDB aliceVision_stl - Boost::filesystem PRIVATE_LINKS Boost::boost ) diff --git a/src/aliceVision/sfmData/SfMData.cpp b/src/aliceVision/sfmData/SfMData.cpp index ad0234f6b5..f9d3b36488 100644 --- a/src/aliceVision/sfmData/SfMData.cpp +++ b/src/aliceVision/sfmData/SfMData.cpp @@ -9,7 +9,7 @@ #include -#include +#include namespace aliceVision { namespace sfmData { @@ -18,7 +18,7 @@ using namespace aliceVision::geometry; using namespace aliceVision::camera; using namespace aliceVision::image; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; bool SfMData::operator==(const SfMData& other) const { @@ -125,7 +125,7 @@ std::vector toAbsoluteFolders(const std::vector& folde absolutePaths.reserve(folders.size()); for (const auto& folder : folders) { - const fs::path f = fs::absolute(folder, fs::path(absolutePath).parent_path()); + const fs::path f = fs::absolute(folder); if (fs::exists(f)) { // fs::canonical can only be used if the path exists diff --git a/src/aliceVision/sfmData/sfmData_test.cpp b/src/aliceVision/sfmData/sfmData_test.cpp index 20cf4aee2d..b5c768115a 100644 --- a/src/aliceVision/sfmData/sfmData_test.cpp +++ b/src/aliceVision/sfmData/sfmData_test.cpp @@ -1,13 +1,13 @@ - -#include #include #define BOOST_TEST_MODULE sfmData #include +#include + using namespace aliceVision; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; BOOST_AUTO_TEST_CASE(SfMData_InternalFolders) { diff --git a/src/aliceVision/sfmData/uid.cpp b/src/aliceVision/sfmData/uid.cpp index bfb9375dfe..70d7431f9e 100644 --- a/src/aliceVision/sfmData/uid.cpp +++ b/src/aliceVision/sfmData/uid.cpp @@ -9,11 +9,13 @@ #include #include +#include #include -#include -namespace fs = boost::filesystem; +#include + +namespace fs = std::filesystem; namespace aliceVision { namespace sfmData { @@ -85,8 +87,8 @@ std::size_t computeViewUID(const View& view) else { // if no original date/time, fallback to the file date/time - std::time_t t = fs::last_write_time(imagePath); - stl::hash_combine(uid, t); + auto lastWriteTime = utils::getLastWriteTime(imagePath.string()); + stl::hash_combine(uid, lastWriteTime); } // cannot use view.getWidth() and view.getHeight() directly diff --git a/src/aliceVision/sfmData/view_test.cpp b/src/aliceVision/sfmData/view_test.cpp index 9f36740ea5..451aeb8faa 100644 --- a/src/aliceVision/sfmData/view_test.cpp +++ b/src/aliceVision/sfmData/view_test.cpp @@ -1,5 +1,3 @@ - -#include #include #define BOOST_TEST_MODULE view @@ -7,7 +5,6 @@ #include using namespace aliceVision; -namespace fs = boost::filesystem; BOOST_AUTO_TEST_CASE(View_Metadata) { From 2e64033c7c8396e3dd6b741d5b760dd5949b526e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 8 Jan 2024 09:07:31 +0000 Subject: [PATCH 07/17] [calibration][dataio] Replace calls to `boost::filesystem` with `std::filesystem` --- src/aliceVision/calibration/CMakeLists.txt | 1 - src/aliceVision/calibration/exportData.cpp | 5 ++--- src/aliceVision/dataio/CMakeLists.txt | 1 - src/aliceVision/dataio/FeedProvider.cpp | 11 +++++------ src/aliceVision/dataio/ImageFeed.cpp | 22 +++++++++++----------- 5 files changed, 18 insertions(+), 22 deletions(-) diff --git a/src/aliceVision/calibration/CMakeLists.txt b/src/aliceVision/calibration/CMakeLists.txt index f3ed04282f..801c7c88ac 100644 --- a/src/aliceVision/calibration/CMakeLists.txt +++ b/src/aliceVision/calibration/CMakeLists.txt @@ -31,7 +31,6 @@ alicevision_add_library(aliceVision_calibration aliceVision_image aliceVision_system aliceVision_dataio - Boost::filesystem Boost::program_options Boost::boost Boost::json diff --git a/src/aliceVision/calibration/exportData.cpp b/src/aliceVision/calibration/exportData.cpp index d4e9d57a79..3add0a155b 100644 --- a/src/aliceVision/calibration/exportData.cpp +++ b/src/aliceVision/calibration/exportData.cpp @@ -13,8 +13,7 @@ #include #include -#include - +#include #include #include #include @@ -59,7 +58,7 @@ void exportImages(aliceVision::dataio::FeedProvider& feed, // drawChessboardCorners(view, boardSize, cv::Mat(pointbuf), found); aliceVision::camera::UndistortImage(inputImage, &camera, outputImage, static_cast(0)); - const boost::filesystem::path imagePath = boost::filesystem::path(debugFolder) / (std::to_string(currentFrame) + suffix); + const std::filesystem::path imagePath = std::filesystem::path(debugFolder) / (std::to_string(currentFrame) + suffix); aliceVision::image::writeImage(imagePath.string(), outputImage, image::ImageWriteOptions()); } ALICEVISION_LOG_DEBUG("... finished"); diff --git a/src/aliceVision/dataio/CMakeLists.txt b/src/aliceVision/dataio/CMakeLists.txt index ab24fb6e3d..d423e88b48 100644 --- a/src/aliceVision/dataio/CMakeLists.txt +++ b/src/aliceVision/dataio/CMakeLists.txt @@ -28,7 +28,6 @@ alicevision_add_library(aliceVision_dataio aliceVision_sfmData aliceVision_sfmDataIO aliceVision_system - Boost::filesystem Boost::boost ) diff --git a/src/aliceVision/dataio/FeedProvider.cpp b/src/aliceVision/dataio/FeedProvider.cpp index 8353aa4172..6bccb62339 100644 --- a/src/aliceVision/dataio/FeedProvider.cpp +++ b/src/aliceVision/dataio/FeedProvider.cpp @@ -12,8 +12,7 @@ #include "VideoFeed.hpp" #endif -#include - +#include #include #include #include @@ -28,15 +27,15 @@ FeedProvider::FeedProvider(const std::string& feedPath, const std::string& calib _isLiveFeed(false), _isSfmData(false) { - namespace bf = boost::filesystem; + namespace fs = std::filesystem; if (feedPath.empty()) { throw std::invalid_argument("Empty filepath."); } - if (bf::is_regular_file(bf::path(feedPath))) + if (fs::is_regular_file(fs::path(feedPath))) { // Image or video file - const std::string extension = bf::path(feedPath).extension().string(); + const std::string extension = fs::path(feedPath).extension().string(); if (SfMDataFeed::isSupported(extension)) { _feeder.reset(new SfMDataFeed(feedPath, calibPath)); @@ -67,7 +66,7 @@ FeedProvider::FeedProvider(const std::string& feedPath, const std::string& calib } // parent_path() returns "/foo/bar/" when input path equals to "/foo/bar/" // if the user just gives the relative path as "bar", throws invalid argument exception. - else if (bf::is_directory(bf::path(feedPath)) || bf::is_directory(bf::path(feedPath).parent_path())) + else if (fs::is_directory(fs::path(feedPath)) || fs::is_directory(fs::path(feedPath).parent_path())) { // Folder or sequence of images _feeder.reset(new ImageFeed(feedPath, calibPath)); diff --git a/src/aliceVision/dataio/ImageFeed.cpp b/src/aliceVision/dataio/ImageFeed.cpp index aa41565173..15174b97ff 100644 --- a/src/aliceVision/dataio/ImageFeed.cpp +++ b/src/aliceVision/dataio/ImageFeed.cpp @@ -8,10 +8,10 @@ #include #include -#include #include #include +#include #include #include #include @@ -86,12 +86,12 @@ ImageFeed::FeederImpl::FeederImpl(const std::string& imagePath, const std::strin : _isInit(false), _withCalibration(false) { - namespace bf = boost::filesystem; + namespace fs = std::filesystem; // ALICEVISION_LOG_DEBUG(imagePath); // if it is a json, calibPath is neglected - if (bf::is_regular_file(imagePath)) + if (fs::is_regular_file(imagePath)) { - const std::string ext = bf::path(imagePath).extension().string(); + const std::string ext = fs::path(imagePath).extension().string(); // if it is an image file if (image::isSupported(ext) && !image::isVideoExtension(ext)) { @@ -111,7 +111,7 @@ ImageFeed::FeederImpl::FeederImpl(const std::string& imagePath, const std::strin { // compose the file name as the base path of the inputPath and // the filename just read - const std::string filename = (bf::path(imagePath).parent_path() / line).string(); + const std::string filename = (fs::path(imagePath).parent_path() / line).string(); _images.push_back(filename); } // Close file @@ -125,16 +125,16 @@ ImageFeed::FeederImpl::FeederImpl(const std::string& imagePath, const std::strin throw std::invalid_argument("File or mode not yet implemented"); } } - else if (bf::is_directory(imagePath) || bf::is_directory(bf::path(imagePath).parent_path())) + else if (fs::is_directory(imagePath) || fs::is_directory(fs::path(imagePath).parent_path())) { std::string folder = imagePath; // Recover the pattern : img.@.png (for example) std::string filePattern; std::regex re; - if (!bf::is_directory(imagePath)) + if (!fs::is_directory(imagePath)) { - filePattern = bf::path(imagePath).filename().string(); - folder = bf::path(imagePath).parent_path().string(); + filePattern = fs::path(imagePath).filename().string(); + folder = fs::path(imagePath).parent_path().string(); ALICEVISION_LOG_DEBUG("filePattern: " << filePattern); std::string regexStr = filePattern; re = utils::filterToRegex(regexStr); @@ -145,12 +145,12 @@ ImageFeed::FeederImpl::FeederImpl(const std::string& imagePath, const std::strin } ALICEVISION_LOG_DEBUG("directory feedImage"); // if it is a directory, list all the images and add them to the list - bf::directory_iterator iterator(folder); + fs::directory_iterator iterator(folder); // since some OS will provide the files in a random order, first store them // in a priority queue and then fill the _image queue with the alphabetical // order from the priority queue std::priority_queue, std::greater> tmpSorter; - for (; iterator != bf::directory_iterator(); ++iterator) + for (; iterator != fs::directory_iterator(); ++iterator) { // get the extension of the current file to check whether it is an image const std::string ext = iterator->path().extension().string(); From c64a6f1ac4d5b8142f5c482a45c7151499981d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 8 Jan 2024 09:08:21 +0000 Subject: [PATCH 08/17] [depthMap][feature] Replace calls to `boost::filesystem` with `std::filesystem` --- src/aliceVision/depthMap/CMakeLists.txt | 1 - src/aliceVision/depthMap/DepthMapEstimator.cpp | 4 ---- src/aliceVision/depthMap/NormalMapEstimator.cpp | 4 ++-- src/aliceVision/feature/CMakeLists.txt | 1 - src/aliceVision/feature/ImageDescriber.cpp | 10 +++++----- 5 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/aliceVision/depthMap/CMakeLists.txt b/src/aliceVision/depthMap/CMakeLists.txt index ccd6b07607..8ed473c1e2 100644 --- a/src/aliceVision/depthMap/CMakeLists.txt +++ b/src/aliceVision/depthMap/CMakeLists.txt @@ -128,7 +128,6 @@ alicevision_add_library(aliceVision_depthMap aliceVision_mvsData aliceVision_mvsUtils aliceVision_system - Boost::filesystem assimp::assimp ${CUDA_CUDADEVRT_LIBRARY} ${CUDA_CUBLAS_LIBRARIES} #TODO shouldn't be here, but required to build on some machines diff --git a/src/aliceVision/depthMap/DepthMapEstimator.cpp b/src/aliceVision/depthMap/DepthMapEstimator.cpp index a55e3d6b77..be5f0ef7f9 100644 --- a/src/aliceVision/depthMap/DepthMapEstimator.cpp +++ b/src/aliceVision/depthMap/DepthMapEstimator.cpp @@ -22,10 +22,6 @@ #include #include -#include - -namespace fs = boost::filesystem; - namespace aliceVision { namespace depthMap { diff --git a/src/aliceVision/depthMap/NormalMapEstimator.cpp b/src/aliceVision/depthMap/NormalMapEstimator.cpp index da01e1fbfa..9eba1a5c0c 100644 --- a/src/aliceVision/depthMap/NormalMapEstimator.cpp +++ b/src/aliceVision/depthMap/NormalMapEstimator.cpp @@ -15,9 +15,9 @@ #include #include -#include +#include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace depthMap { diff --git a/src/aliceVision/feature/CMakeLists.txt b/src/aliceVision/feature/CMakeLists.txt index 64f41f4841..5bf0c2a5d1 100644 --- a/src/aliceVision/feature/CMakeLists.txt +++ b/src/aliceVision/feature/CMakeLists.txt @@ -79,7 +79,6 @@ alicevision_add_library(aliceVision_feature aliceVision_gpu vlsift PRIVATE_LINKS - Boost::filesystem Boost::boost ) diff --git a/src/aliceVision/feature/ImageDescriber.cpp b/src/aliceVision/feature/ImageDescriber.cpp index f080848e2c..7631583d1e 100644 --- a/src/aliceVision/feature/ImageDescriber.cpp +++ b/src/aliceVision/feature/ImageDescriber.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #if ALICEVISION_IS_DEFINED(ALICEVISION_HAVE_CCTAG) #include @@ -28,12 +29,11 @@ #include #endif // ALICEVISION_HAVE_OPENCV -#include - #include +#include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace feature { @@ -191,9 +191,9 @@ void ImageDescriber::Save(const Regions* regions, const std::string& sfileNameFe const fs::path bFeatsPath = fs::path(sfileNameFeats); const fs::path bDescsPath = fs::path(sfileNameDescs); const std::string tmpFeatsPath = - (bFeatsPath.parent_path() / bFeatsPath.stem()).string() + "." + fs::unique_path().string() + bFeatsPath.extension().string(); + (bFeatsPath.parent_path() / bFeatsPath.stem()).string() + "." + utils::generateUniqueFilename() + bFeatsPath.extension().string(); const std::string tmpDescsPath = - (bDescsPath.parent_path() / bDescsPath.stem()).string() + "." + fs::unique_path().string() + bDescsPath.extension().string(); + (bDescsPath.parent_path() / bDescsPath.stem()).string() + "." + utils::generateUniqueFilename() + bDescsPath.extension().string(); regions->Save(tmpFeatsPath, tmpDescsPath); From 00b363e4f3af210de39a2cd1be4940d5ae6a7024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 8 Jan 2024 09:08:40 +0000 Subject: [PATCH 09/17] [featureEngine][fuseCut] Replace calls to `boost::filesystem` with `std::filesystem` --- src/aliceVision/featureEngine/CMakeLists.txt | 2 - .../featureEngine/FeatureExtractor.cpp | 5 +- src/aliceVision/fuseCut/CMakeLists.txt | 1 - src/aliceVision/fuseCut/DelaunayGraphCut.cpp | 10 ++-- .../fuseCut/DelaunayGraphCut_test.cpp | 6 +-- src/aliceVision/fuseCut/Fuser.cpp | 13 +++--- src/aliceVision/fuseCut/LargeScale.cpp | 14 +++--- .../fuseCut/ReconstructionPlan.cpp | 14 +++--- src/aliceVision/fuseCut/VoxelsGrid.cpp | 46 +++++++------------ 9 files changed, 48 insertions(+), 63 deletions(-) diff --git a/src/aliceVision/featureEngine/CMakeLists.txt b/src/aliceVision/featureEngine/CMakeLists.txt index 5b2f110593..5082f6cd96 100644 --- a/src/aliceVision/featureEngine/CMakeLists.txt +++ b/src/aliceVision/featureEngine/CMakeLists.txt @@ -16,6 +16,4 @@ alicevision_add_library(aliceVision_featureEngine aliceVision_image aliceVision_sfmData aliceVision_system - PRIVATE_LINKS - Boost::filesystem ) diff --git a/src/aliceVision/featureEngine/FeatureExtractor.cpp b/src/aliceVision/featureEngine/FeatureExtractor.cpp index 032f2ad8cd..8b66c9bd3f 100644 --- a/src/aliceVision/featureEngine/FeatureExtractor.cpp +++ b/src/aliceVision/featureEngine/FeatureExtractor.cpp @@ -8,10 +8,11 @@ #include #include #include -#include + +#include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace featureEngine { diff --git a/src/aliceVision/fuseCut/CMakeLists.txt b/src/aliceVision/fuseCut/CMakeLists.txt index f8168008c6..ddd70f134e 100644 --- a/src/aliceVision/fuseCut/CMakeLists.txt +++ b/src/aliceVision/fuseCut/CMakeLists.txt @@ -32,7 +32,6 @@ alicevision_add_library(aliceVision_fuseCut aliceVision_sfmData aliceVision_system Geogram::geogram - Boost::filesystem Boost::graph Boost::container PRIVATE_LINKS diff --git a/src/aliceVision/fuseCut/DelaunayGraphCut.cpp b/src/aliceVision/fuseCut/DelaunayGraphCut.cpp index edfd9a34a0..da11023a54 100644 --- a/src/aliceVision/fuseCut/DelaunayGraphCut.cpp +++ b/src/aliceVision/fuseCut/DelaunayGraphCut.cpp @@ -26,10 +26,10 @@ #include -#include #include #include +#include #include #include @@ -41,7 +41,7 @@ namespace aliceVision { namespace fuseCut { -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; // #define USE_GEOGRAM_KDTREE 1 @@ -1189,7 +1189,7 @@ void DelaunayGraphCut::fuseFromDepthMaps(const StaticVector& cams, const Po const std::string nmodMapFilepath = getFileNameFromIndex(_mp, c, mvsUtils::EFileType::nmodMap); // If we have an nModMap in input (from depthmapfilter) use it, // else init with a constant value. - if (boost::filesystem::exists(nmodMapFilepath)) + if (fs::exists(nmodMapFilepath)) { image::readImage(nmodMapFilepath, numOfModalsMap, image::EImageColorSpace::NO_CONVERSION); if (numOfModalsMap.Width() != width || numOfModalsMap.Height() != height) @@ -3892,7 +3892,7 @@ void DelaunayGraphCut::exportDebugMesh(const std::string& filename, const Point3 mesh->tris.push_back(t); } - const std::string tempDirPath = boost::filesystem::temp_directory_path().generic_string(); + const std::string tempDirPath = fs::temp_directory_path().generic_string(); mesh->save(tempDirPath + "/" + filename); meshf->save(tempDirPath + "/" + filename); } @@ -3956,7 +3956,7 @@ void DelaunayGraphCut::exportBackPropagationMesh(const std::string& filename, void DelaunayGraphCut::writeScoreInCsv(const std::string& filePath, const size_t& sizeLimit) { - assert(boost::filesystem::path(filePath).extension().string() == std::string(".csv")); + assert(fs::path(filePath).extension().string() == std::string(".csv")); const unsigned int seed = (unsigned int)_mp.userParams.get("delaunaycut.seed", 0); std::mt19937 generator(seed != 0 ? seed : std::random_device{}()); diff --git a/src/aliceVision/fuseCut/DelaunayGraphCut_test.cpp b/src/aliceVision/fuseCut/DelaunayGraphCut_test.cpp index 056bbbad5c..48b9eadb18 100644 --- a/src/aliceVision/fuseCut/DelaunayGraphCut_test.cpp +++ b/src/aliceVision/fuseCut/DelaunayGraphCut_test.cpp @@ -8,8 +8,6 @@ #include #include -#include - #include #include @@ -19,6 +17,8 @@ #include #include +#include + using namespace aliceVision; using namespace aliceVision::fuseCut; using namespace aliceVision::sfmData; @@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE(fuseCut_delaunayGraphCut) for (int i = 0; i < cams.size(); ++i) cams[i] = i; - const std::string tempDirPath = boost::filesystem::temp_directory_path().generic_string(); + const std::string tempDirPath = std::filesystem::temp_directory_path().generic_string(); DelaunayGraphCut delaunayGC(mp); ALICEVISION_LOG_TRACE("Creating dense point cloud witout support pts."); diff --git a/src/aliceVision/fuseCut/Fuser.cpp b/src/aliceVision/fuseCut/Fuser.cpp index 7df157f72d..b0c595f5da 100644 --- a/src/aliceVision/fuseCut/Fuser.cpp +++ b/src/aliceVision/fuseCut/Fuser.cpp @@ -18,16 +18,17 @@ #include #include -#include #include #include +#include + #include namespace aliceVision { namespace fuseCut { -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; unsigned long computeNumberOfAllPoints(const mvsUtils::MultiViewParams& mp, int scale) { @@ -137,7 +138,7 @@ void Fuser::filterGroups(const std::vector& cams, float pixToleranceFactor, // minNumOfModals number of other cams including this cam ... minNumOfModals /in 2,3,... bool Fuser::filterGroupsRC(int rc, float pixToleranceFactor, int pixSizeBall, int pixSizeBallWSP, int nNearestCams) { - if (bfs::exists(getFileNameFromIndex(_mp, rc, mvsUtils::EFileType::nmodMap))) + if (fs::exists(getFileNameFromIndex(_mp, rc, mvsUtils::EFileType::nmodMap))) { return true; } @@ -685,9 +686,9 @@ std::string generateTempPtsSimsFiles(const std::string& tmpDir, ALICEVISION_LOG_INFO("generating temp files."); std::string depthMapsPtsSimsTmpDir = tmpDir + "depthMapsPtsSimsTmp/"; - if (!bfs::is_directory(depthMapsPtsSimsTmpDir)) + if (!fs::is_directory(depthMapsPtsSimsTmpDir)) { - bfs::create_directory(depthMapsPtsSimsTmpDir); + fs::create_directory(depthMapsPtsSimsTmpDir); const int scaleuse = 1; @@ -846,7 +847,7 @@ void deleteTempPtsSimsFiles(mvsUtils::MultiViewParams& mp, const std::string& de remove(ptsfn.c_str()); remove(simsfn.c_str()); } - bfs::remove_all(depthMapsPtsSimsTmpDir); + fs::remove_all(depthMapsPtsSimsTmpDir); } } // namespace fuseCut diff --git a/src/aliceVision/fuseCut/LargeScale.cpp b/src/aliceVision/fuseCut/LargeScale.cpp index 582cc94130..b9ffce35e3 100644 --- a/src/aliceVision/fuseCut/LargeScale.cpp +++ b/src/aliceVision/fuseCut/LargeScale.cpp @@ -10,12 +10,12 @@ #include #include -#include +#include namespace aliceVision { namespace fuseCut { -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; LargeScale::LargeScale(mvsUtils::MultiViewParams* _mp, const std::string& _spaceFolderName) : mp(_mp), @@ -23,15 +23,15 @@ LargeScale::LargeScale(mvsUtils::MultiViewParams* _mp, const std::string& _space spaceVoxelsFolderName(_spaceFolderName + "_data/"), spaceFileName(spaceFolderName + "/space.txt") { - bfs::create_directory(spaceFolderName); - bfs::create_directory(spaceVoxelsFolderName); + fs::create_directory(spaceFolderName); + fs::create_directory(spaceVoxelsFolderName); doVisualize = mp->userParams.get("LargeScale.doVisualizeOctreeTracks", false); } LargeScale::~LargeScale() {} -bool LargeScale::isSpaceSaved() { return bfs::exists(spaceFileName); } +bool LargeScale::isSpaceSaved() { return fs::exists(spaceFileName); } void LargeScale::saveSpaceToFile() { @@ -159,7 +159,7 @@ bool LargeScale::generateSpace(int maxPts, int ocTreeDim, bool generateTracks) ReconstructionPlan->reserve(1000000); std::string tmpdir = spaceFolderName + "tmp/"; - bfs::create_directory(tmpdir); + fs::create_directory(tmpdir); VoxelsGrid* vg = new VoxelsGrid(dimensions, &space[0], mp, tmpdir, doVisualize); int maxlevel = 0; vg->generateTracksForEachVoxel(ReconstructionPlan, maxOcTreeDim, maxPts, 1, maxlevel, depthMapsPtsSimsTmpDir); @@ -181,7 +181,7 @@ bool LargeScale::generateSpace(int maxPts, int ocTreeDim, bool generateTracks) delete vgnew; delete vg; - bfs::remove_all(tmpdir); + fs::remove_all(tmpdir); deleteTempPtsSimsFiles(*mp, depthMapsPtsSimsTmpDir); diff --git a/src/aliceVision/fuseCut/ReconstructionPlan.cpp b/src/aliceVision/fuseCut/ReconstructionPlan.cpp index 01eef09fb8..1b7de28c72 100644 --- a/src/aliceVision/fuseCut/ReconstructionPlan.cpp +++ b/src/aliceVision/fuseCut/ReconstructionPlan.cpp @@ -13,12 +13,12 @@ #include #include -#include +#include namespace aliceVision { namespace fuseCut { -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; ReconstructionPlan::ReconstructionPlan(Voxel& dimmensions, Point3d* space, mvsUtils::MultiViewParams* _mp, const std::string& _spaceRootDir) : VoxelsGrid(dimmensions, space, _mp, _spaceRootDir) @@ -250,7 +250,7 @@ StaticVector*>* loadLargeScalePtsCams(const std::vector& recsDirs, StaticVecto std::string filePtsCamsFromDCTName = folderName + "meshPtsCamsFromDGC.bin"; - if (!bfs::exists(filePtsCamsFromDCTName)) + if (!fs::exists(filePtsCamsFromDCTName)) { throw std::runtime_error("Missing file: " + filePtsCamsFromDCTName); } @@ -316,7 +316,7 @@ mesh::Mesh* joinMeshes(const std::vector& recsDirs, StaticVectorloadFromBin(fileName); @@ -352,7 +352,7 @@ mesh::Mesh* joinMeshes(const std::vector& recsDirs, StaticVectorloadFromBin(fileName); @@ -368,7 +368,7 @@ mesh::Mesh* joinMeshes(const std::vector& recsDirs, StaticVector* ptsColsi = loadArrayFromFile(fileName); StaticVector* trisColsi = getTrisColorsRgb(mei, ptsColsi); diff --git a/src/aliceVision/fuseCut/VoxelsGrid.cpp b/src/aliceVision/fuseCut/VoxelsGrid.cpp index ede4db3651..02aec514df 100644 --- a/src/aliceVision/fuseCut/VoxelsGrid.cpp +++ b/src/aliceVision/fuseCut/VoxelsGrid.cpp @@ -12,12 +12,12 @@ #include #include -#include +#include namespace aliceVision { namespace fuseCut { -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; VoxelsGrid::VoxelsGrid() {} @@ -32,10 +32,10 @@ VoxelsGrid::VoxelsGrid(const Voxel& dimensions, Point3d* _space, mvsUtils::Multi } voxels = mvsUtils::computeVoxels(space, dimensions); spaceRootDir = _spaceRootDir; - bfs::create_directory(spaceRootDir); + fs::create_directory(spaceRootDir); spaceCamsTracksDir = _spaceRootDir + "camsTracks/"; - bfs::create_directory(spaceCamsTracksDir); + fs::create_directory(spaceCamsTracksDir); } VoxelsGrid* VoxelsGrid::clone(const std::string& _spaceRootDir) @@ -56,10 +56,10 @@ VoxelsGrid* VoxelsGrid::clone(const std::string& _spaceRootDir) out->space[k] = space[k]; } out->spaceRootDir = _spaceRootDir; - bfs::create_directory(out->spaceRootDir); + fs::create_directory(out->spaceRootDir); out->spaceCamsTracksDir = _spaceRootDir + "camsTracks/"; - bfs::create_directory(out->spaceCamsTracksDir); + fs::create_directory(out->spaceCamsTracksDir); return out; } @@ -125,21 +125,7 @@ bool VoxelsGrid::isValidVoxel(const Voxel& v) std::string VoxelsGrid::getVoxelFolderName(int id) const { const Voxel v = getVoxelForId(id); - // std::string fnx = spaceRootDir + "X"+num2str(v.x)+"/"; - // std::string fnxyz = fnx + "Y"+num2str(v.y)+"Z"+num2str(v.z)+"/"; - // bfs::create_directory(fnx); - // bfs::create_directory(fnxyz); - std::string fnxyz = spaceRootDir + "X" + mvsUtils::num2str(v.x) + "Y" + mvsUtils::num2str(v.y) + "Z" + mvsUtils::num2str(v.z) + "/"; - // bfs::create_directory(fnxyz); - - // if (bfs::is_directory(fnx)==false) { - // printf("Warning folder %s does not exist!\n",fnx.c_str()); - //} - - // if (bfs::is_directory(fnxyz)==false) { - // printf("Warning folder %s does not exist!\n",fnxyz.c_str()); - //} return fnxyz; } @@ -153,7 +139,7 @@ StaticVector* VoxelsGrid::loadTracksFromVoxelFiles(S const std::string fileNameTracksPtsCams = folderName + "tracksGridPtsCams.bin"; const std::string fileNameTracksStat = folderName + "tracksGridStat.bin"; - if (!bfs::exists(fileNameTracksPts)) + if (!fs::exists(fileNameTracksPts)) return nullptr; StaticVector* tracksStat = loadArrayFromFile(fileNameTracksStat); // minPixSize, minSim, npts @@ -192,8 +178,8 @@ bool VoxelsGrid::saveTracksToVoxelFiles(StaticVector* cams, StaticVector* Reconstructio std::string folderName = getVoxelFolderName(i); // std::string subfn = folderName + "sub/"; std::string subfn = folderName; - bfs::create_directory(subfn); + fs::create_directory(subfn); // create file that indicates that the voxel has subvoxels std::string subfnFileMark = folderName + "sub.txt"; @@ -374,8 +360,8 @@ void VoxelsGrid::generateSpace(VoxelsGrid* vgnew, const Voxel& LU, const Voxel& Voxel subLU = LU + v * ns; Voxel subRD = LU + (v + 1) * ns; - // if (bfs::is_directory(subfn)==true) - if (bfs::exists(subfnFileMark)) + // if (fs::is_directory(subfn)==true) + if (fs::exists(subfnFileMark)) { VoxelsGrid* vgrec = new VoxelsGrid(Voxel(2, 2, 2), &(*voxels)[voxid * 8], mp, subfn, doVisualize); vgrec->generateSpace(vgnew, subLU, subRD, depthMapsPtsSimsTmpDir); @@ -470,7 +456,7 @@ void VoxelsGrid::cloneSpaceVoxel(int voxelId, int numSubVoxs, VoxelsGrid* newSpa std::string folderName = getVoxelFolderName(voxelId); std::string fileNameTracksPts = folderName + "tracksGridPts.bin"; - if (bfs::exists(fileNameTracksPts)) + if (fs::exists(fileNameTracksPts)) { OctreeTracks* ott = new OctreeTracks(&(*voxels)[voxelId * 8], mp, Voxel(numSubVoxs, numSubVoxs, numSubVoxs)); StaticVector* tcams; @@ -515,7 +501,7 @@ void VoxelsGrid::copySpaceVoxel(int voxelId, VoxelsGrid* newSpace) std::string folderName = getVoxelFolderName(voxelId); std::string fileNameTracksPts = folderName + "tracksGridPts.bin"; - if (bfs::exists(fileNameTracksPts)) + if (fs::exists(fileNameTracksPts)) { StaticVector* tcams; StaticVector* tracksOld = loadTracksFromVoxelFiles(&tcams, voxelId); @@ -568,7 +554,7 @@ void VoxelsGrid::generateCamsPtsFromVoxelsTracks() // printf("SAVING %i-th VOXEL POINTS TO CAMS FILES\n",i); - if (bfs::exists(fileNameTracksPts)) + if (fs::exists(fileNameTracksPts)) { StaticVector* tracksPoints = loadArrayFromFile(fileNameTracksPts); StaticVector*>* tracksPointsCams = loadArrayOfArraysFromFile(fileNameTracksPtsCams); @@ -622,7 +608,7 @@ void VoxelsGrid::vizualize() { std::string subFoldeName = getVoxelFolderName(i); std::string fname = subFoldeName + "tracks.wrl"; - if (bfs::is_directory(subFoldeName)) + if (fs::is_directory(subFoldeName)) { fprintf(f, "Inline{ url [\"%s\"] \n }\n", fname.c_str()); } From 2293a53d7688c535ddbb0de9d10166f5dd8f1910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 8 Jan 2024 09:09:04 +0000 Subject: [PATCH 10/17] [hdr][image] Replace calls to `boost::filesystem` with `std::filesystem` --- src/aliceVision/hdr/CMakeLists.txt | 1 - src/aliceVision/hdr/brackets.cpp | 6 +++--- src/aliceVision/hdr/hdrTestCommon.hpp | 7 ++++--- src/aliceVision/image/CMakeLists.txt | 1 - src/aliceVision/image/ImageCache.hpp | 7 ++++--- src/aliceVision/image/cache.cpp | 17 +++++++++-------- src/aliceVision/image/colorspace.cpp | 5 +++-- src/aliceVision/image/dcp.cpp | 15 ++++++++------- src/aliceVision/image/io.cpp | 9 +++++---- 9 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/aliceVision/hdr/CMakeLists.txt b/src/aliceVision/hdr/CMakeLists.txt index 0da651df73..474a9ab25a 100644 --- a/src/aliceVision/hdr/CMakeLists.txt +++ b/src/aliceVision/hdr/CMakeLists.txt @@ -32,7 +32,6 @@ alicevision_add_library(aliceVision_hdr aliceVision_system aliceVision_image aliceVision_sfmData - Boost::filesystem ${CERES_LIBRARIES} ) diff --git a/src/aliceVision/hdr/brackets.cpp b/src/aliceVision/hdr/brackets.cpp index 3a00f4ab09..847547bd0f 100644 --- a/src/aliceVision/hdr/brackets.cpp +++ b/src/aliceVision/hdr/brackets.cpp @@ -4,7 +4,7 @@ #include -#include +#include namespace aliceVision { namespace hdr { @@ -36,8 +36,8 @@ bool estimateBracketsFromSfmData(std::vectorgetImage().getImagePath()); - boost::filesystem::path path_b(b->getImage().getImagePath()); + std::filesystem::path path_a(a->getImage().getImagePath()); + std::filesystem::path path_b(b->getImage().getImagePath()); return (path_a.stem().string() < path_b.stem().string()); }); diff --git a/src/aliceVision/hdr/hdrTestCommon.hpp b/src/aliceVision/hdr/hdrTestCommon.hpp index d0475ab45c..ba9e2a064f 100644 --- a/src/aliceVision/hdr/hdrTestCommon.hpp +++ b/src/aliceVision/hdr/hdrTestCommon.hpp @@ -1,11 +1,12 @@ #pragma once #include #include +#include #include "rgbCurve.hpp" #include "sampling.hpp" -#include +#include #include #include @@ -165,8 +166,8 @@ bool buildBrackets(std::vector& paths, std::vector& times, } } - boost::filesystem::path temp = boost::filesystem::temp_directory_path(); - temp /= boost::filesystem::unique_path(); + std::filesystem::path temp = std::filesystem::temp_directory_path(); + temp /= utils::generateUniqueFilename(); temp += ".exr"; ALICEVISION_LOG_INFO("writing to " << temp.string()); diff --git a/src/aliceVision/image/CMakeLists.txt b/src/aliceVision/image/CMakeLists.txt index 2b8d93e69f..6fb4ab4136 100644 --- a/src/aliceVision/image/CMakeLists.txt +++ b/src/aliceVision/image/CMakeLists.txt @@ -47,7 +47,6 @@ alicevision_add_library(aliceVision_image PRIVATE_LINKS aliceVision_system ${OPENEXR_LIBRARIES} - Boost::filesystem PRIVATE_INCLUDE_DIRS ${OPENEXR_INCLUDE_DIR} ) diff --git a/src/aliceVision/image/ImageCache.hpp b/src/aliceVision/image/ImageCache.hpp index 11dd6db712..56c79731c5 100644 --- a/src/aliceVision/image/ImageCache.hpp +++ b/src/aliceVision/image/ImageCache.hpp @@ -12,10 +12,11 @@ #include "imageAlgo.hpp" #include +#include -#include #include +#include #include #include #include @@ -300,7 +301,7 @@ std::shared_ptr> ImageCache::get(const std::string& filename, int do using TInfo = ColorTypeInfo; - auto lastWriteTime = boost::filesystem::last_write_time(filename); + auto lastWriteTime = utils::getLastWriteTime(filename); CacheKey keyReq(filename, TInfo::size, TInfo::typeDesc, downscaleLevel, lastWriteTime); // find the requested image in the cached images @@ -453,7 +454,7 @@ bool ImageCache::contains(const std::string& filename, int downscaleLevel) const using TInfo = ColorTypeInfo; - auto lastWriteTime = boost::filesystem::last_write_time(filename); + auto lastWriteTime = utils::getLastWriteTime(filename); CacheKey keyReq(filename, TInfo::size, TInfo::typeDesc, downscaleLevel, lastWriteTime); auto it = std::find(_keys.begin(), _keys.end(), keyReq); diff --git a/src/aliceVision/image/cache.cpp b/src/aliceVision/image/cache.cpp index 576fff0bc7..c70d5d28f2 100644 --- a/src/aliceVision/image/cache.cpp +++ b/src/aliceVision/image/cache.cpp @@ -1,8 +1,9 @@ #include "cache.hpp" #include +#include -#include +#include namespace aliceVision { namespace image { @@ -38,8 +39,8 @@ std::string CacheManager::getPathForIndex(size_t indexId) { if (_indexPaths.find(indexId) == _indexPaths.end()) { - boost::filesystem::path path(_basePathStorage); - path /= boost::filesystem::unique_path(); + std::filesystem::path path(_basePathStorage); + path /= std::filesystem::path(utils::generateUniqueFilename()); path += ".idx"; _indexPaths[indexId] = path.string(); @@ -53,7 +54,7 @@ void CacheManager::deleteIndexFiles() std::size_t cacheSize = 0; for (std::pair& p : _indexPaths) { - const std::size_t s = boost::filesystem::file_size(p.second); + const std::size_t s = std::filesystem::file_size(p.second); ALICEVISION_LOG_TRACE("CacheManager::deleteIndexFiles: '" << p.second << "': " << s / (1024 * 1024) << "MB."); cacheSize += s; } @@ -62,8 +63,8 @@ void CacheManager::deleteIndexFiles() // Remove all cache files for (std::pair& p : _indexPaths) { - boost::filesystem::path path(p.second); - boost::filesystem::remove(path); + std::filesystem::path path(p.second); + std::filesystem::remove(path); } // Remove list of cache files @@ -78,10 +79,10 @@ bool CacheManager::prepareBlockGroup(size_t startBlockId, size_t blocksCount) size_t len = _blockSize * blocksCount; std::string pathname = getPathForIndex(index_id); - boost::filesystem::path path(pathname); + std::filesystem::path path(pathname); std::ofstream file_index; - if (boost::filesystem::exists(path)) + if (std::filesystem::exists(path)) { file_index.open(pathname, std::ios::binary | std::ios::out | std::ios::in); } diff --git a/src/aliceVision/image/colorspace.cpp b/src/aliceVision/image/colorspace.cpp index 7e152e65f6..d49e20a15e 100644 --- a/src/aliceVision/image/colorspace.cpp +++ b/src/aliceVision/image/colorspace.cpp @@ -11,9 +11,8 @@ #include #include -#include -namespace fs = boost::filesystem; +#include namespace aliceVision { namespace image { @@ -22,6 +21,8 @@ namespace { oiio::ColorConfig colorConfigOCIO(getDefaultColorConfigFilePath()); } +namespace fs = std::filesystem; + oiio::ColorConfig& getGlobalColorConfigOCIO() { return colorConfigOCIO; } std::string getColorConfigFilePathFromSourceCode() diff --git a/src/aliceVision/image/dcp.cpp b/src/aliceVision/image/dcp.cpp index 76ad942287..c16045550d 100644 --- a/src/aliceVision/image/dcp.cpp +++ b/src/aliceVision/image/dcp.cpp @@ -4,20 +4,21 @@ #include #include -#include + #include #include #include #include #include +#include #include namespace aliceVision { namespace image { using aliceVision::clamp; -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; double calibrationIlluminantToTemperature(const LightSource light) { @@ -2379,16 +2380,16 @@ int DCPDatabase::load(const std::string& databaseDirPath, bool force) folderName = databaseDirPath; - if (!bfs::is_directory(databaseDirPath)) + if (!fs::is_directory(databaseDirPath)) { return 0; } - bfs::path targetDir(databaseDirPath); - bfs::directory_iterator it(targetDir), eod; - BOOST_FOREACH (bfs::path const& p, std::make_pair(it, eod)) + fs::path targetDir(databaseDirPath); + fs::directory_iterator it(targetDir), eod; + BOOST_FOREACH (fs::path const& p, std::make_pair(it, eod)) { - if (bfs::is_regular_file(p)) + if (fs::is_regular_file(p)) { dcpFilenamesList.emplace_back(p.generic_string()); } diff --git a/src/aliceVision/image/io.cpp b/src/aliceVision/image/io.cpp index 5e83ba0072..1c2b35d0d7 100644 --- a/src/aliceVision/image/io.cpp +++ b/src/aliceVision/image/io.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -19,9 +20,9 @@ #include #include -#include #include +#include #include #include #include @@ -29,7 +30,7 @@ namespace aliceVision { namespace image { -namespace fs = boost::filesystem; +namespace fs = std::filesystem; EImageColorSpace getImageColorSpace(const std::string& imagePath) { @@ -1014,7 +1015,7 @@ void writeImage(const std::string& path, { const fs::path bPath = fs::path(path); const std::string extension = boost::to_lower_copy(bPath.extension().string()); - const std::string tmpPath = (bPath.parent_path() / bPath.stem()).string() + "." + fs::unique_path().string() + extension; + const std::string tmpPath = (bPath.parent_path() / bPath.stem()).string() + "." + utils::generateUniqueFilename() + extension; const bool isEXR = (extension == ".exr"); //const bool isTIF = (extension == ".tif"); const bool isJPG = (extension == ".jpg"); @@ -1185,7 +1186,7 @@ void writeImageNoFloat(const std::string& path, { const fs::path bPath = fs::path(path); const std::string extension = boost::to_lower_copy(bPath.extension().string()); - const std::string tmpPath = (bPath.parent_path() / bPath.stem()).string() + "." + fs::unique_path().string() + extension; + const std::string tmpPath = (bPath.parent_path() / bPath.stem()).string() + "." + utils::generateUniqueFilename() + extension; const bool isEXR = (extension == ".exr"); //const bool isTIF = (extension == ".tif"); const bool isJPG = (extension == ".jpg"); From c9822a3bd3b81c113c970d1d81d0bded63bef019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 8 Jan 2024 09:09:28 +0000 Subject: [PATCH 11/17] [keyframe][lensCorrectionProfile] Replace calls to `boost::filesystem` with `std::filesystem` --- src/aliceVision/keyframe/CMakeLists.txt | 1 - src/aliceVision/keyframe/KeyframeSelector.cpp | 5 ++--- src/aliceVision/lensCorrectionProfile/CMakeLists.txt | 1 - src/aliceVision/lensCorrectionProfile/lcp.cpp | 12 ++++++------ src/aliceVision/lensCorrectionProfile/lcp.hpp | 9 ++++----- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/aliceVision/keyframe/CMakeLists.txt b/src/aliceVision/keyframe/CMakeLists.txt index 3915919feb..44c0c626b8 100644 --- a/src/aliceVision/keyframe/CMakeLists.txt +++ b/src/aliceVision/keyframe/CMakeLists.txt @@ -18,7 +18,6 @@ alicevision_add_library(aliceVision_keyframe PRIVATE_LINKS aliceVision_sensorDB aliceVision_system - Boost::filesystem ) if(ALICEVISION_HAVE_OPENCV) diff --git a/src/aliceVision/keyframe/KeyframeSelector.cpp b/src/aliceVision/keyframe/KeyframeSelector.cpp index 4df3d51f97..22a358599e 100644 --- a/src/aliceVision/keyframe/KeyframeSelector.cpp +++ b/src/aliceVision/keyframe/KeyframeSelector.cpp @@ -8,17 +8,16 @@ #include #include -#include - #include #include #include #include +#include #include #include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace keyframe { diff --git a/src/aliceVision/lensCorrectionProfile/CMakeLists.txt b/src/aliceVision/lensCorrectionProfile/CMakeLists.txt index 24e0d7b67f..be31b59e4f 100644 --- a/src/aliceVision/lensCorrectionProfile/CMakeLists.txt +++ b/src/aliceVision/lensCorrectionProfile/CMakeLists.txt @@ -11,7 +11,6 @@ set(lensCorrectionProfile_files_sources alicevision_add_library(aliceVision_lensCorrectionProfile SOURCES ${lensCorrectionProfile_files_headers} ${lensCorrectionProfile_files_sources} PRIVATE_LINKS - Boost::filesystem Boost::log expat::expat ) diff --git a/src/aliceVision/lensCorrectionProfile/lcp.cpp b/src/aliceVision/lensCorrectionProfile/lcp.cpp index 1e2de6917b..b57dfe71bb 100644 --- a/src/aliceVision/lensCorrectionProfile/lcp.cpp +++ b/src/aliceVision/lensCorrectionProfile/lcp.cpp @@ -2,11 +2,11 @@ #include -#include #include #include +#include #include #include @@ -1126,21 +1126,21 @@ void LCPinfo::setVignetteModel(const std::string& name) currLensParam.vignParams.VignetteModelParam3 = std::stof(_currText.c_str()); } -void LCPdatabase::loadDirectory(const boost::filesystem::path& p) +void LCPdatabase::loadDirectory(const std::filesystem::path& p) { - if (boost::filesystem::is_directory(p)) + if (std::filesystem::is_directory(p)) { // In some border cases, multiple LCP files could match with the image metadata // and we stop the search as soon as we have found a valid match. // So to ensure a repeatable behavior, we sort the files by name. - std::vector sortedPaths; - for (auto&& x : boost::filesystem::directory_iterator(p)) + std::vector sortedPaths; + for (auto&& x : std::filesystem::directory_iterator(p)) sortedPaths.push_back(x.path()); std::sort(sortedPaths.begin(), sortedPaths.end()); for (auto&& x : sortedPaths) loadDirectory(x); } - else if (boost::filesystem::is_regular_file(p) && (boost::filesystem::extension(p) == ".lcp")) + else if (std::filesystem::is_regular_file(p) && (p.extension() == ".lcp")) { _lcpFilepaths.push_back(p); } diff --git a/src/aliceVision/lensCorrectionProfile/lcp.hpp b/src/aliceVision/lensCorrectionProfile/lcp.hpp index de9d49463b..7ae30a86aa 100644 --- a/src/aliceVision/lensCorrectionProfile/lcp.hpp +++ b/src/aliceVision/lensCorrectionProfile/lcp.hpp @@ -1,7 +1,6 @@ #pragma once -#include - +#include #include #include #include @@ -635,7 +634,7 @@ class LCPdatabase size_t size() const { return _lcpFilepaths.size(); } - void loadDirectory(const boost::filesystem::path& p); + void loadDirectory(const std::filesystem::path& p); LCPinfo* retrieveLCP() { return retrieveLCP(_lcpFilepaths.begin()->path.string()); } @@ -664,11 +663,11 @@ class LCPdatabase private: struct LcpPath { - LcpPath(const boost::filesystem::path& p) + LcpPath(const std::filesystem::path& p) : path(p), reducedPath(reduceString(p.string())) {} - boost::filesystem::path path; + std::filesystem::path path; std::string reducedPath; }; From fc0f63debe518b69ebeee4de95b85f8f0dc6da9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 8 Jan 2024 09:09:54 +0000 Subject: [PATCH 12/17] [lightingEstimation][localization] Replace calls to `boost::filesystem` with `std::filesystem` --- .../lightingCalibration.cpp | 4 +-- .../localization/CCTagLocalizer.cpp | 25 +++++++-------- src/aliceVision/localization/CMakeLists.txt | 1 - .../localization/LocalizationResult_test.cpp | 7 ++-- .../localization/VoctreeLocalizer.cpp | 32 +++++++++---------- 5 files changed, 33 insertions(+), 36 deletions(-) diff --git a/src/aliceVision/lightingEstimation/lightingCalibration.cpp b/src/aliceVision/lightingEstimation/lightingCalibration.cpp index 0e2112f4ae..55b6724498 100644 --- a/src/aliceVision/lightingEstimation/lightingCalibration.cpp +++ b/src/aliceVision/lightingEstimation/lightingCalibration.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include @@ -25,9 +24,10 @@ #include #include +#include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace bpt = boost::property_tree; namespace aliceVision { diff --git a/src/aliceVision/localization/CCTagLocalizer.cpp b/src/aliceVision/localization/CCTagLocalizer.cpp index 6a0bf73376..070104d3d4 100644 --- a/src/aliceVision/localization/CCTagLocalizer.cpp +++ b/src/aliceVision/localization/CCTagLocalizer.cpp @@ -21,9 +21,8 @@ #include -#include - #include +#include #include namespace aliceVision { @@ -197,7 +196,7 @@ bool CCTagLocalizer::localize(const image::Image& imageGrey, LocalizationResult& localizationResult, const std::string& imagePath) { - namespace bfs = boost::filesystem; + namespace fs = std::filesystem; const CCTagLocalizer::Parameters* param = static_cast(parameters); if (!param) @@ -225,7 +224,7 @@ bool CCTagLocalizer::localize(const image::Image& imageGrey, const feature::CCTAG_Regions& cctagQueryRegions = tmpQueryRegions.getRegions(_cctagDescType); // just debugging -- save the svg image with detected cctag - matching::saveCCTag2SVG(imagePath, imageSize, cctagQueryRegions, param->_visualDebug + "/" + bfs::path(imagePath).stem().string() + ".svg"); + matching::saveCCTag2SVG(imagePath, imageSize, cctagQueryRegions, param->_visualDebug + "/" + fs::path(imagePath).stem().string() + ".svg"); } return localize( tmpQueryRegions, imageSize, parameters, randomNumberGenerator, useInputIntrinsics, queryIntrinsics, localizationResult, imagePath); @@ -242,7 +241,7 @@ bool CCTagLocalizer::localize(const feature::MapRegionsPerDesc& genQueryRegions, LocalizationResult& localizationResult, const std::string& imagePath) { - namespace bfs = boost::filesystem; + namespace fs = std::filesystem; const CCTagLocalizer::Parameters* param = dynamic_cast(parameters); if (!param) @@ -301,11 +300,11 @@ bool CCTagLocalizer::localize(const feature::MapRegionsPerDesc& genQueryRegions, ALICEVISION_LOG_DEBUG("[poseEstimation]\tResection failed"); if (!param->_visualDebug.empty() && !imagePath.empty()) { - // namespace bfs = boost::filesystem; + // namespace fs = std::filesystem; // matching::saveFeatures2SVG(imagePath, // imageSize, // resectionData.pt2D, - // param._visualDebug + "/" + bfs::path(imagePath).stem().string() + ".associations.svg"); + // param._visualDebug + "/" + fs::path(imagePath).stem().string() + ".associations.svg"); } localizationResult = LocalizationResult(resectionData, associationIDs, pose, queryIntrinsics, matchedImages, bResection); return localizationResult.isValid(); @@ -751,18 +750,18 @@ void CCTagLocalizer::getAllAssociations(const feature::CCTAG_Regions& queryRegio if (!param._visualDebug.empty() && !imagePath.empty()) { - namespace bfs = boost::filesystem; + namespace fs = std::filesystem; const sfmData::View* mview = _sfm_data.getViews().at(keyframeId).get(); - const std::string queryImage = bfs::path(imagePath).stem().string(); - const std::string matchedImage = bfs::path(mview->getImage().getImagePath()).stem().string(); + const std::string queryImage = fs::path(imagePath).stem().string(); + const std::string matchedImage = fs::path(mview->getImage().getImagePath()).stem().string(); const std::string matchedPath = mview->getImage().getImagePath(); // the directory where to save the feature matches - const auto baseDir = bfs::path(param._visualDebug) / queryImage; - if ((!bfs::exists(baseDir))) + const auto baseDir = fs::path(param._visualDebug) / queryImage; + if ((!fs::exists(baseDir))) { ALICEVISION_LOG_DEBUG("created " << baseDir.string()); - bfs::create_directories(baseDir); + fs::create_directories(baseDir); } // the final filename for the output svg file as a composition of the query diff --git a/src/aliceVision/localization/CMakeLists.txt b/src/aliceVision/localization/CMakeLists.txt index 1001b26ff9..857306a64d 100644 --- a/src/aliceVision/localization/CMakeLists.txt +++ b/src/aliceVision/localization/CMakeLists.txt @@ -36,7 +36,6 @@ alicevision_add_library(aliceVision_localization PRIVATE_LINKS aliceVision_system aliceVision_matchingImageCollection - Boost::filesystem Boost::boost ${FLANN_LIBRARIES} ) diff --git a/src/aliceVision/localization/LocalizationResult_test.cpp b/src/aliceVision/localization/LocalizationResult_test.cpp index d6e3e82edb..ed3764038a 100644 --- a/src/aliceVision/localization/LocalizationResult_test.cpp +++ b/src/aliceVision/localization/LocalizationResult_test.cpp @@ -9,11 +9,10 @@ #include #include -#include - -#include #include +#include #include +#include #define BOOST_TEST_MODULE LocalizationResult @@ -21,7 +20,7 @@ #include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; using namespace aliceVision; sfm::ImageLocalizerMatchData generateRandomMatch_Data(std::size_t numPts) diff --git a/src/aliceVision/localization/VoctreeLocalizer.cpp b/src/aliceVision/localization/VoctreeLocalizer.cpp index 1fd2bb0919..23d3066e45 100644 --- a/src/aliceVision/localization/VoctreeLocalizer.cpp +++ b/src/aliceVision/localization/VoctreeLocalizer.cpp @@ -29,10 +29,10 @@ #include -#include #include #include +#include namespace aliceVision { namespace localization { @@ -227,9 +227,9 @@ bool VoctreeLocalizer::localize(const image::Image& imageGrey, extractedFeatures[descType] = queryRegionsPerDesc.at(descType)->GetRegionsPositions(); } - namespace bfs = boost::filesystem; + namespace fs = std::filesystem; matching::saveFeatures2SVG( - imagePath, queryImageSize, extractedFeatures, param->_visualDebug + "/" + bfs::path(imagePath).stem().string() + ".svg"); + imagePath, queryImageSize, extractedFeatures, param->_visualDebug + "/" + fs::path(imagePath).stem().string() + ".svg"); } return localize( @@ -461,10 +461,10 @@ bool VoctreeLocalizer::localizeFirstBestResult(const feature::MapRegionsPerDesc& if (!param._visualDebug.empty() && !imagePath.empty()) { - namespace bfs = boost::filesystem; + namespace fs = std::filesystem; const sfmData::View* mview = _sfm_data.getViews().at(matchedViewId).get(); - const std::string queryimage = bfs::path(imagePath).stem().string(); - const std::string matchedImage = bfs::path(mview->getImage().getImagePath()).stem().string(); + const std::string queryimage = fs::path(imagePath).stem().string(); + const std::string matchedImage = fs::path(mview->getImage().getImagePath()).stem().string(); const std::string matchedPath = mview->getImage().getImagePath(); matching::saveMatches2SVG(imagePath, @@ -646,9 +646,9 @@ bool VoctreeLocalizer::localizeAllResults(const feature::MapRegionsPerDesc& quer ALICEVISION_LOG_DEBUG("[poseEstimation]\tResection failed"); if (!param._visualDebug.empty() && !imagePath.empty()) { - namespace bfs = boost::filesystem; + namespace fs = std::filesystem; matching::saveFeatures2SVG( - imagePath, queryImageSize, resectionData.pt2D, param._visualDebug + "/" + bfs::path(imagePath).stem().string() + ".associations.svg"); + imagePath, queryImageSize, resectionData.pt2D, param._visualDebug + "/" + fs::path(imagePath).stem().string() + ".associations.svg"); } localizationResult = LocalizationResult(resectionData, associationIDs, pose, queryIntrinsics, matchedImages, bResection); return localizationResult.isValid(); @@ -684,11 +684,11 @@ bool VoctreeLocalizer::localizeAllResults(const feature::MapRegionsPerDesc& quer if (!param._visualDebug.empty() && !imagePath.empty()) { - namespace bfs = boost::filesystem; + namespace fs = std::filesystem; matching::saveFeatures2SVG(imagePath, queryImageSize, resectionData.pt2D, - param._visualDebug + "/" + bfs::path(imagePath).stem().string() + ".associations.svg", + param._visualDebug + "/" + fs::path(imagePath).stem().string() + ".associations.svg", &resectionData.vec_inliers); } @@ -833,21 +833,21 @@ void VoctreeLocalizer::getAllAssociations(const feature::MapRegionsPerDesc& quer // param._visualDebug/queryImage/ if (!param._visualDebug.empty() && !imagePath.empty()) { - namespace bfs = boost::filesystem; + namespace fs = std::filesystem; const sfmData::View* mview = _sfm_data.getViews().at(matchedViewId).get(); // the current query image without extension - const auto queryImage = bfs::path(imagePath).stem(); + const auto queryImage = fs::path(imagePath).stem(); // the matching image without extension - const auto matchedImage = bfs::path(mview->getImage().getImagePath()).stem(); + const auto matchedImage = fs::path(mview->getImage().getImagePath()).stem(); // the full path of the matching image const auto matchedPath = mview->getImage().getImagePath(); // the directory where to save the feature matches - const auto baseDir = bfs::path(param._visualDebug) / queryImage; - if ((!bfs::exists(baseDir))) + const auto baseDir = fs::path(param._visualDebug) / queryImage; + if ((!fs::exists(baseDir))) { ALICEVISION_LOG_DEBUG("created " << baseDir.string()); - bfs::create_directories(baseDir); + fs::create_directories(baseDir); } // damn you, boost, what does it take to make the operator "+"? From 8b32afc37b45210870b3c9aa5ecae31708d0053c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 8 Jan 2024 09:10:10 +0000 Subject: [PATCH 13/17] [matching][mesh] Replace calls to `boost::filesystem` with `std::filesystem` --- src/aliceVision/matching/CMakeLists.txt | 1 - src/aliceVision/matching/indMatch_test.cpp | 23 ++++++++------- src/aliceVision/matching/io.cpp | 11 ++++---- .../matchingImageCollection/CMakeLists.txt | 1 - .../GeometricFilterMatrix_HGrowing.hpp | 9 +++--- src/aliceVision/mesh/CMakeLists.txt | 1 - src/aliceVision/mesh/Mesh.cpp | 7 +++-- src/aliceVision/mesh/MeshEnergyOpt.cpp | 6 +--- src/aliceVision/mesh/Texturing.cpp | 28 ++++++++++--------- src/aliceVision/mesh/Texturing.hpp | 16 +++++------ src/aliceVision/mesh/meshPostProcessing.cpp | 4 --- 11 files changed, 49 insertions(+), 58 deletions(-) diff --git a/src/aliceVision/matching/CMakeLists.txt b/src/aliceVision/matching/CMakeLists.txt index 9444b18de9..0507421ff0 100644 --- a/src/aliceVision/matching/CMakeLists.txt +++ b/src/aliceVision/matching/CMakeLists.txt @@ -39,7 +39,6 @@ alicevision_add_library(aliceVision_matching aliceVision_system PRIVATE_LINKS - Boost::filesystem Boost::boost ${FLANN_LIBRARIES} ) diff --git a/src/aliceVision/matching/indMatch_test.cpp b/src/aliceVision/matching/indMatch_test.cpp index 15869cdd89..bc1f9f81f6 100644 --- a/src/aliceVision/matching/indMatch_test.cpp +++ b/src/aliceVision/matching/indMatch_test.cpp @@ -8,24 +8,23 @@ #include "aliceVision/matching/IndMatch.hpp" #include "aliceVision/matching/io.hpp" -#include - #define BOOST_TEST_MODULE IndMatch #include #include -#include + +#include using namespace aliceVision; using namespace aliceVision::matching; using namespace aliceVision::feature; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; BOOST_AUTO_TEST_CASE(IndMatch_IO) { const std::string testFolder = "matchingTest"; - boost::filesystem::create_directory(testFolder); + fs::create_directory(testFolder); { std::set viewsKeys; PairwiseMatches matches; @@ -36,8 +35,8 @@ BOOST_AUTO_TEST_CASE(IndMatch_IO) BOOST_CHECK_EQUAL(0, matches.size()); fs::remove_all("./1/"); } - boost::filesystem::remove_all(testFolder); - boost::filesystem::create_directory(testFolder); + fs::remove_all(testFolder); + fs::create_directory(testFolder); { std::set viewsKeys; PairwiseMatches matches; @@ -48,8 +47,8 @@ BOOST_AUTO_TEST_CASE(IndMatch_IO) BOOST_CHECK_EQUAL(0, matches.size()); fs::remove_all("./2/"); } - boost::filesystem::remove_all(testFolder); - boost::filesystem::create_directory(testFolder); + fs::remove_all(testFolder); + fs::create_directory(testFolder); { std::set viewsKeys = {0, 1, 2}; PairwiseMatches matches; @@ -67,8 +66,8 @@ BOOST_AUTO_TEST_CASE(IndMatch_IO) BOOST_CHECK_EQUAL(3, matches.at(std::make_pair(1, 2)).at(EImageDescriberType::UNKNOWN).size()); fs::remove_all("./3/"); } - boost::filesystem::remove_all(testFolder); - boost::filesystem::create_directory(testFolder); + fs::remove_all(testFolder); + fs::create_directory(testFolder); { std::set viewsKeys = {0, 1, 2}; PairwiseMatches matches; @@ -105,7 +104,7 @@ BOOST_AUTO_TEST_CASE(IndMatch_IO) BOOST_CHECK_EQUAL(2, matches.at(std::make_pair(0, 2)).at(EImageDescriberType::UNKNOWN).size()); fs::remove_all("./4/"); } - boost::filesystem::remove_all(testFolder); + fs::remove_all(testFolder); } BOOST_AUTO_TEST_CASE(IndMatch_DuplicateRemoval_NoRemoval) diff --git a/src/aliceVision/matching/io.cpp b/src/aliceVision/matching/io.cpp index d1365698de..de1d6ccec6 100644 --- a/src/aliceVision/matching/io.cpp +++ b/src/aliceVision/matching/io.cpp @@ -9,24 +9,25 @@ #include #include #include +#include -#include #include #include +#include #include #include #include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace matching { bool LoadMatchFile(PairwiseMatches& matches, const std::string& filepath) { - const std::string ext = fs::extension(filepath); + const std::string ext = fs::path(filepath).extension().string(); if (!fs::exists(filepath)) return false; @@ -279,7 +280,7 @@ class MatchExporter void saveTxt(const std::string& filepath, const PairwiseMatches::const_iterator& matchBegin, const PairwiseMatches::const_iterator& matchEnd) { const fs::path bPath = fs::path(filepath); - const std::string tmpPath = (bPath.parent_path() / bPath.stem()).string() + "." + fs::unique_path().string() + bPath.extension().string(); + const std::string tmpPath = (bPath.parent_path() / bPath.stem()).string() + "." + utils::generateUniqueFilename() + bPath.extension().string(); // write temporary file { @@ -307,7 +308,7 @@ class MatchExporter : m_matches(matches), m_directory(folder), m_filename(filename), - m_ext(fs::extension(filename)) + m_ext(fs::path(filename).extension().string()) {} ~MatchExporter() = default; diff --git a/src/aliceVision/matchingImageCollection/CMakeLists.txt b/src/aliceVision/matchingImageCollection/CMakeLists.txt index 192d8fcb2e..808208df8f 100644 --- a/src/aliceVision/matchingImageCollection/CMakeLists.txt +++ b/src/aliceVision/matchingImageCollection/CMakeLists.txt @@ -38,7 +38,6 @@ alicevision_add_library(aliceVision_matchingImageCollection aliceVision_sfmData Boost::boost Boost::timer - Boost::filesystem PRIVATE_LINKS aliceVision_system ${CERES_LIBRARIES} diff --git a/src/aliceVision/matchingImageCollection/GeometricFilterMatrix_HGrowing.hpp b/src/aliceVision/matchingImageCollection/GeometricFilterMatrix_HGrowing.hpp index c8097de81c..d270d8c7ff 100644 --- a/src/aliceVision/matchingImageCollection/GeometricFilterMatrix_HGrowing.hpp +++ b/src/aliceVision/matchingImageCollection/GeometricFilterMatrix_HGrowing.hpp @@ -12,9 +12,8 @@ #include "aliceVision/matchingImageCollection/geometricFilterUtils.hpp" #include "aliceVision/sfmData/SfMData.hpp" -#include - #include +#include namespace aliceVision { namespace matchingImageCollection { @@ -240,13 +239,13 @@ struct GeometricFilterMatrix_HGrowing : public GeometricFilterMatrix continue; } - if (boost::filesystem::exists(outputSvgDir)) + if (std::filesystem::exists(outputSvgDir)) { const std::size_t nbMatches = outGeometricInliers.size(); const std::string name = std::to_string(nbMatches) + "hmatches_" + std::to_string(viewI.getViewId()) + "_" + std::to_string(viewJ.getViewId()) + "_" + EImageDescriberType_enumToString(descType) + ".svg"; - // @FIXME not worth it having boost::filesystem in a header - const std::string outFilename = (boost::filesystem::path(outputSvgDir) / boost::filesystem::path(name)).string(); + // @FIXME not worth it having std::filesystem in a header + const std::string outFilename = (std::filesystem::path(outputSvgDir) / std::filesystem::path(name)).string(); drawHomographyMatches( viewI, viewJ, regions_I.Features(), regions_J.Features(), homographiesAndMatches, putativeMatchesPerType.at(descType), outFilename); } diff --git a/src/aliceVision/mesh/CMakeLists.txt b/src/aliceVision/mesh/CMakeLists.txt index 8609b255f3..b4516c21d1 100644 --- a/src/aliceVision/mesh/CMakeLists.txt +++ b/src/aliceVision/mesh/CMakeLists.txt @@ -31,7 +31,6 @@ alicevision_add_library(aliceVision_mesh aliceVision_mvsData aliceVision_mvsUtils Geogram::geogram - Boost::filesystem assimp::assimp PRIVATE_LINKS aliceVision_system diff --git a/src/aliceVision/mesh/Mesh.cpp b/src/aliceVision/mesh/Mesh.cpp index 538ea0a0d9..0084babe7f 100644 --- a/src/aliceVision/mesh/Mesh.cpp +++ b/src/aliceVision/mesh/Mesh.cpp @@ -14,7 +14,6 @@ #include #include -#include #include #include @@ -23,7 +22,9 @@ #include #include +#include #include +#include #include #include @@ -77,7 +78,7 @@ std::istream& operator>>(std::istream& in, EFileType& meshFileType) void Mesh::save(const std::string& filepath) { - const std::string fileTypeStr = boost::filesystem::path(filepath).extension().string().substr(1); + const std::string fileTypeStr = std::filesystem::path(filepath).extension().string().substr(1); const EFileType fileType = mesh::EFileType_stringToEnum(fileTypeStr); ALICEVISION_LOG_INFO("Save " << fileTypeStr << " mesh file"); @@ -2358,7 +2359,7 @@ void Mesh::load(const std::string& filepath, bool mergeCoincidentVerts, Material normals.clear(); pointsVisibilities.clear(); - if (!boost::filesystem::exists(filepath)) + if (!std::filesystem::exists(filepath)) { ALICEVISION_THROW_ERROR("Mesh::load: no such file: " << filepath); } diff --git a/src/aliceVision/mesh/MeshEnergyOpt.cpp b/src/aliceVision/mesh/MeshEnergyOpt.cpp index 6a1080f81a..48e836a837 100644 --- a/src/aliceVision/mesh/MeshEnergyOpt.cpp +++ b/src/aliceVision/mesh/MeshEnergyOpt.cpp @@ -7,18 +7,14 @@ #include "MeshEnergyOpt.hpp" #include -#include - namespace aliceVision { namespace mesh { -namespace bfs = boost::filesystem; - MeshEnergyOpt::MeshEnergyOpt(mvsUtils::MultiViewParams* _mp) : MeshAnalyze(_mp) { // tmpDir = mp->mvDir + "meshEnergyOpt/"; - // bfs::create_directory(tmpDir); + // fs::create_directory(tmpDir); } MeshEnergyOpt::~MeshEnergyOpt() = default; diff --git a/src/aliceVision/mesh/Texturing.cpp b/src/aliceVision/mesh/Texturing.cpp index 33202f3281..4e98b52564 100644 --- a/src/aliceVision/mesh/Texturing.cpp +++ b/src/aliceVision/mesh/Texturing.cpp @@ -8,6 +8,7 @@ #include "geoMesh.hpp" #include "UVAtlas.hpp" +#include #include #include #include @@ -36,6 +37,7 @@ #include #include +#include #include #include @@ -279,7 +281,7 @@ void Texturing::updateAtlases() } void Texturing::generateTextures(const mvsUtils::MultiViewParams& mp, - const boost::filesystem::path& outPath, + const fs::path& outPath, size_t memoryAvailable, image::EImageFileType textureFileType) { @@ -369,7 +371,7 @@ void Texturing::generateTextures(const mvsUtils::MultiViewParams& mp, void Texturing::generateTexturesSubSet(const mvsUtils::MultiViewParams& mp, const std::vector& atlasIDs, mvsUtils::ImagesCache>& imageCache, - const bfs::path& outPath, + const fs::path& outPath, image::EImageFileType textureFileType) { if (atlasIDs.size() > _atlases.size()) @@ -679,7 +681,7 @@ void Texturing::generateTexturesSubSet(const mvsUtils::MultiViewParams& mp, const std::string textureName = "contrib_" + std::to_string(1001 + atlasID) + std::string("_") + std::to_string(level) + std::string(".") + EImageFileType_enumToString(textureFileType); // starts at '1001' for UDIM compatibility - bfs::path texturePath = outPath / textureName; + fs::path texturePath = outPath / textureName; using namespace imageIO; OutputFileColorSpace colorspace(EImageColorSpace::SRGB, EImageColorSpace::AUTO); @@ -745,7 +747,7 @@ void Texturing::generateTexturesSubSet(const mvsUtils::MultiViewParams& mp, void Texturing::generateNormalAndHeightMaps(const mvsUtils::MultiViewParams& mp, const Mesh& denseMesh, - const bfs::path& outPath, + const fs::path& outPath, const mesh::BumpMappingParams& bumpMappingParams) { GEO::Mesh geoDenseMesh; @@ -765,7 +767,7 @@ void Texturing::generateNormalAndHeightMaps(const mvsUtils::MultiViewParams& mp, void Texturing::writeTexture(AccuImage& atlasTexture, const std::size_t atlasID, - const boost::filesystem::path& outPath, + const std::filesystem::path& outPath, image::EImageFileType textureFileType, const int level) { @@ -897,7 +899,7 @@ void Texturing::writeTexture(AccuImage& atlasTexture, const std::string textureName = material.textureName(Material::TextureType::DIFFUSE, static_cast(atlasID)); material.addTexture(Material::TextureType::DIFFUSE, textureName); - bfs::path texturePath = outPath / textureName; + fs::path texturePath = outPath / textureName; ALICEVISION_LOG_INFO(" - Writing texture file: " << texturePath.string()); image::writeImage(texturePath.string(), @@ -1037,17 +1039,17 @@ void Texturing::unwrap(mvsUtils::MultiViewParams& mp, EUnwrapMethod method) // Meanwhile, // use a temporary obj file to save result - Geogram merges common UV coordinates per facet corner - // and reload it - const std::string tmpObjPath = (bfs::temp_directory_path() / bfs::unique_path()).string() + ".obj"; + const std::string tmpObjPath = (fs::temp_directory_path() / fs::path(utils::generateUniqueFilename())).string() + ".obj"; // save temp mesh with UVs GEO::mesh_save(geoMesh, tmpObjPath); // replace initial mesh replaceMesh(tmpObjPath); // remove temp mesh - bfs::remove(tmpObjPath); + fs::remove(tmpObjPath); } } -void Texturing::saveAs(const bfs::path& dir, const std::string& basename, EFileType meshFileType) +void Texturing::saveAs(const fs::path& dir, const std::string& basename, EFileType meshFileType) { const std::string meshFileTypeStr = EFileType_enumToString(meshFileType); const std::string filepath = (dir / (basename + "." + meshFileTypeStr)).string(); @@ -1327,7 +1329,7 @@ void Texturing::_generateNormalAndHeightMaps(const mvsUtils::MultiViewParams& mp const GEO::Mesh& sparseMesh, size_t atlasID, mvsUtils::ImagesCache>& imageCache, - const bfs::path& outPath, + const fs::path& outPath, const mesh::BumpMappingParams& bumpMappingParams) { ALICEVISION_LOG_INFO("Generating Height and Normal Maps for atlas " << atlasID + 1 << "/" << _atlases.size() << " (" << _atlases[atlasID].size() @@ -1484,7 +1486,7 @@ void Texturing::_generateNormalAndHeightMaps(const mvsUtils::MultiViewParams& mp const std::string name = material.textureName(Material::TextureType::NORMAL, static_cast(atlasID)); material.addTexture(Material::TextureType::NORMAL, name); - bfs::path normalMapPath = outPath / name; + fs::path normalMapPath = outPath / name; ALICEVISION_LOG_INFO("Writing normal map: " << normalMapPath.string()); image::writeImage(normalMapPath.string(), @@ -1524,7 +1526,7 @@ void Texturing::_generateNormalAndHeightMaps(const mvsUtils::MultiViewParams& mp const std::string bumpName = material.textureName(Material::TextureType::BUMP, static_cast(atlasID)); material.addTexture(Material::TextureType::BUMP, bumpName); - bfs::path bumpMapPath = outPath / bumpName; + fs::path bumpMapPath = outPath / bumpName; ALICEVISION_LOG_INFO("Writing bump map: " << bumpMapPath); image::writeImage(bumpMapPath.string(), heightMap, image::ImageWriteOptions().storageDataType(image::EStorageDataType::Half)); @@ -1536,7 +1538,7 @@ void Texturing::_generateNormalAndHeightMaps(const mvsUtils::MultiViewParams& mp const std::string dispName = material.textureName(Material::TextureType::DISPLACEMENT, static_cast(atlasID)); material.addTexture(Material::TextureType::DISPLACEMENT, dispName); - bfs::path dispMapPath = outPath / dispName; + fs::path dispMapPath = outPath / dispName; ALICEVISION_LOG_INFO("Writing displacement map: " << dispMapPath); image::writeImage(dispMapPath.string(), heightMap, image::ImageWriteOptions().storageDataType(image::EStorageDataType::Half)); diff --git a/src/aliceVision/mesh/Texturing.hpp b/src/aliceVision/mesh/Texturing.hpp index 6b32c81f0a..601b8eb111 100644 --- a/src/aliceVision/mesh/Texturing.hpp +++ b/src/aliceVision/mesh/Texturing.hpp @@ -18,9 +18,9 @@ #include #include -#include +#include -namespace bfs = boost::filesystem; +namespace fs = std::filesystem; namespace GEO { class MeshFacetsAABB; @@ -194,7 +194,7 @@ struct Texturing /// Generate texture files for all texture atlases void generateTextures(const mvsUtils::MultiViewParams& mp, - const bfs::path& outPath, + const fs::path& outPath, size_t memoryAvailable, image::EImageFileType textureFileType = image::EImageFileType::PNG); @@ -202,12 +202,12 @@ struct Texturing void generateTexturesSubSet(const mvsUtils::MultiViewParams& mp, const std::vector& atlasIDs, mvsUtils::ImagesCache>& imageCache, - const bfs::path& outPath, + const fs::path& outPath, image::EImageFileType textureFileType = image::EImageFileType::PNG); void generateNormalAndHeightMaps(const mvsUtils::MultiViewParams& mp, const Mesh& denseMesh, - const bfs::path& outPath, + const fs::path& outPath, const mesh::BumpMappingParams& bumpMappingParams); void _generateNormalAndHeightMaps(const mvsUtils::MultiViewParams& mp, @@ -215,18 +215,18 @@ struct Texturing const GEO::Mesh& sparseMesh, size_t atlasID, mvsUtils::ImagesCache>& imageCache, - const bfs::path& outPath, + const fs::path& outPath, const mesh::BumpMappingParams& bumpMappingParams); /// Fill holes and write texture files for the given texture atlas void writeTexture(AccuImage& atlasTexture, const std::size_t atlasID, - const bfs::path& outPath, + const fs::path& outPath, image::EImageFileType textureFileType, const int level); /// Save textured mesh as an OBJ + MTL file - void saveAs(const bfs::path& dir, const std::string& basename, aliceVision::mesh::EFileType meshFileType = aliceVision::mesh::EFileType::OBJ); + void saveAs(const fs::path& dir, const std::string& basename, aliceVision::mesh::EFileType meshFileType = aliceVision::mesh::EFileType::OBJ); }; } // namespace mesh diff --git a/src/aliceVision/mesh/meshPostProcessing.cpp b/src/aliceVision/mesh/meshPostProcessing.cpp index 6ee996f7bf..b11111df54 100644 --- a/src/aliceVision/mesh/meshPostProcessing.cpp +++ b/src/aliceVision/mesh/meshPostProcessing.cpp @@ -11,13 +11,9 @@ #include #include -#include - namespace aliceVision { namespace mesh { -namespace bfs = boost::filesystem; - void meshPostProcessing(Mesh*& inout_mesh, StaticVector>& inout_ptsCams, mvsUtils::MultiViewParams& mp, From 9c5a5e117df837c338ab8278fdfc80dcb3c53b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 8 Jan 2024 09:10:22 +0000 Subject: [PATCH 14/17] [mvsData][mvsUtils] Replace calls to `boost::filesystem` with `std::filesystem` --- src/aliceVision/mvsData/CMakeLists.txt | 1 - src/aliceVision/mvsData/StaticVector.hpp | 8 +++----- src/aliceVision/mvsUtils/CMakeLists.txt | 1 - src/aliceVision/mvsUtils/ImagesCache.hpp | 1 + src/aliceVision/mvsUtils/mapIO.cpp | 7 ++++--- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/aliceVision/mvsData/CMakeLists.txt b/src/aliceVision/mvsData/CMakeLists.txt index 1bde136585..9db83a84e1 100644 --- a/src/aliceVision/mvsData/CMakeLists.txt +++ b/src/aliceVision/mvsData/CMakeLists.txt @@ -34,7 +34,6 @@ alicevision_add_library(aliceVision_mvsData aliceVision_numeric aliceVision_image ZLIB::ZLIB - Boost::filesystem Boost::boost OpenImageIO::OpenImageIO OpenImageIO::OpenImageIO_Util diff --git a/src/aliceVision/mvsData/StaticVector.hpp b/src/aliceVision/mvsData/StaticVector.hpp index f67f21c182..3c7f7776f2 100644 --- a/src/aliceVision/mvsData/StaticVector.hpp +++ b/src/aliceVision/mvsData/StaticVector.hpp @@ -11,15 +11,13 @@ #include #include #include +#include #include #include #include #include #include -#include -#include - namespace aliceVision { template @@ -345,8 +343,8 @@ void saveArrayToFile(const std::string& fileName, const StaticVector* a, bool { ALICEVISION_LOG_DEBUG("[IO] saveArrayToFile: " << fileName); - boost::filesystem::path filepath = fileName; - boost::filesystem::create_directories(filepath.parent_path()); + std::filesystem::path filepath = fileName; + std::filesystem::create_directories(filepath.parent_path()); if (!a) { diff --git a/src/aliceVision/mvsUtils/CMakeLists.txt b/src/aliceVision/mvsUtils/CMakeLists.txt index 2a87d661bd..af02dcb676 100644 --- a/src/aliceVision/mvsUtils/CMakeLists.txt +++ b/src/aliceVision/mvsUtils/CMakeLists.txt @@ -29,6 +29,5 @@ alicevision_add_library(aliceVision_mvsUtils OpenImageIO::OpenImageIO_Util PRIVATE_LINKS aliceVision_system - Boost::filesystem Boost::boost ) diff --git a/src/aliceVision/mvsUtils/ImagesCache.hpp b/src/aliceVision/mvsUtils/ImagesCache.hpp index 198eab5f3e..8849153cde 100644 --- a/src/aliceVision/mvsUtils/ImagesCache.hpp +++ b/src/aliceVision/mvsUtils/ImagesCache.hpp @@ -14,6 +14,7 @@ #include #include +#include #include #include diff --git a/src/aliceVision/mvsUtils/mapIO.cpp b/src/aliceVision/mvsUtils/mapIO.cpp index 1c87ba831b..5a68aa14bb 100644 --- a/src/aliceVision/mvsUtils/mapIO.cpp +++ b/src/aliceVision/mvsUtils/mapIO.cpp @@ -11,10 +11,11 @@ #include #include -#include #include -namespace fs = boost::filesystem; +#include + +namespace fs = std::filesystem; namespace aliceVision { namespace mvsUtils { @@ -142,7 +143,7 @@ void getTilePathList(int rc, const boost::regex mapPattern(mapPath.stem().string() + "_\\d+_\\d+" + mapPath.extension().string()); - for (auto& entry : boost::make_iterator_range(boost::filesystem::directory_iterator(mapDirectory), {})) + for (auto& entry : fs::directory_iterator{mapDirectory}) { if (boost::regex_match(entry.path().filename().string(), mapPattern)) out_mapTilePathList.push_back(entry.path().string()); From 5338020e522e27bc3812079d60e9c1c078c2593d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 8 Jan 2024 09:10:37 +0000 Subject: [PATCH 15/17] [photometricStereo][sensorDB] Replace calls to `boost::filesystem` with `std::filesystem` --- src/aliceVision/photometricStereo/CMakeLists.txt | 2 -- src/aliceVision/photometricStereo/photometricDataIO.cpp | 4 ++-- src/aliceVision/photometricStereo/photometricStereo.cpp | 7 +++---- src/aliceVision/sensorDB/CMakeLists.txt | 3 +-- src/aliceVision/sensorDB/parseDatabase.cpp | 4 ++-- src/aliceVision/sensorDB/parseDatabase_test.cpp | 5 ++--- 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/aliceVision/photometricStereo/CMakeLists.txt b/src/aliceVision/photometricStereo/CMakeLists.txt index ee6d3d3c90..9adbe72f43 100644 --- a/src/aliceVision/photometricStereo/CMakeLists.txt +++ b/src/aliceVision/photometricStereo/CMakeLists.txt @@ -21,6 +21,4 @@ alicevision_add_library(aliceVision_photometricStereo aliceVision_sfmData aliceVision_sfmDataIO aliceVision_mvsData - Boost::filesystem - ) diff --git a/src/aliceVision/photometricStereo/photometricDataIO.cpp b/src/aliceVision/photometricStereo/photometricDataIO.cpp index b56b1d1a32..33d7983a38 100644 --- a/src/aliceVision/photometricStereo/photometricDataIO.cpp +++ b/src/aliceVision/photometricStereo/photometricDataIO.cpp @@ -12,14 +12,14 @@ #include #include -#include #include #include +#include #include namespace bpt = boost::property_tree; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace photometricStereo { diff --git a/src/aliceVision/photometricStereo/photometricStereo.cpp b/src/aliceVision/photometricStereo/photometricStereo.cpp index b51d864c32..3be449557c 100644 --- a/src/aliceVision/photometricStereo/photometricStereo.cpp +++ b/src/aliceVision/photometricStereo/photometricStereo.cpp @@ -15,14 +15,13 @@ #include #include -#include - #include #include +#include #include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace photometricStereo { @@ -581,7 +580,7 @@ void getPicturesNames(const std::string& folderPath, std::vector& i { fs::path currentFilePath = itr->path(); - std::string fileExtension = fs::extension(currentFilePath.string()); + std::string fileExtension = currentFilePath.extension().string(); std::transform(fileExtension.begin(), fileExtension.end(), fileExtension.begin(), ::tolower); if (!boost::algorithm::icontains(currentFilePath.stem().string(), "mask") && diff --git a/src/aliceVision/sensorDB/CMakeLists.txt b/src/aliceVision/sensorDB/CMakeLists.txt index b22c730754..f88f27bae1 100644 --- a/src/aliceVision/sensorDB/CMakeLists.txt +++ b/src/aliceVision/sensorDB/CMakeLists.txt @@ -15,7 +15,6 @@ set(sensorDB_files_sources alicevision_add_library(aliceVision_sensorDB SOURCES ${sensorDB_files_headers} ${sensorDB_files_sources} PRIVATE_LINKS - Boost::filesystem Boost::system Boost::boost ) @@ -26,7 +25,7 @@ install(FILES cameraSensors.db ) # Unit tests -alicevision_add_test(parseDatabase_test.cpp NAME "sensorDB_parseDatabase" LINKS aliceVision_sensorDB Boost::filesystem) +alicevision_add_test(parseDatabase_test.cpp NAME "sensorDB_parseDatabase" LINKS aliceVision_sensorDB) diff --git a/src/aliceVision/sensorDB/parseDatabase.cpp b/src/aliceVision/sensorDB/parseDatabase.cpp index b2b47c60cb..953dc54b43 100644 --- a/src/aliceVision/sensorDB/parseDatabase.cpp +++ b/src/aliceVision/sensorDB/parseDatabase.cpp @@ -8,17 +8,17 @@ #include "parseDatabase.hpp" #include -#include #include #include #include #include +#include #include #include #include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; namespace aliceVision { namespace sensorDB { diff --git a/src/aliceVision/sensorDB/parseDatabase_test.cpp b/src/aliceVision/sensorDB/parseDatabase_test.cpp index 4241d22c10..f91c3fa494 100644 --- a/src/aliceVision/sensorDB/parseDatabase_test.cpp +++ b/src/aliceVision/sensorDB/parseDatabase_test.cpp @@ -7,8 +7,7 @@ #include -#include - +#include #include #define BOOST_TEST_MODULE parseDatabase @@ -17,7 +16,7 @@ #include using namespace aliceVision::sensorDB; -namespace fs = boost::filesystem; +namespace fs = std::filesystem; static const std::string sDatabase = (fs::path(THIS_SOURCE_DIR) / "cameraSensors.db").string(); From 5bf9f6736b2e3ad478418f59d728fc21b8530fe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 8 Jan 2024 10:09:51 +0000 Subject: [PATCH 16/17] [doc] INSTALL.md: Remove `boost-filesystem` from the dependencies --- INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 1bdc14ef09..b2aa3a48ee 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -81,7 +81,7 @@ cd set VCPKG_ROOT=%cd% vcpkg install ^ - boost-algorithm boost-accumulators boost-atomic boost-container boost-date-time boost-exception boost-filesystem boost-geometry boost-graph boost-json boost-log ^ + boost-algorithm boost-accumulators boost-atomic boost-container boost-date-time boost-exception boost-geometry boost-graph boost-json boost-log ^ boost-program-options boost-property-tree boost-ptr-container boost-regex boost-serialization boost-system boost-test boost-thread boost-timer ^ lz4 ^ liblemon ^ From 32fbd248051107638fe88e36e11c3d8fdb73452c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Candice=20Bent=C3=A9jac?= Date: Mon, 8 Jan 2024 10:25:09 +0000 Subject: [PATCH 17/17] [build] Remove "filesystem" from the Boost dependencies --- src/CMakeLists.txt | 8 +------- src/cmake/AliceVisionConfig.cmake.in | 4 ---- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8fcdd67318..b5478f6ad2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -274,7 +274,7 @@ endif() # Boost # ============================================================================== option(BOOST_NO_CXX11 "if Boost is compiled without C++11 support (as it is often the case in OS packages) this must be enabled to avoid symbol conflicts (SCOPED_ENUM)." OFF) -set(ALICEVISION_BOOST_COMPONENTS atomic container date_time filesystem graph json log log_setup program_options regex serialization system thread timer) +set(ALICEVISION_BOOST_COMPONENTS atomic container date_time graph json log log_setup program_options regex serialization system thread timer) if(ALICEVISION_BUILD_TESTS) set(ALICEVISION_BOOST_COMPONENT_UNITTEST unit_test_framework) endif() @@ -306,12 +306,6 @@ else() set(Boost_USE_STATIC_LIBS ON) endif() -if(BOOST_NO_CXX11) - # Avoid link errors on boost filesystem copy_file function - # http://stackoverflow.com/questions/35007134/c-boost-undefined-reference-to-boostfilesystemdetailcopy-file - add_definitions(-DBOOST_NO_CXX11_SCOPED_ENUMS) -endif() - # ============================================================================== # OpenEXR >= 2.5 diff --git a/src/cmake/AliceVisionConfig.cmake.in b/src/cmake/AliceVisionConfig.cmake.in index 5106ab2bb6..8dc4a0d12d 100644 --- a/src/cmake/AliceVisionConfig.cmake.in +++ b/src/cmake/AliceVisionConfig.cmake.in @@ -98,10 +98,6 @@ if(ALICEVISION_HAVE_OPENMP) endif() find_dependency(Boost COMPONENTS @ALICEVISION_BOOST_COMPONENTS@) -set(BOOST_NO_CXX11 @BOOST_NO_CXX11@) -if(BOOST_NO_CXX11) - add_definitions(-DBOOST_NO_CXX11_SCOPED_ENUMS) -endif() set(ALICEVISION_BUILD_SFM @ALICEVISION_BUILD_SFM@) if(ALICEVISION_BUILD_SFM)