pythonopencvmodulesimgcodecssrcloadsave.cpp

pythonopencvmodulesimgcodecssrcloadsave.cpp ,第1张

[ WARN:0@2.146] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('IMG/完成时间0.png'): can't open/read file: check file path/integrity
Traceback (most recent call last):
  File "D:\Works\work\填补工单\测试找0.py", line 6, in 
    xin_zeng = pyautogui.locateOnScreen('IMG/完成时间0.png', grayscale=True)  # 寻找图片
  File "C:\Users\FMY\AppData\Local\Programs\Python\Python39\lib\site-packages\pyautogui\__init__.py", line 175, in wrapper
    return wrappedFunction(*args, **kwargs)
  File "C:\Users\FMY\AppData\Local\Programs\Python\Python39\lib\site-packages\pyautogui\__init__.py", line 213, in locateOnScreen
    return pyscreeze.locateOnScreen(*args, **kwargs)
  File "C:\Users\FMY\AppData\Local\Programs\Python\Python39\lib\site-packages\pyscreeze\__init__.py", line 373, in locateOnScreen
    retVal = locate(image, screenshotIm, **kwargs)
  File "C:\Users\FMY\AppData\Local\Programs\Python\Python39\lib\site-packages\pyscreeze\__init__.py", line 353, in locate
    points = tuple(locateAll(needleImage, haystackImage, **kwargs))
  File "C:\Users\FMY\AppData\Local\Programs\Python\Python39\lib\site-packages\pyscreeze\__init__.py", line 207, in _locateAll_opencv
    needleImage = _load_cv2(needleImage, grayscale)
  File "C:\Users\FMY\AppData\Local\Programs\Python\Python39\lib\site-packages\pyscreeze\__init__.py", line 170, in _load_cv2
    raise IOError("Failed to read %s because file is missing, "
OSError: Failed to read IMG/完成时间0.png because file is missing, has improper permissions, or is an unsupported or invalid format

主要是两个问题:

①路径的斜杠与反斜杠

②图片命名不能包含中文

我使用的pyautogui一直是没有问题的,但是加上pip install opencv-python 就会报错很奇怪,这下终于解决了。

参考:使用opencv读取图片时出现错误:cv2.error: OpenCV(4.4.0)解决办法_木泽锐的博客-CSDN博客使用opencv读取图片时出现错误:cv2.error: OpenCV(4.4.0)解决办法- 利用opencv对图像进行增强时出现如下错误:cv2.error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\pip-req-build-k8sx3e60\opencv\modules\imgproc\src\resize.cpp:3929: error: (-215:Assertion failed) 原代码:百度出现的错误代码,https://blog.csdn.net/qq_43521500/article/details/108751507

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/662406.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-18
下一篇 2022-04-18

发表评论

登录后才能评论

评论列表(0条)

保存