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 authored and GitHub committed 2023-10-24 10:37:38 -07:00
1 parent c5de49d5e4
commit e3822ded8d
2 files changed
+18 -10

No files matched your search

@@ -41,6 +41,9 @@ class ColmapConverterToNerfstudioDataset(BaseConverterToNerfstudioDataset):
refine_pixsfm: bool = False refine_pixsfm: bool = False
"""If True, runs refinement using Pixel Perfect SFM. """If True, runs refinement using Pixel Perfect SFM.
Only works with hloc sfm_tool""" 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[ feature_type: Literal[
"any", "any",
"sift", "sift",
@@ -204,6 +207,7 @@ class ColmapConverterToNerfstudioDataset(BaseConverterToNerfstudioDataset):
gpu=self.gpu, gpu=self.gpu,
verbose=self.verbose, verbose=self.verbose,
matching_method=self.matching_method, matching_method=self.matching_method,
refine_intrinsics=self.refine_intrinsics,
colmap_cmd=self.colmap_cmd, colmap_cmd=self.colmap_cmd,
) )
elif sfm_tool == "hloc": elif sfm_tool == "hloc":
+14 -10
View File
@@ -93,6 +93,7 @@ def run_colmap(
gpu: bool = True, gpu: bool = True,
verbose: bool = False, verbose: bool = False,
matching_method: Literal["vocab_tree", "exhaustive", "sequential"] = "vocab_tree", matching_method: Literal["vocab_tree", "exhaustive", "sequential"] = "vocab_tree",
refine_intrinsics: bool = True,
colmap_cmd: str = "colmap", colmap_cmd: str = "colmap",
) -> None: ) -> None:
"""Runs COLMAP on the images. """Runs COLMAP on the images.
@@ -105,6 +106,7 @@ def run_colmap(
gpu: If True, use GPU. gpu: If True, use GPU.
verbose: If True, logs the output of the command. verbose: If True, logs the output of the command.
matching_method: Matching method to use. matching_method: Matching method to use.
refine_intrinsics: If True, refine intrinsics.
colmap_cmd: Path to the COLMAP executable. colmap_cmd: Path to the COLMAP executable.
""" """
@@ -154,7 +156,7 @@ def run_colmap(
f"--output_path {sparse_dir}", f"--output_path {sparse_dir}",
] ]
if colmap_version >= 3.7: 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) mapper_cmd = " ".join(mapper_cmd)
@@ -165,15 +167,17 @@ def run_colmap(
): ):
run_command(mapper_cmd, verbose=verbose) run_command(mapper_cmd, verbose=verbose)
CONSOLE.log("[bold green]:tada: Done COLMAP bundle adjustment.") CONSOLE.log("[bold green]:tada: Done COLMAP bundle adjustment.")
with status(msg="[bold yellow]Refine intrinsics...", spinner="dqpb", verbose=verbose):
bundle_adjuster_cmd = [ if refine_intrinsics:
f"{colmap_cmd} bundle_adjuster", with status(msg="[bold yellow]Refine intrinsics...", spinner="dqpb", verbose=verbose):
f"--input_path {sparse_dir}/0", bundle_adjuster_cmd = [
f"--output_path {sparse_dir}/0", f"{colmap_cmd} bundle_adjuster",
"--BundleAdjustment.refine_principal_point 1", f"--input_path {sparse_dir}/0",
] f"--output_path {sparse_dir}/0",
run_command(" ".join(bundle_adjuster_cmd), verbose=verbose) "--BundleAdjustment.refine_principal_point 1",
CONSOLE.log("[bold green]:tada: Done refining intrinsics.") ]
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]: def parse_colmap_camera_params(camera) -> Dict[str, Any]: