Working with LAS and PCD Files

It’s possible to read pointcloud files with the format .las and .pcd. In order to read them just the submodule PointCloud.from_file():

[ ]:
from pathlib import Path

import laspy
import numpy as np

import pointcloudset as pcs
[ ]:
testpcd = Path().cwd().parent.joinpath("../../../tests/testdata/las_files/test_tree.pcd")
testlas = testpcd = Path().cwd().parent.joinpath("../../../tests/testdata/las_files/test_tree.las")

[ ]:
las_pc = pcs.PointCloud.from_file(testlas)
pcd_pc = pcs.PointCloud.from_file(testpcd)

Note:

Coordinates might not be correct yet, since the offset and scale values that are stored within the .las-file are not applied. But now you can use the data as a pcs.PointCloud and analyze + edit it.

[ ]:
las_pc.data
[ ]:
las_pc.plot(color="z")
[ ]:
def treetop(frame: pcs.PointCloud) -> pcs.PointCloud:
    return frame.limit("z", 8, 19)


tip = treetop(las_pc)
[ ]:
tip.plot(color="z")