欢迎光临北京国标标准舞学院网!

服务热线:010-69453013

[ WARN:0@0.010] : can‘t open/read file: check file path/integrity错误的一种解决办法

import cv2
import numpy as np
# #读取图片
# src = cv2.imread('../111/a.png', cv2.IMREAD_UNCHANGED)
# blur=cv2.blur(src,(5,5))
# cv2.imshow("original", src)
# cv2.imshow("opening", blur)
#等待显示
img=cv2.imread('../素材/a.jpg')
cv2.imshow('a',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

[ WARN:0@0.010] global loadsave.cpp:244 cv::findDecoder imread_('图像处理\a1.jpg'): can't open/read file: check file path/integrity

Traceback (most recent call last):

File "D:/PyCharm Community Edition 2021.2.3/Project/Calculate/机器视觉/test.py", line 4, in

cv2.imshow('a',img)

cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:971: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'

在进行学习的时候,遇到了这个问题

原因是:imread读取路径中不能带中文字符