The interview problem

Practice prompt

Design a preprocessing decision stage that improves faint scans without destroying already readable text.

Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.

1. Scope and worked approach

Compare raw images, global equalization and bounded local contrast enhancement with the same OCR engine. Route based on image quality features or a small classifier, trained against downstream OCR outcomes. Split by scanner and document batch, retaining original scans.

2. Trace the design or derivation

Image quality signals
  → candidate transform
  → fixed OCR
  → field validation

Calibrate the routing policy on held-out paired outcomes, including a cost for running multiple candidates. Enforce identical crops and orientation when comparing transformations so an accidental crop change is not mistaken for a contrast-model improvement.

3. Calculate the example

On 100 faint pages, 70 improve, 20 tie and 10 worsen after preprocessing. This does not justify applying it to 900 clean pages whose outcomes have not been measured.

4. Failure cases and trade-offs

Contrast enhancement can amplify background texture, halos and compression noise. Selecting the most confident OCR output can favor confidently wrong text rather than the true transcription.

5. Validation, follow-ups and self-review

Measure character errors and critical-field accuracy by scan type. Follow-up: how do you select among transformations without reference text? Self-review: include a raw baseline and a degradation gate.

Sources and related practice

Technical reference: docs.opencv.org — Global and local histogram-based contrast adjustment; OCR routing is original.

Source publication/update: Not established. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.

Continue with Read handwritten form fields with reviewable uncertainty; Extract structured tables from enterprise documents.

Continue your preparation

Choose a connected learning path or browse more ML system design questions. Read our editorial method and attribution policy.