无法运行tune_blockmatcher和image_to_pointcloud程序

时间:2018-02-22 08:50:38

标签: opencv stereo-3d opencv-python 3dcamera

我能够在网络摄像头上捕捉图像并使用它进行校准 来自erget的StereoVision library

但是,在尝试执行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,安装了立体视觉库,并安装了立体声视频&#39;

针对此问题的任何解决方案?

1 个答案:

答案 0 :(得分:1)

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

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

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

希望这有帮助