tag exported ply files (#3472)

* tag exported ply files

* Added the version

* fix import order

* Added information about the up-axis
This commit is contained in:
Simon Bethke authored and GitHub committed 2024-10-13 18:48:52 -07:00
1 parent 67be06009e
commit adc743c3a0
1 file changed
+4 -1
+4 -1
View File
@@ -24,6 +24,7 @@ import sys
import typing import typing
from collections import OrderedDict from collections import OrderedDict
from dataclasses import dataclass, field from dataclasses import dataclass, field
from importlib.metadata import version
from pathlib import Path from pathlib import Path
from typing import List, Optional, Tuple, Union, cast from typing import List, Optional, Tuple, Union, cast
@@ -534,10 +535,12 @@ class ExportGaussianSplat(Exporter):
raise ValueError("All tensors must be numpy arrays of float or uint8 type and not empty") raise ValueError("All tensors must be numpy arrays of float or uint8 type and not empty")
with open(filename, "wb") as ply_file: with open(filename, "wb") as ply_file:
nerfstudio_version = version("nerfstudio")
# Write PLY header # Write PLY header
ply_file.write(b"ply\n") ply_file.write(b"ply\n")
ply_file.write(b"format binary_little_endian 1.0\n") ply_file.write(b"format binary_little_endian 1.0\n")
ply_file.write(f"comment Generated by Nerstudio {nerfstudio_version}\n".encode())
ply_file.write(b"comment Vertical Axis: z\n")
ply_file.write(f"element vertex {count}\n".encode()) ply_file.write(f"element vertex {count}\n".encode())
# Write properties, in order due to OrderedDict # Write properties, in order due to OrderedDict