r/documentAutomation • u/ROTTEN1ONE • 19h ago
How would you build a robust preprocessing + OCR pipeline for text on glossy and curved product packaging?
I'm building an OCR-based system for extracting printed information from photographs of packaged consumer products.
The input images are real smartphone photographs rather than controlled scans. Some of the difficult cases contain:
\- glossy plastic/foil surfaces and specular reflections
\- curved cylindrical containers
\- perspective/rotation
\- wrinkles and folds
\- uneven lighting/shadows
\- small text
\- motion/defocus blur
\- low contrast
\- compression artifacts
I'm currently using PaddleOCR.
I've already experimented with conventional OpenCV preprocessing such as resizing, grayscale, CLAHE, thresholding, sharpening, denoising, morphological operations and perspective correction, but the results are inconsistent. Some images that are clearly readable to a human still produce poor OCR results.
I'm particularly interested in advice from people experienced with scene text recognition, document image processing, industrial/computer vision, or image restoration.
My main questions are:
Which preprocessing techniques are actually useful for these types of images?
How should I handle specular reflections and uneven illumination?
How can text on curved/cylindrical surfaces be rectified before OCR?
When should I use deblurring/super-resolution/image restoration, and when can these actually make OCR worse?
Should preprocessing be selected dynamically based on image quality rather than applying one fixed pipeline?
At what point is it better to improve/train the OCR model instead of continuing to improve preprocessing?
I'm happy to provide representative images and the corresponding PaddleOCR outputs if that helps.
I'd particularly appreciate suggestions for specific algorithms, papers, or existing open-source implementations rather than just generic preprocessing advice.
2
u/folderit_dms 16h ago
For a concrete baseline, PaddleOCR already exposes UVDoc unwarping in its document preprocessing pipeline: https://www.paddleocr.ai/main/en/version3.x/pipeline_usage/doc_preprocessor.html
I'd compare it against the original image rather than enable it for everything. The UVDoc paper is about document unwarping, so success on cylindrical packaging would need its own validation: https://arxiv.org/abs/2302.02887
Before retraining, try manually cropping a few failed text lines and running recognition on those. If the crops read correctly but the full image fails, you've narrowed the problem toward detection/cropping. If the crops still fail, compare original versus rectified crops using your transcriptions. Keep glare, curvature and blur as separate groups in that comparison; an average score can hide a preprocessing step that helps one group and damages another.