This commit is contained in:
leon 2025-02-27 18:06:06 +08:00
parent 281fc8d066
commit 4999643d13

View File

@ -322,7 +322,7 @@ if __name__ == "__main__":
h = contour["height"]
# 由于定位框大小大于预埋件大小,因此这里需要做缩放处理
k = int(h*0.2) # roi2
k = int(h*0.01) # roi2
k = int(h*0.01) # roi1
x += k
y += k
@ -427,6 +427,7 @@ if __name__ == "__main__":
bim_im = gen_im_from_params(data_bim["params"])
# sub_im = gen_im_from_params(data_sub["params"])# 需要读取
min_match_score = 999999
times = 0
for i, param in enumerate(candi_params):
tmp_roi_w_base_len = param['x2'] - param['x1']
scale = tmp_roi_w_base_len / sub_roi_w_base_len
@ -471,7 +472,8 @@ if __name__ == "__main__":
score += (1 - abs(tmp_sum_r - sum_r) / sub_roi_width) * 0.25
score += (1 - abs(tmp_sum_theta - sum_theta) / 3.14) * 0.25
if score > 0.6: #????
if score > 0.0: #????
print("11111111111111111111", str(score))
cartesian_points1 = polar_to_cartesian(np.asarray(tmp_polar_list))
cartesian_points2 = polar_to_cartesian(np.asarray(polar_list))
sc1 = compute_shape_context(cartesian_points1)
@ -485,15 +487,20 @@ if __name__ == "__main__":
param['match_score'] = match_score
if min_match_score > match_score:
min_match_score = match_score
rst_params.append(param)
# rst_params.append(param)
times += 1
if times == 3:
rst_params.append(param)
break
# 预埋件匹配
for i, param in enumerate(rst_params):
score = param["score"]
match_score = param["match_score"]
id = param["code"]
if min_match_score == match_score or match_score < 0.5: #????
# if True:
# if min_match_score == match_score or match_score < 0.5: #????
if True:
index_list = []
for j in range(len(param['effective_points'])):
pt = param['effective_points'][j]