[ WARN:[email protected]] : 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:[email protected]] 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读取路径中不能带中文字符

你可能感兴趣的:(opencv,人工智能,计算机视觉)