Class StereoSgbmPar
Defined in File stereo.hpp
Class Documentation
-
class StereoSgbmPar
The StereoSgbmPar class is used to store/retrieve the stereo matching parameters.
Public Functions
-
inline StereoSgbmPar()
Default constructor.
-
bool load()
load stereo matching parameters
- Returns:
true if a configuration file exists
-
bool save()
save stereo matching parameters
- Returns:
true if a configuration file has been correctly created
-
void setDefaultValues()
set default stereo matching parameters
-
void print()
print the current stereo matching parameters on standard output
Public Members
-
int blockSize
[default: 3] Matched block size. It must be an odd number >=1 . Normally, it should be somewhere in the 3..11 range.
-
int minDisparity
[default: 0] Minimum possible disparity value. Normally, it is zero but sometimes rectification algorithms can shift images, so this parameter needs to be adjusted accordingly.
-
int numDisparities
[default: 96] Maximum disparity minus minimum disparity. The value is always greater than zero. In the current implementation, this parameter must be divisible by 16.
-
int 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
cv::StereoSGBM::MODE_SGBM_3WAY.
-
int P1
[default: 24*blockSize*blockSize] The first parameter controlling the disparity smoothness. See below.
-
int P2
[default: 4*PI]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*blockSize*blockSize and 32*number_of_image_channels*blockSize*blockSize , respectively).
-
int disp12MaxDiff
[default: 96] Maximum allowed difference (in integer pixel units) in the left-right disparity check. Set it to a non-positive value to disable the check.
-
int preFilterCap
[default: 63] 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.
-
int uniquenessRatio
[default: 5] 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.
-
int speckleWindowSize
[default: 255] 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.
-
int speckleRange
[default: 1] 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.
-
double minDepth_mm
[default: 300] Minimum value of depth for the extracted depth map
-
double maxDepth_mm
[default: 10000] Maximum value of depth for the extracted depth map
-
inline StereoSgbmPar()