Table of Contents

Class StereoMatcher

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

The base class for stereo correspondence algorithms.

public class StereoMatcher : Algorithm, IDisposable
Inheritance
StereoMatcher
Implements
Derived
Inherited Members

Constructors

StereoMatcher(nint, nint, Action<nint>)

constructor

Properties

BlockSize

The linear size of the blocks compared by the algorithm. The size should be odd (as the block is centered at the current pixel). Larger block size implies smoother, though less accurate disparity map. Smaller block size gives more detailed disparity map, but there is higher chance for the algorithm to find a wrong correspondence.

Disp12MaxDiff

Maximum allowed difference (in integer pixel units) in the left-right disparity check. Set it to a non-positive value to disable the check.

MinDisparity

Minimum possible disparity value. Normally, it is zero but sometimes rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.

NumDisparities

The disparity search range. For each pixel the algorithm will find the best disparity from 0 (default minimum disparity) to NumDisparities. The search range can then be shifted by changing the minimum disparity.

SpeckleRange

Maximum disparity variation within each connected component. If you do speckle filtering, set the parameter to a positive value; it will be implicitly multiplied by 16. Normally, 1 or 2 is good enough.

SpeckleWindowSize

Maximum size of smooth disparity regions to consider their noise speckles and invalidate. Set it to 0 to disable speckle filtering. Otherwise, set it somewhere in the 50-200 range.

Methods

Compute(InputArray, InputArray, OutputArray)

Computes disparity map for the specified stereo pair