mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-07 00:09:14 +08:00
scripts/exporter.py: export PLY compatible with PCL (#1572)
* scripts/exporter.py: export PLY compatible with PCL Use the newer Open3D Tensor API to write pointclouds as float32, which are compatible with PCL (see https://github.com/isl-org/Open3D/issues/1633). fixes https://github.com/nerfstudio-project/nerfstudio/issues/1571 * exporter.py: pylint: disable=no-member fixes https://github.com/nerfstudio-project/nerfstudio/actions/runs/4377569585/jobs/7661246358#step:10:13 open3d.core.Dtype has been around since open3d 0.11.0 http://www.open3d.org/docs/0.11.0/python_api/open3d.core.Dtype.html --------- Co-authored-by: Frédéric Devernay <f-dy@users.noreply.github.com>
This commit is contained in:
1 parent
99afaa7164
commit
21a452f1b4
1 file changed
+7
-1
+7
-1
@@ -2,6 +2,8 @@
|
|||||||
Script for exporting NeRF into other formats.
|
Script for exporting NeRF into other formats.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# pylint: disable=no-member
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import json
|
import json
|
||||||
@@ -94,7 +96,11 @@ class ExportPointCloud(Exporter):
|
|||||||
|
|
||||||
CONSOLE.print(f"[bold green]:white_check_mark: Generated {pcd}")
|
CONSOLE.print(f"[bold green]:white_check_mark: Generated {pcd}")
|
||||||
CONSOLE.print("Saving Point Cloud...")
|
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")
|
print("\033[A\033[A")
|
||||||
CONSOLE.print("[bold green]:white_check_mark: Saving Point Cloud")
|
CONSOLE.print("[bold green]:white_check_mark: Saving Point Cloud")
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user