TypeError: Incorrect type of self (must be 'StereoMatcher' or its derivative) in Opencv

308 Views Asked by At

Description: I am following the sample code to find the disparity.

Code:

import cv2
from matplotlib import pyplot as plt
imgL = cv2.imread('tsukuba_l.png',0)
imgR = cv2.imread('tsukuba_r.png',0)
stereo = cv2.StereoBM(numDisparities=16, blockSize=15)
disparity = stereo.compute(imgL,imgR)
plt.imshow(disparity,'gray')
plt.show()

But the error I got is:

File "D:drawing-epipolar-lines/untitled0.py", line 15, in <module>
disparity = stereo.compute(imgL,imgR)
TypeError: Incorrect type of self (must be 'StereoMatcher' or its derivative)
0

There are 0 best solutions below