将拉伸变形环形点云还原为原始圆形的变换方法求助
环形拉伸点云还原为圆形的问题与尝试方法
有一组由激光轮廓仪采集的环形点云(如图所示),当前呈现拉伸变形状态,仅已知该点云的XYZ坐标,希望将其变换还原为原始圆形。尝试了以下两种方法均未成功:
方法1
x_min = 0 x_max = 360 D = 1 x_coordinates = xyz[:, 1] y_coordinates = xyz[:, 0] z_coordinates = xyz[:, 2] theta = (x_coordinates - x_min)/(x_max - x_min)*2*np.radians(180) gamma = D - y_coordinates x_round = gamma * np.cos(theta) y_round = gamma * np.sin(theta) z_round = z_coordinates assert x_round.ndim == 1 and y_round.ndim == 1 and z_round.ndim == 1, "Arrays must be 1-dimensional" points = np.stack((x_round, y_round, z_round), axis=-1) # Stack arrays along a new axis to get Nx3 pcd = o3d.geometry.PointCloud() pcd.points = o3d.utility.Vector3dVector(points) o3d.visualization.draw_geometries([pcd], window_name="Original Shape")
方法2
def cart2sph(x, y, z): xy = np.sqrt(x**2 + y**2) # sqrt(x² + y²) x_2 = x**2 y_2 = y**2 z_2 = z**2 r = np.sqrt(x_2 + y_2 + z_2) # r = sqrt(x² + y² + z²) theta = np.arctan2(y, x) phi = np.arctan2(xy, z) return r, theta, phi
内容的提问来源于stack exchange,提问作者José Alejandro Donate
相关产品推荐
相关产品推荐

