Revert "drag_success优化"

This reverts commit a9ddbf9b6f9d9bda1a881aab07a34101755183c3.
This commit is contained in:
Elaina 2024-11-24 11:58:43 +08:00
parent b5cde9d6c6
commit e43b90b065

View file

@ -347,13 +347,13 @@ class FightMixin:
img, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE
)
rect = [cv2.boundingRect(c) for c in contours]
left = min((x for x, y, w, h in rect if w > 15 and h > 15), default=None)
left = min((x for x, y, w, h in rect if w > 10 and h > 10), default=None)
right = max(
(x + w for x, y, w, h in rect if w > 15 and h > 15), default=None
(x + w for x, y, w, h in rect if w > 10 and h > 10), default=None
)
top = min((y for x, y, w, h in rect if w > 15 and h > 15), default=None)
top = min((y for x, y, w, h in rect if w > 10 and h > 10), default=None)
bottom = max(
(y + h for x, y, w, h in rect if w > 15 and h > 15), default=None
(y + h for x, y, w, h in rect if w > 10 and h > 10), default=None
)
if any(v is None for v in [left, right, top, bottom]):
return False