Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Update pointcloud_io.py (#3345)

Thimoté Dupuchdf52ff018435
diff --git a/kornia/utils/pointcloud_io.py b/kornia/utils/pointcloud_io.py
index 6fe1c25f0..c2baf61bd 100644
--- a/kornia/utils/pointcloud_io.py
+++ b/kornia/utils/pointcloud_io.py
@@ -47,14 +47,18 @@ def save_pointcloud_ply(filename: str, pointcloud: torch.Tensor) -> None:
with open(filename, "w", encoding="utf-8") as f:
# Write PLY header
- f.write("ply\n")
- f.write("format ascii 1.0\n")
- f.write("comment arraiy generated\n")
- f.write(f"element vertex {valid_count}\n")
- f.write("property double x\n")
- f.write("property double y\n")
- f.write("property double z\n")
- f.write("end_header\n")
+ f.writelines(
+ [
+ "ply\n",
+ "format ascii 1.0\n",
+ "comment arraiy generated\n",
+ f"element vertex {valid_count}\n",
+ "property double x\n",
+ "property double y\n",
+ "property double z\n",
+ "end_header\n",
+ ]
+ )
if valid_count > 0:
# Move to CPU, convert to float64 for matching 'double' in header