isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
10.82k stars 2.24k forks source link

Inconsistent rotation matrix of get_oriented_bounding_box() #6245

Open robinvetsch opened 1 year ago

robinvetsch commented 1 year ago

Checklist

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

    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?

Many thanks for the help.

image Results in Open3D

image Results in robotics simulation

theNded commented 10 months ago

I have trouble understanding the results in robotics simulation. Would you please elaborate more what would be the expected outcome?