National Instruments IMAQTM 用户手册

下载
页码 121
Chapter 5
Performing Machine Vision Tasks
5-30
ni.com
types: Codabar, Code 39, Code 93, Code 128, EAN 8, EAN 13, 
Interleaved 2 of 5, MSI, and UPCA.
Read Data Matrix Barcode
Use 
CWIMAQVision.ReadDataMatrixBarcode
 to read values encoded 
in a Data Matrix barcode. This method can automatically determine the 
location of the barcode and appropriate search options for the application. 
However, you can improve the performance of the application by 
specifying control values specific to the application.
CWIMAQVision.ReadDataMatrixBarcode
 can automatically locate 
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 the 
 section, 
and then passing the Regions parameter into 
CWIMAQVision.ReadDataMatrixBarcode
.
Tip
If you need to read only one barcode per image, set 
CWIMAQDataMatrixOptions.SearchMode
 to 
cwimaqBarcode2DSearchSingleConservative
 to increase the speed of the method.
By default, 
CWIMAQVision.ReadDataMatrixBarcode
 determines if the 
barcode has black cells on a white background or white cells on a black 
background.
Note
Specify round cells only if the Data Matrix cells are round and have clearly defined 
edges. If the cells in the matrix touch one another, you must set 
CellShape
 to 
cwimaqBarcode2DCellShapeSquare
.
By default, 
CWIMAQVision.ReadDataMatrixBarcode
 assumes the 
barcode cells are square. If the barcodes you need to read have round cells, 
set the 
CellShape
 member of the 
CWIMAQDataMatrixOptions
 object to 
cwimaqBarcode2DCellShapeRound
.
Set the 
BarcodeShape
 member of the 
CWIMAQDataMatrixOptions
 
object to 
cwimaqBarcode2DShapeRectangular
 or 
cwimaqBarcode2DShapeSquare
 depending on the shape of the 
barcode you need to read. 
Note
Setting the 
BarcodeShape
 member of the 
CWIMAQDataMatrixOptions
 object to 
cwimaqBarcode2DShapeRectangular
 when the barcode you need to read is square 
reduces the reliability of the application.