Chapter 5
Performing Machine Vision Tasks
IMAQ Vision for LabWindows/CVI User Manual
5-30
ni.com
Reading Barcodes
Use barcode reading functions to read values encoded into 1D barcodes,
Data Matrix barcodes, and PDF417 barcodes.
Reading 1D Barcodes
To read a 1D barcode, locate the barcode in the image using one of the
techniques described in this chapter. Then pass the ROI Descriptor of the
location into
imaqReadBarcode()
.
Use
imaqReadBarcode()
to read values encoded in the 1D barcode.
Specify the type of 1D barcode in the application using the
type
parameter.
IMAQ Vision supports the following 1D barcode types: Codabar, Code 39,
Code 93, Code 128, EAN 8, EAN 13, Interleaved 2 of 5, MSI, and UPCA.
Reading Data Matrix Barcodes
Use
imaqReadDataMatrixBarcode()
to read values encoded in a
Data Matrix barcode. The function can determine automatically the
location of the barcode and appropriate search options for your application.
However, you can improve the performance of the application by
specifying control values specific to your application.
imaqReadDataMatrixBarcode()
can locate automatically one or
multiple Data Matrix barcodes in an image. However, you can improve
the inspection performance by locating the barcodes using one of the
techniques described in this chapter. Then pass the ROI indicating the
location into
imaqReadDataMatrixBarcode()
.
Tip
If you need to read only one barcode per image, set the
searchMode
element of the
options
parameter to
IMAQ_SEARCH_SINGLE_CONSERVATIVE
to increase the speed of
your application. If the barcode occupies a large percentage of your search region, has
clearly defined cells, and exhibits little or no rotation, you can further increase the speed
of your application by setting the
searchMode
element of the
options
parameter to
IMAQ_SEARCH_SINGLE_AGGRESSIVE
.
By default,
imaqReadDataMatrixBarcode()
detects whether the
barcode has black cells on a white background or white cells on a black
background. If the barcodes in your application have a consistent
cell-to-background contrast, you can improve the performance by setting
the
contrast
element of the
options
parameter to
IMAQ_BLACK_ON_WHITE_BARCODE
or
IMAQ_WHITE_ON_BLACK_BARCODE
.