ReadDataMatrix

#include "BIBRDM.H"

 

int CALLBACK ReadDataMatrix(                      HANDLE hDIB,
LPRECT   pDataMatrixRect,
int              MinimalCellSize,
BOOL *    bCheckSumOK,
BYTE *     OutpString,
int *           iAngle,
STRUCT_APPEND * pStrApp,
int *           iErrCode)

Description

This function reads and decodes a data matrix with any orientation in the given range of the input image and returns the decoded string, an indicator whether the checksum was correct, and the detected orientation. This function works for only monochrome, 8 bit per pixel and 24 bit per pixel images. (The 8 bit per pixel and 24 bit per pixel images are converted into monochrome, using adaptive thresholding method.)  The buffer for the returned string must be allocated by the user. If OutpString is NULL, the function returns the length of the buffer to be allocated (in bytes). This function will use the Peterson-Gorenstein-Zierler algorithm to detect and repair damaged codewords.

Parameters

HANDLE

hDIB

Handle of the input DIB.

LPRECT

PDataMatrixRect

A rectangle specifying the area of the image where the data matrix is. If all of the pDataMatrixRect values are zero, or pRect is NULL, the whole image is scanned.

int

MinimalCellSize

This parameter specifies the minimal cell size in pixels to search on the image. If the used cell size is not known, use 0 value.

BOOL *

bCheckSumOK

A BOOL buffer where the checksum indicator is written into. The buffer must be allocated and freed up by the user.

BYTE *

OutpString

A byte buffer where the decoded bytes are written. The buffer must be allocated and freed up by the user, and has to contain enough space for the coding constant. If sOutpString is NULL, the function returns the length of the buffer to be allocated (in bytes).

int *

iAngle

An integer buffer where the detected orientation is written into. The buffer must be allocated and freed up by the user. Orientation's unit is angle and is defined as the anlge in mathematics. It's from 0 degree to 359 degrees, and it's counter-clockwise. 0 degree is the normal horizontal barcode's angle assuming it's left to right coded. In case of having a right to left coded horizontal barcode, angle should be 180 degrees.

STRUCT_APPEND*

pStrApp

Structured Append information buffer. pStrApp points to a STRUCT_APPEND structure wich will contain the Structured Append information if available. If no Structured Append info is available, all members of the struct will be zeroe. The buffer must be allocated and freed up by the user.

int *

iErrCode

An integer buffer where the error code is written into. The buffer must be allocated and freed up by the user. For possible values see Data Matrix Reading Error Codes.

Return values

The length of the decoded string, or the space needed for the string in the case of sOutpString input parameter is NULL, or 0 on error.

Programming notes

None

Requirements

Header :     Declared in BIBrDM.h; include BIBrDM.h.

Library :    Use BIBrDM.lib (32 bit version) or BIBrDMx.lib (64 bit version).

DLLs :       BIBrDM.dll (32 bit version) or BIBrDMx.dll (64 bit version).