Error analysis: [AttributeError: 'NoneType' object has no attribute 'shape']

-----------------------------------Aspiration should be lofty and down-to-earth--------- --------------------------- Cheng_Qichen

Error reporting about OpenCV reading pictures

foreword

OpenCV image reading

#读取原始图像
img = cv2.imread('OpenCV/man.png') 
print(img.shape)

mistake

显示:【AttributeError: ‘NoneType’ object has no attribute ‘shape’】

solution

Change the path [absolute path & relative path]

inspirational quotes

No matter how difficult the front is,
as long as you walk in the right direction,
no matter how rough it is
, you will be closer to happiness than standing still

Summarize

The path error leads to no data being read, and finally causes the variable to be of NoneType type. Nonetype type does not support any operations and has no built-in method, which finally leads to failure to run and error reporting.

Guess you like

Origin blog.csdn.net/CHENG15234944691/article/details/124273881