In addition to making measurements after you set regions of inspection, you also can identify parts using classification, optical character recognition (OCR), and barcode reading.
Use classification to identify unknown samples based on their color or shape by comparing a set significant characteristics to a set of characteristics that conceptually represent classes of known samples.
Typical applications involving color classification include the following:
Before you classify colors, you must create a classifier file with samples of the colors using the NI Color Classification Training Interface. Go to Start»All Programs»National Instruments»Color Classification Training to launch the NI Color Classification Training Interface. Refer to the NI Color Classification Training Interface Help for more information about the NI Color Classification Training Interface.
Typical applications involving color classification include the following:
Before you classify objects, you must create a classifier file with samples of the objects using the NI Particle Classification Training Interface. Go to Start»All Programs»National Instruments»Particle Classification Training to launch the NI Particle Classification Training Interface. Refer to the NI Particle Classification Training Interface Help for more information about the NI Particle Classification Training Interface.
After you have trained samples of the objects or colors that you want to classify, use the following VIs to perform classification:
The following figure shows LabVIEW pseudocode for a typical classification VI.
![]() |
||
| 1 Read a Classifier File | 4 Classify the Sample | 7 Class |
| 2 Acquire and Preprocess the Image | 5 Dispose of the Classifier Session | 8 Stop |
| 3 Locate the Sample to Classify | 6 Path to the Trained Classifier File | |
Use OCR to read text and/or characters in an image. Typical uses for OCR in an inspection application include identifying or classifying components.
Before you read text and/or characters in an image, you must train the OCR Session with samples of the characters using the NI OCR Training Interface. Select Start»All Programs»National Instruments»Vision»OCR Training to launch the NI OCR Training Interface.
After you have trained samples of the characters you want to read, use the following VIs to read the characters:
Use barcode reading VIs to read values encoded into 1D barcodes, Data Matrix codes, QR codes, and PDF417 codes.
Use the IMAQ Read Barcode VI to read values encoded in a 1D barcode. Locate the barcode in the image using one of the techniques described in the Locate Objects to Inspect and Set Search Areas sections. Then pass the ROI Descriptor of the location into the IMAQ Read Barcode VI. Specify the type of 1D barcode in the application using the Barcode Type control.
NI Vision supports the following 1D barcode types: Codabar, Code 39, Code 93, Code 128, EAN 8, EAN 13, Interleaved 2 of 5, MSI, UPCA, GS1 DataBar Limited (previously referred to as RSS-14 Limited), and Pharmacode.
Use the IMAQ Read Data Matrix Barcode 2 VI to read values encoded in a Data Matrix code. The VI can automatically determine the appropriate search options for your application. However, you can improve the performance of the application by specifying control values specific to your application.
The IMAQ Read Data Matrix Barcode 2 VI can automatically locate the Data Matrix code in an image. However, you can improve the inspection performance by locating the barcode, using one of the techniques described in the Locate Objects to Inspect section, and then passing in ROI Descriptors of the locations into the IMAQ Read Data Matrix Barcode 2 VI.
Use the IMAQ Read QR Code VI to read values encoded in a QR or micro-QR code. The VI can automatically determine the appropriate search options for your application. However, you can improve the performance of the application by specifying control values specific to your application.
The IMAQ Read QR Code VI can automatically locate the QR code in the image. However, you can improve the inspection performance by locating the barcode, using one of the techniques described in the Locate Objects to Inspect section, and then passing in ROI Descriptors of the locations into the IMAQ Read QR Code VI.
Use the IMAQ Read PDF417 Barcode VI to locate a PDF417 code in the image and read encoded values.
the IMAQ Read PDF417 Barcode VI can automatically locate one or multiple PDF417 codes in an image. However, you can improve the inspection performance by locating the codes, using one of the techniques described in the Locate Objects to Inspect section, and then passing in ROI Descriptors of the locations into the IMAQ Read PDF417 Barcode VI.
![]() |
Tip If you need to read only one PDF417 code per image, set Search Mode to Single Barcode, Conservative to increase the speed of the VI. |