4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-11 10:34:29 +08:00

Gaussian splatting process data fixes (#2554)

* make refine intrinsics during ns-process-data optional (#2550)

ns-process-data will still refine intrinsics by default for compatibility.

Specify --no-refine-intrinsics to turn off.

* multinerf uses equals sign
This commit is contained in:
machenmusik 2023-10-24 13:37:38 -04:00 committed by GitHub
parent c5de49d5e4
commit e3822ded8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 10 deletions

View File

@ -41,6 +41,9 @@ class ColmapConverterToNerfstudioDataset(BaseConverterToNerfstudioDataset):
refine_pixsfm: bool = False
"""If True, runs refinement using Pixel Perfect SFM.
Only works with hloc sfm_tool"""
refine_intrinsics: bool = True
"""If True, do bundle adjustment to refine intrinsics.
Only works with colmap sfm_tool"""
feature_type: Literal[
"any",
"sift",
@ -204,6 +207,7 @@ class ColmapConverterToNerfstudioDataset(BaseConverterToNerfstudioDataset):
gpu=self.gpu,
verbose=self.verbose,
matching_method=self.matching_method,
refine_intrinsics=self.refine_intrinsics,
colmap_cmd=self.colmap_cmd,
)
elif sfm_tool == "hloc":

View File

@ -93,6 +93,7 @@ def run_colmap(
gpu: bool = True,
verbose: bool = False,
matching_method: Literal["vocab_tree", "exhaustive", "sequential"] = "vocab_tree",
refine_intrinsics: bool = True,
colmap_cmd: str = "colmap",
) -> None:
"""Runs COLMAP on the images.
@ -105,6 +106,7 @@ def run_colmap(
gpu: If True, use GPU.
verbose: If True, logs the output of the command.
matching_method: Matching method to use.
refine_intrinsics: If True, refine intrinsics.
colmap_cmd: Path to the COLMAP executable.
"""
@ -154,7 +156,7 @@ def run_colmap(
f"--output_path {sparse_dir}",
]
if colmap_version >= 3.7:
mapper_cmd.append("--Mapper.ba_global_function_tolerance 1e-6")
mapper_cmd.append("--Mapper.ba_global_function_tolerance=1e-6")
mapper_cmd = " ".join(mapper_cmd)
@ -165,15 +167,17 @@ def run_colmap(
):
run_command(mapper_cmd, verbose=verbose)
CONSOLE.log("[bold green]:tada: Done COLMAP bundle adjustment.")
with status(msg="[bold yellow]Refine intrinsics...", spinner="dqpb", verbose=verbose):
bundle_adjuster_cmd = [
f"{colmap_cmd} bundle_adjuster",
f"--input_path {sparse_dir}/0",
f"--output_path {sparse_dir}/0",
"--BundleAdjustment.refine_principal_point 1",
]
run_command(" ".join(bundle_adjuster_cmd), verbose=verbose)
CONSOLE.log("[bold green]:tada: Done refining intrinsics.")
if refine_intrinsics:
with status(msg="[bold yellow]Refine intrinsics...", spinner="dqpb", verbose=verbose):
bundle_adjuster_cmd = [
f"{colmap_cmd} bundle_adjuster",
f"--input_path {sparse_dir}/0",
f"--output_path {sparse_dir}/0",
"--BundleAdjustment.refine_principal_point 1",
]
run_command(" ".join(bundle_adjuster_cmd), verbose=verbose)
CONSOLE.log("[bold green]:tada: Done refining intrinsics.")
def parse_colmap_camera_params(camera) -> Dict[str, Any]: