i followed the example of the creation of disparity maps and got strange results. While the images look good on the first look, the numeric values of the disparity of the pixels seem incorrect. In my understanding, the disparity should map the distance of a feature in image_left to the same feature in image_right image in pixels.
Consider this example:
import numpy as np import cv2 as cv from matplotlib import pyplot as plt imgL = cv.imread('Tsukuba_L.png', 0) imgR = cv.imread('Tsukuba_R.png', 0) stereo = cv.StereoBM_create(numDisparities=16, blockSize=15) disparity = stereo.compute(imgL, imgR) fig, ax = plt.subplots(ncols=3, nrows=1) ax.imshow(imgL) ax.imshow(imgR) ax.imshow(disparity) plt.show()
This will lead to these images:
Check the position, where the paper meets the image bound. Its around 0,115 in the left image and 0, 105 in the right image. So shouldnt the disparity image be (roughly) 10? Its 180, which appears vastly wrong.
This is important as I am trying to measure the 3d-distance based on the found disparity.