'commit'
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
# 采集配置
|
||||
SCROLL_DISTANCE_RATIO = 0.5
|
||||
MAX_STATIONS_COUNT = 20
|
||||
MAX_STATIONS_COUNT = 1
|
||||
FIRST_RUN_ONLY_ONE_STATION = False
|
||||
REDIS_STATION_EXPIRE = 120
|
||||
DATA_RETENTION_DAYS = 365
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
import numpy as np
|
||||
from PIL import Image
|
||||
from PIL import Image, ImageDraw
|
||||
import os
|
||||
import asyncio
|
||||
import hashlib
|
||||
@@ -156,10 +156,28 @@ class ReadImageKit:
|
||||
norm_point = result["close_point"]
|
||||
x = int(norm_point[0] / 1000 * primary_width)
|
||||
y = int(norm_point[1] / 1000 * primary_height)
|
||||
ad_type = result.get("ad_type", "unknown")
|
||||
if ad_type == "rabbit":
|
||||
offset_y = int(primary_height * 0.05)
|
||||
offset_x = int(primary_width * 0.014)
|
||||
y = min(primary_height - 1, y + offset_y)
|
||||
x = min(primary_width - 1, x + offset_x)
|
||||
try:
|
||||
os.makedirs(TEMP_IMAGE_DIR, exist_ok=True)
|
||||
img = Image.open(image_path).convert("RGB")
|
||||
draw = ImageDraw.Draw(img)
|
||||
r = max(6, int(primary_height * 0.012))
|
||||
draw.ellipse((x - r, y - r, x + r, y + r), outline="red", width=4)
|
||||
base = os.path.basename(image_path)
|
||||
debug_path = os.path.join(TEMP_IMAGE_DIR, f"debug_click_{base}")
|
||||
img.save(debug_path)
|
||||
logger.info(f"保存广告关闭按钮点击预览图: {debug_path}")
|
||||
except Exception as e:
|
||||
logger.warning(f"保存广告关闭按钮点击预览图失败: {e}")
|
||||
return {
|
||||
"x": x,
|
||||
"y": y,
|
||||
"ad_type": result.get("ad_type", "unknown")
|
||||
"ad_type": ad_type
|
||||
}
|
||||
|
||||
except Exception as e:
|
||||
@@ -171,6 +189,18 @@ class ReadImageKit:
|
||||
norm_point = cv_rabbit_point
|
||||
x = int(norm_point[0] * primary_width)
|
||||
y = int(norm_point[1] * primary_height)
|
||||
try:
|
||||
os.makedirs(TEMP_IMAGE_DIR, exist_ok=True)
|
||||
img = Image.open(image_path).convert("RGB")
|
||||
draw = ImageDraw.Draw(img)
|
||||
r = max(6, int(primary_height * 0.012))
|
||||
draw.ellipse((x - r, y - r, x + r, y + r), outline="red", width=4)
|
||||
base = os.path.basename(image_path)
|
||||
debug_path = os.path.join(TEMP_IMAGE_DIR, f"debug_click_{base}")
|
||||
img.save(debug_path)
|
||||
logger.info(f"保存广告关闭按钮点击预览图(CV): {debug_path}")
|
||||
except Exception as e:
|
||||
logger.warning(f"保存广告关闭按钮点击预览图(CV)失败: {e}")
|
||||
return {"x": x, "y": y, "ad_type": "rabbit"}
|
||||
|
||||
return None
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user