SpatialLocationCalculator
SpatialLocationCalculator node calculates the spatial coordinates of the ROI (region-of-interest) based on thedepth
map from the inputDepth
. It will average the depth values in the ROI and remove the ones out of range.You can also calculate spatial coordinates on host side, demo here. The demo also has the same logic that's performed on the device (calc.py
file).
How to place it
Python
C++
Python
Python
1pipeline = dai.Pipeline()
2spatialCalc = pipeline.create(dai.node.SpatialLocationCalculator)
Inputs and Outputs
Usage
Python
C++
Python
Python
1pipeline = dai.Pipeline()
2spatialCalc = pipeline.create(dai.node.SpatialLocationCalculator)
3spatialCalc.setWaitForConfigInput(False)
4
5# Set initial config
6config = dai.SpatialLocationCalculatorConfigData()
7config.depthThresholds.lowerThreshold = 100
8config.depthThresholds.upperThreshold = 10000
9
10topLeft = dai.Point2f(0.4, 0.4)
11bottomRight = dai.Point2f(0.6, 0.6)
12config.roi = dai.Rect(topLeft, bottomRight)
13
14spatial_calc.initialConfig.addROI(config)
15
16# You can later send configs from the host (XLinkIn) / Script node to the InputConfig
Examples of functionality
Spatial coordinate system
OAK camera uses left-handed (Cartesian) coordinate system for all spatial coordinates.Reference
class
dai::node::SpatialLocationCalculator
variable
std::shared_ptr< SpatialLocationCalculatorConfig > initialConfig
Initial config to use when calculating spatial location data.
variable
Input inputConfig
Input SpatialLocationCalculatorConfig message with ability to modify parameters in runtime. Default queue is non-blocking with size 4.
variable
Input inputDepth
Input message with depth data used to retrieve spatial information about detected object. Default queue is non-blocking with size 4.
variable
Output out
variable
Output passthroughDepth
Passthrough message on which the calculation was performed. Suitable for when input queue is set to non-blocking behavior.
function
SpatialLocationCalculator()
function
SpatialLocationCalculator(std::unique_ptr< Properties > props)
inline function
DeviceNodeCRTP()
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props, bool confMode)
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device, std::unique_ptr< Properties > props, bool confMode)
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.