# PointCloudData

PointCloudData encapsulates 3D spatial information, representing a collection of points in a 3D space. Each point within the point
cloud has its own position (X, Y, Z coordinates). PointCloudData is used to represent the output of PointCloud node and can be
used to perform a variety of spatial analysis and reconstruction tasks.

Setter methods are only used to provide metadata to the PointCloudData message (will be used for recording and replaying point
clouds).

## Usage notes

 * Organized vs filtered — When setOrganized(true) is used on the PointCloud node, getWidth() / getHeight() match the source depth
   frame dimensions and include invalid points (z ≤ 0). When filtered (default), height is 1 and width equals the number of valid
   points.
 * Color data — When isColor() is true, use getPointsRGB() to retrieve both positions and RGBA colors. In Python this returns a
   tuple (points, colors) where points is np.ndarray (N, 3) float32 and colors is np.ndarray (N, 4) uint8.
 * Bounding box — getMinX/Y/Z() and getMaxX/Y/Z() return axis-aligned bounds in the configured length unit.

## Reference

The detailed API for PointCloudData offers control over the generation, manipulation, and retrieval of 3D point cloud data.

#### Python

### dai::PointCloudData

Kind: class

PointCloudData message. Carries point cloud data.

#### dai::PointCloudData::dependent_false

Kind: struct

#### int64_t sequenceNum

Kind: variable

#### Timestamp ts

Kind: variable

#### Timestamp tsDevice

Kind: variable

#### std::optional< ImgTransformation > transformation

Kind: variable

#### PointCloudData()

Kind: function

Construct PointCloudData message.

#### ~PointCloudData()

Kind: function

#### std::vector< Point3f > getPoints()

Kind: function

#### std::vector< Point3fRGBA > getPointsRGB()

Kind: function

#### void setPoints(const std::vector< Point3f > & points)

Kind: function

#### void setPointsRGB(const std::vector< Point3fRGBA > & points)

Kind: function

#### unsigned int getInstanceNum()

Kind: function

Retrieves instance number

#### unsigned int getWidth()

Kind: function

Retrieves the height in pixels - in case of a sparse point cloud, this represents the hight of the frame which was used to
generate the point cloud

#### unsigned int getHeight()

Kind: function

Retrieves the height in pixels - in case of a sparse point cloud, this represents the hight of the frame which was used to
generate the point cloud

#### float getMinX()

Kind: function

Retrieves minimal x coordinate in depth units (millimeter by default)

#### float getMinY()

Kind: function

Retrieves minimal y coordinate in depth units (millimeter by default)

#### float getMinZ()

Kind: function

Retrieves minimal z coordinate in depth units (millimeter by default)

#### float getMaxX()

Kind: function

Retrieves maximal x coordinate in depth units (millimeter by default)

#### float getMaxY()

Kind: function

Retrieves maximal y coordinate in depth units (millimeter by default)

#### float getMaxZ()

Kind: function

Retrieves maximal z coordinate in depth units (millimeter by default)

#### bool isSparse()

Kind: function

Retrieves whether point cloud is sparse

#### bool isOrganized()

Kind: function

Retrieves whether point cloud is organized (height > 1) Organized point clouds have width x height structure from the original
image Sparse point clouds have height == 1 and only contain valid points

#### bool isColor()

Kind: function

Retrieves whether point cloud is color

#### PointCloudData & setWidth(unsigned int width)

Kind: function

Specifies frame width parameters: width: frame width

#### PointCloudData & setHeight(unsigned int height)

Kind: function

Specifies frame height parameters: height: frame height

#### PointCloudData & setSize(unsigned int width, unsigned int height)

Kind: function

Specifies frame size parameters: height: frame height; width: frame width

#### PointCloudData & setSize(std::tuple< unsigned int, unsigned int > size)

Kind: function

Specifies frame size parameters: size: frame size

#### PointCloudData & setMinX(float val)

Kind: function

Specifies minimal x coordinate in depth units (millimeter by default) parameters: val: minimal x coordinate in depth units
(millimeter by default)

#### PointCloudData & setMinY(float val)

Kind: function

Specifies minimal y coordinate in depth units (millimeter by default) parameters: val: minimal y coordinate in depth units
(millimeter by default)

#### PointCloudData & setMinZ(float val)

Kind: function

Specifies minimal z coordinate in depth units (millimeter by default) parameters: val: minimal z coordinate in depth units
(millimeter by default)

#### PointCloudData & setMaxX(float val)

Kind: function

Specifies maximal x coordinate in depth units (millimeter by default) parameters: val: maximal x coordinate in depth units
(millimeter by default)

#### PointCloudData & setMaxY(float val)

Kind: function

Specifies maximal y coordinate in depth units (millimeter by default) parameters: val: maximal y coordinate in depth units
(millimeter by default)

#### PointCloudData & setMaxZ(float val)

Kind: function

Specifies maximal z coordinate in depth units (millimeter by default) parameters: val: maximal z coordinate in depth units
(millimeter by default)

#### PointCloudData & setSparse(bool val)

Kind: function

Specifies whether point cloud is sparse parameters: val: whether point cloud is sparse

#### PointCloudData & setColor(bool val)

Kind: function

Specifies whether point cloud is color parameters: val: whether point cloud is color

#### PointCloudData & setInstanceNum(unsigned int instanceNum)

Kind: function

Specifies instance number parameters: instanceNum: instance number

#### const ImgTransformation & getTransformation()

Kind: function

Retrieves image transformation data

#### PointCloudData transformTo(const ImgTransformation & target)

Kind: function

Returns a copy of this point cloud. Due to efficiency reasons, point cloud remapping is currently not implemented. Point clouds
should be generated from already aligned source messages instead of being transformed after the fact. Use ImageAlign on the source
inputs before creating the point cloud. parameters: target: Target image transformation.

#### PointCloudData & setTransformation(const ImgTransformation & transformation)

Kind: function

Specifies image transformation data parameters: transformation: transformation data

#### PointCloudData & updateBoundingBox()

Kind: function

Recomputes the bounding box (min/max X, Y, Z) from the current point data. All stored points are included regardless of their z
value. If the cloud is empty, all bounds are set to 0.

#### void getPclData()

Kind: function

#### void setPclData(T...)

Kind: function

#### void serialize(std::vector< std::uint8_t > & metadata, DatatypeEnum & datatype)

Kind: function

#### DatatypeEnum getDatatype()

Kind: function

Get the datatype of this specific message.

return: DatatypeEnum

#### DEPTHAI_SERIALIZE(PointCloudData, width, height, minx, miny, minz, maxx, maxy, maxz, instanceNum, color, transformation, ts,
tsDevice, sequenceNum)

Kind: function

#### int64_t getSequenceNum()

Kind: function

Retrieves image sequence number

#### std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > getTimestamp()

Kind: function

Retrieves timestamp related to dai::Clock::now()

#### std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > getTimestampDevice()

Kind: function

Retrieves timestamp directly captured from device's monotonic clock, not synchronized to host time. Used mostly for debugging

#### std::optional< ImgTransformation > getTransformation()

Kind: function

Returns the current transformation if set, else std::nullopt.

#### void setTransformation(const ImgTransformation & transformation)

Kind: function

Sets the current transformation.

#### C++

### dai::PointCloudData

Kind: class

PointCloudData message. Carries point cloud data.

#### dai::PointCloudData::dependent_false

Kind: struct

#### int64_t sequenceNum

Kind: variable

#### Timestamp ts

Kind: variable

#### Timestamp tsDevice

Kind: variable

#### std::optional< ImgTransformation > transformation

Kind: variable

#### PointCloudData()

Kind: function

Construct PointCloudData message.

#### ~PointCloudData()

Kind: function

#### std::vector< Point3f > getPoints()

Kind: function

#### std::vector< Point3fRGBA > getPointsRGB()

Kind: function

#### void setPoints(const std::vector< Point3f > & points)

Kind: function

#### void setPointsRGB(const std::vector< Point3fRGBA > & points)

Kind: function

#### unsigned int getInstanceNum()

Kind: function

Retrieves instance number

#### unsigned int getWidth()

Kind: function

Retrieves the height in pixels - in case of a sparse point cloud, this represents the hight of the frame which was used to
generate the point cloud

#### unsigned int getHeight()

Kind: function

Retrieves the height in pixels - in case of a sparse point cloud, this represents the hight of the frame which was used to
generate the point cloud

#### float getMinX()

Kind: function

Retrieves minimal x coordinate in depth units (millimeter by default)

#### float getMinY()

Kind: function

Retrieves minimal y coordinate in depth units (millimeter by default)

#### float getMinZ()

Kind: function

Retrieves minimal z coordinate in depth units (millimeter by default)

#### float getMaxX()

Kind: function

Retrieves maximal x coordinate in depth units (millimeter by default)

#### float getMaxY()

Kind: function

Retrieves maximal y coordinate in depth units (millimeter by default)

#### float getMaxZ()

Kind: function

Retrieves maximal z coordinate in depth units (millimeter by default)

#### bool isSparse()

Kind: function

Retrieves whether point cloud is sparse

#### bool isOrganized()

Kind: function

Retrieves whether point cloud is organized (height > 1) Organized point clouds have width x height structure from the original
image Sparse point clouds have height == 1 and only contain valid points

#### bool isColor()

Kind: function

Retrieves whether point cloud is color

#### PointCloudData & setWidth(unsigned int width)

Kind: function

Specifies frame width parameters: width: frame width

#### PointCloudData & setHeight(unsigned int height)

Kind: function

Specifies frame height parameters: height: frame height

#### PointCloudData & setSize(unsigned int width, unsigned int height)

Kind: function

Specifies frame size parameters: height: frame height; width: frame width

#### PointCloudData & setSize(std::tuple< unsigned int, unsigned int > size)

Kind: function

Specifies frame size parameters: size: frame size

#### PointCloudData & setMinX(float val)

Kind: function

Specifies minimal x coordinate in depth units (millimeter by default) parameters: val: minimal x coordinate in depth units
(millimeter by default)

#### PointCloudData & setMinY(float val)

Kind: function

Specifies minimal y coordinate in depth units (millimeter by default) parameters: val: minimal y coordinate in depth units
(millimeter by default)

#### PointCloudData & setMinZ(float val)

Kind: function

Specifies minimal z coordinate in depth units (millimeter by default) parameters: val: minimal z coordinate in depth units
(millimeter by default)

#### PointCloudData & setMaxX(float val)

Kind: function

Specifies maximal x coordinate in depth units (millimeter by default) parameters: val: maximal x coordinate in depth units
(millimeter by default)

#### PointCloudData & setMaxY(float val)

Kind: function

Specifies maximal y coordinate in depth units (millimeter by default) parameters: val: maximal y coordinate in depth units
(millimeter by default)

#### PointCloudData & setMaxZ(float val)

Kind: function

Specifies maximal z coordinate in depth units (millimeter by default) parameters: val: maximal z coordinate in depth units
(millimeter by default)

#### PointCloudData & setSparse(bool val)

Kind: function

Specifies whether point cloud is sparse parameters: val: whether point cloud is sparse

#### PointCloudData & setColor(bool val)

Kind: function

Specifies whether point cloud is color parameters: val: whether point cloud is color

#### PointCloudData & setInstanceNum(unsigned int instanceNum)

Kind: function

Specifies instance number parameters: instanceNum: instance number

#### const ImgTransformation & getTransformation()

Kind: function

Retrieves image transformation data

#### PointCloudData transformTo(const ImgTransformation & target)

Kind: function

Returns a copy of this point cloud. Due to efficiency reasons, point cloud remapping is currently not implemented. Point clouds
should be generated from already aligned source messages instead of being transformed after the fact. Use ImageAlign on the source
inputs before creating the point cloud. parameters: target: Target image transformation.

#### PointCloudData & setTransformation(const ImgTransformation & transformation)

Kind: function

Specifies image transformation data parameters: transformation: transformation data

#### PointCloudData & updateBoundingBox()

Kind: function

Recomputes the bounding box (min/max X, Y, Z) from the current point data. All stored points are included regardless of their z
value. If the cloud is empty, all bounds are set to 0.

#### void getPclData()

Kind: function

#### void setPclData(T...)

Kind: function

#### void serialize(std::vector< std::uint8_t > & metadata, DatatypeEnum & datatype)

Kind: function

#### DatatypeEnum getDatatype()

Kind: function

Get the datatype of this specific message.

return: DatatypeEnum

#### DEPTHAI_SERIALIZE(PointCloudData, width, height, minx, miny, minz, maxx, maxy, maxz, instanceNum, color, transformation, ts,
tsDevice, sequenceNum)

Kind: function

#### int64_t getSequenceNum()

Kind: function

Retrieves image sequence number

#### std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > getTimestamp()

Kind: function

Retrieves timestamp related to dai::Clock::now()

#### std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > getTimestampDevice()

Kind: function

Retrieves timestamp directly captured from device's monotonic clock, not synchronized to host time. Used mostly for debugging

#### std::optional< ImgTransformation > getTransformation()

Kind: function

Returns the current transformation if set, else std::nullopt.

#### void setTransformation(const ImgTransformation & transformation)

Kind: function

Sets the current transformation.

### Need assistance?

Head over to [Discussion Forum](https://discuss.luxonis.com/) for technical support or any other questions you might have.
