9.11. pointCloud¶

class
itom.
pointCloud
(type=point.PointInvalid) → pointCloud¶ 
class
itom.
pointCloud
(pointCloud, indices=None) → pointCloud 
class
itom.
pointCloud
(width, height, point=None) → pointCloud 
class
itom.
pointCloud
(singlePoint) → pointCloud Creates new point cloud.
Possible point types of this point cloud are:
point.PointXYZ
point.PointXYZI
point.PointXYZRGBA
point.PointXYZNormal
point.PointXYZINormal
point.PointXYZRGBNormal
 Parameters
 type
int
,optional
The type of this point cloud.
 pointCloud
pointCloud
Creates a point cloud from this
pointCloud
. indicessequence
of
int
or iterableof
int
,optional
Only the indices of the given
pointCloud
are used to create this cloud object. width
int
Width of the new point cloud.
 height
int
Height of the new point cloud (the point cloud is
dense
if height > 1). point
point
,optional
If a
width
and / orheight
is given, this optionalpoint
is used to initialize every point in the cloud with this value. If the constructor overload with onepoint
argument is used, this cloud only consists of this one point. If nopoint
is given, by awidth
andheight
, an invalid cloud type will be initialized. singlePoint
point
Creates a point cloud with this
singlePoint
. The type is also derived from the type of thesinglePoint
.
 type
 Returns
 cloud
pointCloud
the initialized point cloud
 cloud

append
(pointCloud) → None¶ 
append
(point) → None 
append
(xyz) → None 
append
(xyzi) → None 
append
(xyz, rgba) → None 
append
(xyz_normal_curvature) → None 
append
(xyz_i_normal_curvature) → None 
append
(xyz_normal_curvature, rgba) → None Appends another point cloud or a point, e.g. given by its coordinates etc., to this cloud.
In all cases, the type of the point or pointCloud, or the correct overload must fit to the type of this point cloud. Else a
RuntimeError
is thrown. If this cloud has an invalid type and apoint
or apointCloud
is given, the type of this arguments is used to initialize this point cloud. Parameters
 pointCloud
pointCloud
is another pointCloud, appended to this cloud. If this cloud was uninitialized yet (
type
=pointCloud.PointInvalid
), the type of the givenpointCloud
is used. point
point
is another
point
, appended to this cloud. If this cloud was uninitialized yet (type
=pointCloud.PointInvalid
), the type of the givenpoint
is used. xyzsequence
of
float
or iterableof
float
Only possible if
type = pointCloud.PointXYZ
orpointCloud.PointXYZRGBA
: A point with the given(x, y, z)
tuple, list, sequence, array… is added to this point cloud. xyzisequence
of
float
or iterableof
float
Only possible if
type = pointCloud.PointXYZI
: A point with the given(x, y, z, intensity)
tuple, list, sequence, array… is added to this point cloud. xyz_normal_curvaturesequence
of
float
or iterableof
float
Only possible if
type = pointCloud.PointXYZNormal
orpointCloud.PointXYZRGBNormal
: A point with the given(x, y, z, nx, ny, nz, curvature)
tuple, list, sequence, array… is added to this point cloud. xyz_i_normal_curvaturesequence
of
float
or iterableof
float
Only possible if
type = pointCloud.PointXYZINormal
: A point with the given(x, y, z, intensity, nx, ny, nz, curvature)
tuple, list, sequence, array… is added to this point cloud. rgbasequence
of
float
or iterableof
float
Only possible if
type = pointCloud.PointXYZRGBA
orpointCloud.PointXYZRGBNormal
: The added point gets the color defined by this(red, green, blue, alpha)
tuple…
 pointCloud

clear
()¶ Clears the whole point cloud.

copy
() → pointCloud¶ Returns a deep copy of this point cloud.
 Returns
 cloud
pointCloud
An exact copy if this point cloud.
 cloud

dense
¶ bool
: Gets or sets if all points have finite coordinates (True
), or if some might contain Inf / NaN values (False
).

erase
(indices)¶ Erases the points in point clouds indicated by indices.
 Parameters
Notes
This method is the same than typing
del myPointCloud[indices]
.

fields
¶ list of
str
: Gets a list of all available field names of this point cloud.This property returns a list of field names that are contained in this cloud, e.g. [‘x’, ‘y’, ‘z’].

static
fromDisparity
(disparity, intensity=None, deleteNaN=False, color=None) → pointCloud¶ Creates a point cloud from a given topography dataObject.
Creates a point cloud from the 2.5D data set given by the topography
dataObject
. The x and ycomponents of each point are taken from the regular grid, spanned by the coordinate system oftopography
(considering the scaling and offset of the object). The corresponding zvalue is the topography’s value itself.This method is deprecated. Use the method
fromTopography()
with the same arguments instead. Parameters
 disparity
dataObject
M x N
, float32dataObject
are the disparity values. intensity
dataObject
,optional
a
M x N
, float32dataObject
. If given, apoint.PointXYZI
pointCloud
is created whose intensity values are determined by this argument (cannot be used together withcolor
). deleteNaNbool,
optional
If
True
,NaN
orInf
zcoordiantes in thedisparity
object will not be copied into the point cloud (the point cloud is not organized any more). color
dataObject
,optional
a
M x N
, rgba32dataObject
. If given, apoint.PointXYZRGBA
pointCloud
is created whose color values are determined by this argument (cannot be used together withintensity
).
 disparity
 Returns
pointCloud
the newly created
pointCloud
(either of typepoint.POINTXYZI
orpoint.PointXYZRGBA
.

static
fromTopography
(topography, intensity=None, deleteNaN=False, color=None) → pointCloud¶ Creates a point cloud from a given topography dataObject.
Creates a point cloud from the 2.5D data set given by the topography
dataObject
. The x and ycomponents of each point are taken from the regular grid, spanned by the coordinate system oftopography
(considering the scaling and offset of the object). The corresponding zvalue is the topography’s value itself. Parameters
 topography
dataObject
M x N
, float32dataObject
are the topography values. intensity
dataObject
,optional
a
M x N
, float32dataObject
. If given, apoint.PointXYZI
pointCloud
is created whose intensity values are determined by this argument (cannot be used together withcolor
). deleteNaNbool,
optional
If
True
,NaN
orInf
zcoordiantes in thetopography
object will not be copied into the point cloud (the point cloud is not organized any more). color
dataObject
,optional
a
M x N
, rgba32dataObject
. If given, apoint.PointXYZRGBA
pointCloud
is created whose color values are determined by this argument (cannot be used together withintensity
).
 topography
 Returns
pointCloud
the newly created
pointCloud
(either of typepoint.POINTXYZI
orpoint.PointXYZRGBA
.

static
fromXYZ
(X, Y, Z, deleteNaN=False) → pointCloud¶ 
static
fromXYZ
(XYZ, deleteNaN=False) → pointCloud Creates a point cloud from three X,Y,Z dataObjects or from one 3xMxN or Mx3 dataObject.
The created point cloud is not organized (
height = 1
) anddense
, if noNaN
orInf
values are within thepointCloud
.dense
isTrue
forever, ifdeleteNaN = True
. Parameters
 X
dataObject
A
M x N
float32dataObject
with the xcoordinates of all points. Y
dataObject
A
M x N
float32dataObject
with the ycoordinates of all points. Z
dataObject
A
M x N
float32dataObject
with the zcoordinates of all points. XYZ
dataObject
Either a
3 x M x N
float32dataObject
, where the first plane[0,:,:]
contains the xcoordiantes, the 2nd plane[1,:,:]
the ycoordinates and the 3rd plane the zcoordinates. Or aM x 3
float32dataObject
, where each row represents one point, that consists of the x, y and zcoordinates. deleteNaNbool
if
True
all points, whose coordinate has at least oneNaN
component, will be skipped. Else, they are also put to the cloud, however it is notdense
anymore.
 X
 Returns
pointCloud
The newly created point cloud of the type
point.PointXYZ
.
Notes
The
dataObject
X
,Y
,Z
,XYZ
are recommended to have thedtype
float32. However, it is possible to pass any real data type, that is then implicitly converted to float32.

static
fromXYZI
(X, Y, Z, I, deleteNaN=False) → pointCloud¶ 
static
fromXYZI
(XYZ, I, deleteNaN=False) → pointCloud Creates a point cloud from four X, Y, Z, I dataObjects or from one 3xMxN or Mx3 dataObject and one I dataObject.
The created point cloud is not organized (
height = 1
) anddense
, if noNaN
orInf
values are within thepointCloud
.dense
isTrue
forever, ifdeleteNaN = True
. Parameters
 X
dataObject
A
M x N
float32dataObject
with the xcoordinates of all points. Y
dataObject
A
M x N
float32dataObject
with the ycoordinates of all points. Z
dataObject
A
M x N
float32dataObject
with the zcoordinates of all points. XYZ
dataObject
Either a
3 x M x N
float32dataObject
, where the first plane[0,:,:]
contains the xcoordiantes, the 2nd plane[1,:,:]
the ycoordinates and the 3rd plane the zcoordinates. Or aM x 3
float32dataObject
, where each row represents one point, that consists of the x, y and zcoordinates. I
dataObject
A
M x N
float32dataObject
with the intensity values of all points. deleteNaNbool
if
True
all points, whose coordinate has at least oneNaN
component, will be skipped. Else, they are also put to the cloud, however it is notdense
anymore.
 X
 Returns
pointCloud
The newly created point cloud of the type
point.PointXYZI
.
Notes
The
dataObject
X
,Y
,Z
,XYZ
andI
are recommended to have thedtype
float32. However, it is possible to pass any real data type, that is then implicitly converted to float32.

static
fromXYZRGBA
(X, Y, Z, color, deleteNaN=False) → pointCloud¶ 
static
fromXYZRGBA
(XYZ, color, deleteNaN=False) → pointCloud Creates a point cloud from three X, Y, Z, color dataObjects or from one 3xMxN or Mx3 dataObject and one color dataObject.
The created point cloud is not organized(
height = 1
) anddense
, if noNaN
orInf
values are within the : class :pointCloud
. : attr :dense
isTrue
forever, ifdeleteNaN = True
. Parameters
 X
dataObject
A
M x N
float32 :class :dataObject
with the x  coordinates of all points. Y
dataObject
A
M x N
float32 :class :dataObject
with the y  coordinates of all points. Z
dataObject
A
M x N
float32 :class :dataObject
with the z  coordinates of all points. XYZ
dataObject
Either a
3 x M x N
float32 :class :dataObject
, where the first plane[0, :, : ]
contains the x  coordiantes, the 2nd plane[1, :, : ]
the y  coordinates and the 3rd plane the z  coordinates.Or aM x 3
float32 :class :dataObject
, where each row represents one point, that consists of the x  , y  and z  coordinates. color
dataObject
M x N
dataObject
with the colors for each point, type: rgba32. deleteNaNbool
if
True
all points, whose coordinate has at least oneNaN
component, will be skipped.Else, they are also put to the cloud, however it is notdense
anymore.
 X
 Returns
pointCloud
The newly created point cloud of the type
point.PointXYZRGBA
.
Notes
The
dataObject
X
,Y
,Z
,XYZ
are recommended to have thedtype
float32. However, it is possible to pass any real data type, that is then implicitly converted to float32.

height
¶ int
: Gets the height of this point cloud if it is organized as regular grid, else 1.The height of a point cloud is equal to
1
, if the points in the point cloud are not organized. If the cloud is organized, all points are assumed to lie on a regular grid, such that neighbouring points in the grid are adjacent in space, too. In this case, the height is the number of rows in this grid. The total number of points is thenheight * width
.

insert
(index, values)¶ Inserts a single point or a sequence of points before position given by index.
By this method, a
point
or a sequence of points is inserted into the existingpointCloud
.The new points are inserted before the existing value at the indexth position.
The type of the inserted points must fit to the type of the point cloud.
 Parameters

moveXYZ
(x=0.0, y=0.0, z=0.0)¶ Moves the x, y and z components of every point by the given offsets.

name
() → str¶ Returns the name of this object.
 Returns
str
returns the name of this object:
PointCloud
.

organized
¶ bool
: returnsTrue
if this point cloud is organized, elseFalse
.Points in an organized point cloud are assumed to lie on a regular grid, defined by
height
andwidth
. Neighbouring points in this grid are the neighbours in space, too. An unorganized point cloud has always a height equal to1
andwidth
equal to the total number of points.

scaleXYZ
(x=1.0, y=1.0, z=1.0)¶ Scales the x, y and z components of every point by the given values.

toDataObject
() → dataObject¶ Returns a
P x N
float32 dataObject with all point data, where P depends on the point type and N is the number of points.The output has at least 3 components per point. The first three rows contain always the
(x, y, z)
coordinates of each point.If this cloud has normals defined, these will be added in the next 4 rows as
(nx, ny, nz, curvature)
. For types, that contain intensity values, the next row contains thisintensity
value. Point types, that contain colour information for each point will put this information in the upcoming 4 rows, as(red, green, blue, alpha)
.To sum up, row column patterns are:
(x,y,z)
,(x,y,z,intensity)
,(x,y,z,r,g,b,a)
,(x,y,z,nx,ny,nz,curvature)
,(x,y,z,nx,ny,nz,curvature,intensity]
, among others. Returns
 dObj
dataObject
A
float32
dataObject
of sizeP x N
(N
is equal toself.size
).
 dObj

type
¶ int
: Gets the point type of this point cloud.Point types can be:
point.PointInvalid
= 0x00point.PointXYZ
= 0x01point.PointXYZI
= 0x02point.PointXYZRGBA
= 0x04point.PointXYZNormal
= 0x08point.PointXYZINormal
= 0x10point.PointXYZRGBNormal
0x20

width
¶ int
: Gets the width of point cloud (if the cloud is not organized, since is equal tosize
).The width of a point cloud is equal to the number of total points, if the points in the point cloud are not organized. If it is organized, all points are assumed to lie on a regular grid, such that neighbouring points in the grid are adjacent in space, too. In this case, the width is the number of columns in this grid. The total number of points is then
height * width
.