12
White Paper Making Codes Readable Designing Labels for Vision Inspection Contents 1 Introduction 2 Codes Briefly Explained 3 Reading 1D and 2D Codes 4 How Optical Character Verification Works 5 How Optical Character Recognition Works 6 Design Elements to Consider 7 Enabling Inkjet Print Detection 8 Reading Codes Properly is a Process

Designing Labels for Vision Inspection - METTLER … · 5 How Optical Character Recognition Works 6 Design Elements ... print and label inspection systems makes good ... rather than

Embed Size (px)

Citation preview

Whi

te P

aper

Making Codes ReadableDesigning Labels for Vision Inspection

Contents

1 Introduction

2 Codes Briefly Explained

3 Reading 1D and 2D Codes

4 How Optical Character Verification Works

5 How Optical Character Recognition Works

6 Design Elements to Consider

7 Enabling Inkjet Print Detection

8 Reading Codes Properly is a Process

2 White Paper METTLER TOLEDO

Whi

te P

aper

1 Introduction

Product labels are a critical component of product packaging, offering manufacturers a chance to convince consumers of the quality of a product, and providing the last opportunity to impart information such as allergen warnings, expiration date and instructions for use. Less immediately apparent is the importance of product labeling with regards to inventory management, itemization, traceability and product tracking: crucial information in the event of a product recall.

Traceability in particular has become a growing concern in industries beyond pharmarceuticals. The food industry is one area in which traceability measures are already being considered - in 2016, the United States’ Federal Food and Drug Administration (FDA) implemented measures mandating greater traceability of ingredients, as does the BRC’s Food Safety Issue 7 - and similar regulations are expected to appear in the personal care and household chemicals industry in the coming years. Product bar codes, lot codes and expiration dates are mandatory elements in nearly every country, and in countries where this information is not mandatory there is sufficient consumer pressure that packages need them present anyway.

This is all taking place in a world of increasing manufacturing speeds which can cause errors that are not immediately caught leading to the production of larger quantities of defective products. Add to that the traditionally high cost of a product recall (now augmented by the internet’s ability to magnify bad press a thousand fold) and the trend toward greater acceptance and use of in-line automated print and label inspection systems makes good business sense.

There are plenty of reasons for wanting an automated inspection solution for print and label quality, of course - every product on the line is inspected rather than a random sampling, errors are caught earlier which means fewer defective products are created to begin with, reducing waste and the accuracy of a system is higher than the accuracy of a manual inspector - but it is a mistake to consider the installation of an automated vision inspection system as the only thing required for solving label quality issues. Inspection systems are highly accurate, and growing more accurate all the time, but they still have limitations which must be considered when implementing a label inspection program.

In order to understand the most effective way to create a print and label quality inspection program, it is important to know how inspection equipment works, what codes are and the factors that can influence inspection effectiveness. By understanding these factors and taking them into consideration in the creation of the inspection program, it is possible to drastically decrease the risk of a recall and improve consumer satisfaction. This white paper describes the methodology for inspection of printed text and codes (e.g. 1D and 2D barcodes), including challenging applications such as variable dot matrix printed text applied at high speeds.

3White Paper METTLER TOLEDO

2 Codes Briefly Explained

There are three basic ways codes are presented on product packaging:• Alphanumeric strings• 1D Barcodes• 2D Barcodes (Matrix Codes)

Alphanumeric strings are straightforward - strings of letters and numbers which can be read by the human eye. This is the simplest code, requiring no specialized equipment to know what the code says - though obviously it assumes the reader knows what the code means. The advantage to alphanumeric strings is obvious: no specialized equipment is necessary, and it is easy to inspect manually. The disadvantage is mostly in the limited amount of information that can be put on a given package without interfering with label design. Alphanumeric strings generally only are used for lot codes, label control numbers and expiration dates on labels - and while these strings are often printed directly on the surface of the packaging rather than on the label, the same factors need to be taken into account when inspecting them as if they were on a label.

A 1D barcode is most commonly seen pre-printed on a product label and used to identify the product at point of sale and consists of a pattern of parallel lines side by side. Each line is of a varying thickness, and the spacing between lines varies in thickness as well. A reader - which can be a simple optical scanner or camera - decodes the lines and spaces between those lines into a numerical or alphanumerical string. This information can be used as a reference to the product name or (most commonly) price of the product. This allows for a greater quantity of information to be presented in a tight space, but the resulting code is unreadable by the human eye, making manual verification without a scanner impossible. As 1D barcodes rely heavily on the juxtaposition of the printed lines and the spaces between those lines, any irregularity in printing can alter the meaning of the code (or more likely, make the code unreadable). Also, space concerns become a limiting factor again -longer strings mean longer codes, and the space saved by using the codes is not particularly significant.

2D barcodes, or matrix codes as they are also called, are the natural evolution of the 1D barcode. Rather than using vertical lines, a 2D barcode uses cells - these cells are arranged in a larger rectangle and position of the cell, shapes created by the cells and the white spaces left all contribute to represent quantities of information. The advantage is that greater quantities of data can be encoded into a smaller space than a 1D barcode, which means 2D codes take up less space on a product package, which is advantageous for companies seeking to have a large amount of information in a small space. It would be easy to believe a disadvantage of these codes would be a greater chance of any marking or marring of the code rendering it unreadable, but in actuality most, if not all, 2D codes have redundancies built into them - so much so that nearly 30% of the code can be missing and the code would still be readable. Of course, this all relies on the size and shape of the code.

It is not surprising then that 2D barcode standards include a specific finder pattern so that readers can quickly identify the size of the code. They also, like 1D barcodes, require a “quiet zone” or blank white space around the code to prevent disruption of the code reading process.

Figure 1. Illustration of different code types.

4 White Paper METTLER TOLEDO

Whi

te P

aper

3 Reading 1D and 2D Codes

Reading barcodes is accomplished through one of two methods: specialized barcode readers or cameras. Both of these methods rely on the contrast between filled and empty space on the label to gain a picture of the code.

The difference is in how the methods detect that contrast - a barcode reader will use a light source (usually a laser) and photodiode sensors to determine the brightness of the reflected light. This information is fed back into a processor that assembles the pattern and outputs the character string the code represents, which is then checked against the expected output. Cameras work the same way, except that instead of using a laser to detect the contrast, a camera captures an image of the barcode and separate vision processing software analyzes and decodes. This is accomplished by looking at the contrast between the printed lines or cells and the space between them, much like a photodiode-based reader would do. The difference is that the displayed image can be further analyzed based on how easy the code was to read and assign a ‘grade’ - so if a printer is running out of ink and beginning to print faintly, the system can notify an operator once the code drops below a certain grade.

There are a variety of advantages to using cameras and software rather than a specialized reader, the most obvious of which is that any camera can be converted into a barcode reader with the addition of some software. As long as the camera is able to determine the type of barcode it is inspecting - there are many different formats for barcodes - it can display the represented string to a user or check it against a database to identify the product. The advantage over a specialized barcode reader is the ability of a camera-based reader to also read alphanumeric strings - a process known as optical character recognition (OCR) or optical character verification (OCV). In addition, cameras are historically capable of searching for codes across a larger area, which can reduce or even eliminate the need to readjust the camera position during product changeovers. Camera based readers can use similar processes to identify labels based on unique graphical features or even colors; often using the same image as the one captured for barcode reading.

Figure 2. A 2D barcode is read by looking for the darker squares against a lighter background; 1D barcodes are read the same way.

5White Paper METTLER TOLEDO

4 How Optical Character Verification Works

In theory, a camera reads a character the same way it reads a barcode: it captures an image of the character and uses a software tool to determine what the character is. This involves highlighting the darker pixels of each character in the case of dark text on a bright background, or the lighter pixels in the case of white text on a dark background, and comparing that data against pre-defined images of characters to “decode” the text.

In practice, the process is actually more complicated than that, because there are greater opportunities for variation in printed text compared to a barcode. More to the point, it’s not always certain what sort of text is being inspected - and determining what the text is can be a processor-intensive undertaking. This is not always necessary, of course - for things like a lot code, the manufacturer already knows what the text is supposed to read and where it is supposed to be.

For print quality inspections of character strings vision software uses an Optical Character Verification (OCV) tool. OCV is used to compare a printed character against a pre-determined reference character. In a way, OCV accom-plishes two separate tasks: it confirms printed information is correct, and then confirms print is readable. Any deviation from the pre-defined character lowers the print score. This allows manufacturers to confirm important information such as lot codes and expiration dates are sufficiently legible.

The process begins with isolating the characters in the image. For most applications, the location of the text will be known - even on an un-oriented product. A search area is defined around the text and, like a barcode, the contrast between the print and the surface is used to separate the characters out from one another; essentially breaking the character string into discrete characters in a process known as segmentation. Each character is then compared against its pre-defined image or training image and the system assigns a score. This score is based on how closely the captured image resembles the pre-defined image. If the character is incorrect or poorly printed, the comparison will fail - although depending on where the inspection tolerance is set, a C and an O may confuse the system, or (even worse) the letter O and a 0 (zero). OCV cannot identify what the mistaken character is; it will at best be able to say the character is not the character that is meant to be there.

OCV is an easy task for vision inspection systems to perform. The quality of the print can be quickly assessed since the system is just comparing a trained character to the captured character to assign a grade. What OCV cannot do, however, is read in a string of unknown characters.

Figure 3. Inspection software searches a pre-defined area and highlights all text that stands out against the background.

6 White Paper METTLER TOLEDO

Whi

te P

aper

5 How Optical Character Recognition Works

An inspection system may not always know the precise configuration of characters to expect on a label - for example, if a label is being marked with unique string of characters such as a serial number, an inspection system will not know what the number will necessarily look like before inspection. In order to properly track and identify the number, the system needs to be able to actually read in the characters rather than compare each character against an image which has been pre-defined.

Setting up Optical Character Recognition (OCR) involves teaching the system the font which is to be used in the marking of the product label or package. After the font has been trained in, the initial steps are identical to those of OCV - the system captures an image, searches an area for the character string, identifies the string, and runs a segmentation process to break it into separate characters. At this point, instead of checking each character against a pre-defined character image, the system instead compares the captured character against every charac-ter in the pre-defined font to find the one which most closely resembles the captured character. This character is then added to the results for every other character in order to produce the complete code string.

A drawback of this particular tool is the inability to provide a quality grade of the presented string - the tool will always select a character that most closely represents the image, so even unreadable print will have characters assigned to it. Granted, poor print quality will most likely still fail - the character closest in appearance may not be the intended character in the case of a print verification application - but it is still a possible issue to keep in mind. Some applications will involve adding an extra step to the process which utilizes OCV, but this adds time to the inspection process.

Most vision providers will use OCV whenever possible as it requires far less processing power to accomplish the inspection. Unlike OCR, which requires comparison to every character in a font, OCV only needs to compare to the expected character and assign a quality score.

Figure 4. When presented with a character (S, in this example), the software compares stored character shapes against the presented shape to find the closest match, shown in green.

7White Paper METTLER TOLEDO

6 Design Elements to Consider

The method by which a vision system is able to pick out things like characters or codes on a label surface is reliant on the contrast between the printed character and the background upon which the character is printed. Contrast is necessary so that OCR and OCV tools can pick out the characters from the background in order to do their comparisons.

This is also, as mentioned previously, how dedicated barcode scanners work - contrast is key to allowing any sort of code or print reading to take place, regardless of the method used. All too often more ambitious label designs can result in a frustratingly difficult reading situation, leaving a consumer angrily swiping their product on the self-checkout lane over and over again. Choose print colors which stand out against the label background in order to avoid this problem - and remember that black and white are the preferred colors for barcodes, though if this is impossible choose colors which sufficiently contrast from one another. This same rule applies when dealing with alphanumeric applications as well, as vision systems (and eyes) rely on contrast to pick out individual characters from the label surface.

Contrast may be king when it comes to label design, but it is far from the only factor to consider. The label material can also be a factor in determining how easy inspection can be - reflective materials (such as foils) can cause problems and require a custom lighting solution to accurately perform the inspection. This is less of a problem for a barcode sensor, but any character identification or verification inspection will require a camera solution. Alphanumeric codes should be printed at a size which cameras can easily read; the width of the smallest character should be no smaller than three pixels, and the total area of a given character should consist of some 20-25 pixels. The space between characters also needs to be sufficient for the system to distinguish between characters: two pixels of space at least. In addition, it is generally recommended that fonts be bold in order to maximize the thickness of each character for the best possible comparison.

There are other things to consider when producing alphanumeric codes in particular which a barcode does not need to consider. The advantage of a barcode over alphanumeric codes is partially due to the uniformity of appearance - while there are multiple code symbologies, the basic principles remain the same - while fonts are far more varied. This allows codes to have standardized quality grades which make creating effective designs far more easily. These quality grades are determined by analyzing the reflectance of the barcode, the edge contrast, the symbol contrast, the modulation, the decodability and any defects in the code. Each of these elements are graded separately on a scale from A to F, and an average of these grades determines the overall score of the code. Generally, a grade of C or higher will be readable by most barcode scanners, although obviously the higher the grade the less-likely there will be any reading errors.

Figure 5. High-contrast black & white printed codes are best for readability.

8 White Paper METTLER TOLEDO

Whi

te P

aper

7 Enabling Inkjet Detection

Historically, vision systems have struggled to read dot matrix printing, which has limited the effectiveness of OCV and OCR - particularly when it comes to high speed printing on a package surface (lot codes or expiration dates, for example). Even with these challenges, inkjet printing is still used to relay information to the end consumer. Developing efficient inspection methods to inspect inkjet print is critical to ensuring consumer safety.

Depending on the package, and when the print needs to be applied to the label or container, there are a variety of printing methods to use. By knowing which printing method is being used, you can keep in mind the potential drawbacks and print errors that could occur and engage your inspections appropriately. This is particularly true when dealing with print applied late in the production process - expiration dates, serial numbers and lot codes, to be precise. These are usually applied using ink jet printers, which spray a jet of ink dots in patterned rows which, placed next to one another, form characters. Unfortunately, because the print technique relies on a jet of ink, any obstruction or debris that gets on the nozzle can cause problems (to say nothing of misfires and the possibility that characters come out looking distorted). Vision systems are challenged in reading inkjet print due to the spaces between dots. This makes it difficult for a system to recognize the connect dots as a defined character. Any movement of the print surface can cause the text to smear or distort in ways which are more difficult to read.

Along with the distortion problem, there is also the issue of positional shifting of print. In a high speed printing process, there can be a variation in positioning which does not exist on a pre-printed label. The printer has to hit a moving target, but OCV and OCR applications rely on being able to focus on a small area of inspection in order to pick out text from the background. Further complicating matters, the dots in dot matrix print can vary in size depending on the printer being used, making it difficult to teach a system a unified “dot matrix” font. In late 2016, however, a new technique for reading dot matrix print was devleoped which has made dot matrix print inspections far more feasible.

This new technology allows users to define a larger search area without sacrificing fideltiy, and (more importantly) allows users to define the size of the dots the printer uses. As a result, the system is better able to connect the dots of a character together, forming the necessary characters. Other processes help systems to correct for distortion caused by smearing or uneven print surfaces, finally making reliable dot print inspection a reality. This is particularly useful for industries where in-line printing is used to apply variable information such as expiration dates.

Of course, it is still important to keep in mind the way a vision system performs text inspection when developing a label. The system needs to be able to separate out individual characters from one another, meaning that fonts with narrow kerning should be avoided. The more space between characters your text has, the better an OCR or OCV routine will be able to provide an accurate inspection of the text. This is especially critical with variable text, as an OCR routine will get hung up on characters that look similar to one another. Some software has the ability to make a best guess as to the correct character, but it is best to avoid this risk whenever possible.

9White Paper METTLER TOLEDO

Most printers for these applications are set up to use machine readable fonts (OCR-A, OCR-B, SEMI) which make each character clearly separate from one another - other fonts can cause confusion for a system - a Q and an O are nearly identical in most fonts, and if the print quality is anything less than perfect, an OCR routine can easily mistake one for the other. An OCV routine, by contrast, will be less likely to make this mistake, as it does not have to guess at which character it is looking - but depending on how the tolerances are set it might not reject a character that is close enough in resemblance to the character it is expecting to see (again, Q vs O). There are tools which can be used to reduce confusion between characters - fielding, for example, will tell the system whether to expect a letter or a number and make the identification process easier, while designating a character as a “wildcard” allows the system to merely confirm that a character is present without identifying the character. Font size is also a critical element in how difficult or easy a system will find it to read a character.

Problematic Reasonable

Problematic ink jet print - smeared text Reasonable ink jet print - readable characters

Problematic metallic print with poor contrast Reasonable print with good contrast

Problematic printing surface Reasonable printing surface

Problematic contrast Ideal contrast

10 White Paper METTLER TOLEDO

Whi

te P

aper

8 Reading Codes Properly is a Process

It is a well-known fact that product labels are important as a means of communication with consumers, but the contents of a label are equally important for manufacturers and retailers. Product codes - whether barcodes or alphanumeric codes - are necessary for identifying and tracking products, making them critical for a smooth transportation and distribution process - to say nothing of their role in making a product recall go smoothly. Any problems which may arise as a result of a poorly-printed code reflect poorly on the manufacturer and, depending on the industry, could lead to serious problems. It is critical for manufacturers to know ahead of time what the standards for their industry are, and what their own internal standards will be. Pharmaceutical companies, for example, may wish to only produce barcodes with a grade of B or higher to minimize the number of times a code may need to be re-scanned before a successful read, while other applications (such as a UPC) may be able to afford a C grade, as re-scanning a code is not necessarily as troublesome in a retail situation.

There are a lot of things which go into ensuring product codes are readable - everything from the type of printer to the print surface to how you choose to read the codes has to be taken into consideration in order to ensure a high-quality and readable code on product labeling and packaging. Manufacturers who choose to take all of these factors into account, however, will be rewarded with a higher quality product and fewer customer complaints.

Work with ExpertsImplementing quality controls for product labels and codes can be a complicated process, but that does not need to be the case. It is worth making the effort to consult with an experienced vision inspection provider to learn more about what can be done to improve your printing and inspection process. For more information on vision inspection and its role in ensuring code and labeling quality, you can contact METTLER TOLEDO CI-Vision at: [email protected].

11White Paper METTLER TOLEDO

Notes

About Mettler-Toledo Product Inspection:The Product Inspection Division of METTLER TOLEDO is a leader in the field of automated inspection technology. Our solutions increase process efficiency for manufacturers while supporting compliance with industry stan-dards and regulations. Our systems also deliver improved product quality which helps to protect the welfare of consumers and reputation of manufacturers.

Disclaimer:Information contained in this publication is provided "as is" and without warranty. METTLER TOLEDO disclaims all warranties, express or implied, and makes no warranty regarding the accuracy or applicability of the infor-mation contained in this publication, and is therefore explicitly not responsible for any damage, injury or death resulting from the use of or reliance on the information.

No part of this publication may be reproduced or distributed for any purpose without written permission from METTLER TOLEDO.

© 2017 METTLER TOLEDO. All rights reserved. Subject to technical changes.

Checkweighing

Vision Inspection X-ray Inspection

Metal Detection Track & Trace

METTLER TOLEDO GroupVision InspectionLocal contact: www.mt.com/contacts

Subject to technical changes©05/2017 METTLER TOLEDO. All rights reservedEN_A4

www.mt.com/piFor more information