MCPcopy
hub / github.com/cvg/Hierarchical-Localization / visualize_loc

Function visualize_loc

hloc/visualization.py:56–76  ·  view source on GitHub ↗
(results, image_dir, reconstruction=None, db_image_dir=None,
                  selected=[], n=1, seed=0, prefix=None, **kwargs)

Source from the content-addressed store, hash-verified

54
55
56def visualize_loc(results, image_dir, reconstruction=None, db_image_dir=None,
57 selected=[], n=1, seed=0, prefix=None, **kwargs):
58 assert image_dir.exists()
59
60 with open(str(results)+'_logs.pkl', 'rb') as f:
61 logs = pickle.load(f)
62
63 if not selected:
64 queries = list(logs['loc'].keys())
65 if prefix:
66 queries = [q for q in queries if q.startswith(prefix)]
67 selected = random.Random(seed).sample(queries, min(n, len(queries)))
68
69 if reconstruction is not None:
70 if not isinstance(reconstruction, pycolmap.Reconstruction):
71 reconstruction = pycolmap.Reconstruction(reconstruction)
72
73 for qname in selected:
74 loc = logs['loc'][qname]
75 visualize_loc_from_log(
76 image_dir, qname, loc, reconstruction, db_image_dir, **kwargs)
77
78
79def visualize_loc_from_log(image_dir, query_name, loc, reconstruction=None,

Callers

nothing calls this directly

Calls 1

visualize_loc_from_logFunction · 0.85

Tested by

no test coverage detected