ON THIS PAGE

  • StereoDepthConfig
  • Examples of functionality
  • Reference

StereoDepthConfig

This message is used to configure the StereoDepth node. With this message you can set filters, confidences, thresholds and mode of the StereoDepth node.

Examples of functionality

Reference

class

depthai.StereoDepthConfig(depthai.Buffer)

class
class
CensusTransform
The basic cost function used by the Stereo Accelerator for matching the left and right images is the Census Transform. It works on a block of pixels and computes a bit vector which represents the structure of the image in that block...
class
CostAggregation
Cost Aggregation is based on Semi Global Block Matching (SGBM). This algorithm uses a semi global technique to aggregate the cost map. Ultimately the idea is to build inertia into the stereo algorithm. ...
class
CostMatching
The matching cost is way of measuring the similarity of image locations in stereo correspondence algorithm. Based on the configuration parameters and based on the descriptor type, a linear equation is applied to computing the cost for each candidate disparity at each pixel.
class
MedianFilter
Median filter config
class
PostProcessing
Post-processing filters, all the filters are applied in disparity domain.
method
method
get(self) -> RawStereoDepthConfig: RawStereoDepthConfig
Retrieve configuration data for StereoDepth.

Returns:
    config for stereo depth algorithm
method
getBilateralFilterSigma(self) -> int: int
Get sigma value for 5x5 bilateral filter
method
getConfidenceThreshold(self) -> int: int
Get confidence threshold for disparity calculation
method
method
getLeftRightCheckThreshold(self) -> int: int
Get threshold for left-right check combine
method
getMaxDisparity(self) -> float: float
Useful for normalization of the disparity map.

Returns:
    Maximum disparity value that the node can return
method
method
set(self, config: RawStereoDepthConfig) -> StereoDepthConfig: StereoDepthConfig
Set explicit configuration.

Parameter ``config``:
    Explicit configuration
method
setBilateralFilterSigma(self, sigma: int) -> StereoDepthConfig: StereoDepthConfig
A larger value of the parameter means that farther colors within the pixel
neighborhood will be mixed together, resulting in larger areas of semi-equal
color.

Parameter ``sigma``:
    Set sigma value for 5x5 bilateral filter. 0..65535
method
setConfidenceThreshold(self, confThr: int) -> StereoDepthConfig: StereoDepthConfig
Confidence threshold for disparity calculation

Parameter ``confThr``:
    Confidence threshold value 0..255
method
setDepthAlign(self, align: RawStereoDepthConfig.AlgorithmControl.DepthAlign) -> StereoDepthConfig: StereoDepthConfig
Parameter ``align``:
    Set the disparity/depth alignment: centered (between the 'left' and 'right'
    inputs), or from the perspective of a rectified output stream
method
setDepthUnit(self, arg0: RawStereoDepthConfig.AlgorithmControl.DepthUnit) -> StereoDepthConfig: StereoDepthConfig
Set depth unit of depth map.

Meter, centimeter, millimeter, inch, foot or custom unit is available.
method
setDisparityShift(self, arg0: int) -> StereoDepthConfig: StereoDepthConfig
Shift input frame by a number of pixels to increase minimum depth. For example
shifting by 48 will change effective disparity search range from (0,95] to
[48,143]. An alternative approach to reducing the minZ. We normally only
recommend doing this when it is known that there will be no objects farther away
than MaxZ, such as having a depth camera mounted above a table pointing down at
the table surface.
method
setExtendedDisparity(self, enable: bool) -> StereoDepthConfig: StereoDepthConfig
Disparity range increased from 95 to 190, combined from full resolution and
downscaled images. Suitable for short range objects
method
setLeftRightCheck(self, enable: bool) -> StereoDepthConfig: StereoDepthConfig
Computes and combines disparities in both L-R and R-L directions, and combine
them.

For better occlusion handling, discarding invalid disparity values
method
setLeftRightCheckThreshold(self, sigma: int) -> StereoDepthConfig: StereoDepthConfig
Parameter ``threshold``:
    Set threshold for left-right, right-left disparity map combine, 0..255
method
setMedianFilter(self, median: MedianFilter) -> StereoDepthConfig: StereoDepthConfig
Parameter ``median``:
    Set kernel size for disparity/depth median filtering, or disable
method
setNumInvalidateEdgePixels(self, arg0: int) -> StereoDepthConfig: StereoDepthConfig
Invalidate X amount of pixels at the edge of disparity frame. For right and
center alignment X pixels will be invalidated from the right edge, for left
alignment from the left edge.
method
setSubpixel(self, enable: bool) -> StereoDepthConfig: StereoDepthConfig
Computes disparity with sub-pixel interpolation (3 fractional bits by default).

Suitable for long range. Currently incompatible with extended disparity
method
setSubpixelFractionalBits(self, subpixelFractionalBits: int) -> StereoDepthConfig: StereoDepthConfig
Number of fractional bits for subpixel mode. Default value: 3. Valid values:
3,4,5. Defines the number of fractional disparities: 2^x. Median filter
postprocessing is supported only for 3 fractional bits.
class

depthai.StereoDepthConfig.AlgorithmControl

class
DepthAlign
Align the disparity/depth to the perspective of a rectified output, or center it
class
DepthUnit
Measurement unit for depth data
method
property
centerAlignmentShiftFactor
Used only for debug purposes. centerAlignmentShiftFactor is set automatically in firmware, from camera extrinsics when depth alignment to camera is enabled. Center alignment is achieved by shifting the obtained disparity map by a scale factor...
method
property
customDepthUnitMultiplier
Custom depth unit multiplier, if custom depth unit is enabled, relative to 1 meter. A multiplier of 1000 effectively means depth unit in millimeter.
method
property
depthAlign
Set the disparity/depth alignment to the perspective of a rectified output, or center it
method
property
depthUnit
Measurement unit for depth data. Depth data is integer value, multiple of depth unit.
method
property
disparityShift
Shift input frame by a number of pixels to increase minimum depth. For example shifting by 48 will change effective disparity search range from (0,95] to [48,143]. An alternative approach to reducing the minZ...
method
property
enableExtended
Disparity range increased from 95 to 190, combined from full resolution and downscaled images. Suitable for short range objects
method
property
enableLeftRightCheck
Computes and combines disparities in both L-R and R-L directions, and combine them. For better occlusion handling
method
property
enableSubpixel
Computes disparity with sub-pixel interpolation (5 fractional bits), suitable for long range
method
property
leftRightCheckThreshold
Left-right check threshold for left-right, right-left disparity map combine, 0..128 Used only when left-right check mode is enabled. Defines the maximum difference between the confidence of pixels from left-right and right-left confidence maps...
method
property
numInvalidateEdgePixels
Invalidate X amount of pixels at the edge of disparity frame. For right and center alignment X pixels will be invalidated from the right edge, for left alignment from the left edge.
method
property
subpixelFractionalBits
Number of fractional bits for subpixel mode
method
class

depthai.StereoDepthConfig.CensusTransform

class
KernelSize
Census transform kernel size possible values.
method
property
enableMeanMode
If enabled, each pixel in the window is compared with the mean window value instead of the central pixel.
method
property
kernelMask
Census transform mask, default - auto, mask is set based on resolution and kernel size. Disabled for 400p input resolution. Enabled for 720p. 0XA82415 for 5x5 census transform kernel. 0XAA02A8154055 for 7x7 census transform kernel...
method
property
kernelSize
Census transform kernel size.
method
property
threshold
Census transform comparison threshold value.
method
class

depthai.StereoDepthConfig.CostAggregation

method
property
divisionFactor
Cost calculation linear equation parameters.
method
property
horizontalPenaltyCostP1
Horizontal P1 penalty cost parameter.
method
property
horizontalPenaltyCostP2
Horizontal P2 penalty cost parameter.
method
property
verticalPenaltyCostP1
Vertical P1 penalty cost parameter.
method
property
verticalPenaltyCostP2
Vertical P2 penalty cost parameter.
method
class

depthai.StereoDepthConfig.CostMatching

class
DisparityWidth
Disparity search range: 64 or 96 pixels are supported by the HW.
class
LinearEquationParameters
The linear equation applied for computing the cost is: COMB_COST = α*AD + β*(CTC<<3). CLAMP(COMB_COST >> 5, threshold). Where AD is the Absolute Difference between 2 pixels values. CTC is the Census Transform Cost between 2 pixels, based on Hamming distance (xor)...
method
property
confidenceThreshold
Disparities with confidence value under this threshold are accepted. Higher confidence threshold means disparities with less confidence are accepted too.
method
property
disparityWidth
Disparity search range, default 96 pixels.
method
property
enableCompanding
Disparity companding using sparse matching. Matching pixel by pixel for N disparities. Matching every 2nd pixel for M disparitites. Matching every 4th pixel for T disparities. In case of 96 disparities: N=48, M=32, T=16...
method
property
invalidDisparityValue
Used only for debug purposes, SW postprocessing handled only invalid value of 0 properly.
method
property
linearEquationParameters
Cost calculation linear equation parameters.
method
class

depthai.StereoDepthConfig.CostMatching.LinearEquationParameters

class

depthai.StereoDepthConfig.PostProcessing

class
BrightnessFilter
Brightness filtering. If input frame pixel is too dark or too bright, disparity will be invalidated. The idea is that for too dark/too bright pixels we have low confidence, since that area was under/over exposed and details were lost.
class
DecimationFilter
Decimation filter. Reduces the depth scene complexity. The filter runs on kernel sizes [2x2] to [8x8] pixels.
class
SpatialFilter
1D edge-preserving spatial filter using high-order domain transform.
class
SpeckleFilter
Speckle filtering. Removes speckle noise.
class
TemporalFilter
Temporal filtering with optional persistence.
class
ThresholdFilter
Threshold filtering. Filters out distances outside of a given interval.
method
property
bilateralSigmaValue
Sigma value for bilateral filter. 0 means disabled. A larger value of the parameter means that farther colors within the pixel neighborhood will be mixed together.
method
property
brightnessFilter
Brightness filtering. If input frame pixel is too dark or too bright, disparity will be invalidated. The idea is that for too dark/too bright pixels we have low confidence, since that area was under/over exposed and details were lost.
method
property
decimationFilter
Decimation filter. Reduces disparity/depth map x/y complexity, reducing runtime complexity for other filters.
method
property
median
Set kernel size for disparity/depth median filtering, or disable
method
property
spatialFilter
Edge-preserving filtering: This type of filter will smooth the depth noise while attempting to preserve edges.
method
property
speckleFilter
Speckle filtering. Removes speckle noise.
method
property
temporalFilter
Temporal filtering with optional persistence.
method
property
thresholdFilter
Threshold filtering. Filters out distances outside of a given interval.
method
class

depthai.StereoDepthConfig.PostProcessing.BrightnessFilter

method
property
maxBrightness
Maximum range in depth units. If input pixel is less or equal than this value the depth value is invalidated.
method
property
minBrightness
Minimum pixel brightness. If input pixel is less or equal than this value the depth value is invalidated.
method
class

depthai.StereoDepthConfig.PostProcessing.DecimationFilter

class
DecimationMode
Decimation algorithm type.
method
property
decimationFactor
Decimation factor. Valid values are 1,2,3,4. Disparity/depth map x/y resolution will be decimated with this value.
method
property
decimationMode
Decimation algorithm type.
method
class

depthai.StereoDepthConfig.PostProcessing.SpatialFilter

method
property
alpha
The Alpha factor in an exponential moving average with Alpha=1 - no filter. Alpha = 0 - infinite filter. Determines the amount of smoothing.
method
property
delta
Step-size boundary. Establishes the threshold used to preserve "edges". If the disparity value between neighboring pixels exceed the disparity threshold set by this delta parameter, then filtering will be temporarily disabled...
method
property
enable
Whether to enable or disable the filter.
method
property
holeFillingRadius
An in-place heuristic symmetric hole-filling mode applied horizontally during the filter passes. Intended to rectify minor artefacts with minimal performance impact. Search radius for hole filling.
method
property
numIterations
Number of iterations over the image in both horizontal and vertical direction.
method
class

depthai.StereoDepthConfig.PostProcessing.SpeckleFilter

class

depthai.StereoDepthConfig.PostProcessing.TemporalFilter

class
PersistencyMode
Persistency algorithm type.
method
property
alpha
The Alpha factor in an exponential moving average with Alpha=1 - no filter. Alpha = 0 - infinite filter. Determines the extent of the temporal history that should be averaged.
method
property
delta
Step-size boundary. Establishes the threshold used to preserve surfaces (edges). If the disparity value between neighboring pixels exceed the disparity threshold set by this delta parameter, then filtering will be temporarily disabled...
method
property
enable
Whether to enable or disable the filter.
method
property
persistencyMode
Persistency mode. If the current disparity/depth value is invalid, it will be replaced by an older value, based on persistency mode.
method
class

depthai.StereoDepthConfig.PostProcessing.TemporalFilter.PersistencyMode

variable
variable
variable
variable
variable
variable
variable
variable
variable
variable
method
method
method
method
method
method
method
method
method
method
property
property
class

depthai.StereoDepthConfig.PostProcessing.ThresholdFilter

method
property
maxRange
Maximum range in depth units. Depth values over this value are invalidated.
method
property
minRange
Minimum range in depth units. Depth values under this value are invalidated.
method

Need assistance?

Head over to Discussion Forum for technical support or any other questions you might have.