Point Clouds¶
Point-cloud measurements describe height, intensity, and point density within object polygons. Add them to the same table as your raster features, then use the combined measurements for classification.
The recommended order is:
- create segment objects from a raster
- add point-cloud features to those segment objects
- label training segments
- classify the enriched segment table
Install file readers¶
For LAS/LAZ files, install PDAL in a conda environment, then install OBIA with
pip in that environment. In-memory arrays and tables do not need file readers.
1 2 3 | |
If you already have an environment, install PDAL from conda-forge before installing OBIA:
1 2 | |
The conda-forge PDAL package is usually more reliable than installing PDAL through pip because the Python bindings need the PDAL base library.
To include the optional pyforestscan reader, install the point-cloud extra after activating the same environment:
1 | |
Add features to objects¶
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
The output preserves segment rows and appends pc_* feature columns. Segment geometries are used to select points; no new object boundaries are created.
If the point cloud has no CRS, pass one explicitly:
1 2 3 4 5 | |
Use in-memory points¶
Point clouds can also be passed as a DataFrame:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
GeoDataFrames and NumPy arrays are also supported.
Structured arrays can use X, Y, Z, and Intensity fields. Plain NumPy arrays are interpreted as columns in this order:
1 | |
Feature columns¶
Height metrics use the pc_z_* prefix:
pc_z_minpc_z_maxpc_z_meanpc_z_medianpc_z_stdpc_z_p5,pc_z_p25,pc_z_p50,pc_z_p75,pc_z_p95
Intensity metrics use the pc_intensity_* prefix. Density features include:
pc_point_countpc_density
Use the features in classification¶
Label the object table after adding the measurements:
1 2 3 4 5 6 | |
Then train a classifier:
1 2 3 4 5 6 7 8 | |
The predicted output keeps the original segment geometry and the added point-cloud columns.