Instruments & Meters

When Image Clean-Up Alters Mandatory Text: A Reference-Based Quality Gate

Adaeze NwosuOctober 25, 20265 min read3 views

At a glance

  • A carton-label case shows why generative retouching and classical filters both need an independent text reference before publication.
  • A small e-commerce imaging project found that a generative model changed legally required label text and that some classical filters also removed characters. The team replaced visual approval with deterministic processing, a separate reference image and two independent checks before publishing.
A carton back panel is shown with a translucent reference frame and an inspection loupe against a white studio background, suggesting independent verification of label images.

A small e-commerce imaging case offers a compact lesson in measurement discipline: when an image carries legally required text, the printed characters—not the visual polish—are the measurand. Justin Flick of SOMUVA UG describes how a generative image model produced attractive but altered carton labels, prompting a switch to deterministic processing and independent checks.

The task and the first failure

The goal was to convert phone photographs of carton back panels into straightened images on a white background 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 look better, but the information had to remain unchanged. The first attempt used a generative model, with an explicit instruction to preserve every printed character, number and symbol. The output looked professional: sharp print, even lighting and a clean background. A comparison with the source found substantive changes. The digits “2801” had become “2001”; a phone number contained wrong digits; a comma had become a full stop, and elsewhere a full stop had become a comma. Because the changes were plausible, they were not easy to catch by eye. The images were discarded and none was published. The lesson was that a generative model can produce text that looks plausible rather than the text that was printed; visual inspection is a weak reference against plausible errors.

A deterministic chain and a separate reference

The replacement was a deterministic image-processing chain. The carton face was rectified with a perspective transform based on four corner points. Uneven illumination was estimated and divided out, followed by white balancing to a target tone. Denoising was kept gentle and edge-preserving. Text blocks were marked as protected regions, so their pixels passed through background clean-up unchanged. The result was then placed on a white background with a soft shadow. Nothing on the carton was redrawn or re-typeset; every character in the final printed panel came from photographed pixels.

For each image, the team retained a reference—the same crop after rectification and illumination and white-balance correction, but before denoising or clean-up. Each processed carton face was compared with that reference before being placed on the background. The comparison used two measurement principles. The first was an OCR diff: both images were read by an open-source OCR engine with German and English language data after upscaling, and the resulting word sequences were aligned so that every deviation could be listed. The second was an ink check that did not depend on reading text. Pixels clearly darker than the carton background in the reference were counted as print; if such pixels became light in the processed image and most of a connected group disappeared, the group was flagged as a lost character.

The gate also caught classical filters

The reference gate showed that conventional filters are not automatically safe. A speckle filter changed “130” to “30” and removed colons. A threshold clean-up step erased the dot in a web address. Both stages were removed. The broader point is that any step which decides what counts as noise can also decide that a full stop is noise.

OCR is itself a measurement system

The OCR diff introduced its own uncertainty. On small print, the OCR engine misread the reference image—for example, reading a “5” as an “S”. A raw OCR diff therefore reported disagreements that the processing had not caused. Taking those at face value would create false rejects; ignoring them wholesale would hide real changes and create false accepts. The team used a gauge-study analogy: before attributing variation to the part, separate the variation of the measurement system. In this case, the OCR’s misreads of the reference had to be separated from changes introduced by processing. A second, independent principle—the ink check—and a separate review step did that work. The approach reflects a point attributed to Gleb Tsipursky: identify the source of a disagreement rather than assuming that the person or model must be wrong. The operational principle was 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 team downloaded the files as delivered and compared them with their own. 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, in this method, receives the same check as every step before it.

Implications for quality teams

The case is small and outside a factory, but it maps directly onto automated inspection. For images carrying mandatory text, the characters matter more than appearance. A separate reference image should be kept from the earliest reliable processing step, and an output should never be compared only with itself. Two measurement principles—such as an OCR text diff and a pixel-level ink check—provide a stronger basis than either alone. The OCR’s own errors should be characterised on the reference before its verdicts are trusted. Disagreements should be treated as stops, not scores. Classical filters deserve the same rigorous testing as AI tools. An independent second review should remove anything that cannot be verified, and every change should be backed up and the published files pixel-compared.

The team also advises improving the input: frontal, unwrapped, frame-filling photographs in daylight make later steps easier. Generative models remain useful where nothing has to be read. For images that carry mandatory information, the described workflow uses classical processing plus a text comparison against the original. The closing question is whether, when output and reference disagree, the team knows who was right, why, and what changed afterward—before anything is published.

Reported by Adaeze Nwosu, Electrical test and safety editor.