首页 > Web开发 > 详细

attributeError: 'NoneType' object has no attribute 'shape' 报错

时间:2019-07-19 19:44:57      阅读:4324      评论:0      收藏:0      [点我收藏+]

 

# 1 load 2 info 3 resize 4 check
import cv2

img = cv2.imread("image0.jpg", 1)
imgInfo = img.shape
print(imgInfo)

  

可能是因为没有设置路径,所以返回的类型是None。

改正的方法是,读取图片时把路径也写上

import cv2

img = cv2.imread(r"D:\PythonCode\neuron\image0.jpg", 1)
imgInfo = img.shape
print(imgInfo)

  

attributeError: 'NoneType' object has no attribute 'shape' 报错

原文:https://www.cnblogs.com/mjn1/p/11215172.html

(1)
(1)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!