I extract the rotation matrix, as well as centre points and all corner points of individual bounding boxes with the following code.
`for i in range(labels.max()+1):
id is array of point names in main point cloud, owned by cluster with label i
id = np.where(labels == i)[0]
pcd_i = outlier_cloud.select_by_index(id)
obb = pcd_i.get_oriented_bounding_box() #robust=False robust flag doen't work
#check if the OBB rotatio matrix is right--handed
rot_mat = obb.R
#rot_mat = getRotationMatrix(rotation_matrix=obb.R)
#check if the cluster is useful
center_point = obb.get_center()
obb.color = (0,1,0)
mesh_r = o3d.geometry.TriangleMesh.create_coordinate_frame(0.1,origin = obb.get_center())
mesh_r.rotate(rot_mat, obb.get_center())
#use only the bounding boxes where the center point is smaller than a treshold value
if center_point[2] <= mean_z_value:
boxes_rotation.append(np.asarray(rot_mat)) #add cornerpoints to list
boxes_center.append(np.asarray(obb.get_center()))
boxes_corner.append(np.asarray(obb.get_box_points()))
box_list.append(obb)
box_list.append(mesh_r)`
I then use the data in a robotics simulation environment to create the boxes in a virtual enviroment. I have noticed that it seems as if the rotation matrix of individual bounding boxes is not consistent.
I always need the rotation to start from a world coordinate system. Can anyone help me with this?
Checklist
master
branch).My Question
I extract the rotation matrix, as well as centre points and all corner points of individual bounding boxes with the following code.
`for i in range(labels.max()+1):
id is array of point names in main point cloud, owned by cluster with label i
I then use the data in a robotics simulation environment to create the boxes in a virtual enviroment. I have noticed that it seems as if the rotation matrix of individual bounding boxes is not consistent.
I always need the rotation to start from a world coordinate system. Can anyone help me with this?
Many thanks for the help.