feat: add contrast/sharpen strength controls, disable binarization

Major improvements to preprocessing controls:

Backend:
- Add contrast_strength (0.5-3.0) and sharpen_strength (0.5-2.0) to PreprocessingConfig
- Auto-detection now calculates optimal strength based on image quality metrics:
  - Lower contrast → Higher contrast_strength
  - Lower edge strength → Higher sharpen_strength
- Disable binarization in auto mode (rarely beneficial)
- CLAHE clipLimit now scales with contrast_strength
- Sharpening uses unsharp mask with variable strength

Frontend:
- Add strength sliders for contrast and sharpen in manual mode
- Sliders show current value and strength level (輕微/正常/強/最強)
- Move binarize option to collapsible "進階選項" section
- Updated i18n translations for strength labels

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
egg
2025-11-27 17:18:44 +08:00
parent f6d2957592
commit 5982fff71c
7 changed files with 212 additions and 53 deletions

View File

@@ -68,9 +68,9 @@
"title": "影像前處理",
"mode": {
"auto": "自動模式",
"autoDesc": "系統自動分析影像品質,決定最佳的前處理方式",
"autoDesc": "系統自動分析影像品質,決定最佳的前處理方式和強度",
"manual": "手動模式",
"manualDesc": "手動選擇前處理選項,完全控制處理流程",
"manualDesc": "手動選擇前處理選項和強度,完全控制處理流程",
"disabled": "停用前處理",
"disabledDesc": "不進行任何前處理,直接使用原始影像"
},
@@ -84,8 +84,16 @@
"clahe": "CLAHE 自適應均衡化"
},
"sharpen": "邊緣銳化",
"strength": {
"label": "強度",
"subtle": "輕微",
"normal": "正常",
"strong": "強",
"maximum": "最強"
},
"advanced": "進階選項",
"binarize": "二值化處理",
"binarizeWarning": "可能影響顏色資訊",
"binarizeWarning": "不建議使用",
"note": "前處理僅影響版面偵測階段,用於改善表格和文字區塊的識別。原始影像仍用於最終的 OCR 文字提取,確保最佳識別品質。"
}
},