OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax...

36
COGNEX OCVMax Application Guide June 2007 ®

Transcript of OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax...

Page 1: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

COGNEX

OCVMax Application Guide

June 2007

®

Page 2: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

The software described in this document is furnished under license, and may be used or copied only in accordance with the terms of such license and with the inclusion of the copyright notice shown on this page. Neither the software, this document, nor any copies thereof may be provided to or otherwise made available to anyone other than the licensee. Title to and ownership of this software remains with Cognex Corporation or its licensor.

Cognex Corporation assumes no responsibility for the use or reliability of its software on equipment that is not supplied by Cognex Corporation. Cognex Corporation makes no warranties, either express or implied, regarding the described software, its merchantability or its fitness for any particular purpose.

The information in this document is subject to change without notice and should not be construed as a commitment by Cognex Corporation. Cognex Corporation is not responsible for any errors that may be present in either this document or the associated software.

Copyright © 2007 Cognex CorporationAll Rights Reserved

Printed in U.S.A.

This document may not be copied in whole or in part, nor transferred to any other media or language, without the written permission of Cognex Corporation.

The hardware and portions of the software described in this document may be covered by one or more of the U.S. patents listed on the Cognex web site http://www.cognex.com/patents.asp. Other U.S. and foreign patents are pending.

The following are registered trademarks of Cognex Corporation:

acuCoder acuFinder acuReader acuWin BGAII CheckpointCognex Cognex, Vision for Industry CVC-1000 CVL DisplayInspectID Expert PasteInspect PatFind PatInspect PatMax PatQuickPixelProbe SMD4 Virtual Checksum VisionLinx VisionPro VisionX

Other Cognex products, tools, or other trade names may be considered common law trademarks of Cognex Corporation. These trademarks may be marked with a "™". Other product and company names mentioned herein may be the trademarks of their respective owners.

Page 3: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide ........................................................................................................................ 5

OCVMax Image Guide ............................................................................................................................ 6Good Character String Candidates .................................................................................................. 6Poor Character String Candidates ................................................................................................... 8

Insufficient Contrast .................................................................................................................. 8Unpredictable Surface Area ..................................................................................................... 9Poor Image Quality ................................................................................................................... 9Poor Font Quality ..................................................................................................................... 10

Possible Character String Candidates ........................................................................................... 11Verifying Character Strings on a Curved Surface ................................................................... 11Using Advanced Tuning Parameters ...................................................................................... 12Opening Font Render Parameters .......................................................................................... 13Creating a Font File ................................................................................................................. 14Getting the Right Font ............................................................................................................. 16

Included Font Files ................................................................................................................................ 17Domino: 1LS-OCR-B-10 / 1ls_ocr_b_10bt.cst ................................................................................ 19Domino: 1LS-Arial / 1LS-Arial.cst ................................................................................................... 20Domino: 1LS-Arial-Fast / 1LS-Arial-fast.cst ................................................................................... 21Domino: 1LS-Arial-Kap / 1LS-Arial-Kap.cst .................................................................................... 22Domino: 1LS-OCR-A / 1LS-OCR-A.cst .......................................................................................... 23Domino: 1LS-Rom / 1LS-Rom.cst . ................................................................................................. 24Markem: 5 x 5 / char_5_5.ffn .......................................................................................................... 25Videojet: 10 x 16 / FNT10X16.XCL ................................................................................................. 26Markem: 5 x 7 / hi_res7.ffn ............................................................................................................. 27Markem: 10 x 16 / hi_res16.ffn ....................................................................................................... 28Xymark: Simplex / Simplex.vf ......................................................................................................... 29Xymark: Simplex - A / SimplexA.vf ................................................................................................. 30Xymark: Simplex Roman / SimplexRoman.vf ................................................................................. 31Videojet: 5 x 7 / US5A7V7.XCL ...................................................................................................... 32Videojet: 5 x 7 / us5a7v7_alt3.xcl ................................................................................................... 33Videojet: 7 x 9 / US7A9V7.XCL ...................................................................................................... 34Videojet: 10 x 16 / US1016V7.XCL ................................................................................................ 35

VisionPro 4.4 OCVMax Application Guide 3

Page 4: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

4 VisionPro 4.4 OCVMax Application Guide

Page 5: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application GuideThe OCVMax tool performs optical character verification (OCV), a process that verifies the characters in one or more character strings match the characters you expect in each aquired image. When you add an OCVMax tool to your vision application, you specify the number of strings you want to verify and the characters they should contain.

One of the challenges of character string verification is identifying valid character string candidates. Some strings display characteristics that an OCVMax tool handles easily, while other strings require an OCVMax tool be precisely configured to handle such issues as character rotation, rare fonts, and unusual object surfaces. Finally, some character strings resist an analysis by an OCVMax tool altogether.

For more information on how to use and configure an OCVMax tool, see the VisionPro .NET documentation, available by choosing Start->Cognex->VisionPro->VisionPro .NET Documentation on your PC.

VisionPro 4.4 OCVMax Application Guide 5

Page 6: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

OCVMax Image Guide

Particular qualities of the character strings in your acquired images determine the degree of success you will have using an OCVMax tool.

Good Character String CandidatesCharacter strings that can be successfully analyzed with an OCVMax tool typically share most of the following characteristics:

The following image contains all the characteristics that make it a good candidate for analysis with an OCVMax tool:

Characteristic Description

Clear Image The image contains sharp character edges.

Good Contrast The image contains a minimum contrast level of 30 grey levels between the characters and the background.

Print Quality The characters appear with no distortion.

Included Font The characters in the string are composed of a font installed as part of the VisionPro product, located by default in the directory C:\Program Files\Cognex\VisionPro\Fonts.

Good Surface The string appears on a clean flat surface with little or no qualities that could alter the desired appearance of a particular character.

6 VisionPro 4.4 OCVMax Application Guide

Page 7: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

The character string in the following image uses the font Arial Bold, which is not included with the software, but is available on most PCs in the \WINDOWS\Fonts directory.

Be aware that Microsoft Windows prevents you from directly opening font files in the \WINDOWS\Fonts directory. If you need to use a font from \WINDOWS\Fonts, first copy it to any other local directory.

Next, character strings that appear in a consistent location from image to image allow the OCVMax tool to locate the strings quickly, as shown in the following series of images:

VisionPro 4.4 OCVMax Application Guide 7

Page 8: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Poor Character String CandidatesCharacter strings that cannot be successfully analyzed with an OCVMax tool typically suffer from one or more of the following characteristics:

Insufficient Contrast

For example, the characters in the following image do not show enough contrast for an OCVMax tool:

Characteristic Description

Poor Image The acquired image does not appear in focus or properly illuminated.

Font Quality The characters appear distorted, either throughout the entire string or in relation to each other.

Font Size Characters must have a minimum area of 20 x 15 pixels with a maximum area of 100 x 80 pixels.

Low Contrast Images must have a minimum contrast of 30 grey levels between the characters and the background.

Poor Surface Qualities of the surface where the string appears prevent the string from reliably appearing with sufficient quality.

8 VisionPro 4.4 OCVMax Application Guide

Page 9: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Unpredictable Surface Area

In the following image, the surface material underneath the character string rotates randomly during the print application, causing unpredictable character defects:

Poor Image Quality

The image acquisition settings must allow you to capture clear images of the character strings you want the OCVMax tool to analyze, as shown in the following figure:

VisionPro 4.4 OCVMax Application Guide 9

Page 10: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Poor Font Quality

In the following figure, the characters are too distorted to be verified reliably:

10 VisionPro 4.4 OCVMax Application Guide

Page 11: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Possible Character String CandidatesUsing an OCVMax tool to analyze a character string with potentially difficult characteristics is possible with the right configuration parameters. The tool supports a tuning feature that allows it to generate a good set of search parameters, both for locating the character string as a whole, and for identifying individual characters in the string.

Verifying Character Strings on a Curved Surface

The following image shows a character string printed on a curved surface:

Even after tuning, an OCVMax tool can still fail to verify a couple of characters in the string:

VisionPro 4.4 OCVMax Application Guide 11

Page 12: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

By raising the confusion threshold and lowering the accept threshold for individual character parameters, the OCVMax tool reliably locates and verifies the character string as shown:

See the VisionPro .NET documentation for the OCVMax tool for a description of confusion threshold and accept thresholds.

Using Advanced Tuning Parameters

The following figure contains a character string that uses a 5 x 7 dot-matrix font, but the string appears as light characters against a dark background, which is not the default polarity setting:

In addition, the characters appear with a high degree of vertical shift with respect to each other. In such an image, the tuning feature an OCVMax tool supports might fail to generate a good set of search parameters because the default ranges for various degrees of freedom are set too low. By choosing the correct polarity setting and opening the range for

12 VisionPro 4.4 OCVMax Application Guide

Page 13: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

advanced tuning parameters such as Y Shift, the tuning feature can complete successfully and the OCVMax tool will locate and verify each character without additional configuration, as shown in following figure:

See the OCVMax tool documentation for a description of the tuning feature and how to enable advanced tuning parameters.

Opening Font Render Parameters

The following figure shows a training image where the numerical string appears with a wider spacing than the tuning feature would normally expect:

VisionPro 4.4 OCVMax Application Guide 13

Page 14: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

When you create an example of the character string you want to verify, you place the graphics for the string over the training image. During this time, the OCVMax tool allows you to specify additional font rendering parameters. By increasing the horizontal character spacing parameter, the tuning feature can locate the widely spaced characters in the string, as shown in the following figure:

Creating a Font File

The following image contains a character string where the surface material can cause a great deal of degradation on a character by character basis:

14 VisionPro 4.4 OCVMax Application Guide

Page 15: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

For images with custom fonts or where the surface can alter the appearance of the font in a predictable way, VisionPro includes an Image Font Extractor for you to generate your own font file from any image.

Launch the Image Font Extractor by choosing Start->Cognex->VisionPro-> Utilities->Image Font Extractor on your PC. The following image shows the Image Font Extractor in the processing of creating a font file from the previous image:

VisionPro 4.4 OCVMax Application Guide 15

Page 16: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Using a generated font, an OCVMax tool can reliably verify the characters in the original image as shown:

Getting the Right Font

To successfully verify a character string, you must have the correct font file. If you do not have the appropriate font file for the characters that appear in your string(s), Cognex recommends the following options:

• Contact your print vendor for the font file.

• Try the web site www.myfonts.com/WhatTheFont/, which is an online source for finding, trying, and buying fonts. The site boasts 41,680 fonts with search tools that allow you to find the font you use.

• Consider generating your own font file using the Image Font Extractor, described in the previous section.

• Contact your Cognex sales representative.

16 VisionPro 4.4 OCVMax Application Guide

Page 17: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Included Font Files

An OCVMax tool requires you load a specific font file for the type of characters in the strings you want to verify. After you load a font file, you can configure an OCVMax tool to exclude the characters in the font that cannot appear in the strings you want to verify. For example, you can exclude lower-case letters or specific punctuation marks. Excluding the characters that cannot appear in your acquired images improves the performance of the OCVMax tool.

VisionPro automatically includes the following font files:

In addition, the OCVMax tool can use any font file that uses the same format as the font files listed in the previous table. For example, VisionPro can use any Xymark font file with a .vf extension, or any Markem font file with a .ffm extension.

Font Name Font File

Xymark: Simplex Simplex.vf

Xymark: Simplex - A SimplexA.vf

Xymark: Simplex Roman SimplexRoman.vb

Domino: 1LS-Arial-Fast 1LS-Arial-fast.cst

Domino: 1LS-Arial-Kap 1LS-Arial-Kap.cst

Domino: 1LS-Arial 1LS-Arial.cst

Domino: 1LS-OCR-A 1LS-OCR-A.cst

Domino: 1LS-OCR-B-10BT 1ls_ocr_b_10bt.cst

Domino: 1LS-Rom 1LS-Rom.cst

Videojet: 10 x 16 FNT10x16.XCL

Videojet: 5 x 7 US5A7V7.XCL

Videojet: 5 x 7 us5a7v7_alt3.xcl

Videojet: 7 x 9 US7A9V7.XCL

Videojet: 10 x 16 US1016V7.XCL

Markem: 5 x 5 char_5_5.ffn

Markem: 10 x 16 hi_res16.ffn

Markem: 5 x 7 hi_res7.ffm

VisionPro 4.4 OCVMax Application Guide 17

Page 18: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

The VisionPro installation utility automatically installs these font files when you install VisionPro. By default, the installation utility installs them in the directory C:\Program Files\Cognex\VisionPro\Fonts.

Examine the following sections to see if the font you use is already installed as part of the VisionPro software.

18 VisionPro 4.4 OCVMax Application Guide

Page 19: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Domino: 1LS-OCR-B-10 / 1ls_ocr_b_10bt.cst

VisionPro 4.4 OCVMax Application Guide 19

Page 20: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Domino: 1LS-Arial / 1LS-Arial.cst

20 VisionPro 4.4 OCVMax Application Guide

Page 21: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Domino: 1LS-Arial-Fast / 1LS-Arial-fast.cst

VisionPro 4.4 OCVMax Application Guide 21

Page 22: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Domino: 1LS-Arial-Kap / 1LS-Arial-Kap.cst

22 VisionPro 4.4 OCVMax Application Guide

Page 23: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Domino: 1LS-OCR-A / 1LS-OCR-A.cst

VisionPro 4.4 OCVMax Application Guide 23

Page 24: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Domino: 1LS-Rom / 1LS-Rom.cst .

24 VisionPro 4.4 OCVMax Application Guide

Page 25: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Markem: 5 x 5 / char_5_5.ffn

VisionPro 4.4 OCVMax Application Guide 25

Page 26: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Videojet: 10 x 16 / FNT10X16.XCL

26 VisionPro 4.4 OCVMax Application Guide

Page 27: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Markem: 5 x 7 / hi_res7.ffn

VisionPro 4.4 OCVMax Application Guide 27

Page 28: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Markem: 10 x 16 / hi_res16.ffn

28 VisionPro 4.4 OCVMax Application Guide

Page 29: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Xymark: Simplex / Simplex.vf

VisionPro 4.4 OCVMax Application Guide 29

Page 30: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Xymark: Simplex - A / SimplexA.vf

30 VisionPro 4.4 OCVMax Application Guide

Page 31: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Xymark: Simplex Roman / SimplexRoman.vf

VisionPro 4.4 OCVMax Application Guide 31

Page 32: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Videojet: 5 x 7 / US5A7V7.XCL

32 VisionPro 4.4 OCVMax Application Guide

Page 33: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Videojet: 5 x 7 / us5a7v7_alt3.xcl

VisionPro 4.4 OCVMax Application Guide 33

Page 34: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Videojet: 7 x 9 / US7A9V7.XCL

34 VisionPro 4.4 OCVMax Application Guide

Page 35: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

Videojet: 10 x 16 / US1016V7.XCL

VisionPro 4.4 OCVMax Application Guide 35

Page 36: OCVMax Application Guide - Cognex · 2020-03-12 · OCVMax Application Guide VisionPro 4.4 OCVMax Application Guide 7 The character string in the following image uses the font Arial

OCVMax Application Guide

36 VisionPro 4.4 OCVMax Application Guide