def
split_image_tag(img, tag_pos):
x, y
=
tag_pos
img_
=
img[
0
:
35
, y
-
37
:y]
return
img_
def
process_tag(tag_pos):
new_template
=
split_image_tag(img_2, tag_pos)
new_size
=
75
new_template
=
cv2.resize(new_template, (new_size, new_size))
ocr_infos
=
[]
angel_size
=
6
for
angle
in
range
(
-
180
,
180
, angel_size):
template_
=
rotate_image(new_template, angle)
max_val, max_loc
=
template_match(template_, img_1)
ocr_infos.append([angle, max_val, max_loc])
max_info
=
max
(ocr_infos, key
=
lambda
x: x[
1
])
return
max_info
with ThreadPoolExecutor() as executor:
results
=
list
(executor.
map
(process_tag, [(
37
,
37
), (
37
,
74
), (
37
,
111
), (
37
,
148
)]))
for
max_info
in
results:
match_tag_list.append(
list
(max_info[
-
1
]))
return
match_tag_list