binocular_disparity_msbinocular_disparity_msBinocularDisparityMsBinocularDisparityMs (Operator)
Name
binocular_disparity_msbinocular_disparity_msBinocularDisparityMsBinocularDisparityMs
— Compute the disparities of a rectified stereo image pair using
multi-scanline optimization.
Signature
Herror binocular_disparity_ms(const Hobject ImageRect1, const Hobject ImageRect2, Hobject* Disparity, Hobject* Score, const Hlong MinDisparity, const Hlong MaxDisparity, const Hlong SurfaceSmoothing, const Hlong EdgeSmoothing, const char* GenParamName, const char* GenParamValue)
Herror T_binocular_disparity_ms(const Hobject ImageRect1, const Hobject ImageRect2, Hobject* Disparity, Hobject* Score, const Htuple MinDisparity, const Htuple MaxDisparity, const Htuple SurfaceSmoothing, const Htuple EdgeSmoothing, const Htuple GenParamName, const Htuple GenParamValue)
void BinocularDisparityMs(const HObject& ImageRect1, const HObject& ImageRect2, HObject* Disparity, HObject* Score, const HTuple& MinDisparity, const HTuple& MaxDisparity, const HTuple& SurfaceSmoothing, const HTuple& EdgeSmoothing, const HTuple& GenParamName, const HTuple& GenParamValue)
HImage HImage::BinocularDisparityMs(const HImage& ImageRect2, HImage* Score, Hlong MinDisparity, Hlong MaxDisparity, Hlong SurfaceSmoothing, Hlong EdgeSmoothing, const HTuple& GenParamName, const HTuple& GenParamValue) const
HImage HImage::BinocularDisparityMs(const HImage& ImageRect2, HImage* Score, Hlong MinDisparity, Hlong MaxDisparity, Hlong SurfaceSmoothing, Hlong EdgeSmoothing, const HString& GenParamName, const HString& GenParamValue) const
HImage HImage::BinocularDisparityMs(const HImage& ImageRect2, HImage* Score, Hlong MinDisparity, Hlong MaxDisparity, Hlong SurfaceSmoothing, Hlong EdgeSmoothing, const char* GenParamName, const char* GenParamValue) const
HImage HImage::BinocularDisparityMs(const HImage& ImageRect2, HImage* Score, Hlong MinDisparity, Hlong MaxDisparity, Hlong SurfaceSmoothing, Hlong EdgeSmoothing, const wchar_t* GenParamName, const wchar_t* GenParamValue) const
(Windows only)
static void HOperatorSet.BinocularDisparityMs(HObject imageRect1, HObject imageRect2, out HObject disparity, out HObject score, HTuple minDisparity, HTuple maxDisparity, HTuple surfaceSmoothing, HTuple edgeSmoothing, HTuple genParamName, HTuple genParamValue)
HImage HImage.BinocularDisparityMs(HImage imageRect2, out HImage score, int minDisparity, int maxDisparity, int surfaceSmoothing, int edgeSmoothing, HTuple genParamName, HTuple genParamValue)
HImage HImage.BinocularDisparityMs(HImage imageRect2, out HImage score, int minDisparity, int maxDisparity, int surfaceSmoothing, int edgeSmoothing, string genParamName, string genParamValue)
Description
binocular_disparity_msbinocular_disparity_msBinocularDisparityMsBinocularDisparityMsBinocularDisparityMs
calculates the disparity between two
rectified stereo images ImageRect1ImageRect1ImageRect1ImageRect1imageRect1
and ImageRect2ImageRect2ImageRect2ImageRect2imageRect2
using multi-scanline optimization. The resulting disparity image is
returned in DisparityDisparityDisparityDisparitydisparity
.
In contrast to binocular_distance_msbinocular_distance_msBinocularDistanceMsBinocularDistanceMsBinocularDistanceMs
, the results are
not transformed into distance values.
For this task, the three operators binocular_disparitybinocular_disparityBinocularDisparityBinocularDisparityBinocularDisparity
,
binocular_disparity_mgbinocular_disparity_mgBinocularDisparityMgBinocularDisparityMgBinocularDisparityMg
, and binocular_disparity_msbinocular_disparity_msBinocularDisparityMsBinocularDisparityMsBinocularDisparityMs
can be used. binocular_disparitybinocular_disparityBinocularDisparityBinocularDisparityBinocularDisparity
returns robust results
in regions of sufficient texture but fails where is none.
binocular_disparity_mgbinocular_disparity_mgBinocularDisparityMgBinocularDisparityMgBinocularDisparityMg
interpolates low-texture regions
but blurs discontinuities. binocular_disparity_msbinocular_disparity_msBinocularDisparityMsBinocularDisparityMsBinocularDisparityMs
preserves
discontinuities and interpolates partially.
binocular_disparity_msbinocular_disparity_msBinocularDisparityMsBinocularDisparityMsBinocularDisparityMs
requires a reference image
ImageRect1ImageRect1ImageRect1ImageRect1imageRect1
and a search image ImageRect2ImageRect2ImageRect2ImageRect2imageRect2
which both
must be rectified, i.e., corresponding pixels must have the same
row coordinate. If this assumption is violated, the images
can be rectified by using the operators calibrate_camerascalibrate_camerasCalibrateCamerasCalibrateCamerasCalibrateCameras
,
gen_binocular_rectification_mapgen_binocular_rectification_mapGenBinocularRectificationMapGenBinocularRectificationMapGenBinocularRectificationMap
, and map_imagemap_imageMapImageMapImageMapImage
.
ImageRect1ImageRect1ImageRect1ImageRect1imageRect1
and ImageRect2ImageRect2ImageRect2ImageRect2imageRect2
can have different widths,
but must have the same height. Given a pixel in ImageRect1ImageRect1ImageRect1ImageRect1imageRect1
,
the homologous pixel in ImageRect2ImageRect2ImageRect2ImageRect2imageRect2
is selected by searching
along the corresponding row in ImageRect2ImageRect2ImageRect2ImageRect2imageRect2
and matching both pixels based on a similarity measure.
The disparity is the number of pixels
by which each pixel in ImageRect1ImageRect1ImageRect1ImageRect1imageRect1
needs to be moved
to reach the homologous pixel in ImageRect2ImageRect2ImageRect2ImageRect2imageRect2
.
The search space is confined by the minimum and maximum disparity value
MinDisparityMinDisparityMinDisparityMinDisparityminDisparity
and MaxDisparityMaxDisparityMaxDisparityMaxDisparitymaxDisparity
.
The similarity measure can be specified by setting GenParamNameGenParamNameGenParamNameGenParamNamegenParamName
to 'similarity_measure'"similarity_measure""similarity_measure""similarity_measure""similarity_measure" and GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue
to the desired value. For both options
'census_dense'"census_dense""census_dense""census_dense""census_dense" (default) and 'census_sparse'"census_sparse""census_sparse""census_sparse""census_sparse",
the similarity measure is based on the Census transform.
A Census transformed image contains for every pixel information
about the intensity topology within a support window around it.
'census_dense'"census_dense""census_dense""census_dense""census_dense" uses a dense 9 x 7 pixels window.
'census_sparse'"census_sparse""census_sparse""census_sparse""census_sparse" uses a sparse 15 x 15 pixels window
where only a subset of the pixels is evaluated.
While 'census_dense'"census_dense""census_dense""census_dense""census_dense" is more suitable for fine structures,
'census_sparse'"census_sparse""census_sparse""census_sparse""census_sparse" is more robust on low texture areas.
To calculate the disparities from the similarity measure,
the intermediate results are optimized by a multi-scanline method.
The optimization increases the robustness in low-texture areas
without blurring discontinuities in the disparity image.
The optimization is controlled by the parameters
SurfaceSmoothingSurfaceSmoothingSurfaceSmoothingSurfaceSmoothingsurfaceSmoothing
and EdgeSmoothingEdgeSmoothingEdgeSmoothingEdgeSmoothingedgeSmoothing
.
SurfaceSmoothingSurfaceSmoothingSurfaceSmoothingSurfaceSmoothingsurfaceSmoothing
controls the smoothness within surfaces.
High values suppress disparity differences of one pixel.
EdgeSmoothingEdgeSmoothingEdgeSmoothingEdgeSmoothingedgeSmoothing
controls the occurrence and the shape of edges.
Low values allow many edges, high values lead to fewer and rounder edges.
For both parameters, reasonable values usually range between 0 and 100.
If both parameters are set to zero, no optimization is performed.
The resulting disparity is returned in the single-channel image
DisparityDisparityDisparityDisparitydisparity
. A quality measure for each disparity value
is returned in ScoreScoreScoreScorescore
, containing the best (lowest) result
of the optimized similarity measure of a reference pixel.
Finally, there are two optional post-processing steps. A consistency check
is applied if GenParamNameGenParamNameGenParamNameGenParamNamegenParamName
is set to 'consistency_check'"consistency_check""consistency_check""consistency_check""consistency_check"
and GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue
is set to 'true'"true""true""true""true" (default).
This increases the robustness of the returned matches since the
result relies on a concurrent direct and reverse match. It is switched off
by setting GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue
to 'false'"false""false""false""false".
Sub-pixel refinement of disparities is performed by setting
GenParamNameGenParamNameGenParamNameGenParamNamegenParamName
to 'sub_disparity'"sub_disparity""sub_disparity""sub_disparity""sub_disparity" and GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue
to 'true'"true""true""true""true" (default). It is switched off by setting
GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue
to 'false'"false""false""false""false".
The runtime of the operator is approximately linear to the image width,
the image height, and the disparity range. Consequently, the disparity range
should be chosen as narrow as possible for large images.
Execution Information
- Supports OpenCL compute devices.
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Automatically parallelized on tuple level.
- Automatically parallelized on internal data level.
Parameters
ImageRect1ImageRect1ImageRect1ImageRect1imageRect1
(input_object) singlechannelimage →
objectHImageHImageHobject (byte*) *allowed for compute devices
Rectified image of camera 1.
ImageRect2ImageRect2ImageRect2ImageRect2imageRect2
(input_object) singlechannelimage →
objectHImageHImageHobject (byte*) *allowed for compute devices
Rectified image of camera 2.
DisparityDisparityDisparityDisparitydisparity
(output_object) singlechannelimage →
objectHImageHImageHobject * (real)
Disparity map.
ScoreScoreScoreScorescore
(output_object) singlechannelimage →
objectHImageHImageHobject * (real)
Score of the calculated disparity.
MinDisparityMinDisparityMinDisparityMinDisparityminDisparity
(input_control) integer →
HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Minimum of the expected disparities.
Default value: -30
Typical range of values: -32768
≤
MinDisparity
MinDisparity
MinDisparity
MinDisparity
minDisparity
≤
32767
MaxDisparityMaxDisparityMaxDisparityMaxDisparitymaxDisparity
(input_control) integer →
HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Maximum of the expected disparities.
Default value: 30
Typical range of values: -32768
≤
MaxDisparity
MaxDisparity
MaxDisparity
MaxDisparity
maxDisparity
≤
32767
Restriction: MinDisparity <= MaxDisparity
SurfaceSmoothingSurfaceSmoothingSurfaceSmoothingSurfaceSmoothingsurfaceSmoothing
(input_control) integer →
HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Smoothing of surfaces.
Default value: 50
Suggested values: 20, 50, 100
Restriction: SurfaceSmoothing >= 0
EdgeSmoothingEdgeSmoothingEdgeSmoothingEdgeSmoothingedgeSmoothing
(input_control) integer →
HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
Smoothing of edges.
Default value: 50
Suggested values: 20, 50, 100
Restriction: EdgeSmoothing >= 0
GenParamNameGenParamNameGenParamNameGenParamNamegenParamName
(input_control) attribute.name(-array) →
HTupleHTupleHtuple (string) (string) (HString) (char*)
Parameter name(s) for the multi-scanline algorithm.
Default value: []
List of values: 'consistency_check'"consistency_check""consistency_check""consistency_check""consistency_check", 'similarity_measure'"similarity_measure""similarity_measure""similarity_measure""similarity_measure", 'sub_disparity'"sub_disparity""sub_disparity""sub_disparity""sub_disparity"
GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue
(input_control) attribute.value(-array) →
HTupleHTupleHtuple (string) (string) (HString) (char*)
Parameter value(s) for the multi-scanline algorithm.
Default value: []
Suggested values: 'census_dense'"census_dense""census_dense""census_dense""census_dense", 'census_sparse'"census_sparse""census_sparse""census_sparse""census_sparse", 'true'"true""true""true""true", 'false'"false""false""false""false"
Example (HDevelop)
read_image (BaseballL, 'stereo/epipolar/baseball_l')
read_image (BaseballR, 'stereo/epipolar/baseball_r')
binocular_disparity_ms (BaseballL, BaseballR, Disparity, Score, \
-40, -10, 50, 50, [], [])
Result
If the parameter values are correct, binocular_disparity_msbinocular_disparity_msBinocularDisparityMsBinocularDisparityMsBinocularDisparityMs
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>)
. If necessary, an
exception is raised.
Possible Predecessors
map_imagemap_imageMapImageMapImageMapImage
Possible Successors
thresholdthresholdThresholdThresholdThreshold
,
disparity_to_distancedisparity_to_distanceDisparityToDistanceDisparityToDistanceDisparityToDistance
,
disparity_image_to_xyzdisparity_image_to_xyzDisparityImageToXyzDisparityImageToXyzDisparityImageToXyz
Alternatives
binocular_disparitybinocular_disparityBinocularDisparityBinocularDisparityBinocularDisparity
,
binocular_disparity_mgbinocular_disparity_mgBinocularDisparityMgBinocularDisparityMgBinocularDisparityMg
,
binocular_distancebinocular_distanceBinocularDistanceBinocularDistanceBinocularDistance
,
binocular_distance_mgbinocular_distance_mgBinocularDistanceMgBinocularDistanceMgBinocularDistanceMg
,
binocular_distance_msbinocular_distance_msBinocularDistanceMsBinocularDistanceMsBinocularDistanceMs
See also
map_imagemap_imageMapImageMapImageMapImage
,
gen_binocular_rectification_mapgen_binocular_rectification_mapGenBinocularRectificationMapGenBinocularRectificationMapGenBinocularRectificationMap
,
binocular_calibrationbinocular_calibrationBinocularCalibrationBinocularCalibrationBinocularCalibration
Module
3D Metrology