'commit'
This commit is contained in:
@@ -188,6 +188,32 @@ def detect_price_info_container_cv(image_path):
|
||||
|
||||
return None
|
||||
|
||||
def detect_warm_popup_xczs_cv(image_path):
|
||||
"""
|
||||
使用 OCR 精准定位“温馨提示”弹窗中的“下次再说”按钮。
|
||||
返回: [x1, y1, x2, y2] 归一化坐标,如果未找到则返回 None
|
||||
"""
|
||||
img = read_image(image_path)
|
||||
if img is None:
|
||||
return None
|
||||
h, w = img.shape[:2]
|
||||
|
||||
keyword = '下次再说'
|
||||
|
||||
try:
|
||||
reader = get_ocr_reader()
|
||||
results = reader.read_text(img)
|
||||
|
||||
for (quad, text, prob) in results:
|
||||
if keyword in text and prob >= 0.5:
|
||||
res = reader.get_normalized_rect(quad, w, h)
|
||||
print(f"[OCR识别] 找到“下次再说”: '{text}', 置信度: {prob:.4f}, 归一化坐标: {res}")
|
||||
return res
|
||||
except Exception as e:
|
||||
print(f"OCR 识别发生异常: {e}")
|
||||
|
||||
return None
|
||||
|
||||
def setup_logger(name, log_file=None, clear_old_log=False):
|
||||
"""
|
||||
配置日志,支持同时输出到控制台和文件。
|
||||
|
||||
Reference in New Issue
Block a user