- defined COLORs added legend

- ocv_template_mnatching uses video
This commit is contained in:
2024-07-01 12:28:47 +02:00
parent 50bb0433f1
commit 0189e02bbc
3 changed files with 93 additions and 46 deletions
+4 -2
View File
@@ -8,7 +8,8 @@ def template_match_rotation(source, template, angle, center, rot_min=-1.0, rot_m
best_angle = 0
best_r = 0
best_max_loc = 0
r = 0
best_res = None
im_source = im.resize(source, scale * source.shape[0], scale * source.shape[1])
for dangle in np.linspace(rot_min, rot_max, n_steps):
# rotated and scale up to IMG_SCALE_UP-size
@@ -23,6 +24,7 @@ def template_match_rotation(source, template, angle, center, rot_min=-1.0, rot_m
best_r = r
best_angle = dangle
best_max_loc = (maxLoc[0]/scale, maxLoc[1]/scale)
best_res = res
else:
break
@@ -30,4 +32,4 @@ def template_match_rotation(source, template, angle, center, rot_min=-1.0, rot_m
loc_x = best_max_loc[0]
loc_y = best_max_loc[1]
return angle, (loc_x, loc_y)
return angle, (loc_x, loc_y), best_res