Chapter 5
Performing Machine Vision Tasks
©
National Instruments Corporation
5-29
IMAQ Vision for Visual Basic User Manual
Before you classify objects, you must create a classifier file with samples
of the objects using the NI Classification Training Interface. Go to
Start»
Programs»National Instruments»Classification Training
to launch the
NI Classification Training Interface.
After you have trained samples of the objects you want to classify, use the
following methods to classify the image under inspection:
•
Use
CWIMAQVision.ReadClassifierFile
to read in the classifier
file you created with the NI Classification Training Interface.
•
Use
CWIMAQClassifier.Classify
to classify the image under
inspection.
Reading Characters
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 create a
character set file with samples of the characters using the OCR Training
Interface. Go to
Start»Programs»National Instruments»Vision»OCR
Training
to launch the OCR Training Interface.
After you have trained samples of the characters you want to read, use the
following methods to read the characters:
•
Use
NIOCR.ReadOCRFile
to read in a character set file that you
created using the OCR Training Interface.
•
Use
NIOCR.ReadText
to read the characters inside the ROI of the
image under inspection.
Reading Barcodes
Use barcode reading objects to read values encoded into 1D barcodes, Data
Matrix symbols, and PDF417 symbols.
Read 1D Barcodes
To read a 1D barcode, locate the barcode in the image using one of the
techniques described in the
Instrument Reader Measurements
then pass the Regions parameter into
CWIMAQVision.ReadBarcode
.
Use
CWIMAQVision.ReadBarcode
to read values encoded in the 1D
barcode. Specify the type of 1D barcode in the application using the
BarcodeType
parameter. IMAQ Vision supports the following 1D barcode