一、代码
Python
import open3d as o3d
import numpy as npdef rotate_pointcloud(pointcloud, degree, axis):radian = np.radians(degree)if axis == 0:restore = pointcloud.get_rotation_matrix_from_xyz((radian, 0, 0))pointcloud.rotate(restore, center=(0, 0, 0))elif axis == 1:restore = pointcloud.get_rotation_matrix_from_xyz((0, radian, 0))pointcloud.rotate(restore, center=(0, 0, 0))elif axis == 2:restore = pointcloud.get_rotation_matrix_from_xyz((0, 0, radian))pointcloud.rotate(restore, center=(0, 0, 0))return pointclouddef translate_pointcloud(pointcloud, translate, axis):if axis == 0:pointcloud = pointcloud.translate((translate, 0, 0))elif axis == 1:pointcloud = pointcloud.translate((0, translate, 0))elif axis == 2:pointcloud = poi