我尝试使用opencv按照以下代码裁剪图像:
import cv2
import numpy as np
import csv
path_image= '/home/'
img=cv2.imread(path_image+"image1.png")
img1=img[40:102,2442:2448]
但是我执行了一个错误:
img1=img[40:102,2442:2448]
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object has no attribute '__getitem__'
答案 0 :(得分:0)
img=cv2.imread(os.path.join(path_image,'image1.png'))