报错:'NoneType' object has no attribute 'shape'
import cv2 as cv
img = cv.imread('images1')
print('img.shape', img.shape) # 图像大小(行、列、通道数)
print('img.size', img.size) # 图像像素的数目数
print('img.dttype', img.dtype) # 图像的数据类型
File “D:/Python项目/opencv入门/3-6.py”, line 3, in
print(‘img.shape’, img.shape) # 图像大小(行、列、通道数)
AttributeError: ‘NoneType’ object has no attribute ‘shape’
原因是 img = cv.imread(‘images1’) 没有给正确的图片路径,程序无法找到该图片