From 4999643d13e96a65a83459d41039e7ef4ccef613 Mon Sep 17 00:00:00 2001 From: leon Date: Thu, 27 Feb 2025 18:06:06 +0800 Subject: [PATCH] init --- search.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/search.py b/search.py index ed16a40..98afe4a 100644 --- a/search.py +++ b/search.py @@ -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]