import cv2 as cv template = r"D:\304550461.jpg" tp = cv.imread(template) a = tp[2:3, 6:8]
其中a = tp[2:3, 6:8]报错TypeError: 'NoneType' object is not subscriptable哪里出了问题?
代码没问题,应该是你的图片路径问题,这里你用的应该是绝对路径