isl-org / isl-org/Open3D

How to transform pointcloud and bounding box in the same way?

Open
#4,875 6 comments 2 reactions 0 assignees View on GitHub
question
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).

### My Question

I have a model as a sampled point cloud and a scene as a point cloud. I want to transform the model correctly in the scene with a given transformation and also want to transform the bounding box of the model correctly into the scene.

Steps:
1. Create axis aligned box of model pcd
2. Convert axis aligned box to oriented bounding box
3. Transform oriented box into scene
4. Transform model pcd into scene

I use model.transform(_transformation_mat_) which works correctly, but the box.transform() is not implemented so I need to use box.rotate() and box.translate(). But it is not the same like the model.transform().

code example:
```
model = o3d.io.read_point_cloud()
scene = o3d.io.read_point_cloud()

aabox = GT_PCL.get_axis_aligned_bounding_box()
aabox.color = (1, 0, 0)

o3d.visualization.draw_geometries([model, aabox])

obox = o3d.geometry.OrientedBoundingBox.create_from_axis_aligned_bounding_box(aabox)
obox.rotate(rob_T_obj[0:3, 0:3])
obox.translate(rob_T_obj[0:3, 3], relative = False)
obox.color = (1, 0, 0)

model.transform(rob_T_obj)

o3d.visualization.draw_geometries([model, obox])
o3d.visualization.draw_geometries([scene, model, obox])
```

The screenshots, show the model and the axis aligned box, the model and the box after transformation and the model/box in the scene (yellow points are the model which are correctly transformed).
![Screenshot from 2022-03-10 08-55-18](https://user-images.githubusercontent.com/50514526/157614896-8e5de45e-b4b2-45b8-bb6c-7d2efce95ed1.png)

![Screenshot from 2022-03-10 08-55-46](https://user-images.githubusercontent.com/50514526/157614892-87d5d693-511b-42f8-99db-8a278a1edcce.png)

![Screenshot from 2022-03-10 08-55-58](https://user-images.githubusercontent.com/50514526/157614888-ae3cfa7f-91f1-456b-9d82-5d1517501dc1.png)

If I use model.rotate() and model.translate() the model is also not correctly transformed into the scene. I also tried to get the oriented box after the model transformation but the oriented box is rotated relative to the model, so I want to use this approach. I also tried with box.translate(..., relative=Ture) but it's also not working.

Can you help me?

Thank you in advance!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.