ON THIS PAGE

  • PointCloudConfig
  • Configuration Options
  • Usage
  • Examples of Functionality
  • Reference

PointCloudConfig

PointCloudConfig is a configuration class used to adjust settings for point cloud generation within the DepthAI ecosystem. It allows users to configure properties such as sparsity and transformation matrices, which are crucial for tailoring the point cloud data to specific application requirements.

Configuration Options

  • Sparsity: Determines whether the generated point cloud should be sparse. Sparse point clouds may omit points based on certain criteria, such as depth value thresholds, to reduce data volume and processing requirements.
  • Transformation Matrix: Applies a transformation matrix to the point cloud data, enabling rotations, translations, and scaling to align the point cloud with a world or application-specific coordinate system.

Usage

Configuring PointCloudConfig allows for precise control over the generation of point cloud data. Here's an example of how to configure and apply PointCloudConfig in a DepthAI application:
Python
C++

Python

Python
1import depthai as dai
2
3# Create pipeline
4pipeline = dai.Pipeline()
5
6# Create PointCloud node
7pointCloud = pipeline.create(dai.node.PointCloud)
8
9pointCloud.initialConfig.setSparse(True) # Enable sparse point cloud generation
10
11# Define a transformation matrix
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) # Apply transformation matrix
19
20# Further pipeline setup and execution...
This example demonstrates initializing PointCloudConfig, setting it to generate sparse point clouds, and applying a transformation matrix. This configuration is then applied to a PointCloud node within the DepthAI pipeline.

Examples of Functionality

  • 3D Object Localization: Adjusting the transformation matrix to align point clouds with a known coordinate system for precise object placement.
  • Scene Optimization: Utilizing sparse point clouds for efficient processing in large-scale or complex scenes.
  • Data Alignment: Applying transformation matrices for seamless integration of point cloud data with other sensor data or pre-existing 3D models.

Reference

Python
C++

Python

class

dai::PointCloudConfig

#include PointCloudConfig.hpp
function
PointCloudConfig()
Construct PointCloudConfig message.
function
~PointCloudConfig()
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:
inline function
void serialize(std::vector< std::uint8_t > & metadata, DatatypeEnum & datatype)
function
DEPTHAI_SERIALIZE(PointCloudConfig, Buffer::sequenceNum, Buffer::ts, Buffer::tsDevice, sparse, transformationMatrix)

Need assistance?

Head over to Discussion Forum for technical support or any other questions you might have.