Skip to content

Commit

Permalink
Change parameter names and add voxel size parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Jameson-Crate committed Dec 22, 2024
1 parent 200d012 commit 0397ee8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 4 additions & 0 deletions docs/quickstart/custom_dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,10 @@ follow these steps:
ns-process-data record3d --data {data directory} --ply {ply directory} --output-dir {output directory}
```

Additionally you can specify `--voxel-size {float}` which determines the level of sparsity when downsampling from the dense
point clouds generated by Record3D to the sparse point cloud used in Nerfstudio. The default value is 0.8, lower is less
sparse, higher is more sparse.

(spectacularai)=

## Spectacular AI
Expand Down
5 changes: 3 additions & 2 deletions nerfstudio/process_data/record3d_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def record3d_to_json(
metadata_path: Path,
output_dir: Path,
indices: np.ndarray,
ply_dirname: Optional[Path] = None,
ply_dirname: Optional[Path],
voxel_size: Optional[float],
) -> int:
"""Converts Record3D's metadata and image paths to a JSON file.
Expand Down Expand Up @@ -104,7 +105,7 @@ def record3d_to_json(
pcd = o3d.geometry.PointCloud()
for ply_filename in ply_dirname.iterdir():
temp_pcd = o3d.io.read_point_cloud(str(ply_filename))
pcd += temp_pcd.voxel_down_sample(voxel_size=0.8)
pcd += temp_pcd.voxel_down_sample(voxel_size=voxel_size)

# Save point cloud
points3D = np.asarray(pcd.points)
Expand Down
12 changes: 9 additions & 3 deletions nerfstudio/scripts/process_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ class ProcessRecord3D(BaseConverterToNerfstudioDataset):
2. Converts Record3D poses into the nerfstudio format.
"""

ply: Optional[Path] = None
ply_dir: Optional[Path] = None
"""Path to the Record3D directory of point export ply files."""
voxel_size: Optional[float] = 0.8
"""Voxel size for down sampling dense point cloud"""

num_downscales: int = 3
"""Number of times to downscale the images. Downscales by 2 each time. For example a value of 3
Expand Down Expand Up @@ -104,9 +106,13 @@ def main(self) -> None:
)

metadata_path = self.data / "metadata.json"
ply_path = self.ply if hasattr(self, "ply") else None
record3d_utils.record3d_to_json(
copied_image_paths, metadata_path, self.output_dir, indices=idx, ply_dirname=ply_path
copied_image_paths,
metadata_path,
self.output_dir,
indices=idx,
ply_dirname=self.ply_dir,
voxel_size=self.voxel_size,
)
CONSOLE.rule("[bold green]:tada: :tada: :tada: All DONE :tada: :tada: :tada:")

Expand Down

0 comments on commit 0397ee8

Please sign in to comment.