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:
@@ -72,13 +72,25 @@ class PreprocessingConfig(BaseModel):
|
||||
default=PreprocessingContrastEnum.CLAHE,
|
||||
description="Contrast enhancement method"
|
||||
)
|
||||
contrast_strength: float = Field(
|
||||
default=1.0,
|
||||
ge=0.5,
|
||||
le=3.0,
|
||||
description="Contrast enhancement strength (0.5=subtle, 1.0=normal, 2.0=strong, 3.0=maximum)"
|
||||
)
|
||||
sharpen: bool = Field(
|
||||
default=True,
|
||||
description="Enable sharpening for faint lines"
|
||||
)
|
||||
sharpen_strength: float = Field(
|
||||
default=1.0,
|
||||
ge=0.5,
|
||||
le=2.0,
|
||||
description="Sharpening strength (0.5=subtle, 1.0=normal, 1.5=strong, 2.0=maximum)"
|
||||
)
|
||||
binarize: bool = Field(
|
||||
default=False,
|
||||
description="Enable binarization (aggressive, for very low contrast)"
|
||||
description="Enable binarization (aggressive, for very low contrast). Not recommended for most documents."
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user