AttributeError: 'module' object has no attribute

Ujjwal

I am trying to get the depth map of two stereo images. I have taken the code from this documentation.

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 entered the Python line interpreter, and wrote the following code:

import cv2
help(cv2)

There is no function called createStereoBM in cv2.

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?

Please help.

youssefhassan

Use this function instead

stereo = cv2.StereoBM(cv2.STEREO_BM_BASIC_PRESET,ndisparities=16, SADWindowSize=15)

You can find documentation for this function here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

AttributeError: 'module' object has no attribute

From Dev

AttributeError: 'module' object has no attribute

From Dev

AttributeError:'module' object has no attribute 'call' :Python

From Dev

AttributeError: 'module' object has no attribute 'tk'

From Dev

AttributeError: 'module' object has no attribute 'cache'

From Java

AttributeError: 'module' object has no attribute 'tests'

From Dev

AttributeError: 'module' object has no attribute 'TestCase'

From Dev

AttributeError: 'module' object has no attribute 'version'

From Dev

Mtaplotlib AttributeError: 'module' object has no attribute 'pyplot'

From Dev

AttributeError: 'module' object has no attribute 'plotting'

From Java

AttributeError: 'module' object has no attribute 'request'

From Java

tensorflow:AttributeError: 'module' object has no attribute 'mul'

From Java

AttributeError: 'module' object has no attribute 'urlretrieve'

From Dev

AttributeError: 'module' object has no attribute 'grd'

From Dev

AttributeError: 'module' object has no attribute 'SignedJwtAssertionCredentials'

From Dev

AttributeError: 'module' object has no attribute 'scandir'

From Dev

AttributeError: 'module' object has no attribute 'SFrame'

From Dev

Pylint AttributeError: 'module' object has no attribute 'append'

From Dev

Inheritance AttributeError: 'module' object has no attribute

From Dev

AttributeError: 'module' object has no attribute 'ORB'

From Dev

AttributeError: 'module' object has no attribute 'utcnow'

From Dev

AttributeError: "'module' object has no attribute 'ARRAY'"

From Dev

AttributeError: 'module' object has no attribute 'div'

From Dev

Python AttributeError: 'module' object has no attribute 'atoi'

From Dev

AttributeError: 'module' object has no attribute 'EmailInput'

From Dev

python - AttributeError: 'module' object has no attribute 'lock'

From Dev

AttributeError: 'module' object has no attribute '[x]'

From Dev

Pygame AttributeError: 'module' object has no attribute 'copy'

From Dev

SQLAlchemy AttributeError: 'module' object has no attribute 'PandasSQLAlchemy'

Related Related

  1. 1

    AttributeError: 'module' object has no attribute

  2. 2

    AttributeError: 'module' object has no attribute

  3. 3

    AttributeError:'module' object has no attribute 'call' :Python

  4. 4

    AttributeError: 'module' object has no attribute 'tk'

  5. 5

    AttributeError: 'module' object has no attribute 'cache'

  6. 6

    AttributeError: 'module' object has no attribute 'tests'

  7. 7

    AttributeError: 'module' object has no attribute 'TestCase'

  8. 8

    AttributeError: 'module' object has no attribute 'version'

  9. 9

    Mtaplotlib AttributeError: 'module' object has no attribute 'pyplot'

  10. 10

    AttributeError: 'module' object has no attribute 'plotting'

  11. 11

    AttributeError: 'module' object has no attribute 'request'

  12. 12

    tensorflow:AttributeError: 'module' object has no attribute 'mul'

  13. 13

    AttributeError: 'module' object has no attribute 'urlretrieve'

  14. 14

    AttributeError: 'module' object has no attribute 'grd'

  15. 15

    AttributeError: 'module' object has no attribute 'SignedJwtAssertionCredentials'

  16. 16

    AttributeError: 'module' object has no attribute 'scandir'

  17. 17

    AttributeError: 'module' object has no attribute 'SFrame'

  18. 18

    Pylint AttributeError: 'module' object has no attribute 'append'

  19. 19

    Inheritance AttributeError: 'module' object has no attribute

  20. 20

    AttributeError: 'module' object has no attribute 'ORB'

  21. 21

    AttributeError: 'module' object has no attribute 'utcnow'

  22. 22

    AttributeError: "'module' object has no attribute 'ARRAY'"

  23. 23

    AttributeError: 'module' object has no attribute 'div'

  24. 24

    Python AttributeError: 'module' object has no attribute 'atoi'

  25. 25

    AttributeError: 'module' object has no attribute 'EmailInput'

  26. 26

    python - AttributeError: 'module' object has no attribute 'lock'

  27. 27

    AttributeError: 'module' object has no attribute '[x]'

  28. 28

    Pygame AttributeError: 'module' object has no attribute 'copy'

  29. 29

    SQLAlchemy AttributeError: 'module' object has no attribute 'PandasSQLAlchemy'

HotTag

Archive