// List the index used by the relative motions static std::set<IndexT> getIndexT(const RelativeInfo_Vec & vec_relative) { std::set<IndexT> indexT_set; for (RelativeInfo_Vec::const_iterator iter = vec_relative.begin(); iter != vec_relative.end(); ++iter) { indexT_set.insert(iter->first.first); indexT_set.insert(iter->first.second); } return indexT_set; }
inline void KeepOnlyReferencedElement( const std::set<IndexT> & set_remainingIds, RelativeInfo_Vec & relativeInfo_vec) { RelativeInfo_Vec map_infered; for (RelativeInfo_Vec::const_iterator iter = relativeInfo_vec.begin(); iter != relativeInfo_vec.end(); ++iter) { if (set_remainingIds.count(iter->first.first) && set_remainingIds.count(iter->first.second)) { map_infered.push_back(*iter); } } relativeInfo_vec.swap(map_infered); }
// List the pairs used by the relative motions static Pair_Set getPairs(const RelativeInfo_Vec & vec_relative) { Pair_Set pair_set; for(size_t i = 0; i < vec_relative.size(); ++i) { const relativeInfo & rel = vec_relative[i]; pair_set.insert(Pair(rel.first.first, rel.first.second)); } return pair_set; }
inline void KeepOnlyReferencedElement( const std::set<IndexT> & set_remainingIds, std::vector<RelativeInfo_Vec> & relative_motion_group) { std::vector<RelativeInfo_Vec> infered_relative_motion; for (const openMVG::RelativeInfo_Vec & iter : relative_motion_group) { RelativeInfo_Vec group; for (const relativeInfo & rel : iter) { if (set_remainingIds.count(rel.first.first) && set_remainingIds.count(rel.first.second)) { group.push_back(rel); } } if (!group.empty()) { infered_relative_motion.push_back(std::move(group)); } } relative_motion_group.swap(infered_relative_motion); }