isl-org / Open3D

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

Is it possible to implement gridmap in open3d? #1765

Closed crea397 closed 4 years ago

crea397 commented 4 years ago

Set up a grid map in the xy plane represented by a rectangular grid with a certain width, and compute the dispersion in the z-axis in each cell.

In each cell, if the average value in the z-axis direction exceeds the threshold value, the data in the cell is treated as a three-dimensional object.

How to do this in open3D?

syncle commented 4 years ago

How about using VoxelGrid? http://www.open3d.org/docs/release/python_api/open3d.geometry.VoxelGrid.html You may voxelize point sets, and take a custom operation over z-axis.

crea397 commented 4 years ago

Thank you for your reply.

I have tried VoxelGrid. I tried to run VoxelGrid.voxels to get the coordinates for each Voxel. However, I couldn't run it with the following error.

import open3d as o3d
pcd = o3d.io.read_point_cloud('./examples/TestData/fragment.pcd')
voxel_grid = o3d.geometry.VoxelGrid.create_from_point_cloud(pcd, voxel_size=0.1)
print(voxel_grid.voxel_size)
print(voxel_grid.voxels)

print(voxel.voxels) TypeError: unhashable type: 'numpy.ndarray'

Why do I get an error? voxel_grid.voxel_size was able to run.


Enviroment

If I use the VoxelGrid, how do I get the coordinates for each Voxel? Also, how do I get the average of the z-coordinates of a cell (or Voxel) in a given xy plane?

crea397 commented 4 years ago

[Solved] I'm sorry.

I was looking at version 0.9 of the document. I compiled Open3D from the source and reinstalled it. Then, referring to the latest version of the documentation, I was able to get the coordinates of Voxel using VoxelGrid.get_voxels().

Thank you very much!