logo

怎样把循环得出的变量有序存入一个变量里?

2019-10-10 15:43
J
x2sk

怎样把t[1]存在一个变量中?

 for roi in rois:
        for t in templates:
             template = image.Image(t)
             img.draw_rectangle(roi, thickness=1)
             r = img.find_template(template, 0.70,roi, step=4, search=SEARCH_EX) #, roi=(10, 0, 60, 60))
             if r:
                img.draw_rectangle(r, thickness=2)
                img.draw_string(roi[0]+16,100, t[1],scale = 2,color=(255,0,0), mono_space = False)#打印到屏幕
                print(t)
2019-10-11 10:39
I
网红小智智 星瞳科技

我不懂你是要做什么。

I
网红小智智 星瞳科技

直接

a = 0

 for roi in rois:
        for t in templates:
             a = t[1]
             template = image.Image(t)
             img.draw_rectangle(roi, thickness=1)
             r = img.find_template(template, 0.70,roi, step=4, search=SEARCH_EX) #, roi=(10, 0, 60, 60))
             if r:
                img.draw_rectangle(r, thickness=2)
                img.draw_string(roi[0]+16,100, t[1],scale = 2,color=(255,0,0), mono_space = False)#打印到屏幕
                print(t)

但是每次循环都会覆盖a,我不明白你要做什么。

2019-10-11 11:01
J
x2sk

对5位数字 每位分开识别,再组合出原来的数