无法 运行 tune_blockmatcher 和 image_to_pointcloud 程序

Unable to run tune_blockmatcher and image_to_pointcloud programs

我能够在网络摄像头上捕捉图像并使用 StereoVision library 来自 erget。

但是,在尝试执行 tune_blockmatcher 和 images_to_pointcloud 时,我发现以下错误,因为 StereoBM 和 StereoSGBM 类 无法导入。

>import cv2
>from stereovision.blockmatchers import StereoBM, StereoSGBM
Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
 File "C:\Python27\lib\site-packages\stereovision\blockmatchers.py", line 111,
in <module>
   class StereoBM(BlockMatcher):
 File "C:\Python27\lib\site-packages\stereovision\blockmatchers.py", line 117,
in StereoBM
   "stereo_bm_preset": cv2.STEREO_BM_NARROW_PRESET}
AttributeError: 'module' object has no attribute 'STEREO_BM_NARROW_PRESET'
>`

C:\s\StereoVision-master\stereovision>python tune_blockmatcher.py
Traceback (most recent call last):
  File "tune_blockmatcher.py", line 34, in <module>
    from stereovision.blockmatchers import StereoBM, StereoSGBM
  File "build\bdist.win-amd64\egg\stereovision\blockmatchers.py", line 111, in <
module>
    class StereoBM(BlockMatcher):
  File "build\bdist.win-amd64\egg\stereovision\blockmatchers.py", line 117, in S
tereoBM
    "stereo_bm_preset": cv2.STEREO_BM_NARROW_PRESET}
AttributeError: 'module' object has no attribute 'STEREO_BM_NARROW_PRESET'

OS 我是 运行 是 Windows7,运行 OPENCV 3.4.0 和 Python2.7,用 [=23= 安装了立体视觉库]

这个问题有什么解决方案吗?

您遇到此问题是因为 Daniel Lee 提供的 StereoVision 框架不适用于 OpenCV 3。

首先,从您的机器上卸载 OpenCV 3。

然后安装 OpenCV 2 并重试:您的问题将会消失。

希望对您有所帮助