daavoo / pyntcloud

pyntcloud is a Python library for working with 3D point clouds.
http://pyntcloud.readthedocs.io
MIT License
1.39k stars 221 forks source link

scalar field writing #281

Closed Ciaran1981 closed 3 years ago

Ciaran1981 commented 4 years ago

Is it possible to write a custom scalar field? Can the data be inserted via numpy array?

tgoelles commented 4 years ago

Yes that would also be interesting for lidar application. Lidar give x,y,z data and in addition intensity, noise, range and more.

Ciaran1981 commented 4 years ago

Yes - it can be done outside this lib but would be great given it's other utilities

daavoo commented 3 years ago

Hola @Ciaran1981!

The pandas DataFrame stored at Pyntcloud.points can be modified as you wish. A new scalar_field can be considered in this case a new column of this pandas DataFrame so you can just add the column as follows:

from pyntcloud import PyntCloud

cloud = PyntCloud.from_file("test/data/filters/filters.ply")
# compute a new scalar_field
# you can retrieve the new scalar field from whatever source you need
above_03 = cloud.points["z"] > 0.3
# add the new scalar field
cloud.points["my_new_scalar_field"] = above_03
Ciaran1981 commented 3 years ago

Ah yes I discovered this after I asked the question and forgot to update. Thanks for clarifying. Great lib!