Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[fuseCut] Similarity map is optional #831

Merged
merged 1 commit into from
Jul 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions src/aliceVision/fuseCut/DelaunayGraphCut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,20 @@ void createVerticesWithVisibilities(const StaticVector<int>& cams, std::vector<P
}
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("Similarity map size doesn't match the depth map size: " + simMapFilepath + ", " + depthMapFilepath);
// 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("Similarity map size doesn't match the depth map size: " + simMapFilepath + ", " + depthMapFilepath);
}
else
{
ALICEVISION_LOG_WARNING("simMap file can't be found.");
simMap.resize(width * height, -1);
}

{
std::vector<float> simMapTmp(simMap.size());
imageAlgo::convolveImage(width, height, simMap, simMapTmp, "gaussian", simGaussianSize, simGaussianSize);
Expand Down Expand Up @@ -879,9 +890,20 @@ void DelaunayGraphCut::fuseFromDepthMaps(const StaticVector<int>& 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<float> simMapTmp(simMap.size());
imageAlgo::convolveImage(width, height, simMap, simMapTmp, "gaussian", params.simGaussianSizeInit, params.simGaussianSizeInit);
Expand Down