Ask Your Question

Revision history [back]

StereoMatching parameters:

  • minDisparity is the smallest disparity value to search for. Use smaller values to look for scenes which include objects at infinity, and larger values for scenes near the cameras. Negative minDisparity can be useful if the cameras are intentionally cross-eyed, but you wish to calculate long-range distances. Setting this to a sensible value reduces interference from out of scene areas and reduces unneeded computation.

  • numDisparities is the range of disparities to search over. It is effectively your scene's depth of field setting. Use smaller values for relatively shallow depth of field scenes, and large values for deep depth-of-field scenes. Setting this to a sensible value reduces interference from out of scene areas and reduces unneeded computation.

  • blockSize is the dimension (in pixels on a side) of the block which is compared between the left and right images. Setting this to a sensible value reduces interference from out of scene areas and reduces unneeded computation.

  • disp12MaxDiff, speckleRange, speckleWindowSize - used in filtering the disparity map before returning, looking for areas of similar disparity (small areas will be assumed to be noise and marked as having invalid depth information). These reduce noise in disparity map output.

StereoBM:

  • preFilterCap, preFilterSize, preFilterType - used in filtering the input images before disparity computation. These may improve noise rejection in input images.

  • ROI1, ROI2 - region of interest, used to constrain the computation to a smaller rectangle within the input images. These may help avoid unneeded computation.

  • textureThreshold, uniquenessRation, smallerBlockSize - used in filtering the disparity map before returning. May reduce noise.

StereoSGBM: - mode - selects the block compare mechanism to use. Some modes may perform much better for certain input scenes, comparing a few lines out of the entire block rather than every pixel in the block.

  • P1, P2, uniquenessRation - used in filtering the disparity map before returning to reject small blocks. May reduce noise.

  • preFilterCap - used in filtering the input images before disparity computation. These may improve noise rejection in input images.

Fuzziness can be due to:

  • poor calibration or rectification - calibration (discovery of distortion, rotation, translation matrices) must be very accurate, to within a fraction of a pixel correspondence between left and right, in order to rectify the left and right images to epipolar form so that the disparity algorithms will return accurate results.

  • poor contrast/illumination or poor focus resulting in mismatches - features in left and right cameras must be cear and not under or over exposed.

  • too regular a background pattern (mismatches) or no background pattern (hard to get a valid distance) - random pattern projectors can help here.

  • poor range selection: minDisparities and numDisparities are not set to select just the range of interesting disparities for your scene, causing interfering matches from depths outside your range of interest - constrain these as sensible.

  • filtering of input images or output disparity map can reduce noise blobs.

The black bar is the sum of:

  • blockSize / 2 (which makes a frame around the entire image)

  • minDisparity (the left portion of the image visible to the left camera which is out of view to the right camera)

  • numDisparities (the left portion of the image which visible to the left camera which at nearer range will be out of view to the right camera)

This is another reason why setting minDisparity and numDisparities to sensible settings for the interesting parts of your scene is important.

StereoMatching parameters:

  • minDisparity is the smallest disparity value to search for. Use smaller values to look for scenes which include objects at infinity, and larger values for scenes near the cameras. Negative minDisparity can be useful if the cameras are intentionally cross-eyed, but you wish to calculate long-range distances. Setting this to a sensible value reduces interference from out of scene areas and reduces unneeded computation.

  • numDisparities is the range of disparities to search over. It is effectively your scene's depth of field setting. Use smaller values for relatively shallow depth of field scenes, and large values for deep depth-of-field scenes. Setting this to a sensible value reduces interference from out of scene areas and reduces unneeded computation.

  • blockSize is the dimension (in pixels on a side) of the block which is compared between the left and right images. Setting this to a sensible value reduces interference from out of scene areas and reduces unneeded computation.

  • disp12MaxDiff, speckleRange, speckleWindowSize - used in filtering the disparity map before returning, looking for areas of similar disparity (small areas will be assumed to be noise and marked as having invalid depth information). These reduce reduces noise in disparity map output.

StereoBM:

  • preFilterCap, preFilterSize, preFilterType - used in filtering the input images before disparity computation. These may improve noise rejection in input images.

  • ROI1, ROI2 - region of interest, used to constrain the computation to a smaller rectangle within the input images. These may help avoid unneeded computation.

  • textureThreshold, uniquenessRation, smallerBlockSize - used in filtering the disparity map before returning. May reduce noise.

StereoSGBM: - StereoSGBM:

  • mode - selects the block compare mechanism to use. Some modes may perform much better for certain input scenes, comparing a few lines out of the entire block rather than every pixel in the block.

    • P1, P2, uniquenessRation - used in filtering the disparity map before returning to reject small blocks. May reduce noise.

    • preFilterCap - used in filtering the input images before disparity computation. These may improve noise rejection in input images.

    Fuzziness can be due to:

    • poor calibration or rectification - calibration (discovery of distortion, rotation, translation matrices) must be very accurate, to within a fraction of a pixel correspondence between left and right, in order to rectify the left and right images to epipolar form so that the disparity algorithms will return accurate results.

    • poor contrast/illumination or poor focus resulting in mismatches - features in left and right cameras must be cear and not under or over exposed.

    • too regular a background pattern (mismatches) or no background pattern (hard to get a valid distance) - random pattern projectors can help here.

    • poor range selection: minDisparities and numDisparities are not set to select just the range of interesting disparities for your scene, causing interfering matches from depths outside your range of interest - constrain these as sensible.

    • filtering of input images or output disparity map can reduce noise blobs.

    The black bar is the sum of:

    • blockSize / 2 (which makes a frame around the entire image)

    • minDisparity (the left portion of the image visible to the left camera which is out of view to the right camera)

    • numDisparities (the left portion of the image which visible to the left camera which at nearer range will be out of view to the right camera)

    This is another reason why setting minDisparity and numDisparities to sensible settings for the interesting parts of your scene is important.

StereoMatching parameters:

  • minDisparity is the smallest disparity value to search for. Use smaller values to look for scenes which include objects at infinity, and larger values for scenes near the cameras. Negative minDisparity can be useful if the cameras are intentionally cross-eyed, but you wish to calculate long-range distances. Setting this to a sensible value reduces interference from out of scene areas and reduces unneeded computation.

  • numDisparities is the range of disparities to search over. It is effectively your scene's depth of field setting. Use smaller values for relatively shallow depth of field scenes, and large values for deep depth-of-field scenes. Setting this to a sensible value reduces interference from out of scene areas and reduces unneeded computation.

  • blockSize is the dimension (in pixels on a side) of the block which is compared between the left and right images. Setting this to a sensible value reduces interference from out of scene areas and reduces unneeded computation.

  • disp12MaxDiff, speckleRange, speckleWindowSize - used in filtering the disparity map before returning, looking for areas of similar disparity (small areas will be assumed to be noise and marked as having invalid depth information). These reduces noise in disparity map output.

StereoBM:

  • preFilterCap, preFilterSize, preFilterType - used in filtering the input images before disparity computation. These may improve noise rejection in input images.

  • ROI1, ROI2 - region of interest, used to constrain the computation to a smaller rectangle within the input images. These may help avoid unneeded computation.

  • textureThreshold, uniquenessRation, smallerBlockSize - used in filtering the disparity map before returning. May reduce noise.

StereoSGBM:

  • mode - selects the block compare mechanism to use. Some modes may perform much better for certain input scenes, comparing a few lines out of the entire block rather than every pixel in the block.

  • P1, P2, uniquenessRation - used in filtering the disparity map before returning to reject small blocks. May reduce noise.

  • preFilterCap - used in filtering the input images before disparity computation. These may improve noise rejection in input images.

Fuzziness can be due to:

  • poor calibration or rectification - calibration (discovery of distortion, rotation, translation matrices) must be very accurate, to within a fraction of a pixel correspondence between left and right, in order to rectify the left and right images to epipolar form so that the disparity algorithms will return accurate results.

  • poor contrast/illumination or poor focus resulting in mismatches - features in left and right cameras must be cear clear and not under or over exposed.

  • too regular a background pattern (mismatches) or no background pattern (hard to get a valid distance) - random pattern projectors can help here.

  • poor range selection: minDisparities and numDisparities are not set to select just the range of interesting disparities for your scene, causing interfering matches from depths outside your range of interest - constrain these as sensible.

  • filtering of input images or output disparity map can reduce noise blobs.

The black bar is the sum of:

  • blockSize / 2 (which makes a frame around the entire image)

  • minDisparity (the left portion of the image visible to the left camera which is out of view to the right camera)

  • numDisparities (the left portion of the image which visible to the left camera which at nearer range will be out of view to the right camera)

This is another reason why setting minDisparity and numDisparities to sensible settings for the interesting parts of your scene is important.

The C++ documentation helps some... see cv::StereoSGBM Class Reference. My takes on it follow.

StereoMatching parameters:

  • minDisparity is the smallest disparity value to search for. Use smaller values to look for scenes which include objects at infinity, and larger values for scenes near the cameras. Negative minDisparity can be useful if the cameras are intentionally cross-eyed, but you wish to calculate long-range distances. Setting this to a sensible value reduces interference from out of scene areas and reduces unneeded computation.

  • numDisparities is the range of disparities to search over. It is effectively your scene's depth of field setting. Use smaller values for relatively shallow depth of field scenes, and large values for deep depth-of-field scenes. Setting this to a sensible value reduces interference from out of scene areas and reduces unneeded computation.

  • blockSize is the dimension (in pixels on a side) of the block which is compared between the left and right images. Setting this to a sensible value reduces interference from out of scene areas and reduces unneeded computation.

  • disp12MaxDiff, speckleRange, speckleWindowSize - used in filtering the disparity map before returning, looking for areas of similar disparity (small areas will be assumed to be noise and marked as having invalid depth information). These reduces noise in disparity map output.

StereoBM:

  • preFilterCap, preFilterSize, preFilterType - used in filtering the input images before disparity computation. These may improve noise rejection in input images.

  • ROI1, ROI2 - region of interest, used to constrain the computation to a smaller rectangle within the input images. These may help avoid unneeded computation.

  • textureThreshold, uniquenessRation, smallerBlockSize - used in filtering the disparity map before returning. May reduce noise.

StereoSGBM:

  • mode - selects the block compare mechanism to use. Some modes may perform much better for certain input scenes, comparing a few lines out of the entire block rather than every pixel in the block.

  • P1, P2, uniquenessRation - used in filtering the disparity map before returning to reject small blocks. May reduce noise.

  • preFilterCap - used in filtering the input images before disparity computation. These may improve noise rejection in input images.

Fuzziness can be due to:

  • poor calibration or rectification - calibration (discovery of distortion, rotation, translation matrices) must be very accurate, to within a fraction of a pixel correspondence between left and right, in order to rectify the left and right images to epipolar form so that the disparity algorithms will return accurate results.

  • poor contrast/illumination or poor focus resulting in mismatches - features in left and right cameras must be clear and not under or over exposed.

  • too regular a background pattern (mismatches) or no background pattern (hard to get a valid distance) - random pattern projectors can help here.

  • poor range selection: minDisparities and numDisparities are not set to select just the range of interesting disparities for your scene, causing interfering matches from depths outside your range of interest - constrain these as sensible.

  • filtering of input images or output disparity map can reduce noise blobs.

The black bar is the sum of:

  • blockSize / 2 (which makes a frame around the entire image)

  • minDisparity (the left portion of the image visible to the left camera which is out of view to the right camera)

  • numDisparities (the left portion of the image which visible to the left camera which at nearer range will be out of view to the right camera)

This is another reason why setting minDisparity and numDisparities to sensible settings for the interesting parts of your scene is important.