Class for computing stereo correspondence using the variational matching algorithm
class StereoVar
{
StereoVar();
StereoVar( int levels, double pyrScale,
int nIt, int minDisp, int maxDisp,
int poly_n, double poly_sigma, float fi,
float lambda, int penalization, int cycle,
int flags);
virtual ~StereoVar();
virtual void operator()(InputArray left, InputArray right, OutputArray disp);
int levels;
double pyrScale;
int nIt;
int minDisp;
int maxDisp;
int poly_n;
double poly_sigma;
float fi;
float lambda;
int penalization;
int cycle;
int flags;
...
};
The class implements the modified S. G. Kosov algorithm [KTS09] that differs from the original one as follows:
 The automatic initialization of method’s parameters is added.
 The method of Smart Iteration Distribution (SID) is implemented.
 The support of MultiLevel Adaptation Technique (MLAT) is not included.
 The method of dynamic adaptation of method’s parameters is not included.
[KTS09]  Sergey Kosov, Thorsten Thormählen and HansPeter Seidel: Accurate realtime disparity estimation with variational methods. In: Advances in Visual Computing. Springer Berlin Heidelberg, 2009. 796807. 
The constructor
Parameters: 


The first constructor initializes StereoVar with all the default parameters. So, you only have to set StereoVar::maxDisp and / or StereoVar::minDisp at minimum. The second constructor enables you to set each parameter to a custom value.
Computes disparity using the variational algorithm for a rectified stereo pair.
Parameters: 


The method executes the variational algorithm on a rectified stereo pair. See stereo_match.cpp OpenCV sample on how to prepare images and call the method.
Note:
The method is not constant, so you should not use the same StereoVar instance from different threads simultaneously.