PointCloudData
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),heightis1andwidthequals the number of valid points. - Color data — When
isColor()istrue, usegetPointsRGB()to retrieve both positions and RGBA colors. In Python this returns a tuple(points, colors)wherepointsisnp.ndarray (N, 3) float32andcolorsisnp.ndarray (N, 4) uint8. - Bounding box —
getMinX/Y/Z()andgetMaxX/Y/Z()return axis-aligned bounds in the configured length unit.
Reference
PointCloudData offers control over the generation, manipulation, and retrieval of 3D point cloud data.Python
class
dai::PointCloudData
variable
int64_t sequenceNum
variable
Timestamp ts
variable
Timestamp tsDevice
variable
std::optional< ImgTransformation > transformation
function
PointCloudData()function
~PointCloudData()function
std::vector< Point3f > getPoints()function
std::vector< Point3fRGBA > getPointsRGB()function
void setPoints(const std::vector< Point3f > & points)function
void setPointsRGB(const std::vector< Point3fRGBA > & points)function
unsigned int getInstanceNum()Retrieves instance number
function
unsigned int getWidth()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
function
unsigned int getHeight()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
function
float getMinX()Retrieves minimal x coordinate in depth units (millimeter by default)
function
float getMinY()Retrieves minimal y coordinate in depth units (millimeter by default)
function
float getMinZ()Retrieves minimal z coordinate in depth units (millimeter by default)
function
float getMaxX()Retrieves maximal x coordinate in depth units (millimeter by default)
function
float getMaxY()Retrieves maximal y coordinate in depth units (millimeter by default)
function
float getMaxZ()Retrieves maximal z coordinate in depth units (millimeter by default)
function
bool isSparse()Retrieves whether point cloud is sparse
function
bool isOrganized()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
function
bool isColor()Retrieves whether point cloud is color
function
PointCloudData & setWidth(unsigned int width)Specifies frame width
Parameters
- width: frame width
function
PointCloudData & setHeight(unsigned int height)Specifies frame height
Parameters
- height: frame height
function
PointCloudData & setSize(unsigned int width, unsigned int height)Specifies frame size
Parameters
- height: frame height
- width: frame width
function
PointCloudData & setSize(std::tuple< unsigned int, unsigned int > size)Specifies frame size
Parameters
- size: frame size
function
PointCloudData & setMinX(float val)Specifies minimal x coordinate in depth units (millimeter by default)
Parameters
- val: minimal x coordinate in depth units (millimeter by default)
function
PointCloudData & setMinY(float val)Specifies minimal y coordinate in depth units (millimeter by default)
Parameters
- val: minimal y coordinate in depth units (millimeter by default)
function
PointCloudData & setMinZ(float val)Specifies minimal z coordinate in depth units (millimeter by default)
Parameters
- val: minimal z coordinate in depth units (millimeter by default)
function
PointCloudData & setMaxX(float val)Specifies maximal x coordinate in depth units (millimeter by default)
Parameters
- val: maximal x coordinate in depth units (millimeter by default)
function
PointCloudData & setMaxY(float val)Specifies maximal y coordinate in depth units (millimeter by default)
Parameters
- val: maximal y coordinate in depth units (millimeter by default)
function
PointCloudData & setMaxZ(float val)Specifies maximal z coordinate in depth units (millimeter by default)
Parameters
- val: maximal z coordinate in depth units (millimeter by default)
function
PointCloudData & setSparse(bool val)Specifies whether point cloud is sparse
Parameters
- val: whether point cloud is sparse
function
PointCloudData & setColor(bool val)Specifies whether point cloud is color
Parameters
- val: whether point cloud is color
function
PointCloudData & setInstanceNum(unsigned int instanceNum)Specifies instance number
Parameters
- instanceNum: instance number
function
const ImgTransformation & getTransformation()Retrieves image transformation data
function
PointCloudData transformTo(const ImgTransformation & target)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.
function
PointCloudData & setTransformation(const ImgTransformation & transformation)Specifies image transformation data
Parameters
- transformation: transformation data
function
PointCloudData & updateBoundingBox()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.
inline function
void getPclData()inline function
void setPclData(T...)function
void serialize(std::vector< std::uint8_t > & metadata, DatatypeEnum & datatype)inline function
DatatypeEnum getDatatype()function
DEPTHAI_SERIALIZE(PointCloudData, width, height, minx, miny, minz, maxx, maxy, maxz, instanceNum, color, transformation, ts, tsDevice, sequenceNum)function
int64_t getSequenceNum()Retrieves image sequence number
function
std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > getTimestamp()Retrieves timestamp related to dai::Clock::now()
function
std::chrono::time_point< std::chrono::steady_clock, std::chrono::steady_clock::duration > getTimestampDevice()Retrieves timestamp directly captured from device's monotonic clock, not synchronized to host time. Used mostly for debugging
function
std::optional< ImgTransformation > getTransformation()Returns the current transformation if set, else std::nullopt.
function
void setTransformation(const ImgTransformation & transformation)Sets the current transformation.
struct
dai::PointCloudData::dependent_false
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.