你的逻辑很奇怪,遍历区域直接for循环就行。那个a加来加去没意义。
rois = [(5, 50, 25, 35),(30, 50, 25, 35),(55, 50, 25, 35),(80, 50, 25, 35),(105, 50, 25, 35)]
for roi in rois:
for t in templates:
template = image.Image(t)
r = img.find_template(template, 0.70, step=4, search=SEARCH_EX, roi=roi)
if r:
img.draw_rectangle(r)
print(t)