'commit'
This commit is contained in:
@@ -189,7 +189,11 @@ class ReadImageKit:
|
||||
else:
|
||||
prompt = """
|
||||
分析这张充电站列表截图,提取所有充电站卡片信息。
|
||||
忽略顶部的筛选栏,仅提取下方重复出现的场站卡片。
|
||||
|
||||
**重要限制**:
|
||||
1. 忽略页面上半部分(坐标 y < 500)的所有内容,包括顶部的搜索框、广告 Banner 和“PLUS会员/我的卡券”等图标。
|
||||
2. 仅提取下方重复出现的、包含“充电站”名称的矩形卡片。
|
||||
|
||||
输出格式为 JSON 数组,每个对象包含:
|
||||
- "name": 场站名称
|
||||
- "address": 场站地址
|
||||
@@ -215,7 +219,22 @@ class ReadImageKit:
|
||||
"bbox": bbox
|
||||
})
|
||||
elif not cv_bboxes:
|
||||
final_stations = vlm_results if isinstance(vlm_results, list) else []
|
||||
vlm_list = vlm_results if isinstance(vlm_results, list) else []
|
||||
w, h = 0, 0
|
||||
for res in vlm_list:
|
||||
p = res.get("point")
|
||||
if p and len(p) == 2:
|
||||
# 如果坐标小于 1000,认为是归一化坐标,需要转换
|
||||
if p[0] <= 1000 and p[1] <= 1000:
|
||||
if w == 0:
|
||||
import cv2
|
||||
img = cv2.imread(image_path)
|
||||
if img is not None:
|
||||
h, w = img.shape[:2]
|
||||
else:
|
||||
w, h = 1080, 2400 # 兜底
|
||||
res["point"] = [int(p[0] * w / 1000), int(p[1] * h / 1000)]
|
||||
final_stations.append(res)
|
||||
|
||||
return final_stations
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user