proposal: add hybrid control mode with auto-detection and preview

Updates add-layout-preprocessing proposal:
- Auto mode: analyze image quality, auto-select parameters
- Manual mode: user override with specific settings
- Preview API: compare original vs preprocessed before processing
- Frontend UI: mode selection, manual controls, preview button

🤖 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 14:31:09 +08:00
parent c12ea0b9f6
commit 06a5973f2e
4 changed files with 244 additions and 20 deletions

View File

@@ -18,9 +18,19 @@ The root cause is that layout detection happens **before** table structure recog
- Image element extraction continues to use original (preserves quality)
- Raw OCR continues to use original image
- **Configurable preprocessing options**
- Enable/disable preprocessing per track
- Adjustable preprocessing intensity
- **Hybrid control mode** (Auto + Manual)
- **Auto mode (default)**: Analyze image quality and auto-select parameters
- Calculate contrast level (standard deviation)
- Detect edge clarity for faint lines
- Apply appropriate preprocessing based on analysis
- **Manual mode**: User can override with specific settings
- Contrast: none / histogram / clahe
- Sharpen: on/off
- Binarize: on/off
- **Frontend preview API**
- Preview endpoint to show original vs preprocessed comparison
- Users can verify settings before processing
## Impact
@@ -31,6 +41,8 @@ The root cause is that layout detection happens **before** table structure recog
- `backend/app/services/ocr_service.py` - Add preprocessing before PP-Structure
- `backend/app/core/config.py` - New preprocessing configuration options
- `backend/app/services/preprocessing_service.py` - New service (to be created)
- `backend/app/api/v2/endpoints/preview.py` - New preview API endpoint
- `frontend/src/components/PreprocessingSettings.tsx` - New UI component
### Track Impact Analysis