写在最前边,这是对于Point cloud tools for Matlab网页的整理
https://www.geo.tuwien.ac.at/downloads/pg/pctools/pctools.html#PointCloud_class原网页
pointCloud Import of point cloud data. //输入点云数据,其实是生成点云的功能,主要包含三部分1、输入2、属性3、输出
----------------------------------------------------------------------
工作区有这个就表示生成了点云文件
DESCRIPTION/NOTES
This function creates an object instance of the pointCloud class. For
a listing of available attributes and methods for the pointCloud class
run 'doc pointCloud'.
----------------------------------------------------------------------
INPUT //输入 主要是这两种pc=pcCloud([x y z])和pc=pcCloud(‘文件名.xyz’)
1 [pcData] //例如pcCloud([x y z])就可以直接生成点云
Point cloud input data defined as: //通过文件路径输入
a PATH TO A POINT CLOUD FILE
Absolute or relative path to a:
1 PLAIN TEXT FILE //纯文本格式.txt文件
//pcCloud(‘文件名.xyz’)是可以直接使用,直接生成点云
Column oriented text file where each row correspondonds to one //所以其他格式例如asc要么要转格式,要么就要添加其他功能包
point. The first 3 columns contain the point coordinates x, y //dlmread可以读取asc格式文件,然后再用save保存为xyz格式就行
and z. Further columns can be used for point attributes (e.g. //其他格式转换也类似
color values r, g and b). Two possibilities exist to define the
names of the attributes:
* by using the parameter 'Attributes' (see below)
* by defining the attribute names in the first line of the
file using the following format:
'# columns: x y z attributeName1 attributeName2 ...'
2 BINARY FILE
In binary files all values have to be stored in double precision
(i.e. 8 bytes per value). All values are stored sequentially
(e.g. for two points with one attribute the ordering would be
x1, y1, z1, a1, x2, y2, z2, a2).
3 LAS/LAZ FILE
For reading las or laz files the function 'las2mat' must be
accessible on the path. It can be downloaded here:
https://github.com/plitkey/matlas_tools
4 ODM FILE
Files created with OPALS (http://geo.tuwien.ac.at/opals). For
this it is necessary to:
1) Install OPALS
2) Add '%opals_root%\opals' to the search path in Matlab.
Note: with the 'Filter' parameter, an odm filter string can be
applied during the import.
5 PLY FILE
Polygon file format, either in ascii or binary format.
6 MAT FILE
This method can also be used to load a mat file generated with
the 'save' method of this class. For more details run
'help pointCloud.save'.
b MATRIX CONTAINING POINT CLOUD DATA //数组生成点云,最少三列表示xyz坐标
A matrix of size n-by-3+a. Each row corresponds to one point, i.e.
n is the total number of points. The first 3 columns contain the
point coordinates x, y and z. Further columns can be used for
point attributes (e.g. color values r, g and b). To import these
attributes the parameter 'Attributes' has to be defined (see
below).
2 ['Attributes', attributes] //常见的属性 nx,ny,nz是方向向量,r、g、b是颜色,roughness是粗糙度
Name of attributes contained in input data defined as 1-by-a cell,
where a denotes the number of attributes. Predefined attribute names
to use for extended functionality:
* 'nx' = normal x component
* 'ny' = normal x component
* 'nz' = normal z component
* 'r' = color red component
* 'g' = color green component
* 'b' = color blue component
* 'roughness' = roughness in point neighborhood
Imported attributes are saved into the property A of the pointCloud //数据的参数是保存在点云中的
object, i.e. obj.A.
Additionally, for LAS/LAZ, ODM and PLY files the following applies:
- If the parameter 'Attributes' is not defined by the user, all
non-empty attributes are imported.
- If the name of one or more attribute is specified by the parameter
'Attributes', only these are imported.
- If the parameter 'Attributes' is set to an empty cell, i.e. {}, NO
attributes are imported.
3 ['Label', label] //点云的名字
Label of point cloud defined as a string. If no label is defined and
input is a file path, the file name is used as label.
4 ['RedPoi', redPoi]
Coordinate reduction point defined as vector with 3 elements. The //坐标原点位置
reduction point defines the origin of a local coordinate system in
which the points are stored.
5 ['HeaderLines', headerLines]
Number of header lines (=rows) to be skipped, if a plain text file
is used as point cloud input.
----------------------------------------------------------------------
OUTPUT
1 [obj]
Object instance of class pointCloud.
----------------------------------------------------------------------
EXAMPLES //1、显示狮子的点云2、三角龙点云3、均匀分布的球体点云
1 Import a point cloud without attributes.
pc = pointCloud('Lion.xyz');
pc.plot;
2 Import a point cloud with attributes.
pc = pointCloud('Gieszkanne.xyz', 'Attributes', {'r' 'g' 'b'});
% Attributes are now accessible in the object property pc.A
pc.plot('Color', 'rgb', 'MarkerSize', 5);
3 Import a point cloud from a matrix.
[x, y, z] = sphere(100);
x = x(:); y = y(:); z = z(:);
pc = pointCloud([x y z], 'Label', 'sphere');
pc.plot('MarkerSize', 5);
----------------------------------------------------------------------
philipp.glira@gmail.com
----------------------------------------------------------------------