-4

Hi all I’m have managed to reconstruct a shape using the carve from silhouette voxel carving function in open3D.

How do I count the total number of voxels contained in the grid that makes up the carved 3D model ?

JO92SE
  • 1

1 Answers1

0

You can find the total number of voxels in a VoxelGrid with len(voxel_grid.get_voxels()). Here is a complete example

>>> import open3d as o3d
>>> import numpy as np
>>> 
>>> N = 2000
>>> armadillo_data = o3d.data.ArmadilloMesh()
>>> pcd = o3d.io.read_triangle_mesh(armadillo_data.path).sample_points_poisson_disk(N)
>>> pcd.scale(1 / np.max(pcd.get_max_bound() - pcd.get_min_bound()), center=pcd.get_center())
PointCloud with 2000 points.
>>> voxel_grid = o3d.geometry.VoxelGrid.create_from_point_cloud(pcd, voxel_size=0.05)
>>> 
>>> len(voxel_grid.get_voxels())
737
Dilara Gokay
  • 418
  • 3
  • 10