StereoSGBM class

The class implements the modified H. Hirschmuller algorithm 128 that differs from the original one as follows:

  • By default, the algorithm is single-pass, which means that you consider only 5 directions instead of 8. Set mode=StereoSGBM::MODE_HH in createStereoSGBM to run the full variant of the algorithm but beware that it may consume a lot of memory.
  • The algorithm matches blocks, not individual pixels. Though, setting blockSize=1 reduces the blocks to single pixels.
  • Mutual information cost function is not implemented. Instead, a simpler Birchfield-Tomasi sub-pixel metric from 29 is used. Though, the color images are supported as well.
  • Some pre- and post- processing steps from K. Konolige algorithm StereoBM are included, for example: pre-filtering (StereoBM::PREFILTER_XSOBEL type) and post-filtering (uniqueness check, quadratic interpolation and speckle filtering).

https://docs.opencv.org/4.x/d2/d85/classcv_1_1StereoSGBM.html#details

Inheritance

Constructors

StereoSGBM.create({int minDisparity = 0, int numDisparities = 16, int blockSize = 3, int P1 = 0, int P2 = 0, int disp12MaxDiff = 0, int preFilterCap = 0, int uniquenessRatio = 0, int speckleWindowSize = 0, int speckleRange = 0, int mode = MODE_SGBM})
Creates StereoSGBM object.
factory
StereoSGBM.fromPointer(StereoSGBMPtr ptr)
factory

Properties

blockSize ↔ int
getter/setter pair
disp12MaxDiff ↔ int
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
isDisposed → bool
Whether this object has been disposed.
no setterinherited
minDisparity ↔ int
getter/setter pair
mode ↔ int
getter/setter pair
numDisparities ↔ int
getter/setter pair
P1 ↔ int
getter/setter pair
P2 ↔ int
getter/setter pair
preFilterCap ↔ int
getter/setter pair
props → List<Object?>
no setterinherited
ptr ↔ Pointer<StereoSGBM>
getter/setter pairinherited
ref → StereoSGBM
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
speckleRange ↔ int
getter/setter pair
speckleWindowSize ↔ int
getter/setter pair
uniquenessRatio ↔ int
getter/setter pair

Methods

compute(Mat left, Mat right, {Mat? disparity}) → Mat
dispose() → void
Releases the underlying native resources. Idempotent: calling it more than once is safe, but the object must not be used after dispose.
inherited
freeNative() → void
Frees the native resources owned by this object. Subclasses implement the concrete free logic here; callers must use dispose instead.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

finalizer → NativeFinalizer
final

Constants

MODE_HH → const int
MODE_HH4 → const int
MODE_SGBM → const int
MODE_SGBM_3WAY → const int