windows环境Python调用opencv出错的问题记录

1.报错现象

使用cv2进行图像腐蚀时报错,版本号 3.4.3,如下:

>>> erosion = cv2.erode(src,kernel)
Traceback (most recent call last):
  File "<pyshell#22>", line 1, in <module>
    erosion = cv2.erode(src,kernel)
cv2.error: OpenCV(3.4.3) D:\Build\OpenCV\opencv-3.4.3\modules\core\src\matrix.cpp:756: error: (-215:Assertion failed) dims <= 2 && step[0] > 0 in function 'cv::Mat::locateROI'

2.解决方案

将windows路径中的“\”,全部更改为“/”,问题解决。

猜你喜欢

转载自blog.csdn.net/weixin_39128119/article/details/84177584