Main Content

readPointCloud

从LAS或LAZ文件读取点云数据

Description

例子

ptcloud= ReadPointCloud(Lasreaderreads the point cloud data from the LAS or LAZ file indicated by the inputlasFileReader对象并将其归还为pointCloud目的,ptcloud

例子

[[ptcloud,,,,ptattributes] = readPointCloud(Lasreader,“属性”,ptAtt读取指定的点属性ptAttfrom a LAS or LAZ file. In addition to the point cloud, the function returns the specified attributes of each point in the point cloud.

[[___] = readPointCloud(___,,,,名称,价值除了以前的语法中的任何参数组合外,还使用一个或多个名称值对参数指定选项。例如,“ ROI”,,,,[5 10 5 10 5 10]sets the region of interest (ROI) in which the function reads the point cloud.

Examples

全部收缩

This example shows how to read and visualize point cloud data from a LAS / LAZ file.

创建一个lasFileReaderLAZ文件的对象。然后,使用readPointCloudfunction to read point cloud data from the LAZ file and generate apointCloud目的。

创建一个lasFileReader目的to access the LAZ file data.

path = fullfile(toolboxdir(“ LIDAR”),“ Lidardata”,,,,。。。"las",,,,“ Aeriallidardata.laz”);Lasreader= lasFileReader(path);

使用laz文件读取点云数据readPointCloud功能。

ptcloud= ReadPointCloud(Lasreader);

可视化点云。

figure pcshow(ptCloud.Location)

图包含一个轴对象。轴对象包含类型散点的对象。

基于LAZ文件的分类数据划分和可视化点云数据。

创建一个lasFileReader对象可以从LAZ文件访问数据。

path = fullfile(toolboxdir(“ LIDAR”),“ Lidardata”,,,,。。。"las",,,,“ Aeriallidardata.laz”);Lasreader= lasFileReader(path);

使用LAZ文件读取点云数据和关联的分类点属性readPointCloud功能。

[ptcloud,pointattributes] = readpointcloud(lasreader,,"Attributes",,,,“分类”);

根据其分类属性为点上色。将标签图像重塑为点云的形状。

labels = label2rgb(pointAttributes.Classification);colordata = reshape(标签,[],3);

可视化颜色编码点云。

图PCSHOW(PTCLOUD.Location,Colordata)

图包含一个轴对象。轴对象包含类型散点的对象。

输入参数

全部收缩

LAS或LAZ文件读取器,指定为lasFileReader目的。

点属性,指定为字符向量,字符串标量,字符矢量的单元格数或字符串向量。输入必须包含其中一个或多个选项:

  • “分类”

  • “ gpstimestamp”

  • "LaserReturn"

  • “数字”

  • "NearIR"

  • “扫描”

  • “用户数据”

  • “ Pointsourceid”

  • “ ScannerChannel”

  • "ScanDirectionFlag"

  • “ EdgeOfflightlineFlag”

  • "WaveformData"

该函数返回一个中每个点的指定属性LIDARPOINTATTRIBUTS目的,ptattributes。这unspecified attributes are returned empty.

Data Types:char|string|细胞

名称值参数

将可选的参数对Name1=Value1,...,NameN=ValueN,,,,whereName是参数名称和价值一世s the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and encloseName一世n quotes.

Example:“ ROI”,,,,[5 10 5 10 5 10]sets the region of interest (ROI) in which the function reads the point cloud.

ROIto read in the point cloud, specified as the comma-separated pair consisting of'ROI'and a six-element row vector in the order, [XminX最大限度yminy最大限度zminz最大限度]. Each element must be a real number. The values specify the ROI boundaries in theX- ,,y-, 和z-axis.

Data Types:single|double|int8|一世nt16|一世nt32|一世nt64|uint8|uint16|uint32|Uint64

GPS时间戳范围,指定为逗号分隔对'gpstimespan'and a two-element vector of期间对象,表示[startTimeendTime]. The timestamps must be positive.

Data Types:期间

兴趣的分类数字,指定为逗号分隔对'分类'以及有效分类数字的向量。

有效分类数字范围为0到255。

Classification Number 分类类型
0 创建,从未分类
1 Unclassified
2 地面
3 Low vegetation
4 中等植被
5 高植被
6 建造
7 低点(噪声)
8 预订的
9
10 Rail
11 路面
12 预订的
13 Wire guard (shield)
14 电线导体(相)
15 Transmission tower
16 Wire-structure connector (insulator)
17 桥甲板
18 高噪音
19 Overhead structure
20 Ignored ground
21
22 Temporal exclusion
23-63 预订的
64-255 用户自定义

这se are standard class names and class-object mappings. The class definition and mapping might differ from the standard depending on the application that created the LAS or LAZ file.

Data Types:single|double|int8|一世nt16|一世nt32|一世nt64|uint8|uint16|uint32|Uint64

分离其返回号的点数,指定为逗号分隔对“激光”以及有效返回号码的向量。有效的返回号码是整数从1到该值NumReturns输入的属性lasFileReader目的。For each value,一世,,,,一世n the vector, the function returns a point cloud of only the points that have一世作为他们的返回号码。

这return number is the number of times a laser pulse reflects back to the sensor.

Data Types:single|double|int8|一世nt16|一世nt32|一世nt64|uint8|uint16|uint32|Uint64

Output Arguments

全部收缩

点云,返回pointCloud目的。

点属性数据,返回为LIDARPOINTATTRIBUTS目的。该对象包含指定属性的数据ptAtt每个点ptcloud输出。

版本历史记录

在R2020b中引入

expand all

R2022A中的行为发生了变化

R2022A中的行为发生了变化