Skip to content

Commit

Permalink
[mesh] Texturing: code cleaning & set multiBandDownscale default value
Browse files Browse the repository at this point in the history
  • Loading branch information
cvere committed Jun 12, 2019
1 parent eca8944 commit 846158b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 10 additions & 12 deletions src/aliceVision/mesh/Texturing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,17 +258,15 @@ void Texturing::generateUVsBasicMethod(mvsUtils::MultiViewParams& mp)
void Texturing::generateTextures(const mvsUtils::MultiViewParams &mp,
const boost::filesystem::path &outPath, imageIO::EImageFileType textureFileType)
{
ALICEVISION_LOG_INFO("Texturing: Use multiband blending with the following contributions per band:");
// Ensure that contribution levels do not contain 0 and are sorted (as each frequency band contributes to lower bands).
auto& m = texParams.multiBandNbContrib;
m.erase(std::remove(std::begin(m), std::end(m), 0), std::end(m));
texParams.nbBand = m.size();

texParams.multiBandNbContrib.erase(std::remove(std::begin(texParams.multiBandNbContrib), std::end(texParams.multiBandNbContrib), 0),
std::end(texParams.multiBandNbContrib));
texParams.nbBand = texParams.multiBandNbContrib.size();

if(!std::is_sorted(std::begin(texParams.multiBandNbContrib), std::end(texParams.multiBandNbContrib)))
if(!std::is_sorted(std::begin(m), std::end(m)))
{
ALICEVISION_LOG_INFO("Sorting contributions per band (necessary).");
std::sort(std::begin(texParams.multiBandNbContrib), std::end(texParams.multiBandNbContrib));

std::sort(std::begin(m), std::end(m));
}
for(int c: texParams.multiBandNbContrib)
{
Expand Down Expand Up @@ -453,10 +451,9 @@ void Texturing::generateTexturesSubSet(const mvsUtils::MultiViewParams& mp,
camContribution[atlasID].resize(texParams.nbBand);
camContribution.at(atlasID)[band].emplace_back(triangleID, triangleScore);

if(contrib + 1 == nbContribLevel)
if(contrib + 1 == texParams.multiBandNbContrib[band])
{
++band;
nbContribLevel = texParams.multiBandNbContrib[band];
}
}
}
Expand All @@ -476,10 +473,10 @@ void Texturing::generateTexturesSubSet(const mvsUtils::MultiViewParams& mp,

if(cameraContributions.empty())
{
ALICEVISION_LOG_INFO("- camera " << camId + 1 << "/" << mp.ncams << " unused.");
ALICEVISION_LOG_INFO("- camera " << mp.getViewId(camId) << " (" << camId + 1 << "/" << mp.ncams << ") unused.");
continue;
}
ALICEVISION_LOG_INFO("- camera " << camId + 1 << "/" << mp.ncams << " with contributions to " << cameraContributions.size() << " texture files:");
ALICEVISION_LOG_INFO("- camera " << mp.getViewId(camId) << " (" << camId + 1 << "/" << mp.ncams << ") with contributions to " << cameraContributions.size() << " texture files:");

//Load camera image from cache
imageCache.refreshData(camId);
Expand Down Expand Up @@ -600,6 +597,7 @@ void Texturing::generateTexturesSubSet(const mvsUtils::MultiViewParams& mp,

#if TEXTURING_MBB_DEBUG
{
// write the number of contribution per atlas frequency bands
for(std::size_t level = 0; level < accuPyramid.pyramid.size(); ++level)
{
AccuImage& atlasLevelTexture = accuPyramid.pyramid[level];
Expand Down
2 changes: 1 addition & 1 deletion src/aliceVision/mesh/Texturing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct TexturingParams
{
bool useScore = true;
unsigned int nbBand = 4;
unsigned int multiBandDownscale = 2;
unsigned int multiBandDownscale = 4;
std::vector<int> multiBandNbContrib = {1, 5, 10, 0}; // number of contributions per frequency band for the multi-band blending

double bestScoreThreshold = 0.0; //< 0.0 to disable filtering based on threshold to relative best score
Expand Down

0 comments on commit 846158b

Please sign in to comment.