feat: 算法升级、整车配准集成与性能分析文档
算法更新: delivery v1.2.1、平整度v1.5、测距v2.2、整车配准v1.3 适配器: vehicle-registration 新增、各算法 manifest 和 adapter 更新 后端: taskCadFiles/source 字段迁移、derivedPointClouds 注册、取消任务联动 前端: ElapsedTime 时长显示、两步算法流程、canRun 逻辑修复 文档: 新增5份算法性能分析报告
This commit is contained in:
29
alg/平整度、平面度、轮廓测量v1.5/preprocessing/noise.py
Normal file
29
alg/平整度、平面度、轮廓测量v1.5/preprocessing/noise.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import copy
|
||||
|
||||
import numpy as np
|
||||
import open3d as o3d
|
||||
|
||||
|
||||
class GaussianNoiseAdder:
|
||||
"""Add Gaussian noise to an Open3D point cloud."""
|
||||
|
||||
def __init__(self, noise_std: float = 4.0, seed: int | None = None) -> None:
|
||||
self.noise_std = noise_std
|
||||
self.seed = seed
|
||||
|
||||
def apply(self, pointcloud: o3d.geometry.PointCloud) -> o3d.geometry.PointCloud:
|
||||
noisy = copy.deepcopy(pointcloud)
|
||||
points = np.asarray(noisy.points)
|
||||
rng = np.random.default_rng(self.seed)
|
||||
noise = rng.normal(0, self.noise_std, points.shape)
|
||||
noisy.points = o3d.utility.Vector3dVector(points + noise)
|
||||
return noisy
|
||||
|
||||
def noise_level(self, clean: o3d.geometry.PointCloud, noisy: o3d.geometry.PointCloud) -> float:
|
||||
clean_points = np.asarray(clean.points)
|
||||
noisy_points = np.asarray(noisy.points)
|
||||
if clean_points.shape != noisy_points.shape:
|
||||
raise ValueError("Clean and noisy point clouds must have the same point count.")
|
||||
return float(np.mean(np.linalg.norm(noisy_points - clean_points, axis=1)))
|
||||
Reference in New Issue
Block a user