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


class depthai.StereoDepthConfig
class MedianFilter






property name
get(self: depthai.StereoDepthConfig)depthai.RawStereoDepthConfig
getBilateralFilterSigma(self: depthai.StereoDepthConfig)int
getConfidenceThreshold(self: depthai.StereoDepthConfig)int
getData(self: object) → numpy.ndarray[numpy.uint8]
getDepthUnit(self: depthai.StereoDepthConfig)depthai.RawStereoDepthConfig.AlgorithmControl.DepthUnit
getLeftRightCheckThreshold(self: depthai.StereoDepthConfig)int
getMaxDisparity(self: depthai.StereoDepthConfig)float
getMedianFilter(self: depthai.StereoDepthConfig)depthai.MedianFilter
getRaw(self: depthai.ADatatype)depthai.RawBuffer
getSequenceNum(self: depthai.Buffer)int
getTimestamp(self: depthai.Buffer)datetime.timedelta
getTimestampDevice(self: depthai.Buffer)datetime.timedelta
set(self: depthai.StereoDepthConfig, config: depthai.RawStereoDepthConfig)depthai.StereoDepthConfig
setBilateralFilterSigma(self: depthai.StereoDepthConfig, sigma: int)depthai.StereoDepthConfig
setConfidenceThreshold(self: depthai.StereoDepthConfig, confThr: int)depthai.StereoDepthConfig
setData(*args, **kwargs)

Overloaded function.

  1. setData(self: depthai.Buffer, arg0: List[int]) -> None

  2. setData(self: depthai.Buffer, arg0: numpy.ndarray[numpy.uint8]) -> None

setDepthAlign(self: depthai.StereoDepthConfig, align: depthai.RawStereoDepthConfig.AlgorithmControl.DepthAlign)depthai.StereoDepthConfig
setDepthUnit(self: depthai.StereoDepthConfig, arg0: depthai.RawStereoDepthConfig.AlgorithmControl.DepthUnit)depthai.StereoDepthConfig
setDisparityShift(self: depthai.StereoDepthConfig, arg0: int)depthai.StereoDepthConfig
setExtendedDisparity(self: depthai.StereoDepthConfig, enable: bool)depthai.StereoDepthConfig
setLeftRightCheck(self: depthai.StereoDepthConfig, enable: bool)depthai.StereoDepthConfig
setLeftRightCheckThreshold(self: depthai.StereoDepthConfig, sigma: int)depthai.StereoDepthConfig
setMedianFilter(self: depthai.StereoDepthConfig, median: depthai.MedianFilter)depthai.StereoDepthConfig
setNumInvalidateEdgePixels(self: depthai.StereoDepthConfig, arg0: int)depthai.StereoDepthConfig
setSequenceNum(self: depthai.Buffer, arg0: int)depthai.Buffer
setSubpixel(self: depthai.StereoDepthConfig, enable: bool)depthai.StereoDepthConfig
setSubpixelFractionalBits(self: depthai.StereoDepthConfig, subpixelFractionalBits: int)depthai.StereoDepthConfig
setTimestamp(self: depthai.Buffer, arg0: datetime.timedelta)depthai.Buffer
setTimestampDevice(self: depthai.Buffer, arg0: datetime.timedelta)depthai.Buffer
class dai::StereoDepthConfig : public dai::Buffer

StereoDepthConfig message.

Public Types

using MedianFilter = dai::MedianFilter
using AlgorithmControl = RawStereoDepthConfig::AlgorithmControl
using PostProcessing = RawStereoDepthConfig::PostProcessing
using CensusTransform = RawStereoDepthConfig::CensusTransform
using CostMatching = RawStereoDepthConfig::CostMatching
using CostAggregation = RawStereoDepthConfig::CostAggregation

Public Functions


Construct StereoDepthConfig message.

StereoDepthConfig(std::shared_ptr<RawStereoDepthConfig> ptr)
~StereoDepthConfig() = default
StereoDepthConfig &setDepthAlign(AlgorithmControl::DepthAlign align)

  • align: Set the disparity/depth alignment: centered (between the ‘left’ and ‘right’ inputs), or from the perspective of a rectified output stream

StereoDepthConfig &setConfidenceThreshold(int confThr)

Confidence threshold for disparity calculation

  • confThr: Confidence threshold value 0..255

int getConfidenceThreshold() const

Get confidence threshold for disparity calculation

StereoDepthConfig &setMedianFilter(MedianFilter median)

  • median: Set kernel size for disparity/depth median filtering, or disable

MedianFilter getMedianFilter() const

Get median filter setting

StereoDepthConfig &setBilateralFilterSigma(uint16_t sigma)

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.

  • sigma: Set sigma value for 5x5 bilateral filter. 0..65535

uint16_t getBilateralFilterSigma() const

Get sigma value for 5x5 bilateral filter

StereoDepthConfig &setLeftRightCheckThreshold(int threshold)

  • threshold: Set threshold for left-right, right-left disparity map combine, 0..255

int getLeftRightCheckThreshold() const

Get threshold for left-right check combine

StereoDepthConfig &setLeftRightCheck(bool enable)

Computes and combines disparities in both L-R and R-L directions, and combine them.

For better occlusion handling, discarding invalid disparity values

StereoDepthConfig &setExtendedDisparity(bool enable)

Disparity range increased from 95 to 190, combined from full resolution and downscaled images. Suitable for short range objects

StereoDepthConfig &setSubpixel(bool enable)

Computes disparity with sub-pixel interpolation (3 fractional bits by default).

Suitable for long range. Currently incompatible with extended disparity

StereoDepthConfig &setSubpixelFractionalBits(int subpixelFractionalBits)

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.

StereoDepthConfig &setDepthUnit(AlgorithmControl::DepthUnit depthUnit)

Set depth unit of depth map.

Meter, centimeter, millimeter, inch, foot or custom unit is available.

StereoDepthConfig &setDisparityShift(int 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. 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.

StereoDepthConfig &setNumInvalidateEdgePixels(int32_t 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.

AlgorithmControl::DepthUnit getDepthUnit()

Get depth unit of depth map.

float getMaxDisparity() const

Useful for normalization of the disparity map.


Maximum disparity value that the node can return

StereoDepthConfig &set(dai::RawStereoDepthConfig config)

Set explicit configuration.

  • config: Explicit configuration

dai::RawStereoDepthConfig get() const

Retrieve configuration data for StereoDepth.


config for stereo depth algorithm

Private Functions

std::shared_ptr<RawBuffer> serialize() const override

Private Members

RawStereoDepthConfig &cfg

Got questions?

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