-
-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pipeline] Extract removePoorlyOverlappingImagePairs()
- Loading branch information
Showing
4 changed files
with
53 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/aliceVision/matchingImageCollection/GeometricFilter.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// This file is part of the AliceVision project. | ||
// Copyright (c) 2022 AliceVision contributors. | ||
// This Source Code Form is subject to the terms of the Mozilla Public License, | ||
// v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
#include "GeometricFilter.hpp" | ||
|
||
namespace aliceVision { | ||
namespace matchingImageCollection { | ||
|
||
void removePoorlyOverlappingImagePairs(PairwiseMatches& geometricMatches, | ||
const PairwiseMatches& putativeMatches, | ||
float minimumRatio, | ||
std::size_t minimumGeometricCount) | ||
{ | ||
std::vector<PairwiseMatches::key_type> toRemoveVec; | ||
for (const auto& match : geometricMatches) | ||
{ | ||
const size_t photometricCount = putativeMatches.find(match.first)->second.getNbAllMatches(); | ||
const size_t geometricCount = match.second.getNbAllMatches(); | ||
const float ratio = geometricCount / (float)photometricCount; | ||
if (geometricCount < minimumGeometricCount || ratio < minimumRatio) { | ||
toRemoveVec.push_back(match.first); // the image pair will be removed | ||
} | ||
} | ||
|
||
// remove discarded pairs | ||
for (const auto& pair : toRemoveVec) | ||
{ | ||
geometricMatches.erase(pair); | ||
} | ||
} | ||
|
||
} // namespace matchingImageCollection | ||
} // namespace aliceVision |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters