pymccrgb.core module

Multiscale curvature classification of ground points with color updates

pymccrgb.core.classify_ground_mcc(data, scale, tol, downsample=False)[source]

Classifies ground points by a single iteration of the MCC algorithm

Classifies ground and nonground (or “high”) points by comparing the elevation of each data point to an interpolated surface. If downsample is True, a down-sampled version of the data coordinates will be used when interpolating (currently not implemented).

Based on MCC algorithm implemented in [1] and [2].

[1]Evans, Jeffrey S.; Hudak, Andrew T. 2007. A multiscale curvature algorithm for classifying discrete return LiDAR in forested environments. Geoscience and Remote Sensing. 45(4): 1029-1038.
[2]https://sourceforge.net/p/mcclidar
Parameters:
data: array

A n x 3 (or more) data matrix with rows [x, y, z, …]

scale: float

The interpolation scale. This defines the resolution of the interpolated surface, which is calculated by a 3 x 3 windowed mean around each intrpolation point.

tol: float

The height tolerance. Points exceeding the durface by more than tol units are classified as nonground

downsample: bool

If True, use a downsampled dataset for interpolation. Not implemented.

Returns:
An n x 1 array of point class labels. By default, 1 is ground,

and 0 is nonground.

pymccrgb.core.mcc(data, scales=[0.5, 1, 1.5], tols=[0.3, 0.3, 0.3], threshs=[1, 0.1, 0.01], use_las_codes=False, verbose=False)[source]

Classifies ground points using the MCC algorithm

Classifies ground and nonground (or “high”) points by comparing the elevation of each data point to an interpolated surface at user-defined scales. The algorithm iterates at each scale until a convergence threshold is reached based on the percentage of points classified as ground. Only ground points are retained after each iteration.

Based on MCC algorithm implemented in [1] and [2].

[1]Evans, Jeffrey S.; Hudak, Andrew T. 2007. A multiscale curvature algorithm for classifying discrete return LiDAR in forested environments. Geoscience and Remote Sensing. 45(4): 1029-1038.
[2]https://sourceforge.net/p/mcclidar
Parameters:
data: array

A n x d data matrix with rows [x, y, z, …]

scales: list

The interpolation scales. This defines the resolution of the interpolated surface, which is calculated by a 3 x 3 windowed mean around each intrpolation point. Defaults to [0.5, 1, 1.5] meters.

tols: list

The height tolerances. Points exceeding the durface by more than tol units are classified as nonground. Deaults to 0.3 meters.

threshs: list

The convergence thresholds as percentages. Defaults to [1%, 0.1%, 0.01%]

use_las_codes: bool

If True, return LAS 1.4 classification codes (2 = ground, 4 = medium vegetation). Default False.

Returns:
data: array

An m x d array of ground points

labels: array

An n x 1 array of labels (1 is ground, 0 is nonground)

pymccrgb.core.mcc_rgb(data, scales=[0.5, 1, 1.5], tols=[0.3, 0.3, 0.3], threshs=[1, 0.1, 0.01], training_scales=None, training_tols=None, n_train=1000, max_iter=20, n_jobs=1, seed=None, use_las_codes=False, verbose=False, **pipeline_kwargs)[source]

Classifies ground points using the MCC-RGB algorithm

Classifies ground and nonground (or “high”) points by comparing the elevation of each data point to an interpolated surface at user-defined scales. The algorithm proceeds as MCC (see the mcc() documentation), except that ground points are reclassified based on their color similarity to nonground points.

Parameters:
data: array

A n x d data matrix with rows [x, y, z, r, g, b …]

scales: list

The interpolation scales. This defines the resolution of the interpolated surface, which is calculated by a 3 x 3 windowed mean around each interpolation point. Defaults to [0.5, 1, 1.5] meters. Scale domains are processed in order of increasing scale.

tols: list

The height tolerances. Points exceeding the surface by more than tol units are classified as nonground. Deaults to 0.3 meters.

threshs: list

The convergence thresholds as percentages. Defaults to [1%, 0.1%, 0.01%]

training_scales: list

The training interpolation scales. This defaults to the first scale domain (e.g., 0.5). Both training_scales and training_tols must be specified; otherwise the defaults are used.

training_tols: list

The training relative heights. Defaults to the first height tolerance (e.g., 0.3). Can be specified as a list or single value

n_train: int

The total number of points to use for training the color classifier. Defaults to 1E5.

max_iter: int

Maximum number of iterations in a scale domain. Defaults to 20.

seed: int

Optional seed value for selecting training data.

use_las_codes: bool

If True, return LAS 1.4 classification codes (2 = ground, 4 = medium vegetation). Default False.

Returns:
data: array

An m x d array of ground points

labels: array

An n x 1 array of labels (1 is ground, 0 is nonground)

updated: array

An n x 1 array of labels indicating whether the point was updated in an MCC-RGB step. -1 indicates the point’s classification was not updated. If there are multiple training scales, this will be the index of the scale and tolerance range defined in training_scales and training_tols.