fix(vision): distance max 500px pour template global et SeeClick
Some checks failed
security-audit / Bandit (scan statique) (push) Successful in 12s
security-audit / pip-audit (CVE dépendances) (push) Successful in 10s
security-audit / Scan secrets (grep) (push) Successful in 8s
tests / Lint (ruff + black) (push) Successful in 13s
tests / Tests unitaires (sans GPU) (push) Failing after 14s
tests / Tests sécurité (critique) (push) Has been skipped

Le template matching global trouvait l'icône Chrome à 0.99 de confiance
mais la rejetait car elle avait bougé de >150px. Même problème pour
SeeClick (>200px). Aligné tous les seuils de distance à 500px
pour supporter les workflows VWB cross-résolution.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dom
2026-04-18 19:48:26 +02:00
parent f30461b88c
commit 969236da03

View File

@@ -759,8 +759,7 @@ def find_and_click(
found_y = global_result['coordinates']['y'] found_y = global_result['coordinates']['y']
distance = np.sqrt((found_x - orig_x)**2 + (found_y - orig_y)**2) distance = np.sqrt((found_x - orig_x)**2 + (found_y - orig_y)**2)
# Rejeter si trop loin (> 150px de la position originale) MAX_GLOBAL_DISTANCE = 500
MAX_GLOBAL_DISTANCE = 150
if distance > MAX_GLOBAL_DISTANCE: if distance > MAX_GLOBAL_DISTANCE:
print(f"⛔ [Vision] Template global rejeté: distance {distance:.0f}px > {MAX_GLOBAL_DISTANCE}px max") print(f"⛔ [Vision] Template global rejeté: distance {distance:.0f}px > {MAX_GLOBAL_DISTANCE}px max")
else: else:
@@ -797,7 +796,7 @@ def find_and_click(
orig_y = anchor_bbox.get('y', 0) + anchor_bbox.get('height', 0) // 2 orig_y = anchor_bbox.get('y', 0) + anchor_bbox.get('height', 0) // 2
distance = np.sqrt((found_x - orig_x)**2 + (found_y - orig_y)**2) distance = np.sqrt((found_x - orig_x)**2 + (found_y - orig_y)**2)
MAX_SEECLICK_DISTANCE = 200 # Plus permissif car c'est un fallback MAX_SEECLICK_DISTANCE = 500
if distance > MAX_SEECLICK_DISTANCE: if distance > MAX_SEECLICK_DISTANCE:
print(f"⛔ [Vision] SeeClick rejeté: distance {distance:.0f}px > {MAX_SEECLICK_DISTANCE}px max") print(f"⛔ [Vision] SeeClick rejeté: distance {distance:.0f}px > {MAX_SEECLICK_DISTANCE}px max")
accept_seeclick = False accept_seeclick = False