What does the map returned by stereo.compute()
indicate?
The definition of disparity is the distance between two comparable pixels in the left and right images.
However, by running the following code, I obtained a map with the same size as the input photos with values ranging from -16
to 211
. I got confused when it comes with some negative numbers. If these values refer to distance, why would a distance of -16
be possible? (In fact, it has plenty of -16
in the map).
What precisely do these values indicate?
Any help is greatly appreciated.
code:
import cv2 as cv
from matplotlib import pyplot as plt
imgL = cv.imread("data/stereo-corridor_l.png", 0)
print(imgL.shape)
imgR = cv.imread("data/stereo-corridor_r.png", 0)
stereo = cv.StereoBM_create(numDisparities=16, blockSize=17)
disparity = stereo.compute(imgL, imgR)
plt.imshow(disparity, "gray")
plt.show()