|
| 1 | +# Making point clouds fun again |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | +**pyntcloud** is a Python library for working with 3D point clouds leveraging the power of the Python scientific stack. |
| 7 | + |
| 8 | +- [Examples](https://github.com/daavoo/pyntcloud/tree/master/examples). |
| 9 | +- [Documentation](http://pyntcloud.readthedocs.io/en/latest/) |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | +```bash |
| 14 | +pip install pyntcloud |
| 15 | +``` |
| 16 | + |
| 17 | +## Quick Overview |
| 18 | + |
| 19 | +You can access most of pyntcloud's functionality from its core class: PyntCloud. |
| 20 | + |
| 21 | +With PyntCloud you can perform complex 3D processing operations with minimum lines of |
| 22 | +code. For example you can: |
| 23 | + |
| 24 | +- Load a PLY point cloud from disk. |
| 25 | +- Add 3 new scalar fields by converting RGB to HSV. |
| 26 | +- Build a grid of voxels from the point cloud. |
| 27 | +- Build a new point cloud keeping only the nearest point to each occupied voxel center. |
| 28 | +- Save the new point cloud in numpy's NPZ format. |
| 29 | + |
| 30 | +With the following concise code: |
| 31 | + |
| 32 | +```python |
| 33 | +from pyntcloud import PyntCloud |
| 34 | + |
| 35 | +cloud = PyntCloud.from_file("some_file.ply") |
| 36 | + |
| 37 | +cloud.add_scalar_field("hsv") |
| 38 | + |
| 39 | +voxelgrid_id = cloud.add_structure("voxelgrid", n_x=32, n_y=32, n_z=32) |
| 40 | + |
| 41 | +new_cloud = cloud.get_sample("voxelgrid_nearest", voxelgrid_id=voxelgrid_id, as_PyntCloud=True) |
| 42 | + |
| 43 | +new_cloud.to_file("out_file.npz") |
| 44 | +``` |
| 45 | + |
| 46 | +## Integration with other libraries |
| 47 | + |
| 48 | +pyntcloud offers seamless integration with other 3D processing libraries. |
| 49 | + |
| 50 | +You can create / convert PyntCloud instances from / to many 3D processing libraries using the `from_instance` / `to_instance` methods: |
| 51 | + |
| 52 | +- [Open3D](https://www.open3d.org) |
| 53 | + |
| 54 | +```python |
| 55 | +import open3d as o3d |
| 56 | +from pyntcloud import PyntCloud |
| 57 | + |
| 58 | +# FROM Open3D |
| 59 | +original_triangle_mesh = o3d.io.read_triangle_mesh("diamond.ply") |
| 60 | +cloud = PyntCloud.from_instance("open3d", original_triangle_mesh) |
| 61 | + |
| 62 | +# TO Open3D |
| 63 | +cloud = PyntCloud.from_file("diamond.ply") |
| 64 | +converted_triangle_mesh = cloud.to_instance("open3d", mesh=True) # mesh=True by default |
| 65 | +``` |
| 66 | + |
| 67 | +- [PyVista](https://docs.pyvista.org) |
| 68 | + |
| 69 | +```python |
| 70 | +import pyvista as pv |
| 71 | +from pyntcloud import PyntCloud |
| 72 | + |
| 73 | +# FROM PyVista |
| 74 | +original_point_cloud = pv.read("diamond.ply") |
| 75 | +cloud = PyntCloud.from_instance("pyvista", original_point_cloud) |
| 76 | + |
| 77 | +# TO PyVista |
| 78 | +cloud = PyntCloud.from_file("diamond.ply") |
| 79 | +converted_triangle_mesh = cloud.to_instance("pyvista", mesh=True) |
| 80 | +``` |
0 commit comments