在 z 轴上旋转点云

rotate a pointcloud in z axis

我正在尝试旋转 pcd 但出现以下错误,我该如何修复 -

import open3d as o3d 
import numpy as np 

xyz = o3d.io.read_point_cloud("data.pcd")
xyz = xyz.rotate(xyz.get_rotation_matrix_from_xyz((0.7 * np.pi, 0, 0.6 * np.pi)),center=True)

错误-

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: get_rotation_matrix_from_xyz(): incompatible function arguments. The following argument types are supported:
    1. (rotation: numpy.ndarray[float64[3, 1]]) -> numpy.ndarray[float64[3, 3]]

Invoked with: array([[-0.30901699, -0.95105652,  0.        ],
       [-0.55901699,  0.18163563, -0.80901699],
       [ 0.76942088, -0.25      , -0.58778525]]); kwargs: center=True

我该如何修复

center参数不是布尔值,但应该描述旋转中心(参见docs):

center (numpy.ndarray[float64[3, 1]]) – Rotation center used for transformation

这将围绕原点 (0,0,0) 旋转:

import open3d as o3d 
import numpy as np 

xyz = o3d.io.read_point_cloud("data.pcd")
R = xyz.get_rotation_matrix_from_xyz((0.7 * np.pi, 0, 0.6 * np.pi))
xyz = xyz.rotate(R, center=(0,0,0))