add height

This commit is contained in:
leon 2025-03-05 14:30:15 +08:00
parent 1725d44939
commit 457a33bad8

View File

@ -173,6 +173,23 @@ def gen_im_from_params(params, type="lines"):
return im
def get_bim_height(bim_json):
"""
确定整个bim图的高度
"""
max_y = -999999 # y坐标最大值
# 遍历,找到矩形y坐标最大值
for i, param in enumerate(bim_json):
# y中心点坐标加上高度的一半 = 当前矩形的y最大坐标
if param["center"] + param["h"] / 2 > max_y:
# 如果是最大的y坐标就更新
max_y = param["center"] + param["h"] / 2
bim_height = int(max_y)
return bim_height
"""
判断点是否在区域内部
True
@ -763,7 +780,9 @@ if __name__ == "__main__":
hd_roi_list = get_hd_roi_from_txt("data_sub/test_1/roi_conners.txt") # 高清摄像头的ROI数据
hd_img_width = 9344
hd_img_height = 7000
bim_im_height = bim_im.shape[0]
bim_im_height = get_bim_height(data_bim_json)
print(f"[bim_im_height] ====== [{bim_im_height}]")
print(f"[bim_im.shape[0]] ====== [{bim_im.shape[0]}]")
bim_rect_hit_list = bim_compare_to_hd_roi(hd_roi_list, hd_img_width, hd_img_height, bim_im_height, bim_sub_area,data_bim_json)
# ===================== 预埋件号码匹配 结束 ===========================