[英]How to rotate a point cloud so that the obb of the point cloud coincides with the abb
I have a series of radar point clouds and I have used shapfile to segment out several of these areas, which are all rectangular in shape from the z-axis.我有一系列雷达点云,我使用 shapfile 分割出其中几个区域,这些区域都是从 z 轴开始的矩形。 I would like to know if there is a way to rotate them so that one edge is parallel to the x or y axis.我想知道是否有办法旋转它们,使一条边平行于 x 或 y 轴。 My idea is to create obb enclosing boxes with abb enclosing boxes and then compare the two and rotate them cyclically.我的想法是用abb包围盒创建obb包围盒,然后比较两者并循环旋转它们。 Thanks!谢谢!
aabb = cloud.get_axis_aligned_bounding_box()
aabb.color = (1, 0, 0)
obb = cloud.get_oriented_bounding_box()
obb.color = (0, 1, 0)
You should be able to call cloud.rotate() directly to which you pass a 3x3 rotation matrix.您应该能够直接调用传递 3x3 旋转矩阵的cloud.rotate() 。
To get that 3x3 rotation matrix you have multiple options:要获得 3x3 旋转矩阵,您有多种选择:
open3d.geometry.get_rotation_matrix_from_axis_angle
轴角: open3d.geometry.get_rotation_matrix_from_axis_angle
open3d.geometry.get_rotation_matrix_from_quaternion
四元数: open3d.geometry.get_rotation_matrix_from_quaternion
open3d.geometry.get_rotation_matrix_from_xyz
(and variants ( from_xzy, from_yxz, from_yzx, from_zxy, from_zyx
)) (angles are in radians, not degrees) euler: open3d.geometry.get_rotation_matrix_from_xyz
(和变体( from_xzy, from_yxz, from_yzx, from_zxy, from_zyx
))(角度以弧度为单位,而不是度数)eg例如
cloud.rotate(o3d.geometry.get_rotation_matrix_from_axis_angle([np.radians(90), 0, 0]))
(this should apply a 90 degrees rotation on the x axis: adjust as needed) (这应该在 x 轴上应用 90 度旋转:根据需要调整)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.