attributeError: 'NoneType' object has no attribute 'shape' 报错
作者:互联网
# 1 load 2 info 3 resize 4 check import cv2 img = cv2.imread("image0.jpg", 1) imgInfo = img.shape print(imgInfo)
attributeError: 'NoneType' object has no attribute 'shape' 报错
可能是因为没有设置路径,所以返回的类型是None。
改正的方法是,读取图片时把路径也写上
import cv2 img = cv2.imread(r"D:\PythonCode\neuron\image0.jpg", 1) imgInfo = img.shape print(imgInfo)
标签:img,no,attribute,cv2,shape,报错,imgInfo 来源: https://www.cnblogs.com/mjn1/p/11215172.html