fix: PLY décimation voxel volumétrique 3D + open3d lazy import

This commit is contained in:
Floppyrj45
2026-04-24 10:48:55 +00:00
parent 67b323eea8
commit 36c7889db1

View File

@@ -96,9 +96,11 @@ def _load_data() -> dict:
import open3d as o3d
pcd = o3d.io.read_point_cloud(_PLY_PATH)
n_pts = len(pcd.points)
if n_pts > 200_000:
vox = float((pcd.get_max_bound() - pcd.get_min_bound()).max()) * (200_000 / n_pts) ** (1/3)
pcd = pcd.voxel_down_sample(float(vox))
MAX_PTS = 300_000
if n_pts > MAX_PTS:
vol = float(np.prod(pcd.get_max_bound() - pcd.get_min_bound()))
vox = max((vol / MAX_PTS) ** (1/3), 0.02)
pcd = pcd.voxel_down_sample(vox)
pts = np.asarray(pcd.points)
ce = out.get("origin", {}).get("easting", 0.0)
cn = out.get("origin", {}).get("northing", 0.0)