I am trying to get a depth map of two stereo images. I took the code from http://docs.opencv.org/trunk/doc/py_tutorials/py_calib3d/py_depthmap/py_depthmap.html
I get the following error:
Traceback (most recent call last): File "depth.py", line 9, in <module> stereo = cv2.createStereoBM(numDisparities=16, blockSize=15) AttributeError: 'module' object has no attribute 'createStereoBM'
My code is:
import numpy as np import cv2 from matplotlib import pyplot as plt imgL = cv2.imread('tsukuba_l.png',0) imgR = cv2.imread('tsukuba_r.png',0) stereo = cv2.createStereoBM(numDisparities=16, blockSize=15) disparity = stereo.compute(imgL,imgR) plt.imshow(disparity,'gray') plt.show()
I introduced the Python string interpreter and wrote the following code:
import cv2 help(cv2)
In cv2 there is no function called createStereoBM.
Is the code incorrect in the link provided above? I am using Python 2.7.3 on Ubuntu 12.04. Is it possible that the code is for Python 3 and above?
Please, help.
source share