MCPcopy Create free account
hub / github.com/alicevision/AliceVision / retrieveMatchingFilepath

Function retrieveMatchingFilepath

src/aliceVision/sfm/utils/alignment.cpp:278–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276}
277
278std::map<std::string, IndexT> retrieveMatchingFilepath(const sfmData::SfMData& sfmData, const std::string& filePatternMatching)
279{
280 std::set<std::string> duplicates;
281 std::map<std::string, IndexT> uniqueFileparts;
282 for (auto& viewIt : sfmData.getViews())
283 {
284 const std::string& imagePath = viewIt.second->getImage().getImagePath();
285 std::string cumulatedValues;
286 if (filePatternMatching.empty())
287 {
288 cumulatedValues = imagePath;
289 }
290 else
291 {
292 std::regex re(filePatternMatching);
293 std::smatch matches;
294 if (std::regex_match(imagePath, matches, re))
295 {
296 for (int i = 1; i < matches.size(); ++i)
297 {
298 const std::ssub_match& submatch = matches[i];
299 cumulatedValues += submatch.str();
300 }
301 }
302 }
303 ALICEVISION_LOG_TRACE("retrieveMatchingFilepath: " << imagePath << " -> " << cumulatedValues);
304 auto it = uniqueFileparts.find(cumulatedValues);
305 if (it != uniqueFileparts.end())
306 {
307 duplicates.insert(cumulatedValues);
308 }
309 else
310 {
311 uniqueFileparts[cumulatedValues] = viewIt.first;
312 }
313 }
314 for (const std::string& d : duplicates)
315 {
316 uniqueFileparts.erase(d);
317 }
318 return uniqueFileparts;
319}
320
321void matchViewsByFilePattern(const sfmData::SfMData& sfmDataA,
322 const sfmData::SfMData& sfmDataB,

Callers 1

matchViewsByFilePatternFunction · 0.85

Calls 6

eraseMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
findMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected