Search code examples
pythonc++opencvopencv3.0disparity-mapping

What is the difference between cv2.StereoSGBM_create() and cv2.StereoBM_create() functions for disparity mapping on opencv3?


I am trying to understand the disparity mapping functions of opencv I came across two methods cv2.StereoSGBM_create and cv2.StereoBM_create I don't quite understand the difference.

Also, what are the properties of the functions such as numDisparities or setSpeckleRange etc


Solution

  • The definitions of all the arguments are given at the bottom of the documentation page here

    In block matching or cv2.StereoBM_create() the disparity is computed by comparing the sum of absolute differences (SAD) of each 'block' of pixels. In semi-global block matching or cv2.StereoSGBM_create() forces similar disparity on neighbouring blocks. This creates a more complete disparity map but is more computationally expensive.

    Paper that discusses 'block matching'

    Paper that discusses 'semi-global block matching'