diff --git a/include/depthai-shared/datatype/RawSpatialLocationCalculatorConfig.hpp b/include/depthai-shared/datatype/RawSpatialLocationCalculatorConfig.hpp index e1ac404a..06924ea0 100644 --- a/include/depthai-shared/datatype/RawSpatialLocationCalculatorConfig.hpp +++ b/include/depthai-shared/datatype/RawSpatialLocationCalculatorConfig.hpp @@ -22,12 +22,28 @@ struct SpatialLocationCalculatorConfigThresholds { }; NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SpatialLocationCalculatorConfigThresholds, lowerThreshold, upperThreshold); +enum class SpatialLocationCalculatorAlgorithm : uint32_t { AVERAGE = 0, MIN, MAX }; + /// SpatialLocation configuration data structure struct SpatialLocationCalculatorConfigData { + /** + * Region of interest for spatial location calculation. + */ Rect roi; + /** + * Upper and lower thresholds for depth values to take into consideration. + */ SpatialLocationCalculatorConfigThresholds depthThresholds; + /** + * Calculation method used to obtain spatial locations. + * Average: the average of ROI is used for calculation. + * Min: the minimum value inside ROI is used for calculation. + * Max: the maximum value inside ROI is used for calculation. + * Default: average. + */ + SpatialLocationCalculatorAlgorithm calculationAlgorithm = SpatialLocationCalculatorAlgorithm::AVERAGE; }; -NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SpatialLocationCalculatorConfigData, roi, depthThresholds); +NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SpatialLocationCalculatorConfigData, roi, depthThresholds, calculationAlgorithm); /// RawSpatialLocation configuration structure struct RawSpatialLocationCalculatorConfig : public RawBuffer { diff --git a/include/depthai-shared/properties/SpatialDetectionNetworkProperties.hpp b/include/depthai-shared/properties/SpatialDetectionNetworkProperties.hpp index 399bf8fe..6e87768a 100644 --- a/include/depthai-shared/properties/SpatialDetectionNetworkProperties.hpp +++ b/include/depthai-shared/properties/SpatialDetectionNetworkProperties.hpp @@ -20,6 +20,7 @@ namespace dai { struct SpatialDetectionNetworkProperties : DetectionNetworkProperties { float detectedBBScaleFactor = 1.0; SpatialLocationCalculatorConfigThresholds depthThresholds; + SpatialLocationCalculatorAlgorithm calculationAlgorithm = SpatialLocationCalculatorAlgorithm::AVERAGE; }; NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SpatialDetectionNetworkProperties, @@ -36,6 +37,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SpatialDetectionNetworkProperties, anchorMasks, iouThreshold, detectedBBScaleFactor, - depthThresholds) + depthThresholds, + calculationAlgorithm) } // namespace dai