From f3b9f31c43bda62bae1fa1fb30116556c1c8b24d Mon Sep 17 00:00:00 2001 From: Julien-Haudegond <44610840+Julien-Haudegond@users.noreply.github.com> Date: Mon, 6 Jul 2020 15:57:01 +0200 Subject: [PATCH] [fuseCut] Similarity map is optional --- src/aliceVision/fuseCut/DelaunayGraphCut.cpp | 34 ++++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/aliceVision/fuseCut/DelaunayGraphCut.cpp b/src/aliceVision/fuseCut/DelaunayGraphCut.cpp index be6da5c0cb..999d12eace 100644 --- a/src/aliceVision/fuseCut/DelaunayGraphCut.cpp +++ b/src/aliceVision/fuseCut/DelaunayGraphCut.cpp @@ -295,9 +295,20 @@ void createVerticesWithVisibilities(const StaticVector& cams, std::vector

simMapTmp(simMap.size()); imageAlgo::convolveImage(width, height, simMap, simMapTmp, "gaussian", simGaussianSize, simGaussianSize); @@ -879,9 +890,20 @@ void DelaunayGraphCut::fuseFromDepthMaps(const StaticVector& cams, const Po } int wTmp, hTmp; const std::string simMapFilepath = getFileNameFromIndex(mp, c, mvsUtils::EFileType::simMap, 0); - imageIO::readImage(simMapFilepath, wTmp, hTmp, simMap, imageIO::EImageColorSpace::NO_CONVERSION); - if(wTmp != width || hTmp != height) - throw std::runtime_error("Wrong sim map dimensions: " + simMapFilepath); + // If we have a simMap in input use it, + // else init with a constant value. + if(boost::filesystem::exists(simMapFilepath)) + { + imageIO::readImage(simMapFilepath, wTmp, hTmp, simMap, imageIO::EImageColorSpace::NO_CONVERSION); + if(wTmp != width || hTmp != height) + throw std::runtime_error("Wrong sim map dimensions: " + simMapFilepath); + } + else + { + ALICEVISION_LOG_WARNING("simMap file can't be found."); + simMap.resize(width * height, -1); + } + { std::vector simMapTmp(simMap.size()); imageAlgo::convolveImage(width, height, simMap, simMapTmp, "gaussian", params.simGaussianSizeInit, params.simGaussianSizeInit);