add open3d example

This commit is contained in:
k.koide 2024-04-01 14:53:12 +09:00
parent 91f01900a8
commit 39b81247b3
1 changed files with 20 additions and 0 deletions

View File

@ -275,6 +275,12 @@ Example B : Perform preprocessing and registration separately
target, target_tree = small_gicp.preprocess_points(points_numpy=target_raw_numpy, downsampling_resolution=0.25)
source, source_tree = small_gicp.preprocess_points(points_numpy=source_raw_numpy, downsampling_resolution=0.25)
# `target` and `source` are small_gicp.PointCloud with the following methods
target.size() # Number of points
target.points() # Nx4 numpy array [x, y, z, 1] x N
target.normals() # Nx4 numpy array [nx, ny, nz, 0] x N
target.covs() # Array of 4x4 covariance matrices
# Align point clouds
# Arguments
# - target : Target point cloud (small_gicp.PointCloud)
@ -310,6 +316,20 @@ small_gicp.estimate_covariances(source, source_tree)
result = small_gicp.align(target, source, target_tree)
```
Example D: Example with Open3D
```python
target_o3d = open3d.io.read_point_cloud('small_gicp/data/target.ply').paint_uniform_color([0, 1, 0])
source_o3d = open3d.io.read_point_cloud('small_gicp/data/source.ply').paint_uniform_color([0, 0, 1])
target, target_tree = small_gicp.preprocess_points(points_numpy=numpy.asarray(target_o3d.points), downsampling_resolution=0.25)
source, source_tree = small_gicp.preprocess_points(points_numpy=numpy.asarray(source_o3d.points), downsampling_resolution=0.25)
result = small_gicp.align(target, source, target_tree)
source_o3d.transform(result.T_target_source)
open3d.visualization.draw_geometries([target_o3d, source_o3d])
```
</details>
## Benchmark