inputDepth 输入的深度图计算 ROI(感兴趣区域)的空间坐标。它会计算 ROI 内深度值的平均值,并剔除超出范围的深度值。您也可以在主端计算空间坐标,点击此处查看演示。该演示还包含了在设备上执行的相同逻辑(calc.py 文件)。
如何放置
Python
Python
1pipeline = dai.Pipeline()
2spatialCalc = pipeline.create(dai.node.SpatialLocationCalculator)输入与输出
用法
Python
Python
1pipeline = dai.Pipeline()
2spatialCalc = pipeline.create(dai.node.SpatialLocationCalculator)
3spatialCalc.setWaitForConfigInput(False)
4
5# 设置初始配置
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# 你稍后可以通过主机 (XLinkIn) / Script 节点向 InputConfig 发送配置功能示例
空间坐标系

参考
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 inputDetections
Input messages on which spatial location will be calculated. Possible datatypes are ImgDetections or Keypoints.
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
Outputs SpatialLocationCalculatorData message that carries spatial locations for each additional ROI that is specified in the config.
variable
Output outputDetections
variable
Output passthroughDepth
Passthrough message on which the calculation was performed. Suitable for when input queue is set to non-blocking behavior.
function
SpatialLocationCalculator()inline function
SpatialLocationCalculator(std::unique_ptr< Properties > props)function
void setRunOnHost(bool runOnHost)Specify whether to run on host or device By default, the node will run on device.
function
bool runOnHost()Check if the node is set to run on host
function
void run()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)需要帮助?
请前往 OAKChina 官网 获取技术支持或解答您的任何疑问。