Skip to content

Commit

Permalink
scripts/exporter.py: export PLY compatible with PCL
Browse files Browse the repository at this point in the history
Use the newer Open3D Tensor API to write pointclouds as float32, which
are compatible with PCL (see isl-org/Open3D#1633).

fixes nerfstudio-project#1571
  • Loading branch information
f-dy committed Mar 10, 2023
1 parent 99afaa7 commit 6e8b033
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ def main(self) -> None:

CONSOLE.print(f"[bold green]:white_check_mark: Generated {pcd}")
CONSOLE.print("Saving Point Cloud...")
o3d.io.write_point_cloud(str(self.output_dir / "point_cloud.ply"), pcd)
tpcd = o3d.t.geometry.PointCloud.from_legacy(pcd)
# The legacy PLY writer converts colors to UInt8,
# let us do the same to save space.
tpcd.point.colors = (tpcd.point.colors * 255).to(o3d.core.Dtype.UInt8)
o3d.t.io.write_point_cloud(str(self.output_dir / "point_cloud.ply"), tpcd)
print("\033[A\033[A")
CONSOLE.print("[bold green]:white_check_mark: Saving Point Cloud")

Expand Down

0 comments on commit 6e8b033

Please sign in to comment.