DepthAI v2 has been superseded by DepthAI v3. You are viewing legacy documentation.
此页面由 AI 自动翻译。查看英文原版
最后更新

本页目录

  • 配置选项
  • 用法
  • 功能示例
  • 参考
Claude CodeCodexCursor
Luxonis 智能体工具包为你常用的编程智能体加载 Luxonis 上下文与技能,更快地基于 OAK 开发应用。
安装工具包

PointCloudConfig

最后更新
PointCloudConfig 是一个配置类,用于调整 DepthAI 生态系统内点云生成的设置。它允许用户配置稀疏度和变换矩阵等属性,这些属性对于根据特定应用要求定制点云数据至关重要。

配置选项

  • 稀疏度:确定生成的点云是否应为稀疏点云。稀疏点云可能会根据某些标准(例如深度值阈值)省略点,以减少数据量和处理要求。
  • 变换矩阵:将变换矩阵应用于点云数据,实现旋转、平移和缩放,以使点云与世界或特定于应用的坐标系对齐。

用法

配置 PointCloudConfig 可以精确控制点云数据的生成。以下是如何在 DepthAI 应用程序中配置和应用 PointCloudConfig 的示例:

Python

Python
1import depthai as dai
2
3# 创建管道
4pipeline = dai.Pipeline()
5
6# 创建 PointCloud 节点
7pointCloud = pipeline.create(dai.node.PointCloud)
8
9pointCloud.initialConfig.setSparse(True) # 启用稀疏点云生成
10
11# 定义变换矩阵
12transformationMatrix = [
13    [1.0, 0.0, 0.0, 0.0],
14    [0.0, 1.0, 0.0, 0.0],
15    [0.0, 0.0, 1.0, 0.0],
16    [0.0, 0.0, 0.0, 1.0]
17]
18pointCloud.initialConfig.setTransformationMatrix(transformationMatrix) # 应用变换矩阵
19
20# 进一步的管道设置和执行...

C++

C++
1#include "depthai/depthai.hpp"
2
3int main() {
4    // 创建管道
5    dai::Pipeline pipeline;
6
7    // 创建 PointCloud 节点
8    auto pointCloud = pipeline.create<dai::node.PointCloud>();
9
10    pointCloud->initialConfig.setSparse(true); // 启用稀疏点云生成
11
12    // 定义变换矩阵
13    std::vector<std::vector<float>> transformationMatrix = {
14        {1.0, 0.0, 0.0, 0.0},
15        {0.0, 1.0, 0.0, 0.0},
16        {0.0, 0.0, 1.0, 0.0},
17        {0.0, 0.0, 0.0, 1.0}
18    };
19    pointCloud->initialConfig.setTransformationMatrix(transformationMatrix); // 应用变换矩阵
20
21    // 进一步的管道设置和执行...
22
23    return 0;
24}
此示例演示了初始化 PointCloudConfig,将其设置为生成稀疏点云,并应用变换矩阵。然后将此配置应用于 DepthAI 管道中的 PointCloud 节点。

功能示例

  • 3D 对象定位:调整变换矩阵以使点云与已知坐标系对齐,从而实现精确的对象放置。
  • 场景优化:利用稀疏点云在大型或复杂场景中进行高效处理。
  • 数据对齐:应用变换矩阵以实现点云数据与其他传感器数据或现有 3D 模型的无缝集成。

参考

Python

class

depthai.PointCloudConfig(depthai.Buffer)

method
method
get(self) -> RawPointCloudConfig: RawPointCloudConfig
Retrieve configuration data for SpatialLocationCalculator.  Returns:     config for SpatialLocationCalculator
method
getSparse(self) -> bool: bool
Retrieve sparse point cloud calculation status.  Returns:     true if sparse point cloud calculation is enabled, false otherwise
method
method
set(self, config: RawPointCloudConfig) -> PointCloudConfig: PointCloudConfig
Set explicit configuration.  Parameter ``config``:     Explicit configuration
method
setSparse(self, arg0: bool) -> PointCloudConfig: PointCloudConfig
Enable or disable sparse point cloud calculation.  Parameter ``enable``:
method

C++

class

dai::PointCloudConfig

#include PointCloudConfig.hpp
function
PointCloudConfig()
Construct PointCloudConfig message.
explicit function
PointCloudConfig(std::shared_ptr< RawPointCloudConfig > ptr)
function
~PointCloudConfig()
function
PointCloudConfig & set(dai::RawPointCloudConfig config)
Set explicit configuration.
Parameters
  • config: Explicit configuration
function
dai::RawPointCloudConfig get()
Retrieve configuration data for SpatialLocationCalculator.
Returns
config for SpatialLocationCalculator
function
bool getSparse()
Retrieve sparse point cloud calculation status.
Returns
true if sparse point cloud calculation is enabled, false otherwise
function
std::array< std::array< float, 4 >, 4 > getTransformationMatrix()
Retrieve transformation matrix for point cloud calculation.
Returns
4x4 transformation matrix
function
PointCloudConfig & setSparse(bool enable)
Enable or disable sparse point cloud calculation.
Parameters
  • enable:
function
PointCloudConfig & setTransformationMatrix(const std::array< std::array< float, 4 >, 4 > & transformationMatrix)
Set 4x4 transformation matrix for point cloud calculation. Default is an identity matrix.
Parameters
  • transformationMatrix:
function
PointCloudConfig & setTransformationMatrix(const std::array< std::array< float, 3 >, 3 > & transformationMatrix)
Set 3x3 transformation matrix for point cloud calculation. Default is an identity matrix.
Parameters
  • transformationMatrix:

需要帮助?

请访问讨论论坛以获取技术支持或您可能有的任何其他问题。