binocular_distance_mg — Compute the distance values for a rectified stereo image pair using multigrid methods.
binocular_distance_mg(ImageRect1, ImageRect2 : Distance, Score : CamParamRect1, CamParamRect2, RelPoseRect, GrayConstancy, GradientConstancy, Smoothness, InitialGuess, CalculateScore, MGParamName, MGParamValue : )
binocular_distance_mg computes the distance values for a rectified stereo image pair using multigrid methods. The operator first calculates the disparities between two rectified images ImageRect1 and ImageRect2 similar to binocular_disparity_mg. The resulting disparity values are then transformed into distance values of the corresponding 3D world points to the rectified stereo camera system as in disparity_to_distance. The distances are returned in the single-channel image Distance in which each gray value represents the distance of the respective 3D world point to the stereo camera system. Different from binocular_distance this operator uses a variational approach based on multigrid methods. This approach returns distance values also for image parts that contain no texture.
The input images ImageRect1 and ImageRect2 must be a pair of rectified stereo images, i.e., corresponding points must have the same row coordinate. In case this assumption is violated the images can be rectified by using the operators calibrate_cameras, gen_binocular_rectification_map and map_image.
For the transformation of the disparity to the distance, the internal camera parameters of the rectified camera 1 CamParamRect1 and of the rectified camera 2 CamParamRect2, as well as the relative pose of the cameras RelPoseRect must be specified. The relative pose defines a point transformation from the rectified camera system 2 to the rectified camera system 1. These parameters can be obtained from the operators calibrate_cameras and gen_binocular_rectification_map.
A detailed description of the algorithm and of the remaining parameters can be found in the documentation of binocular_disparity_mg.
If using cameras with telecentric lenses, the Distance is not defined as the distance of a point to the camera but as the distance from the point to the plane, defined by the y-axes of both cameras and their baseline (see gen_binocular_rectification_map).
For a stereo setup of mixed type (i.e., for a stereo setup in which one of the original cameras is a perspective camera and the other camera is a telecentric camera; see gen_binocular_rectification_map), the rectifying plane of the two cameras is in a position with respect to the object that would lead to very unintuitive distances. Therefore, binocular_distance_mg does not support a stereo setup of mixed type. For stereo setups of mixed type, please use reconstruct_surface_stereo, in which the reference coordinate system can be chosen arbitrarily. Alternatively, binocular_disparity_mg and disparity_image_to_xyz might be used.
Additionally, stereo setups that contain cameras with and without hypercentric lenses at the same time are not supported.
Rectified image of camera 1.
Rectified image of camera 2.
Score of the calculated disparity if CalculateScore is set to 'true'.
Internal camera parameters of the rectified camera 1.
Internal camera parameters of the rectified camera 2.
Point transformation from the rectified camera 2 to the rectified camera 1.
Number of elements: 7
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
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
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
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
Should the quality measure be returned in Score?
Default value: 'false'
Suggested values: 'true', 'false'
Parameter name(s) for the multigrid algorithm.
Default value: 'default_parameters'
List of values: 'default_parameters', 'initial_level', 'iterations', 'mg_cycle_type', 'mg_post_relax', 'mg_pre_relax', 'mg_solver', 'pyramid_factor'
Parameter value(s) for the multigrid algorithm.
Default value: 'fast_accurate'
Suggested values: 'very_accurate', 'accurate', 'fast_accurate', 'fast', 'v', 'w', 'none', 'gauss_seidel', '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
If the parameter values are correct, binocular_distance_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>). If necessary, an exception is raised.
binocular_distance, binocular_distance_ms, binocular_disparity, binocular_disparity_mg, binocular_disparity_ms
map_image, gen_binocular_rectification_map, binocular_calibration, disparity_to_distance, distance_to_disparity, disparity_image_to_xyz