Skip to content

Commit

Permalink
Merge pull request #1493 from alicevision/dev/bracketsSize
Browse files Browse the repository at this point in the history
Deal with multiple brackets with same score
  • Loading branch information
cbentejac authored Jul 20, 2023
2 parents aede20f + 17b8e6c commit eb28035
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/aliceVision/hdr/brackets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ namespace hdr {

bool estimateBracketsFromSfmData(std::vector<std::vector<std::shared_ptr<sfmData::View>>>& groups, const sfmData::SfMData& sfmData, size_t countBrackets)
{
groups.clear();

size_t countImages = sfmData.getViews().size();
if(countImages == 0)
{
Expand Down Expand Up @@ -53,7 +55,7 @@ bool estimateBracketsFromSfmData(std::vector<std::vector<std::shared_ptr<sfmData
}

std::vector<std::shared_ptr<sfmData::View>> group;
double lastExposure = std::numeric_limits<double>::max();
double lastExposure = std::numeric_limits<double>::min();
for(auto& view : viewsOrderedByName)
{
if (countBrackets > 0)
Expand Down Expand Up @@ -110,6 +112,12 @@ bool estimateBracketsFromSfmData(std::vector<std::vector<std::shared_ptr<sfmData
maxSize = item.second;
bestBracketCount = item.first;
}
else if (item.second == maxSize && item.first > bestBracketCount)
{
//If two brackets size have the same vote number,
//Keep the larger one (Just to avoid keeping only the outlier)
bestBracketCount = item.first;
}
}

//Only keep groups with majority bracket size
Expand Down

0 comments on commit eb28035

Please sign in to comment.