readField
Description
reads the point field from the fielddata
= readField(pcloud
,fieldname
)PointCloud2
object, pcloud
, specified by
fieldname
and returns it in fielddata
.
If fieldname
does not exist, the function displays an error. To
preserve the structure of the point cloud data, see Preserving Point Cloud Structure.
Note
readField will be removed. Use rosReadField
instead. For more
information, see ROS Message Structure Functions
Examples
Input Arguments
Output Arguments
Tips
Point cloud data can be organized in either 1-D lists or in 2-D image styles. 2-D
image styles usually come from depth sensors or stereo cameras. The input PointCloud2
object contains a PreserveStructureOnRead
property that is either true
or false
(default).
Suppose you set the property to
true
.
pcloud.PreserveStructureOnRead = true;
Now calling any read functions (readXYZ
,readRGB
, or
readField
)
preserves the organizational structure of the point cloud. When you preserve the
structure, the output matrices are of size
m-by-n-by-d, where
m is the height, n is the width, and
d is the number of return values for each point. Otherwise, all
points are returned as a x-by-d list. This
structure can be preserved only if the point cloud is organized.