Table of Contents

Class StereoSGBM

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

Semi-Global Stereo Matching

public class StereoSGBM : StereoMatcher, IDisposable
Inheritance
StereoSGBM
Implements
Inherited Members

Properties

Mode

Set it to StereoSGBM::MODE_HH to run the full-scale two-pass dynamic programming algorithm. It will consume O(W*H*numDisparities) bytes, which is large for 640x480 stereo and huge for HD-size pictures. By default, it is set to false .

P1

The first parameter controlling the disparity smoothness. See P2 description.

P2

The second parameter controlling the disparity smoothness. The larger the values are, the smoother the disparity is. P1 is the penalty on the disparity change by plus or minus 1 between neighbor pixels. P2 is the penalty on the disparity change by more than 1 between neighbor pixels. The algorithm requires P2 > P1 . See stereo_match.cpp sample where some reasonably good P1 and P2 values are shown (like 8*number_of_image_channels*SADWindowSize*SADWindowSize and 32*number_of_image_channels*SADWindowSize*SADWindowSize , respectively).

PreFilterCap

Truncation value for the prefiltered image pixels. The algorithm first computes x-derivative at each pixel and clips its value by [-preFilterCap, preFilterCap] interval. The result values are passed to the Birchfield-Tomasi pixel cost function.

UniquenessRatio

Margin in percentage by which the best (minimum) computed cost function value should "win" the second best value to consider the found match correct. Normally, a value within the 5-15 range is good enough.

Methods

Create(int, int, int, int, int, int, int, int, int, int, StereoSGBMMode)

Creates StereoSGBM object. Using the default parameters, only numDisparities needs to be set at minimum; every other parameter can be set to a custom value as needed.