From 305b7681c3213532d73eb77c5ed3f7cb91cf4ba2 Mon Sep 17 00:00:00 2001 From: cDc Date: Tue, 27 Dec 2022 10:10:25 +0200 Subject: [PATCH] dense: load mask with predefined '.mask.png' extension --- .github/workflows/continuous_integration.yml | 2 +- CMakeLists.txt | 1 + apps/DensifyPointCloud/DensifyPointCloud.cpp | 2 +- libs/MVS/DepthMap.cpp | 8 ++++---- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index b5e9c1cdb..a4429f315 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -39,7 +39,7 @@ jobs: uses: actions/checkout@v3 - name: Restore artifacts, or setup vcpkg for building artifacts - uses: lukka/run-vcpkg@v10.6 + uses: lukka/run-vcpkg@v10 with: vcpkgDirectory: '${{ github.workspace }}/vcpkg' vcpkgGitCommitId: '4cb4a5c5ddcb9de0c83c85837ee6974c8333f032' diff --git a/CMakeLists.txt b/CMakeLists.txt index ecc99eb9c..98b85630e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,6 +184,7 @@ if(OpenMVS_USE_PYTHON) INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS}) LIST(APPEND OpenMVS_EXTRA_INCLUDES ${PYTHON_INCLUDE_DIRS}) LIST(APPEND OpenMVS_EXTRA_LIBS ${PYTHON_LIBRARIES}) + MESSAGE(STATUS "Python ${PYTHON_VERSION} found (include: ${PYTHON_INCLUDE_DIRS})") else() MESSAGE("-- Can't find Python. Continuing without it.") endif() diff --git a/apps/DensifyPointCloud/DensifyPointCloud.cpp b/apps/DensifyPointCloud/DensifyPointCloud.cpp index 949314db9..599e28d36 100644 --- a/apps/DensifyPointCloud/DensifyPointCloud.cpp +++ b/apps/DensifyPointCloud/DensifyPointCloud.cpp @@ -133,7 +133,7 @@ bool Initialize(size_t argc, LPCTSTR* argv) ("sub-resolution-levels", boost::program_options::value(&nSubResolutionLevels)->default_value(2), "number of patch-match sub-resolution iterations (0 - disabled)") ("number-views", boost::program_options::value(&nNumViews)->default_value(nNumViewsDefault), "number of views used for depth-map estimation (0 - all neighbor views available)") ("number-views-fuse", boost::program_options::value(&nMinViewsFuse)->default_value(3), "minimum number of images that agrees with an estimate during fusion in order to consider it inlier (<2 - only merge depth-maps)") - ("ignore-mask-label", boost::program_options::value(&nIgnoreMaskLabel)->default_value(-1), "integer value for the label to ignore in the segmentation mask (<0 - disabled)") + ("ignore-mask-label", boost::program_options::value(&nIgnoreMaskLabel)->default_value(-1), "integer value for the label to ignore in the segmentation mask; the mask for each image is stored in the MVS scene or next to each image with '.mask.png' extension (<0 - disabled)") ("iters", boost::program_options::value(&nEstimationIters)->default_value(numIters), "number of patch-match iterations") ("geometric-iters", boost::program_options::value(&nEstimationGeometricIters)->default_value(2), "number of geometric consistent patch-match iterations (0 - disabled)") ("estimate-colors", boost::program_options::value(&nEstimateColors)->default_value(2), "estimate the colors for the dense point-cloud (0 - disabled, 1 - final, 2 - estimate)") diff --git a/libs/MVS/DepthMap.cpp b/libs/MVS/DepthMap.cpp index b72690de4..9ec91bc25 100644 --- a/libs/MVS/DepthMap.cpp +++ b/libs/MVS/DepthMap.cpp @@ -296,15 +296,15 @@ unsigned DepthData::DecRef() // S T R U C T S /////////////////////////////////////////////////// // try to load and apply mask to the depth map; +// the mask for each image is stored in the MVS scene or next to each image with '.mask.png' extension; // the mask marks as false pixels that should be ignored bool DepthEstimator::ImportIgnoreMask(const Image& image0, const Image8U::Size& size, BitMatrix& bmask, uint16_t nIgnoreMaskLabel) { ASSERT(image0.IsValid() && !image0.image.empty()); - if (image0.maskName.empty()) - return false; + const String maskFileName(image0.maskName.empty() ? Util::getFileFullName(image0.name)+".mask.png" : image0.maskName); Image16U mask; - if (!mask.Load(image0.maskName)) { - DEBUG("warning: can not load the segmentation mask '%s'", image0.maskName.c_str()); + if (!mask.Load(maskFileName)) { + DEBUG("warning: can not load the segmentation mask '%s'", maskFileName.c_str()); return false; } cv::resize(mask, mask, size, 0, 0, cv::INTER_NEAREST);