Python中报错:AttributeError: ‘NoneType‘ object has no attribute ‘copy‘

AttributeError: ‘NoneType’ object has no attribute ‘copy’

运行程序时报错:
可能原因:图片路径写得存在问题,下面是错误代码:

import cv2
import numpy as np

img = cv2.imread('E:\image\1.jpg')
img1 = img.copy()
img2 = img.copy()

正确代码:

import cv2
import numpy as np

img = cv2.imread('E://image//1.jpg')
img1 = img.copy()
img2 = img.copy()

运行成功,不报错哦

你可能感兴趣的:(python)