select
Description
Examples
Select Lidar Point Attributes from LAZ File
Create a lasFileReader
object to access data from a LAZ file.
path = fullfile(toolboxdir("lidar"),"lidardata", ... "las","aerialLidarData.laz"); 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.
figure pcshow(ptCloudB.Location,colorData)
Input Arguments
ptAttr
— Lidar point attributes
lidarPointAttributes
object
Lidar point attributes, specified as a lidarPointAttributes
object.
indices
— Indices of selected point attributes
numeric vector | logical vector
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
objectptAttr
.Logical vector — Specified as a vector of the same length as the value of the
Count
property of thelidarPointAttributes
objectptAttr
. Each element of the vector is a logical0
(false
) or1
(true
), where a value of1
indicates to select the corresponding point attribute.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| logical
Output Arguments
ptAttrOut
— Selected lidar point attributes
lidarPointAttributes
object
Selected lidar point attributes, returned as a lidarPointAttributes
object.
Version History
Introduced in R2024a
See Also
Functions
Objects
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)