I use the StereoSGBM method in OpenCV to generate the disparity map of a pair of stereo images.
However, there is a strange black zone at the left of the disparity map. Can anyone give some help?
import cv2
name_l = ('KITTI/depth/train/2011_09_26_drive_0001_sync/'
'image_02/data/0000000000.png')
name_r = ('KITTI/depth/train/2011_09_26_drive_0001_sync/'
'image_03/data/0000000000.png')
img_l = cv2.imread(name_l)
img_r = cv2.imread(name_r)
window_size = 3
stereo = cv2.StereoSGBM_create(minDisparity=0,
numDisparities=128,
blockSize=window_size,
P1=3 * 4 * window_size**2,
P2=3 * 32 * window_size**2,
disp12MaxDiff=1,
preFilterCap=63,
uniquenessRatio=10,
speckleWindowSize=100,
speckleRange=32,
mode=cv2.StereoSGBM_MODE_HH)
disp = stereo.compute(img_l, img_r).astype('float32') / 16.0
cv2.imshow('left', img_l)
cv2.imshow('right', img_r)
cv2.imshow('disparity', (disp - 0) / 128)
cv2.waitKey()
cv2.destroyAllWindows()