I'm trying to calculate a disparity map using openCV3 in python but the result is not satisfactory. I made sure that the calibration and rectification are done correctly:
I tried disparity function in Matlab using these rectified images and results were quite good. However, the opencv output looks like a Van Gogh paitning:
Here is the python code related to disparity:
block_matcher = cv2.StereoBM_create(numDisparities=16, blockSize=15)
disp = block_matcher.compute(rectified_l, rectified_r)
Interestingly, a range of disparity is [-16,240], however, I expect it to be in [0,16] since I set numDisparities to 16. Am I misunderstanding the concept of numDisparities? I tried varying the numDisparities and blockSize but didn't get any meaningful improvement.
Let me know if you have ideas on what is going on.