'commit'
This commit is contained in:
@@ -10,7 +10,7 @@ if project_root not in sys.path:
|
|||||||
sys.path.append(project_root)
|
sys.path.append(project_root)
|
||||||
|
|
||||||
from Util.VLMKit import VLMKit
|
from Util.VLMKit import VLMKit
|
||||||
from Apps.TeLaiDian.Kit import draw_rectangles, detect_cards_cv, setup_logger
|
from Apps.TeLaiDian.Kit import draw_rectangles, detect_cards_cv, setup_logger, read_image
|
||||||
from Apps.TeLaiDian.Config.Setting import SAFE_EXCLUDE_RATIO, BOTTOM_SAFE_EXCLUDE_RATIO
|
from Apps.TeLaiDian.Config.Setting import SAFE_EXCLUDE_RATIO, BOTTOM_SAFE_EXCLUDE_RATIO
|
||||||
|
|
||||||
# 初始化日志
|
# 初始化日志
|
||||||
@@ -224,16 +224,25 @@ class ReadImageKit:
|
|||||||
for res in vlm_list:
|
for res in vlm_list:
|
||||||
p = res.get("point")
|
p = res.get("point")
|
||||||
if p and len(p) == 2:
|
if p and len(p) == 2:
|
||||||
# 如果坐标小于 1000,认为是归一化坐标,需要转换
|
# 1. 坐标转换逻辑
|
||||||
|
actual_p = p
|
||||||
if p[0] <= 1000 and p[1] <= 1000:
|
if p[0] <= 1000 and p[1] <= 1000:
|
||||||
if w == 0:
|
if w == 0:
|
||||||
import cv2
|
img = read_image(image_path)
|
||||||
img = cv2.imread(image_path)
|
|
||||||
if img is not None:
|
if img is not None:
|
||||||
h, w = img.shape[:2]
|
h, w = img.shape[:2]
|
||||||
else:
|
else:
|
||||||
w, h = 1080, 2400 # 兜底
|
w, h = 1080, 2400 # 兜底
|
||||||
res["point"] = [int(p[0] * w / 1000), int(p[1] * h / 1000)]
|
actual_p = [int(p[0] * w / 1000), int(p[1] * h / 1000)]
|
||||||
|
|
||||||
|
# 2. 坐标安全过滤:忽略页面上半部分的误点击(通常是 Logo 或广告)
|
||||||
|
# 即使 VLM 没听话,我们也在这里硬性过滤
|
||||||
|
y_threshold = h * 0.4 if h > 0 else 800
|
||||||
|
if actual_p[1] < y_threshold:
|
||||||
|
logger.warning(f"过滤掉可能的误点击点 (y={actual_p[1]} < {y_threshold}): {res.get('name')}")
|
||||||
|
continue
|
||||||
|
|
||||||
|
res["point"] = actual_p
|
||||||
final_stations.append(res)
|
final_stations.append(res)
|
||||||
|
|
||||||
return final_stations
|
return final_stations
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user