From 1eb5c99bd1d85e84f9aea24cfb809a7c5b01ca0d Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Mon, 21 Mar 2022 23:03:00 +0200 Subject: [PATCH 1/4] Add customizable depth unit --- .../datatype/RawStereoDepthConfig.hpp | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/include/depthai-shared/datatype/RawStereoDepthConfig.hpp b/include/depthai-shared/datatype/RawStereoDepthConfig.hpp index 1d7eafbe..5d6f2a35 100644 --- a/include/depthai-shared/datatype/RawStereoDepthConfig.hpp +++ b/include/depthai-shared/datatype/RawStereoDepthConfig.hpp @@ -24,11 +24,28 @@ struct RawStereoDepthConfig : public RawBuffer { */ enum class DepthAlign : int32_t { RECTIFIED_RIGHT, RECTIFIED_LEFT, CENTER }; + /** + * Measurement unit for depth data + */ + enum class DepthUnit : int32_t { METRE, CENTIMETRE, MILLIMETRE, INCH, FOOT, CUSTOM }; + /** * Set the disparity/depth alignment to the perspective of a rectified output, or center it */ DepthAlign depthAlign = DepthAlign::RECTIFIED_RIGHT; + /** + * Measurement unit for depth data. + * Depth data is integer value, multiple of depth unit. + */ + DepthUnit depthUnit = DepthUnit::MILLIMETRE; + + /** + * Custom depth unit multiplier, if custom depth unit is enabled, relative to 1 metre. + * A multiplier of 1000 effectively means depth unit in millimetre. + */ + float customDepthUnitMultiplier = 1000.f; + /** * Computes and combines disparities in both L-R and R-L directions, and combine them. * For better occlusion handling @@ -64,7 +81,15 @@ struct RawStereoDepthConfig : public RawBuffer { */ std::int32_t subpixelFractionalBits = 3; - DEPTHAI_SERIALIZE(AlgorithmControl, depthAlign, enableLeftRightCheck, enableExtended, enableSubpixel, leftRightCheckThreshold, subpixelFractionalBits); + DEPTHAI_SERIALIZE(AlgorithmControl, + depthAlign, + depthUnit, + customDepthUnitMultiplier, + enableLeftRightCheck, + enableExtended, + enableSubpixel, + leftRightCheckThreshold, + subpixelFractionalBits); }; /** @@ -196,12 +221,12 @@ struct RawStereoDepthConfig : public RawBuffer { */ struct ThresholdFilter { /** - * Minimum range in millimeters. + * Minimum range in depth units. * Depth values under this value are invalidated. */ std::int32_t minRange = 0; /** - * Maximum range in millimeters. + * Maximum range in depth units. * Depth values over this value are invalidated. */ std::int32_t maxRange = 65535; From 8e26b9acb76672e1f34a00406a82534a628e8f7c Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Mon, 21 Mar 2022 23:53:03 +0200 Subject: [PATCH 2/4] Change millimetre to depth unit where it's applicable --- .../datatype/RawSpatialLocationCalculatorConfig.hpp | 2 +- include/depthai-shared/datatype/RawSpatialLocations.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/depthai-shared/datatype/RawSpatialLocationCalculatorConfig.hpp b/include/depthai-shared/datatype/RawSpatialLocationCalculatorConfig.hpp index b087f70c..6835ae4c 100644 --- a/include/depthai-shared/datatype/RawSpatialLocationCalculatorConfig.hpp +++ b/include/depthai-shared/datatype/RawSpatialLocationCalculatorConfig.hpp @@ -13,7 +13,7 @@ namespace dai { /** * SpatialLocation configuration thresholds structure * - * Contains configuration data for lower and upper threshold in millimeters for ROI. + * Contains configuration data for lower and upper threshold in depth units (millimetre by default) for ROI. * Values outside of threshold range will be ignored when calculating spatial coordinates from depth map. */ struct SpatialLocationCalculatorConfigThresholds { diff --git a/include/depthai-shared/datatype/RawSpatialLocations.hpp b/include/depthai-shared/datatype/RawSpatialLocations.hpp index 4b6db698..d68cf4bc 100644 --- a/include/depthai-shared/datatype/RawSpatialLocations.hpp +++ b/include/depthai-shared/datatype/RawSpatialLocations.hpp @@ -16,7 +16,7 @@ namespace dai { * * Contains configuration data, average depth for the calculated ROI on depth map. * Together with spatial coordinates: x,y,z relative to the center of depth map. - * Units are in millimeters. + * Units are in depth units (millimetre by default). */ struct SpatialLocations { /** From afdedb1437af961fbbdae4ef6ef16b67ff01510d Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Mon, 21 Mar 2022 23:56:49 +0200 Subject: [PATCH 3/4] Remove outdated documentation --- include/depthai-shared/datatype/RawStereoDepthConfig.hpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/depthai-shared/datatype/RawStereoDepthConfig.hpp b/include/depthai-shared/datatype/RawStereoDepthConfig.hpp index 5d6f2a35..e9578190 100644 --- a/include/depthai-shared/datatype/RawStereoDepthConfig.hpp +++ b/include/depthai-shared/datatype/RawStereoDepthConfig.hpp @@ -160,7 +160,6 @@ struct RawStereoDepthConfig : public RawBuffer { /** * Temporal filtering with optional persistence. - * More details about the filter can be found here: */ struct TemporalFilter { static constexpr const std::int32_t DEFAULT_DELTA_VALUE = 3; @@ -211,7 +210,6 @@ struct RawStereoDepthConfig : public RawBuffer { /** * Temporal filtering with optional persistence. - * More details about the filter can be found here: */ TemporalFilter temporalFilter; From 14eb244e238c775fea690c1738e8078a0dd81dbc Mon Sep 17 00:00:00 2001 From: SzabolcsGergely Date: Tue, 22 Mar 2022 16:17:04 +0200 Subject: [PATCH 4/4] Change metre to meter --- .../datatype/RawSpatialLocationCalculatorConfig.hpp | 2 +- include/depthai-shared/datatype/RawSpatialLocations.hpp | 2 +- include/depthai-shared/datatype/RawStereoDepthConfig.hpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/depthai-shared/datatype/RawSpatialLocationCalculatorConfig.hpp b/include/depthai-shared/datatype/RawSpatialLocationCalculatorConfig.hpp index 6835ae4c..10786518 100644 --- a/include/depthai-shared/datatype/RawSpatialLocationCalculatorConfig.hpp +++ b/include/depthai-shared/datatype/RawSpatialLocationCalculatorConfig.hpp @@ -13,7 +13,7 @@ namespace dai { /** * SpatialLocation configuration thresholds structure * - * Contains configuration data for lower and upper threshold in depth units (millimetre by default) for ROI. + * Contains configuration data for lower and upper threshold in depth units (millimeter by default) for ROI. * Values outside of threshold range will be ignored when calculating spatial coordinates from depth map. */ struct SpatialLocationCalculatorConfigThresholds { diff --git a/include/depthai-shared/datatype/RawSpatialLocations.hpp b/include/depthai-shared/datatype/RawSpatialLocations.hpp index d68cf4bc..fb376d13 100644 --- a/include/depthai-shared/datatype/RawSpatialLocations.hpp +++ b/include/depthai-shared/datatype/RawSpatialLocations.hpp @@ -16,7 +16,7 @@ namespace dai { * * Contains configuration data, average depth for the calculated ROI on depth map. * Together with spatial coordinates: x,y,z relative to the center of depth map. - * Units are in depth units (millimetre by default). + * Units are in depth units (millimeter by default). */ struct SpatialLocations { /** diff --git a/include/depthai-shared/datatype/RawStereoDepthConfig.hpp b/include/depthai-shared/datatype/RawStereoDepthConfig.hpp index e9578190..498b270f 100644 --- a/include/depthai-shared/datatype/RawStereoDepthConfig.hpp +++ b/include/depthai-shared/datatype/RawStereoDepthConfig.hpp @@ -27,7 +27,7 @@ struct RawStereoDepthConfig : public RawBuffer { /** * Measurement unit for depth data */ - enum class DepthUnit : int32_t { METRE, CENTIMETRE, MILLIMETRE, INCH, FOOT, CUSTOM }; + enum class DepthUnit : int32_t { METER, CENTIMETER, MILLIMETER, INCH, FOOT, CUSTOM }; /** * Set the disparity/depth alignment to the perspective of a rectified output, or center it @@ -38,11 +38,11 @@ struct RawStereoDepthConfig : public RawBuffer { * Measurement unit for depth data. * Depth data is integer value, multiple of depth unit. */ - DepthUnit depthUnit = DepthUnit::MILLIMETRE; + DepthUnit depthUnit = DepthUnit::MILLIMETER; /** - * Custom depth unit multiplier, if custom depth unit is enabled, relative to 1 metre. - * A multiplier of 1000 effectively means depth unit in millimetre. + * Custom depth unit multiplier, if custom depth unit is enabled, relative to 1 meter. + * A multiplier of 1000 effectively means depth unit in millimeter. */ float customDepthUnitMultiplier = 1000.f;