fix: 触发

This commit is contained in:
2026-08-11 13:20:59 +08:00
parent c0bb245c8c
commit 5f509488c5
3 changed files with 26 additions and 11 deletions
+4 -4
View File
@@ -154,11 +154,11 @@ def detect_circle_v3(frame, laser_point=None):
max_r = max(red_radius, yellow_radius)
size_ratio = min_r / max_r if max_r > 0 else 0
print(f"Debug -> 圆心距={distance:.1f}(阈值={max_distance:.1f}), "
f"大小比={size_ratio:.2f}(阈值=0.5), "
f"距离OK={distance < max_distance}, 大小OK={size_ratio > 0.5}")
f"大小比={size_ratio:.2f}(阈值=0.4), "
f"距离OK={distance < max_distance}, 大小OK={size_ratio >= 0.4}")
# 允许红圈在黄圈外侧或内侧,只要大小相近(较小/较大 >= 0.5)
if distance < max_distance and size_ratio > 0.5:
if distance < max_distance and size_ratio >= 0.4:
found_valid_red = True
print(
f"[target] -> 找到匹配的红圈: 黄心({yellow_center}), 红心({red_center}), 距离:{distance:.1f}, 黄半径:{yellow_radius}, 红半径:{red_radius}")
@@ -598,7 +598,7 @@ if __name__ == "__main__":
# 1. 设置要测试的图片路径
# 建议将图片放在与脚本同级目录,或者使用绝对路径
TARGET_IMAGE = "/root/phot/None_314_258_0_0041.bmp"
TARGET_IMAGE = "/root/phot/shot_1830921_0_no_target.jpg"
TARGET_DIR = "/root/phot" # 修改为你想要读取的目录路径