title: AttributeError: 'module' object has no attribute
body: <p>I am trying to get the depth map of two stereo images. I have taken the code from <a href="http://web.archive.org/web/20190203045746/https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_calib3d/py_depthmap/py_depthmap.html" rel="nofollow noreferrer">this documentation</a>.</p>
  
  <p>I get the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "depth.py", line 9, in &lt;module&gt;
      stereo = cv2.createStereoBM(numDisparities=16, blockSize=15)
  AttributeError: 'module' object has no attribute 'createStereoBM'
  </code></pre>
  
  <p>My code is:</p>
  
  <pre class="lang-py prettyprint-override"><code>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()
  </code></pre>
  
  <p>I entered the Python line interpreter, and wrote the following code:</p>
  
  <pre class="lang-py prettyprint-override"><code>import cv2
  help(cv2)
  </code></pre>
  
  <p>There is no function called <code>createStereoBM</code> in <code>cv2</code>. </p>
  
  <p>Is the code wrong in the link provided at the top? I am using Python 2.7.3 in Ubuntu 12.04.
  Is it possible that the code is meant for Python 3 and above?</p>
  
  <p>Please help.</p>