Class PointCloud

Nested Relationships

Nested Types

Inheritance Relationships

Base Types

Class Documentation

class PointCloud : public dai::DeviceNodeCRTP<DeviceNode, PointCloud, PointCloudProperties>, public dai::HostRunnable

PointCloud node. Computes point cloud from depth frames.

Public Functions

PointCloud()
~PointCloud()
Input &getColorInput()

Get the optional color input for colorized point clouds. Lazily creates the Sync entry so that depth-only mode works without Sync waiting for a color frame that never arrives.

Link an aligned color image (RGB888i, same dimensions as depth) to this input to enable colored point cloud output.

void setNumFramesPool(int numFramesPool)

Specify number of frames in pool.

Parameters:

numFramesPool – How many frames should the pool have

void setRunOnHost(bool runOnHost)

Specify whether to run on host or device By default, the node will run on host.

void useCPU()

Use single-threaded CPU for processing

void useCPUMT(uint32_t numThreads = 2)

Use multi-threaded CPU for processing

void useGPU(uint32_t device = 0)

Use GPU for point cloud computation

Parameters:

device – GPU device index (default 0)

void setTargetCoordinateSystem(CameraBoardSocket targetCamera, bool useSpecTranslation = false)

Set target coordinate system to transform point cloud

Parameters:
  • targetCamera – Target camera socket

  • useSpecTranslation – Use spec translation instead of calibration (default: false)

void setTargetCoordinateSystem(HousingCoordinateSystem housingCS, bool useSpecTranslation = true)

Set target coordinate system to housing coordinate system Point cloud will be transformed to this housing coordinate system

Parameters:
  • housingCS – Target housing coordinate system

  • useSpecTranslation – Whether to use spec translation (default: true)

virtual bool runOnHost() const override

Returns true or false whether the node should be run on host or not.

virtual void buildInternal() override

Function called from within the create function to build the node. This function is useful for initialization, setting up inputs and outputs = stuff that cannot be perform in the constuctor.

Public Members

std::shared_ptr<PointCloudConfig> initialConfig = std::make_shared<PointCloudConfig>()

Initial config to use when computing the point cloud.

Input inputConfig = {*this, {"inputConfig", DEFAULT_GROUP, false, 4, {{{DatatypeEnum::PointCloudConfig, false}}}, DEFAULT_WAIT_FOR_MESSAGE}}

Input PointCloudConfig message with ability to modify parameters in runtime. Default queue is non-blocking with size 4.

Subnode<node::Sync> sync = {*this, "sync"}

Sync subnode for synchronized depth + color input. When only depth is connected, Sync passes through single-item MessageGroups. When both depth and color are connected, Sync pairs them by timestamp.

InputMap &syncInputs = sync->inputs
Input &inputDepth = syncInputs[depthInputName]

Input message with depth data used to create the point cloud. Routed through the internal Sync subnode.

Output outputPointCloud = {*this, {"outputPointCloud", DEFAULT_GROUP, {{{DatatypeEnum::PointCloudData, false}}}}}

Outputs PointCloudData message

Output passthroughDepth = {*this, {"passthroughDepth", DEFAULT_GROUP, {{{DatatypeEnum::ImgFrame, false}}}}}

Passthrough depth from which the point cloud was calculated. Suitable for when input queue is set to non-blocking behavior.

Public Static Attributes

static constexpr const char *NAME = "PointCloud"
static constexpr const char *depthInputName = "depth"
static constexpr const char *colorInputName = "color"

Protected Functions

virtual Properties &getProperties() override
inline DeviceNodeCRTP()
inline DeviceNodeCRTP(const std::shared_ptr<Device> &device)
inline DeviceNodeCRTP(std::unique_ptr<Properties> props)
inline DeviceNodeCRTP(std::unique_ptr<Properties> props, bool confMode)
inline DeviceNodeCRTP(const std::shared_ptr<Device> &device, std::unique_ptr<Properties> props, bool confMode)
class Impl

Public Functions

Impl() = default
void setLogger(std::shared_ptr<::spdlog::logger> log)
void computePointCloudDense(const uint8_t *depthData, std::vector<Point3f> &points)
void computePointCloudDenseColored(const uint8_t *depthData, const uint8_t *colorData, std::vector<Point3fRGBA> &points)
template<typename PointT>
void applyTransformation(std::vector<PointT> &points)
template<typename PointT>
std::vector<PointT> filterValidPoints(const std::vector<PointT> &densePoints)
void setLengthUnit(dai::LengthUnit lengthUnit)
void useCPU()
void useCPUMT(uint32_t numThreads)
void useGPU(uint32_t device)
void setIntrinsics(float fx, float fy, float cx, float cy, unsigned int width, unsigned int height)
void setExtrinsics(const std::vector<std::vector<float>> &transformMatrix)
void clearExtrinsics()

Public Members

LengthUnit targetLengthUnit = LengthUnit::MILLIMETER