Instruments & Meters

Why Text-Faithful Image Processing Requires an Independent Reference

A quality-focused case study shows that generative models and classical filters can both alter mandatory text, making independent reference checks essential before publication.

Chidi OkonkwoOctober 25, 20265 min read6 views
A concept illustration of a carton panel under inspection, with a magnifying glass comparing abstract printed patterns against a digital reference frame.

When product images carry legally required text, automated processing must preserve every character. A recent case study by Justin Flick of SOMUVA UG illustrates why an independent reference and rigorous measurement are essential.

The task was to convert phone photos of carton back panels into clean, straightened images on white backgrounds for online product pages. The panels include manufacturer and importer names and addresses, warning texts, and contact details such as phone numbers. The images could be improved visually, but the printed information had to remain identical. In measurement terms, the measurand was the printed text, not the image appearance.

Generative model produced plausible but wrong text

The first attempt used a generative image model with an explicit instruction to keep every printed character, number, and symbol identical. The output looked professional: sharp print, even light, and a clean background. But a comparison with the source told a different story. The digits "2801" had become "2001"; a phone number contained wrong digits; and commas and full stops had been swapped. None of this was easy to spot at a glance because the changes were plausible. For mandatory information, that is not a cosmetic issue, so the generated images were discarded; none of them was published. The lesson was that a generative model produces what text plausibly looks like, not what was printed. Visual inspection is a weak check against plausible errors, which is precisely why it cannot serve as the reference.

Deterministic processing from photographed pixels

The model was replaced with a deterministic chain. The carton face is rectified with a perspective transform from four corner points. Uneven lighting is flattened by estimating the background illumination and dividing it out, followed by white balancing to a target tone. Denoising is gentle and edge-preserving. Text blocks are marked as protected regions in which pixels pass through the background clean-up unchanged. The result is then placed on a white background with a soft shadow. Nothing on the carton is redrawn or re-typeset; every character of the printed panel in the final image is derived from the photographed pixels.

Reference image and two measurement principles

For each image, a reference was kept: the same crop after rectification and the illumination and white-balance step only, before any denoising or clean-up. Every processed carton face was compared with that reference before it was placed on the background, using two different measurement principles. The first is an OCR diff. Both images are read by an open-source OCR engine with German and English language data after upscaling; the resulting word sequences are aligned and every deviation is listed. The second is an ink check that does not depend on reading text at all. Pixels clearly darker than the carton background in the reference count as print. If such pixels become light in the processed image, and most of a connected group of them disappears, that group is flagged as a lost character.

The gate showed that classical filters are not automatically safe. A speckle filter had turned "130" into "30" and removed colons. A threshold clean-up step had erased the dot in a web address. Both stages were dropped. Any step that decides what counts as noise can decide that a full stop is noise.

OCR has its own measurement uncertainty

An OCR diff is itself a measurement system, with its own error. On small print, it misread the reference image as well, for example reading a "5" as an "S". A raw OCR diff therefore reports disagreements that the processing did not cause. Taken at face value, these lead to false rejects; ignored wholesale, they hide the real changes, which become false accepts. The analogy with a gauge study is useful here. Before attributing variation to the part, you separate out the variation of the measurement system. In this case, the OCR's misreads of the reference had to be separated from changes introduced by the processing. A second, independent principle—the ink check—and a separate review step did that work. This matches Tsipursky's third step: "identify the source of the disagreement rather than assuming the person or the model must be wrong." The principle is to treat each disagreement as a stop to be resolved, not as a similarity score to be averaged away.

Second review, backups, and the published file

A separate automated review, independent of the processing chain, checked the images in two rounds. In the first round, a composite image failed because one inserted line could not be verified reliably. The composite was removed and the genuine information block from the carton was used instead. Before any image was replaced, the previous state was backed up so it could be restored. After publication, the files as actually delivered were downloaded and compared with the originals. At reduced resolution, the mean absolute greyscale difference was well under one grey level. The published file is the last link in the chain, and it deserves the same check as every step before it.

Practical takeaways for quality teams

  • Define the measurand: for images that carry mandatory text, the characters matter, not the appearance.
  • Keep a separate reference image from the earliest reliable processing step, and never compare an output only with itself.
  • Use two measurement principles, such as an OCR text diff and a pixel-level ink check.
  • Characterise the OCR's own errors on the reference before trusting its verdicts.
  • Treat any disagreement as a stop, not a score.
  • Test classical filters as rigorously as AI tools.
  • Add an independent second review, and remove what cannot be verified.
  • Back up before every change and pixel-compare the published files.
  • Improve the input: frontal, unwrapped, frame-filling photos in daylight make every later step easier.
  • Generative models remain useful for images where nothing has to be read. For images that carry mandatory information, use classical processing plus a text comparison against the original.

Tsipursky poses a question quality leaders should be able to answer: "when the machine and a qualified person disagree, do we know who was right, why, and what we changed afterward?" For processed images, the question is the same. When the output and the reference disagree, that answer is needed before anything is published.