isl-org / isl-org/Open3D

Having an Issue with ICP Output

Open
#5,131 0 comments 0 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'm trying to run ICP on the two point clouds that I'm attaching to this issue using the following code:

```python
import numpy as np
from open3d.cpu.pybind.geometry import PointCloud
from open3d.cpu.pybind.pipelines.registration import registration_icp
from open3d.cpu.pybind.utility import Vector3dVector
from open3d.cpu.pybind.visualization import draw_geometries

def icp(model, target, threshold=1e-3):

reg_p2p = registration_icp(
model_o3d,
target_o3d,
threshold,
init=np.eye(4),
)

return reg_p2p.transformation

if __name__ == '__main__':
source = np.load('grasping/modules/tracking/source.npy')
target = np.load('grasping/modules/tracking/target.npy')

idx = np.random.choice(source.shape[0], 2024, replace=False)
source = source[idx]

model_o3d = PointCloud()
model_o3d.points = Vector3dVector(source)
model_o3d.paint_uniform_color([1, 0, 0])

target_o3d = PointCloud(points=Vector3dVector(target))
target_o3d.points = Vector3dVector(target)
target_o3d.paint_uniform_color([0, 1, 0])

draw_geometries([model_o3d, target_o3d])

T = icp(model_o3d, target_o3d)
model_o3d.transform(T)

draw_geometries([model_o3d, target_o3d])
```

The problem is that even though the two point clouds are initially aligned, the output transformation is not close to the identity matrix and it completely misaligns them.

I leave the picture of the point clouds before and after ICP attached.
![before](https://user-images.githubusercontent.com/47559809/170745087-985c7522-e085-4c24-9d72-64913d256cd3.PNG)
![after](https://user-images.githubusercontent.com/47559809/170745179-4117e63d-f199-4830-bef9-5d45e529b130.PNG)

If anyone would like to test the code these are the point clouds
https://drive.google.com/drive/folders/1KwPkiIpKEdFJOrdppImClwGz9uoqqSoO?usp=sharing

Thanks 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.