-
Notifications
You must be signed in to change notification settings - Fork 894
Expand file tree
/
Copy pathreconstruct.py
More file actions
29 lines (23 loc) · 942 Bytes
/
reconstruct.py
File metadata and controls
29 lines (23 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# pyre-strict
import gc
from opensfm import io, reconstruction
from opensfm.dataset_base import DataSetBase
def run_dataset(
data: DataSetBase, algorithm: reconstruction.ReconstructionAlgorithm
) -> None:
"""Compute the SfM reconstruction."""
tracks_manager = data.load_tracks_manager()
if algorithm == reconstruction.ReconstructionAlgorithm.INCREMENTAL:
report, reconstructions = reconstruction.incremental_reconstruction(
data, tracks_manager
)
elif algorithm == reconstruction.ReconstructionAlgorithm.TRIANGULATION:
report, reconstructions = reconstruction.triangulation_reconstruction(
data, tracks_manager
)
else:
raise RuntimeError(f"Unsupported algorithm for reconstruction {algorithm}")
del tracks_manager
gc.collect()
data.save_report(io.json_dumps(report), "reconstruction.json")
data.save_reconstruction(reconstructions)