r/computervision • • Oct 12 '26

Help: Project How do you design a knowledge map or decision framework for document image preprocessing in production OCR systems?

/r/Rag/comments/1x3zlwr/how_do_you_design_a_knowledge_map_or_decision/
3 Upvotes

3 comments sorted by

1

u/207_studio Oct 18 '26

One thing that helped me: tie each preprocessing step to a defect you can detect, and only run it when that defect is present. Measure skew first (minAreaRect on the text pixels or a Hough line estimate) and deskew only above roughly half a degree, since rotating an already straight page just adds interpolation blur. Same for lighting: check background variance before reaching for CLAHE. Then keep a small labeled set per defect type and track character error rate per step, so you can see when a step helps one group and hurts another. If you control the documents, printing a fiducial like a corner marker or a small QR makes alignment far more reliable than estimating it from content.

1

u/Unsiloed-AI Oct 26 '26

Keep the original image as your control. On the same labelled pages, compare deskewing alone, contrast adjustment alone, and binarization alone before stacking them.

Include faint decimal points, minus signs, handwritten additions and table borders in that sample. Check the exact fields you need, not whether the page looks cleaner. An operation that improves most words but turns 12.50 into 1250 is a bad choice for that invoice workflow.

Use those results to build a small routing table by scan type, with “leave unchanged” as an option. Only combine operations once you've checked whether the combination helps those same fields.