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. 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. My idea is to create obb enclosing boxes with abb enclosing boxes and then compare the two and rotate them cyclically. 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.
To get that 3x3 rotation matrix you have multiple options:
open3d.geometry.get_rotation_matrix_from_axis_angle
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)e.g.
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)