SOMUVA UG, the company behind the German-language online shop vapechamp.de, set out to convert phone photos of carton back panels into straightened, evenly lit images on white backgrounds for its product pages. Those panels carry legally required information — manufacturer and importer names and addresses, warning texts — along with contact details such as phone numbers. The images could be improved; the printed information could not change. In measurement terms, author Justin Flick writes, the measurand was the printed text, not the appearance of the image.
A plausible first result that failed the comparison
The first attempt used a generative image model, prompted with a straightened carton image and an explicit instruction to keep every printed character, number and symbol identical. The output looked professional: sharp print, even light, a clean background. A comparison against the source told a different story. The digits “2801” had become “2001”. A phone number contained wrong digits. A comma had turned into a full stop and, elsewhere, a full stop into a comma. The changes were plausible, which is what made them hard to catch at a glance. Because the information is mandatory, the generated images were discarded and none was published. The conclusion: a generative model produces what text plausibly looks like, not what was printed, and visual inspection is too weak a check against plausible errors to serve as the reference.
Deterministic processing from photographed pixels
The model was replaced by a deterministic chain. Each carton face is rectified with a perspective transform from four corner points, and 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, and text blocks are marked as protected regions in which pixels pass through the background clean-up unchanged. The result is placed on a white background with a soft shadow. Nothing on the carton is redrawn or re-typeset: every character in the final image derives from the photographed pixels.
Reference image and a two-principle gate
For each image the team kept a reference — 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 background placement, under 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 disappears, the group is flagged as a lost character.
The gate also showed that classical filters are not automatically safe. A speckle filter had turned “130” into “30” and removed colons, and a threshold clean-up step had erased the dot in a web address. Both stages were dropped. As Flick puts it, any step that decides what counts as noise can decide that a full stop is noise.
OCR is a measurement system with its own error
An OCR diff carries its own measurement uncertainty. On small print it misread the reference image as well, for example reading a “5” as an “S”, so a raw diff reports disagreements the processing did not cause. Taken at face value these produce false rejects; ignored wholesale, they hide real changes and produce false accepts. The author draws the analogy of a gauge study: before attributing variation to the part, the variation of the measurement system has to be separated out. Here, OCR misreads of the reference had to be separated from changes introduced by processing, which the independent ink check and a separate review step accomplished — matching Gleb Tsipursky's advice to identify the source of a disagreement rather than assuming the person or the model must be wrong. The working principle: treat each disagreement as a stop to be resolved, not as a similarity score to be averaged away.
Second review, backups and the delivered 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 used instead. The previous state was backed up before any replacement. After publication, the files as actually delivered were downloaded and compared with the team's own: at reduced resolution the mean absolute greyscale difference was well under one grey level.
Practical takeaways for quality teams
- Define the measurand: for images carrying mandatory text, the characters matter, not the appearance.
- Keep a separate reference 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, the team now uses classical processing plus a text comparison against the original. Flick closes by adapting Tsipursky's question for quality leaders: when the output and the reference disagree, do we know who was right, why, and what we changed afterward — and can we answer that before anything is published?
