PointCloudData
最后更新
PointCloudData 封装了 3D 空间信息,表示 3D 空间中的点集合。点云中的每个点都有自己的位置(X、Y、Z 坐标)。PointCloudData 用于表示 PointCloud 节点的输出,可用于执行各种空间分析和重建任务。Setter 方法仅用于向 PointCloudData 消息提供元数据(将用于记录和回放点云)。保存和加载
PointCloudData 消息可以使用 save() 保存到文件,并使用 load() 读回。保存的文件是二进制 protobuf 封装。有关用法,请参阅 消息 save 和 load 函数。使用说明
- 有序与过滤 — 当在 PointCloud 节点上使用
setOrganized(true)时,getWidth()/getHeight()与源深度帧尺寸匹配,并包含无效点 (z ≤ 0)。当过滤(默认)时,height为1,width等于有效点的数量。 - 颜色数据 — 当
isColor()为true时,使用getPointsRGB()检索位置和 RGBA 颜色。在 Python 中,这会返回一个元组(points, colors),其中points是np.ndarray (N, 3) float32,colors是np.ndarray (N, 4) uint8。 - 边界框 —
getMinX/Y/Z()和getMaxX/Y/Z()返回配置的长度单位中的轴对齐边界。
参考
PointCloudData 的详细 API 提供了对 3D 点云数据生成、操作和检索的控制。Python
class
dai::PointCloudData
variable
int64_t sequenceNum
variable
Timestamp ts
variable
Timestamp tsDevice
variable
std::optional< Timestamp > tsSystem
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 DeprecatedUse isOrganized() instead. Sparse means height == 1
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 sparseDeprecatedThis setter is deprecated and will be removed in a future release
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.For PointCloud output, the distortion model and coefficients describe the source image used to generate the cloud. The 3D points themselves are already compensated for that distortion, so the distortion fields are informational.
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 Align 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()Get the datatype of this specific message.
Returns
DatatypeEnum
function
DEPTHAI_SERIALIZE(PointCloudData, width, height, minx, miny, minz, maxx, maxy, maxz, instanceNum, color, transformation, ts, tsDevice, tsSystem, 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< std::chrono::time_point< std::chrono::system_clock, std::chrono::system_clock::duration > > getTimestampSystem()Retrieves timestamp directly captured from device's system clock, that can be synchronized using PTP
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
需要帮助?
请访问讨论论坛以获取技术支持或您可能有的任何其他问题。