1

我能够在网络摄像头上捕捉图像并使用 erget 的 StereoVision 库很好地校准它们。

但是,在尝试执行 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'

我正在运行的操作系统是 Windows7,运行 OPENCV 3.4.0 和 Python2.7,安装了带有“pip install StereoVision”的立体视觉库

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

4

1 回答 1

1

您正面临这个问题,因为 Daniel Lee 提供的 StereoVision 框架不适用于 OpenCV 3。

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

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

希望这可以帮助

于 2018-05-09T16:23:02.407 回答