问题相关代码
def read_img(img_fp):
img = cv2.imread(img_fp)[:, :, ::-1]
h_origin, w_origin, _ = img.shape
return img, h_origin, w_origin
运行结果及报错内容
TypeError: 'NoneType' object is not subscriptable
直接删掉imread(img_fp)后面的[:, :, ::-1]
def read_img(img_fp):
img = cv2.imread(img_fp)
h_origin, w_origin, _ = img.shape
return img, h_origin, w_origin
结果报错内容为 AttributeError: 'NoneType' object has no attribute 'shape'