How to get good disparity map

Hello,

This is pic after rectification,but disparity map is seemly wrong

should I amend something?

def stereoMatchSGBM(left_image, right_image, down_scale=False):
# SGBM
if left_image.ndim == 2:
img_channels = 1
else:
img_channels = 3
blockSize = 3
paraml = {‘minDisparity’: 0,
‘numDisparities’: 128,
‘blockSize’: blockSize,
‘P1’: 8 * img_channels * blockSize ** 2,
‘P2’: 32 * img_channels * blockSize ** 2,
‘disp12MaxDiff’: 1,
‘preFilterCap’: 63,
‘uniquenessRatio’: 15,
‘speckleWindowSize’: 100,
‘speckleRange’: 1,
‘mode’: cv2.STEREO_SGBM_MODE_SGBM_3WAY
}

left_matcher = cv2.StereoSGBM_create(**paraml)
paramr = paraml
paramr['minDisparity'] = -paraml['numDisparities']
right_matcher = cv2.StereoSGBM_create(**paramr)


size = (left_image.shape[1], left_image.shape[0])
if down_scale == False:
    disparity_left = left_matcher.compute(left_image, right_image)
    disparity_right = right_matcher.compute(right_image, left_image)
else:
    left_image_down = cv2.pyrDown(left_image)
    right_image_down = cv2.pyrDown(right_image)
    factor = left_image.shape[1] / left_image_down.shape[1]

    disparity_left_half = left_matcher.compute(left_image_down, right_image_down)
    disparity_right_half = right_matcher.compute(right_image_down, left_image_down)
    disparity_left = cv2.resize(disparity_left_half, size, interpolation=cv2.INTER_AREA)
    disparity_right = cv2.resize(disparity_right_half, size, interpolation=cv2.INTER_AREA)
    disparity_left = factor * disparity_left
    disparity_right = factor * disparity_right

trueDisp_left = disparity_left.astype(np.float32) / 16.
trueDisp_right = disparity_right.astype(np.float32) / 16.

return trueDisp_left, trueDisp_right

Thank u