Files
PartsInquiry/backend/txm/config/config.yaml
2025-09-27 22:57:59 +08:00

75 lines
2.0 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 全局配置(禁止硬编码)
app:
language: zh_CN
ui:
window_title: "EAN-13 条形码识别测试"
server:
host: "127.0.0.1"
port: 8000
max_upload_mb: 8
preprocess:
# 读取图像时是否等比缩放到此宽度0 表示不缩放)
resize_width: 1280
# 高斯模糊核大小奇数0 表示不使用
gaussian_blur_ksize: 3
# 形态学顶帽/黑帽核大小(奇数)
morphology_kernel: 17
# Sobel 阈值用于增强条纹
sobel_ksize: 3
# 二值化方法otsu | adaptive
binarize: otsu
# 形态学闭运算核大小(合并细条纹)
close_kernel: 21
roi:
# 轮廓面积下限(相对整图面积比例),用于过滤非条码区域
min_area_ratio: 0.01
# 宽高比下限(条码通常宽>高)
min_wh_ratio: 2.0
# 透视矫正时的目标高度(像素)
warp_target_height: 120
# 从底部裁掉的比例去除数字区域影响0-1
crop_bottom_ratio: 0.25
decoder:
# EAN-13 采样线位置(相对高度 0-1可多条线取众数
sample_rows: [0.35, 0.5, 0.65]
# 归一化后模块总数EAN-13 固定 95
total_modules: 95
# 守卫位宽容差(相对模块宽度)
guard_tolerance: 0.35
# 直方图峰谷检测阈值(相对振幅)
peak_valley_rel_threshold: 0.2
# 引擎优先级pyzbar | ean13自研
engine_order: ["pyzbar", "ean13"]
# 是否对图像做反色尝试(黑白反转)
try_invert: true
# 旋转角度集合(度)用于鲁棒性提升
rotations: [0, 90, 180, 270]
font:
# Windows 常见中文字体路径(按需修改)
windows: "C:/Windows/Fonts/msyh.ttc"
macos: "/System/Library/Fonts/PingFang.ttc"
linux: "/usr/share/fonts/truetype/noto/NotoSansCJK-Regular.ttc"
debug:
save_steps: false
out_dir: "debug_out"
log_level: "DEBUG"
log_to_file: true
file_name: "txm.log"
max_bytes: 10485760
backup_count: 5
camera:
index: 0
width: 1280
height: 720
# 采样间隔毫秒UI 轮询帧率),过小会占用较多 CPU
interval_ms: 80