Main Content


Select subset of lidar point attributes

Since R2024a



ptAttrOut = select(ptAttr,indices) selects the subset of lidar point attributes specified by the linear or logical indices indices from the input lidarPointAttributes object ptAttr.


collapse all

Create a lasFileReader object to access data from a LAZ file.

path = fullfile(toolboxdir("lidar"),"lidardata", ...
lasReader = lasFileReader(path);

Read point cloud data and the associated classification point attributes from the LAZ file using the readPointCloud function.

[ptCloud,ptAttr] = readPointCloud(lasReader,Attributes="Classification");

Define a region of interest (ROI) to select points and their attributes from the lidar data.

xmin = ptCloud.XLimits(1);
ymin = ptCloud.YLimits(1);
zmin = ptCloud.ZLimits(1);
ROI = [xmin xmin+50 ymin ymin+50 zmin zmin+50];

Find the indices of the points within ROI, and select the points and their associated point attributes.

idx = findPointsInROI(ptCloud,ROI);
ptCloudB = select(ptCloud,idx);
ptAttrB = select(ptAttr,idx);

Color the points based on their classification attributes. Reshape the label image into the shape of the point cloud.

labels = label2rgb(ptAttrB.Classification);
colorData = reshape(labels,[],3);

Visualize the color-coded point cloud.


Input Arguments

collapse all

Lidar point attributes, specified as a lidarPointAttributes object.

Indices of the selected point attributes, specified as a numeric or logical vector.

  • Numeric vector — Specified as the linear indices of point attributes within the lidarPointAttributes object ptAttr.

  • Logical vector — Specified as a vector of the same length as the value of the Count property of the lidarPointAttributes object ptAttr. Each element of the vector is a logical 0 (false) or 1 (true), where a value of 1 indicates to select the corresponding point attribute.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

Output Arguments

collapse all

Selected lidar point attributes, returned as a lidarPointAttributes object.

Version History

Introduced in R2024a