Created
December 13, 2022 15:35
-
-
Save hugoledoux/77d7f8a9c019e3c360cbc339e25eebfd to your computer and use it in GitHub Desktop.
polyscope: LAZ + OBJ example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import polyscope as ps | |
| import laspy | |
| import point_cloud_utils as pcu | |
| with laspy.open('m1-off-ground.laz') as fh: | |
| las = fh.read() | |
| #-- get the coordinates as numpy array nx3 | |
| coords = np.vstack((las.x, las.y, las.z)).transpose() | |
| print(coords) | |
| classes = np.array(las.classification) | |
| print(classes) | |
| #-- load OBJ | |
| v, f = pcu.load_mesh_vf("m1-2.obj") | |
| ps.init() | |
| ps.set_up_dir("z_up") | |
| ps.set_ground_plane_mode("shadow_only") | |
| ps.set_ground_plane_height_factor(0.01, is_relative=True) | |
| ps.set_autocenter_structures(True) | |
| ps.set_autoscale_structures(True) | |
| #-- select only 1/100 points to display | |
| ps_pc = ps.register_point_cloud("non-ground", coords[::100], radius=0.0002, point_render_mode='sphere') | |
| #-- put the classification as one scalar | |
| ps_pc.add_scalar_quantity("classification", classes[::100], enabled=True) | |
| ps_mesh = ps.register_surface_mesh("ground", v, f) | |
| ps_pc.reset_transform() | |
| ps_mesh.reset_transform() | |
| ps.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment