AttributeError: 'module' object has no attribute

妖精的绣舞 提交于 2019-12-04 03:55:01

Use this function instead

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

You can find documentation for this function here

cv2.StereoBM_create(numDisparities=16, blockSize=15)

Try it. My opencv version is 3.2.

If you want to find any function working in opencv, you can try this

  1. import(cv2)
  2. help(cv2)
hemant yadav
import numpy as np

import cv2

from matplotlib import pyplot as plt

imgL = cv2.imread('l.png',0)

imgR = cv2.imread('r.png',0)

stereo = cv2.StereoBM_create(numDisparities=16, blockSize=15)

disparity = stereo.compute(imgL,imgR)

plt.imshow(disparity,'gray')

plt.show()  

try to use this code is your using the code from open-cv documentation

You are getting the example from the trunk (aka devel) documentation. if you aren't using trunk version, try to find an example for your correct version.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!