By ยศกร จิรพงศานานุรักษ์, Founder · 7 min read · Machine vision

The most expensive scrap is not what gets rejected inside the factory, but what reaches the shelf and then has to be recalled. And one of the leading causes of recalls in the food and pharmaceutical industries is nothing complicated: a lot code or expiry date that was printed wrongly, printed blurred, or did not print at all.
How do OCR and OCV differ?
OCR reads characters and outputs them as text. OCV verifies that the printed text matches what it should be and that the print quality is good enough. In packaging work we need both: read the text, then compare it against the value the system sent to print. If it does not match or cannot be read, treat it as a fail, because if the machine cannot read it, the end customer will not be able to read it either.
Why is reading codes on packaging harder than it looks?
- Printing on curved surfaces, such as bottles or cans, distorts the characters.
- Glossy surfaces reflect light, so parts of characters disappear in the image.
- Inkjet ink breaks up into dots rather than solid strokes like printed text in a document.
- The background has label patterns that mix with the characters.
- Items move fast and do not sit in exactly the same position every time.
Where does AI help?
Conventional OCR compares character shapes with templates. With even a little ink breakup or reflection it can fail to read, and someone has to re-tune parameters every time the packaging material changes. AI OCR, by contrast, learns from real images on that factory's own line, so it tolerates broken ink, curved surfaces and reflections much better. When new packaging arrives, you teach it with sample images instead of tuning values one by one.
A caution: AI helps read difficult codes, but it does not fix a clogged print head or poor lighting. If the image is one that even a person cannot make out, the AI should not guess. A well-designed system must answer that it cannot read it and reject the item, not guess and let it pass.
How do you connect it to the line so it can actually reject defects?
- Receive the correct values from the print system or MES, saying what this lot should print.
- Photograph every item at a fixed position after the print point, with lighting that cuts reflections.
- Read it and compare it with the expected value, within the time the line's pace allows.
- Send a signal to the PLC to blow or push failed items off the conveyor.
- Keep the images and the verdicts so they can be reviewed, for when a customer or auditor asks for evidence.
Is it worth it?
Compare it with the cost of a single product recall, which includes return freight, destruction of the goods, penalties from trading partners, and reputational damage that is hard to put a figure on. Code inspection is therefore a point where an automated inspection system often pays back faster than general dimensional inspection, because the damage if an error slips out is very high compared with the installation cost per point.
Frequently asked questions
Can it be used with Thai labels?
Yes, but you need to collect sample Thai images from the real line to teach the system, because stacked vowels and tone marks above and below the characters make the patterns quite different from Latin letters.
Can it keep up if the line runs very fast?
The deciding factor is not conveyor speed alone, but the time the camera has to capture a sharp image and the time the system has to make a decision. High-speed jobs can be solved with fast-shutter cameras and high-power flash lighting. Have the team calculate from the line's actual pieces per minute before choosing equipment.
What do we do when the packaging changes?
Collect sample images of the new packaging and add them to the training set. This normally does not take long and can be done by the factory's own team after training, without waiting for the manufacturer to come and re-tune every time.




