35 for (
const auto& kv :
matches) {
36 const auto pair_indices = kv.first;
37 const auto corr_indices = kv.second;
40 size_t i1 = pair_indices.first;
41 size_t i2 = pair_indices.second;
42 size_t m =
static_cast<size_t>(corr_indices.rows());
43 for (
size_t k = 0; k <
m; k++) {
45 size_t k1 = corr_indices(k, 0), k2 = corr_indices(k, 1);
60 for (
const auto& index_pair : index_pair_set) {
63 size_t i = index_pair.i();
64 size_t k = index_pair.j();
75 const std::map<IndexPair, std::set<IndexPair> > key_sets = dsf.
sets();
78 if (key_sets.empty())
return {};
82 std::vector<SfmTrack2d> tracks2d;
83 for (
const auto& kv : key_sets) {
86 tracks2d.emplace_back(track2d);
107 if (verbose) std::cout <<
"[SfmTrack2d] Starting Union-Find..." << std::endl;
109 if (verbose) std::cout <<
"[SfmTrack2d] Union-Find Complete" << std::endl;
111 std::vector<SfmTrack2d> tracks2d =
tracksFromDSF(dsf, keypoints);
116 std::vector<SfmTrack2d> validTracks;
118 tracks2d.begin(), tracks2d.end(), std::back_inserter(validTracks),
119 [](
const SfmTrack2d& track2d) { return track2d.hasUniqueCameras(); });
122 size_t erroneous_track_count = tracks2d.size() - validTracks.size();
123 double erroneous_percentage =
static_cast<float>(erroneous_track_count) /
124 static_cast<float>(tracks2d.size()) * 100;
126 std::cout << std::fixed << std::setprecision(2);
127 std::cout <<
"DSF Union-Find: " << erroneous_percentage;
128 std::cout <<
"% of tracks discarded from multiple obs. in a single image."