fix: PLY décimation voxel volumétrique 3D + open3d lazy import
This commit is contained in:
@@ -96,9 +96,11 @@ def _load_data() -> dict:
|
|||||||
import open3d as o3d
|
import open3d as o3d
|
||||||
pcd = o3d.io.read_point_cloud(_PLY_PATH)
|
pcd = o3d.io.read_point_cloud(_PLY_PATH)
|
||||||
n_pts = len(pcd.points)
|
n_pts = len(pcd.points)
|
||||||
if n_pts > 200_000:
|
MAX_PTS = 300_000
|
||||||
vox = float((pcd.get_max_bound() - pcd.get_min_bound()).max()) * (200_000 / n_pts) ** (1/3)
|
if n_pts > MAX_PTS:
|
||||||
pcd = pcd.voxel_down_sample(float(vox))
|
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)
|
pts = np.asarray(pcd.points)
|
||||||
ce = out.get("origin", {}).get("easting", 0.0)
|
ce = out.get("origin", {}).get("easting", 0.0)
|
||||||
cn = out.get("origin", {}).get("northing", 0.0)
|
cn = out.get("origin", {}).get("northing", 0.0)
|
||||||
|
|||||||
Reference in New Issue
Block a user