'commit'
This commit is contained in:
@@ -30,11 +30,25 @@ def test_cv_detection(image_path):
|
||||
for i, box in enumerate(bboxes):
|
||||
print(f" 卡片 {i+1}: {box}")
|
||||
|
||||
# 2. 生成 _vl.jpg (仅绿框)
|
||||
# 1.5 检测红色价格块并打印
|
||||
try:
|
||||
price_blocks = Kit.detect_list_price_blocks_cv(image_path, top_ratio=SAFE_EXCLUDE_RATIO, bottom_ratio=BOTTOM_SAFE_EXCLUDE_RATIO)
|
||||
except AttributeError:
|
||||
price_blocks = []
|
||||
print(f"检测到 {len(price_blocks)} 个红色价格块")
|
||||
for i, pb in enumerate(price_blocks):
|
||||
print(f" 价格块 {i+1}: {pb}")
|
||||
|
||||
# 2. 生成 _vl.jpg (绿框 + 蓝点标记红色价格行)
|
||||
vl_path = image_path.replace(".jpg", "_vl.jpg")
|
||||
img_vl = Kit.read_image(image_path)
|
||||
for box in bboxes:
|
||||
cv2.rectangle(img_vl, (box[0], box[1]), (box[2], box[3]), (0, 255, 0), 3)
|
||||
for pb in price_blocks:
|
||||
px1, py1, px2, py2 = pb
|
||||
pcx = (px1 + px2) // 2
|
||||
pcy = (py1 + py2) // 2
|
||||
cv2.circle(img_vl, (pcx, pcy), 10, (255, 0, 0), -1)
|
||||
Kit.save_image(vl_path, img_vl)
|
||||
print(f"已生成 VLM 标注图: {vl_path}")
|
||||
|
||||
@@ -59,5 +73,5 @@ def test_cv_detection(image_path):
|
||||
print(f"已生成人工核对图: {flag_path}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
target_image = r"d:\dsWork\aiData\Output\tld_list_1768347471.jpg"
|
||||
target_image = r"d:\dsWork\aiData\Output\tld_list_1768359492.jpg"
|
||||
test_cv_detection(target_image)
|
||||
|
||||
Reference in New Issue
Block a user