opencv读取图片AttributeError: ‘NoneType‘ object has no attribute ‘shape‘

python读取图像时报错:
for pngfile in tqdm(os.listdir(rotatepng)):
lena = cv2.imread(os.path.join(rotatepng,pngfile),0)
—> 32 for i in range(lena.shape[0]):
33 for j in range(lena.shape[1]):
34 if lena[i,j] > 10:
AttributeError: ‘NoneType’ object has no attribute ‘shape’
因为读取的不是不是正确的图像数据,是.ipynb文件夹。
删除文件夹下面的ipynb文件即可
rm -rf .ipynb_checkpoints/

你可能感兴趣的:(Python,python)