binocular_disparity_mgbinocular_disparity_mgBinocularDisparityMgBinocularDisparityMgbinocular_disparity_mg (Operator)


binocular_disparity_mgbinocular_disparity_mgBinocularDisparityMgBinocularDisparityMgbinocular_disparity_mg — Compute the disparities of a rectified stereo image pair using multigrid methods.


binocular_disparity_mg(ImageRect1, ImageRect2 : Disparity, Score : GrayConstancy, GradientConstancy, Smoothness, InitialGuess, CalculateScore, MGParamName, MGParamValue : )

Herror binocular_disparity_mg(const Hobject ImageRect1, const Hobject ImageRect2, Hobject* Disparity, Hobject* Score, double GrayConstancy, double GradientConstancy, double Smoothness, double InitialGuess, const char* CalculateScore, const char* MGParamName, const char* MGParamValue)

Herror T_binocular_disparity_mg(const Hobject ImageRect1, const Hobject ImageRect2, Hobject* Disparity, Hobject* Score, const Htuple GrayConstancy, const Htuple GradientConstancy, const Htuple Smoothness, const Htuple InitialGuess, const Htuple CalculateScore, const Htuple MGParamName, const Htuple MGParamValue)

void BinocularDisparityMg(const HObject& ImageRect1, const HObject& ImageRect2, HObject* Disparity, HObject* Score, const HTuple& GrayConstancy, const HTuple& GradientConstancy, const HTuple& Smoothness, const HTuple& InitialGuess, const HTuple& CalculateScore, const HTuple& MGParamName, const HTuple& MGParamValue)

HImage HImage::BinocularDisparityMg(const HImage& ImageRect2, HImage* Score, double GrayConstancy, double GradientConstancy, double Smoothness, double InitialGuess, const HString& CalculateScore, const HTuple& MGParamName, const HTuple& MGParamValue) const

HImage HImage::BinocularDisparityMg(const HImage& ImageRect2, HImage* Score, double GrayConstancy, double GradientConstancy, double Smoothness, double InitialGuess, const HString& CalculateScore, const HString& MGParamName, const HString& MGParamValue) const

HImage HImage::BinocularDisparityMg(const HImage& ImageRect2, HImage* Score, double GrayConstancy, double GradientConstancy, double Smoothness, double InitialGuess, const char* CalculateScore, const char* MGParamName, const char* MGParamValue) const

HImage HImage::BinocularDisparityMg(const HImage& ImageRect2, HImage* Score, double GrayConstancy, double GradientConstancy, double Smoothness, double InitialGuess, const wchar_t* CalculateScore, const wchar_t* MGParamName, const wchar_t* MGParamValue) const   (Windows only)

static void HOperatorSet.BinocularDisparityMg(HObject imageRect1, HObject imageRect2, out HObject disparity, out HObject score, HTuple grayConstancy, HTuple gradientConstancy, HTuple smoothness, HTuple initialGuess, HTuple calculateScore, HTuple MGParamName, HTuple MGParamValue)

HImage HImage.BinocularDisparityMg(HImage imageRect2, out HImage score, double grayConstancy, double gradientConstancy, double smoothness, double initialGuess, string calculateScore, HTuple MGParamName, HTuple MGParamValue)

HImage HImage.BinocularDisparityMg(HImage imageRect2, out HImage score, double grayConstancy, double gradientConstancy, double smoothness, double initialGuess, string calculateScore, string MGParamName, string MGParamValue)

def binocular_disparity_mg(image_rect_1: HObject, image_rect_2: HObject, gray_constancy: float, gradient_constancy: float, smoothness: float, initial_guess: float, calculate_score: str, mgparam_name: MaybeSequence[str], mgparam_value: MaybeSequence[Union[str, float, int]]) -> Tuple[HObject, HObject]


binocular_disparity_mgbinocular_disparity_mgBinocularDisparityMgBinocularDisparityMgBinocularDisparityMgbinocular_disparity_mg calculates the disparity between two rectified stereo images ImageRect1ImageRect1ImageRect1ImageRect1imageRect1image_rect_1 and ImageRect2ImageRect2ImageRect2ImageRect2imageRect2image_rect_2 and returns it in DisparityDisparityDisparityDisparitydisparitydisparity. In contrast to binocular_disparitybinocular_disparityBinocularDisparityBinocularDisparityBinocularDisparitybinocular_disparity, a variational approach based on multigrid methods is used. This approach returns disparity values also for image parts that contain no texture. In contrast to binocular_distance_mgbinocular_distance_mgBinocularDistanceMgBinocularDistanceMgBinocularDistanceMgbinocular_distance_mg, the results are not transformed into distance values.

The input images must be a pair of rectified stereo images, i.e., corresponding points must have the same vertical coordinate. The images can have different widths, but must have the same height. The runtime of the operator is approximately linear in the size of the images.

The disparity is the amount by which each point in the first image ImageRect1ImageRect1ImageRect1ImageRect1imageRect1image_rect_1 needs to be moved to reach its corresponding point in the second image ImageRect2ImageRect2ImageRect2ImageRect2imageRect2image_rect_2. Two points are called corresponding if they are the image of the same point in the original scene. The calculated disparity field is dense and estimates the disparity also for points that do not have a corresponding point. The disparity is calculated only for those lines that are part of the domains of both input images. More exactly, the domain of the disparity map is calculated as the intersection of heights of the smallest enclosing rectangles of the domains of the input images.

The calculated disparity field is usually not perfect. If the parameter CalculateScoreCalculateScoreCalculateScoreCalculateScorecalculateScorecalculate_score is set to 'true'"true""true""true""true""true", a quality measure for the disparity is estimated for each pixel and returned in ScoreScoreScoreScorescorescore, which is a gray value image with a range from 0 to 10, where 0 is the best quality and 10 the worst. For this, the reverse disparity field from the second to the first image is calculated and compared to the returned disparity field. Because of this, the runtime roughly doubles when computing the score.

The operator uses a variational approach, where an energy value is assigned to each possible disparity field. Disparity fields with a lower energy are better than those with a high energy. The operator calculates a disparity field with the minimum energy and returns it.

The energy assigned to a disparity field consists of a data term and a smoothness term. The data term models the fact that corresponding points are images of the same part of the scene and thus have equal gray values. The smoothness term models the fact that the imaged scene and with it its disparity field is piecewise smooth, which leads to an interpolation of the disparity into areas with low information from the data term, e.g., areas with no texture.

The details of the assumptions are as follows:

Constancy of the gray values: It is assumed that corresponding points have the same gray value, i.e., that .

Constancy of the gray value gradients: It is assumed that corresponding points have the same gray value gradient, i.e., that . Discrepancies from this assumption are modeled using the norm of the difference of the two gradients. The gray value gradient has the advantage of being invariant to additive illumination changes between the two images.

Statistical robustness in the data term: To reduce the influence of outliers, i.e., points that violate the constancy assumptions, they are penalized in a statistically robust manner via the total variation , where is a fixed regularization constant.

Smoothness of the disparity field: It is assumed that the resulting disparity field is piecewise smooth. This is modeled by the norm of the derivative of the disparity field.

Statistical robustness in the smoothness term: Analogously to the data term, the statistically robust total variation is applied to the smoothness term to reduce the influence of outliers. This is especially important for preserving edges in the disparity field that appear on object boundaries.

The energy functional is the integral of a linear combination of the above terms over the area of the first image. The coefficients of the linear combination are parameters of the operator and allow a fine tuning of the model to a specific situation. GrayConstancyGrayConstancyGrayConstancyGrayConstancygrayConstancygray_constancy determines the influence of the gray value constancy, GradientConstancyGradientConstancyGradientConstancyGradientConstancygradientConstancygradient_constancy the influence of the constancy of the gray value gradient, and SmoothnessSmoothnessSmoothnessSmoothnesssmoothnesssmoothness the influence of the smoothness term. The first two parameters need to be adapted to the gray value interval of the images. The proposed parameters are valid for images with a gray value range of 0 to 255.

Let be the gray value of the first image at the coordinates (x,y), the gray value of the second image, and u(x,y) the value of the disparity at the coordinate (x,y). Then, the energy functional is then given by

It is assumed that the disparity field u that minimizes the functional E satisfies the above assumptions and is thus a good approximation of the disparity between the two images.

The above functional is minimized by finding the roots of the Euler-Lagrange equation (ELE) of the integral. This is comparable to finding the extremal values of a one-dimensional function by searching the roots of its derivative. The ELE is a nonlinear partial differential equation over the region of the integral, which needs to be 0 for extrema of E. Since the functional typically does not have any maxima, the corresponding roots of the ELE correspond to the minima of the functional.

The following techniques are used to find the roots of the ELE:

Fixed point iteration: The ELE is solved by converting it to a fixed point iteration that iteratively approaches the solution. The number of iterations can be used to balance between speed and accuracy of the solution. Each step of the fixed point iteration consists of solving a linear partial differential equation.

Coarse-to-fine process: A Gaussian image pyramid of the stereo images is created. The ELE is first solved on a coarse level of the pyramid and the solution is taken as the initial value of the fixed point iteration of the next level. This has a number of advantages and disadvantages:

1. Since the fixed point iteration of the next level receives a good initial value, fewer iterations are necessary to archive a good accuracy. The iteration must perform only small corrections of the disparity.

2. Large disparities on the original images become small disparities on the coarse grid levels and can thus be calculated more easily.

3. The robustness against noise in the images is increased because most kinds of noise disappear on the coarse version of the images.

4. Problems arise with small structures that have a large disparity difference to their surroundings since they disappear on coarse versions of the image and thus the disparity of the surroundings is calculated. This error will not be corrected on the finer levels of the image pyramid since only small corrections are calculated there.

Multigrid methods: The linear partial differential equations that arise in the fixed point iteration at each pyramid level are converted into a linear system of equations through linearization. These linear systems are solved using iterative solvers. Multigrid methods are among the most efficient solvers for the kind of linear systems that arise here. They use the fact that classic iterative solvers, like the Gauss-Seidel solver, quickly reduce the high frequency parts of the error, but only slowly reduce the low frequency parts. Multigrid methods thus calculate the error on a coarser grid where the low frequency part of the error appears as high frequencies and can be reduced quickly by the classical solvers. This is done hierarchically, i.e., the computation of the error on a coarser resolution level itself uses the same strategy and efficiently computes its error (i.e., the error of the error) by correction steps on an even coarser resolution level. Depending on whether one or two error correction steps are performed per cycle, a so called V or W cycle is obtained. The corresponding strategies for stepping through the resolution hierarchy are as follows for two to four resolution levels: Here, iterations on the original problem are denoted by large markers, while small markers denote iterations on error correction problems.

Algorithmically, a correction cycle can be described as follows:

1. In the first step, several (few) iterations using an interactive linear or nonlinear basic solver are performed (e.g., a variant of the Gauss-Seidel solver). This step is called pre-relaxation step.

2. In the second step, the current error is computed to correct the current solution (the solution after step 1). For efficiency reasons, the error is calculated on a coarser resolution level. This step, which can be performed iteratively several times, is called coarse grid correction step.

3. In a final step, again several (few) iterations using the interactive linear or nonlinear basic solver of step 1 are performed. This step is called post-relaxation step.

In addition, the solution can be initialized in a hierarchical manner. Starting from a very coarse variant of the original linear equation system, the solution is successively refined. To do so, interpolated solutions of coarser variants of the equation system are used as the initialization of the next finer variant. On each resolution level itself, the V or W cycles described above are used to efficiently solve the linear equation system on that resolution level. The corresponding multigrid methods are called full multigrid methods in the literature. The full multigrid algorithm can be visualized as follows: This example represents a full multigrid algorithm that uses two W correction cycles per resolution level of the hierarchical initialization. The interpolation steps of the solution from one resolution level to the next are denoted by i and the two W correction cycles by and . Iterations on the original problem are denoted by large markers, while small markers denote iterations on error correction problems.

Depending on the selected multigrid solver, a number of parameters for fine tuning the solver are available and are described in the following.

The parameter InitialGuessInitialGuessInitialGuessInitialGuessinitialGuessinitial_guess gives a initial value for the initialization of the fixed point iteration on the coarsest grid. Usually 0 is sufficient, but to avoid local minima other values can be used.

Using the parameters MGParamNameMGParamNameMGParamNameMGParamNameMGParamNamemgparam_name and MGParamValueMGParamValueMGParamValueMGParamValueMGParamValuemgparam_value, the solver is controlled, i.e., the coarse-to-fine process, the fixed point iteration, and the multigrid solver. It is usually sufficient to use one of the predefined parameter sets, which are available by setting MGParamNameMGParamNameMGParamNameMGParamNameMGParamNamemgparam_name = 'default_parameters'"default_parameters""default_parameters""default_parameters""default_parameters""default_parameters" and MGParamValueMGParamValueMGParamValueMGParamValueMGParamValuemgparam_value = 'very_accurate'"very_accurate""very_accurate""very_accurate""very_accurate""very_accurate", 'accurate'"accurate""accurate""accurate""accurate""accurate", 'fast_accurate'"fast_accurate""fast_accurate""fast_accurate""fast_accurate""fast_accurate", or 'fast'"fast""fast""fast""fast""fast".

If the parameters should be specified individually, MGParamNameMGParamNameMGParamNameMGParamNameMGParamNamemgparam_name and MGParamValueMGParamValueMGParamValueMGParamValueMGParamValuemgparam_value must be set to tuples of the same length. The values corresponding to the parameters specified in MGParamNameMGParamNameMGParamNameMGParamNameMGParamNamemgparam_name must be specified at the corresponding position in MGParamValueMGParamValueMGParamValueMGParamValueMGParamValuemgparam_value. The parameters are evaluated in the given order. Therefore, it is possible to first select a group of default parameters (see above) and then change only some of the parameters. in the following, the possible parameters are described.

MGParamNameMGParamNameMGParamNameMGParamNameMGParamNamemgparam_name = 'mg_solver'"mg_solver""mg_solver""mg_solver""mg_solver""mg_solver" sets the solver for the linear system. Possible values for MGParamValueMGParamValueMGParamValueMGParamValueMGParamValuemgparam_value are 'multigrid'"multigrid""multigrid""multigrid""multigrid""multigrid" for a simple multigrid solver, 'full_multigrid'"full_multigrid""full_multigrid""full_multigrid""full_multigrid""full_multigrid" for a full multigrid solver, and 'gauss_seidel'"gauss_seidel""gauss_seidel""gauss_seidel""gauss_seidel""gauss_seidel" for the plain Gauss-Seidel solver. The multigrid methods have the advantage of a faster convergence, but incur the overhead of coarsening the linear system.

MGParamNameMGParamNameMGParamNameMGParamNameMGParamNamemgparam_name = 'mg_cycle_type'"mg_cycle_type""mg_cycle_type""mg_cycle_type""mg_cycle_type""mg_cycle_type" selects the type of recursion for the multigrid solvers. Possible values for MGParamValueMGParamValueMGParamValueMGParamValueMGParamValuemgparam_value are 'v'"v""v""v""v""v" for a V-Cycle, 'w'"w""w""w""w""w" for a W-Cycle, and 'none'"none""none""none""none""none" for no recursion.

MGParamNameMGParamNameMGParamNameMGParamNameMGParamNamemgparam_name = 'mg_pre_relax'"mg_pre_relax""mg_pre_relax""mg_pre_relax""mg_pre_relax""mg_pre_relax" sets the number of iterations of the pre-relaxation step in multigrid solvers, or the number of iterations for the Gauss-Seidel solver, depending on which is selected.

MGParamNameMGParamNameMGParamNameMGParamNameMGParamNamemgparam_name = 'mg_post_relax'"mg_post_relax""mg_post_relax""mg_post_relax""mg_post_relax""mg_post_relax" sets the number of iterations of the post-relaxation step.

Increasing the number of pre- and post-relaxation steps increases the computation time asymptotically linearly. However, no additional restriction and prolongation operations (zooming down and up of the error correction images) are performed. Consequently, a moderate increase in the number of relaxation steps only leads to a slight increase in the computation times.

MGParamNameMGParamNameMGParamNameMGParamNameMGParamNamemgparam_name = 'initial_level'"initial_level""initial_level""initial_level""initial_level""initial_level" sets the coarsest level of the image pyramid where the coarse-to-fine process starts. The value can be positive, in which case it directly gives the initial level. Level 0 is the finest level with the original images. If the value is negative, then it is used relative to the maximum number of pyramid levels. The coarsest available pyramid level is the one where both images have a size of at least 4 pixels in both directions. As described below, the default value of 'initial_level'"initial_level""initial_level""initial_level""initial_level""initial_level" is -2. This facilitates the calculation of the correct disparity for images that have very large disparities. In some cases, e.g., for repeating textures, this may lead to the fact that too large disparities are calculated for some parts of the image. In this case, 'initial_level'"initial_level""initial_level""initial_level""initial_level""initial_level" should be set to a smaller value.

The standard parameters zoom the image with a factor of 0.6 per pyramid level. If a guess of the maximum disparity d exists, then the initial level s should be selected so that is greater than d.

MGParamNameMGParamNameMGParamNameMGParamNameMGParamNamemgparam_name = 'iterations'"iterations""iterations""iterations""iterations""iterations" sets the number of iterations of the fixed point iteration per pyramid level. The exact number of iterations is , where level is the current level in the image pyramid. If this value is set to 0, then no iteration is performed on the finest pyramid level 0. Instead, the result of level 1 is scaled to the original image size and returned, which can be used if speed is crucial. The runtime of the operator is approximately linear in the number of iterations.

MGParamNameMGParamNameMGParamNameMGParamNameMGParamNamemgparam_name = 'pyramid_factor'"pyramid_factor""pyramid_factor""pyramid_factor""pyramid_factor""pyramid_factor" determines the factor by which the images are scaled when creating the image pyramid for the coarse-to-fine process. The width and height of the next smaller image is scaled by the given factor. The value must lie between 0.1 and 0.9.

The predefined parameter sets for MGParamNameMGParamNameMGParamNameMGParamNameMGParamNamemgparam_name = 'default_parameters'"default_parameters""default_parameters""default_parameters""default_parameters""default_parameters" contain the following values:

'default_parameters'"default_parameters""default_parameters""default_parameters""default_parameters""default_parameters" = 'very_accurate'"very_accurate""very_accurate""very_accurate""very_accurate""very_accurate": 'mg_solver'"mg_solver""mg_solver""mg_solver""mg_solver""mg_solver" = 'full_multigrid'"full_multigrid""full_multigrid""full_multigrid""full_multigrid""full_multigrid", 'mg_cycle_type'"mg_cycle_type""mg_cycle_type""mg_cycle_type""mg_cycle_type""mg_cycle_type" = 'w'"w""w""w""w""w", 'mg_pre_relax'"mg_pre_relax""mg_pre_relax""mg_pre_relax""mg_pre_relax""mg_pre_relax" = 5, 'mg_post_relax'"mg_post_relax""mg_post_relax""mg_post_relax""mg_post_relax""mg_post_relax" = 5, 'initial_level'"initial_level""initial_level""initial_level""initial_level""initial_level" = -2, 'iterations'"iterations""iterations""iterations""iterations""iterations" = 5, 'pyramid_factor'"pyramid_factor""pyramid_factor""pyramid_factor""pyramid_factor""pyramid_factor" = 0.6.

'default_parameters'"default_parameters""default_parameters""default_parameters""default_parameters""default_parameters" = 'accurate'"accurate""accurate""accurate""accurate""accurate": 'mg_solver'"mg_solver""mg_solver""mg_solver""mg_solver""mg_solver" = 'full_multigrid'"full_multigrid""full_multigrid""full_multigrid""full_multigrid""full_multigrid", 'mg_cycle_type'"mg_cycle_type""mg_cycle_type""mg_cycle_type""mg_cycle_type""mg_cycle_type" = 'w'"w""w""w""w""w", 'mg_pre_relax'"mg_pre_relax""mg_pre_relax""mg_pre_relax""mg_pre_relax""mg_pre_relax" = 5, 'mg_post_relax'"mg_post_relax""mg_post_relax""mg_post_relax""mg_post_relax""mg_post_relax" = 5, 'initial_level'"initial_level""initial_level""initial_level""initial_level""initial_level" = -2, 'iterations'"iterations""iterations""iterations""iterations""iterations" = 2, 'pyramid_factor'"pyramid_factor""pyramid_factor""pyramid_factor""pyramid_factor""pyramid_factor" = 0.6.

'default_parameters'"default_parameters""default_parameters""default_parameters""default_parameters""default_parameters" = 'fast_accurate'"fast_accurate""fast_accurate""fast_accurate""fast_accurate""fast_accurate": 'mg_solver'"mg_solver""mg_solver""mg_solver""mg_solver""mg_solver" = 'full_multigrid'"full_multigrid""full_multigrid""full_multigrid""full_multigrid""full_multigrid", 'mg_cycle_type'"mg_cycle_type""mg_cycle_type""mg_cycle_type""mg_cycle_type""mg_cycle_type" = 'v'"v""v""v""v""v", 'mg_pre_relax'"mg_pre_relax""mg_pre_relax""mg_pre_relax""mg_pre_relax""mg_pre_relax" = 2, 'mg_post_relax'"mg_post_relax""mg_post_relax""mg_post_relax""mg_post_relax""mg_post_relax" = 2, 'initial_level'"initial_level""initial_level""initial_level""initial_level""initial_level" = -2, 'iterations'"iterations""iterations""iterations""iterations""iterations" = 1, 'pyramid_factor'"pyramid_factor""pyramid_factor""pyramid_factor""pyramid_factor""pyramid_factor" = 0.6. These are the default parameters of the algorithm if the default parameter set is not specified.

'default_parameters'"default_parameters""default_parameters""default_parameters""default_parameters""default_parameters" = 'fast'"fast""fast""fast""fast""fast": 'mg_solver'"mg_solver""mg_solver""mg_solver""mg_solver""mg_solver" = 'full_multigrid'"full_multigrid""full_multigrid""full_multigrid""full_multigrid""full_multigrid", 'mg_cycle_type'"mg_cycle_type""mg_cycle_type""mg_cycle_type""mg_cycle_type""mg_cycle_type" = 'v'"v""v""v""v""v", 'mg_pre_relax'"mg_pre_relax""mg_pre_relax""mg_pre_relax""mg_pre_relax""mg_pre_relax" = 1, 'mg_post_relax'"mg_post_relax""mg_post_relax""mg_post_relax""mg_post_relax""mg_post_relax" = 1, 'initial_level'"initial_level""initial_level""initial_level""initial_level""initial_level" = -2, 'iterations'"iterations""iterations""iterations""iterations""iterations" = 0, 'pyramid_factor'"pyramid_factor""pyramid_factor""pyramid_factor""pyramid_factor""pyramid_factor" = 0.6.

Weaknesses of the operator: Large jumps in the disparity, which correspond to large jumps in the distance of the observed objects, are smoothed rather strongly. This leads to problems with thin objects that have a large distance to their background.

Distortions can occur at the left and right border of the image in the parts that are visible in only one of the images.

Additionally, general problems of stereo vision should be avoided, including horizontally repetitive patterns, areas with little texture as well as reflections.

Execution Information


ImageRect1ImageRect1ImageRect1ImageRect1imageRect1image_rect_1 (input_object)  singlechannelimage(-array) objectHImageHObjectHImageHobject (byte / uint2 / real)

Rectified image of camera 1.

ImageRect2ImageRect2ImageRect2ImageRect2imageRect2image_rect_2 (input_object)  singlechannelimage(-array) objectHImageHObjectHImageHobject (byte / uint2 / real)

Rectified image of camera 2.

DisparityDisparityDisparityDisparitydisparitydisparity (output_object)  singlechannelimage(-array) objectHImageHObjectHImageHobject * (real)

Disparity map.

ScoreScoreScoreScorescorescore (output_object)  singlechannelimage(-array) objectHImageHObjectHImageHobject * (real)

Score of the calculated disparity if CalculateScoreCalculateScoreCalculateScoreCalculateScorecalculateScorecalculate_score is set to 'true'"true""true""true""true""true".

GrayConstancyGrayConstancyGrayConstancyGrayConstancygrayConstancygray_constancy (input_control)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

Weight of the gray value constancy in the data term.

Default value: 1.0

Suggested values: 0.0, 1.0, 2.0, 10.0

Restriction: GrayConstancy >= 0.0

GradientConstancyGradientConstancyGradientConstancyGradientConstancygradientConstancygradient_constancy (input_control)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

Weight of the gradient constancy in the data term.

Default value: 30.0

Suggested values: 0.0, 1.0, 5.0, 10.0, 30.0, 50.0, 70.0

Restriction: GradientConstancy >= 0.0

SmoothnessSmoothnessSmoothnessSmoothnesssmoothnesssmoothness (input_control)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

Weight of the smoothness term in relation to the data term.

Default value: 5.0

Suggested values: 1.0, 3.0, 5.0, 10.0

Restriction: Smoothness > 0.0

InitialGuessInitialGuessInitialGuessInitialGuessinitialGuessinitial_guess (input_control)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

Initial guess of the disparity.

Default value: 0.0

Suggested values: -30.0, -20.0, -10.0, 0.0, 10.0, 20.0, 30.0

CalculateScoreCalculateScoreCalculateScoreCalculateScorecalculateScorecalculate_score (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Should the quality measure should be returned in ScoreScoreScoreScorescorescore?

Default value: 'false' "false" "false" "false" "false" "false"

Suggested values: 'true'"true""true""true""true""true", 'false'"false""false""false""false""false"

MGParamNameMGParamNameMGParamNameMGParamNameMGParamNamemgparam_name (input_control) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Parameter name(s) for the multigrid algorithm.

Default value: 'default_parameters' "default_parameters" "default_parameters" "default_parameters" "default_parameters" "default_parameters"

List of values: 'default_parameters'"default_parameters""default_parameters""default_parameters""default_parameters""default_parameters", 'initial_level'"initial_level""initial_level""initial_level""initial_level""initial_level", 'iterations'"iterations""iterations""iterations""iterations""iterations", 'mg_cycle_type'"mg_cycle_type""mg_cycle_type""mg_cycle_type""mg_cycle_type""mg_cycle_type", 'mg_post_relax'"mg_post_relax""mg_post_relax""mg_post_relax""mg_post_relax""mg_post_relax", 'mg_pre_relax'"mg_pre_relax""mg_pre_relax""mg_pre_relax""mg_pre_relax""mg_pre_relax", 'mg_solver'"mg_solver""mg_solver""mg_solver""mg_solver""mg_solver", 'pyramid_factor'"pyramid_factor""pyramid_factor""pyramid_factor""pyramid_factor""pyramid_factor"

MGParamValueMGParamValueMGParamValueMGParamValueMGParamValuemgparam_value (input_control)  attribute.value(-array) HTupleMaybeSequence[Union[str, float, int]]HTupleHtuple (string / real / integer) (string / double / int / long) (HString / double / Hlong) (char* / double / Hlong)

Parameter value(s) for the multigrid algorithm.

Default value: 'fast_accurate' "fast_accurate" "fast_accurate" "fast_accurate" "fast_accurate" "fast_accurate"

Suggested values: 'very_accurate'"very_accurate""very_accurate""very_accurate""very_accurate""very_accurate", 'accurate'"accurate""accurate""accurate""accurate""accurate", 'fast_accurate'"fast_accurate""fast_accurate""fast_accurate""fast_accurate""fast_accurate", 'fast'"fast""fast""fast""fast""fast", 'v'"v""v""v""v""v", 'w'"w""w""w""w""w", 'none'"none""none""none""none""none", 'gauss_seidel'"gauss_seidel""gauss_seidel""gauss_seidel""gauss_seidel""gauss_seidel", 'multigrid'"multigrid""multigrid""multigrid""multigrid""multigrid", 'full_multigrid'"full_multigrid""full_multigrid""full_multigrid""full_multigrid""full_multigrid", 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, -1, -2, -3, -4, -5

Example (HDevelop)

read_image (BaseballL, 'stereo/epipolar/baseball_l')
read_image (BaseballR, 'stereo/epipolar/baseball_r')
binocular_disparity_mg (BaseballL, BaseballR, Disparity, Score, \
                        0.25, 30, 5, 0, 'true', \


If the parameter values are correct, binocular_disparity_mgbinocular_disparity_mgBinocularDisparityMgBinocularDisparityMgBinocularDisparityMgbinocular_disparity_mg returns the value 2 (H_MSG_TRUE). If the input is empty (no input images are available) the behavior can be set via set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>). If necessary, an exception is raised.

Possible Predecessors


Possible Successors

thresholdthresholdThresholdThresholdThresholdthreshold, disparity_to_distancedisparity_to_distanceDisparityToDistanceDisparityToDistanceDisparityToDistancedisparity_to_distance, disparity_image_to_xyzdisparity_image_to_xyzDisparityImageToXyzDisparityImageToXyzDisparityImageToXyzdisparity_image_to_xyz


binocular_disparitybinocular_disparityBinocularDisparityBinocularDisparityBinocularDisparitybinocular_disparity, binocular_disparity_msbinocular_disparity_msBinocularDisparityMsBinocularDisparityMsBinocularDisparityMsbinocular_disparity_ms, binocular_distancebinocular_distanceBinocularDistanceBinocularDistanceBinocularDistancebinocular_distance, binocular_distance_mgbinocular_distance_mgBinocularDistanceMgBinocularDistanceMgBinocularDistanceMgbinocular_distance_mg, binocular_distance_msbinocular_distance_msBinocularDistanceMsBinocularDistanceMsBinocularDistanceMsbinocular_distance_ms

See also

map_imagemap_imageMapImageMapImageMapImagemap_image, gen_binocular_rectification_mapgen_binocular_rectification_mapGenBinocularRectificationMapGenBinocularRectificationMapGenBinocularRectificationMapgen_binocular_rectification_map, binocular_calibrationbinocular_calibrationBinocularCalibrationBinocularCalibrationBinocularCalibrationbinocular_calibration


3D Metrology