host_spatials_calc
最后更新
depthai_nodes.node.host_spatials_calc类
HostSpatialsCalc
Note
四坐标 ROI 用作 NumPy 切片边界,不进行裁剪。点输入被钳制,以便采样方块适合帧内。
方法
init
Python
1def __init__(calibData: dai.CalibrationHandler, depthAlignmentSocket: dai.CameraBoardSocket = dai.CameraBoardSocket.CAM_A, delta: int = 5, threshLow: int = 200, threshHigh: int = 30000):calibData(dai.CalibrationHandler): 用于获取相机内参的设备校准数据。depthAlignmentSocket(dai.CameraBoardSocket): 深度像素对齐的相机。delta(int): 围绕点输入采样的正方形的半尺寸(像素)。threshLow(int): 深度帧单位中接受的最小深度(包含)。threshHigh(int): 深度帧单位中接受的最大深度(包含)。
calcSpatials
Python
1def calcSpatials(depthData: dai.ImgFrame, roi: list[int], averagingMethod: Callable = np.mean) -> dict[str, float]:depthData(dai.ImgFrame): 与配置的相机对齐的深度帧。roi(list[int]): 像素坐标,格式为[xmin, ymin, xmax, ymax],或由delta扩展的点[x, y]。切片上限是排他性的。averagingMethod(Callable): 在包含的配置阈值内对深度样本进行缩减的函数;默认为平均值。
dict[str, float]: 包含深度帧单位中的x、y和z的字典。如果没有样本通过深度阈值,则所有值为零。
ValueError: 如果 ROI 既不包含两个坐标也不包含四个坐标。
setDeltaRoi
Python
1def setDeltaRoi(delta: int):delta(int): 半尺寸(像素)。浮点值将被截断为整数。
TypeError: 如果 delta 既不是整数也不是浮点数。
setLowerThreshold
Python
1def setLowerThreshold(thresholdLow: int):thresholdLow(int): 接受的下深度值。
setUpperThreshold
Python
1def setUpperThreshold(thresholdHigh: int):thresholdHigh(int): 接受的上深度值。