Hi @jakaskerl

So I have been going through he spatial location calculator and related posts here. So I understand that OAK cameras use left-handed (Cartesian) coordinate system for all spatial coordinates. Also The Z coordinate is always the shortest distance (normal) to object.

So what I am trying to understand when an object is detected and Z is calculated for it, what are the reference points for calculated this distance. By that I mean which point on the bounding box is used (for example its center) to calculate Z.

Thanks
Yishu

Hi @yishu_corpex
In case of SpatialLocationCalculator, the BBOX you see in the examples is the group of points that are taken into account when calculating the depth. The depth is given by an averaging method (usually MEDIAN, but can be MIN/MAX, average, ...).

Same thing goes for SpatialDetectionNetworks, the detected bounding box of an object is first scaled by BBoxScalingFactor, then the points inside that new BBOX are used to calculate the depth across those pixels. X and Y are taken from the centroid of that BBOX.

Thanks,
Jaka

10 days later

Hi @jakaskerl

Thanks for the explanation. Can you also let me know how can we choose the averaging method for Depth.

I understand Median is the default method, but how can we change it to other methods as mentioned by you above?

Thanks
Yishu

Hi @yishu_corpex

config = dai.SpatialLocationCalculatorConfigData()
config.depthThresholds.lowerThreshold = 100
config.depthThresholds.upperThreshold = 10000
calculationAlgorithm = dai.SpatialLocationCalculatorAlgorithm.MIN
config.roi = dai.Rect(topLeft, bottomRight)

Thanks,
Jaka