MCPcopy Create free account
hub / github.com/dcharatan/flowmap / run_sparse

Function run_sparse

scripts/colmap/run_sparse.py:14–47  ·  view source on GitHub ↗
(
    input_path: Path,
    output_path: Path,
    seed: int | None,
    quality: Quality,
    data_type: DataType,
)

Source from the content-addressed store, hash-verified

12
13
14def run_sparse(
15 input_path: Path,
16 output_path: Path,
17 seed: int | None,
18 quality: Quality,
19 data_type: DataType,
20) -> None:
21 output_path.mkdir(exist_ok=True, parents=True)
22 start_time = time()
23
24 # Run COLMAP sparse reconstruction.
25 seed = seed or 0
26 command = (
27 "colmap automatic_reconstructor",
28 f"--image_path {input_path}",
29 f"--workspace_path {output_path}",
30 "--sparse 1",
31 "--dense 0",
32 f"--quality {quality}",
33 f"--data_type {data_type}",
34 "--camera_model SIMPLE_PINHOLE",
35 "--single_camera 1",
36 "--use_gpu 1",
37 f"--random_seed {seed}",
38 )
39
40 if subprocess.run(" ".join(command).split(" ")).returncode != 0:
41 raise Exception("COLMAP sparse reconstruction failed.")
42
43 elapsed = time() - start_time
44 with (output_path / "runtime.json").open("w") as f:
45 json.dump({"runtime": elapsed}, f)
46
47 shutil.copytree(input_path, output_path / "images")
48
49
50@click.command()

Callers 2

mainFunction · 0.90
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected