OCR Preprocessing Pipeline Testing Results¶
Overview¶
This document presents empirical testing results of various image preprocessing pipelines optimized for Romanian medical text OCR using Tesseract. The goal is to maximize OCR accuracy while minimizing processing complexity and LLM token usage.
Test Images¶
- medinterna1.jpeg: Romanian medical textbook page (rotated input)
- medinterna2.jpeg: Romanian medical textbook page (rotated input)
- Both images were scanned documents with 300+ DPI resolution and visible text content in Romanian
Preprocessing Pipelines Tested¶
Pipeline Descriptions¶
- basic: Grayscale conversion + Gaussian blur + adaptive thresholding
- enhanced: CLAHE contrast enhancement + bilateral filtering + morphological operations
- sharpening: Sharpening kernel + median blur + adaptive thresholding
- morphological: Otsu thresholding + morphological opening/closing + dilation
- deep_clean: Background subtraction + contrast normalization + morphological cleaning
- optimal_backprop: Bilateral filtering + CLAHE + optimal parameters + light morphology
Common Steps Applied to All Pipelines¶
- Automatic rotation correction (>2 degrees threshold)
- Additional deskewing (<0.5 degree threshold)
- Romanian language OCR with pytesseract
Test Results¶
medinterna1.jpeg Results¶
| Pipeline | Characters Extracted | Performance Score |
|---|---|---|
| basic | 200 | ⭐⭐⭐ |
| enhanced | 0 | ❌ |
| sharpening | 0 | ❌ |
| morphological | 0 | ❌ |
| deep_clean | 56 | ⭐ |
| optimal_backprop | 139 | ⭐⭐ |
medinterna2.jpeg Results¶
| Pipeline | Characters Extracted | Performance Score |
|---|---|---|
| basic | 664 | ⭐⭐⭐ |
| enhanced | 83 | ⭐ |
| sharpening | 117 | ⭐⭐ |
| morphological | 27 | ⭐ |
| deep_clean | 41 | ⭐ |
| optimal_backprop | 702 | ⭐⭐⭐⭐ |
Analysis and Conclusions¶
Best Performing Pipeline: optimal_backprop¶
- Average Performance: 420.5 characters extracted across test images
- Consistency: Performed well on both test images
- Features:
- Bilateral filtering (preserves edges while reducing noise)
- CLAHE (Contrast Limited Adaptive Histogram Equalization)
- Adaptive thresholding with optimized parameters
- Light morphological cleaning
Key Findings¶
-
Over-processing degrades performance: Enhanced, sharpening, morphological, and deep_clean pipelines extracted significantly fewer characters, suggesting over-aggressive noise removal or contrast adjustments damage text readability.
-
Balance is key: The optimal_backprop pipeline strikes the right balance between noise reduction and text preservation.
-
CLAHE works well: Contrast enhancement improves text visibility without over-saturation.
-
Light morphology preferred: Heavy morphological operations can destroy fine text details.
Recommendations¶
- Use optimal_backprop pipeline for Romanian medical text OCR
- Avoid over-processing: Simpler pipelines often perform better than complex ones
- Test on target domain: Results may vary for different document types (printed vs handwritten, font sizes, etc.)
- Monitor for degradation: Some pipelines that fail completely may indicate issues with parameters or processing logic
Technical Parameters (optimal_backprop)¶
# Bilateral filter: d=9, sigmaColor=75, sigmaSpace=75
# CLAHE: clipLimit=3.0, tileGridSize=(8,8)
# Adaptive threshold: blockSize=15, C=3
# Morphology: Opening with 1x1 kernel
Future Testing Recommendations¶
- Test on additional Romanian medical documents
- Evaluate accuracy metrics beyond character count (word accuracy, contextual accuracy)
- Test computational performance impact
- Validate with different scan qualities (lower DPI, different scanners)
- Compare with Visio OCR baseline performance
Visio OCR Integration Planning¶
Based on these results, the optimal_backprop preprocessing should be applied before attempting Visio OCR to maximize comparison accuracy and minimize token usage.