libdmtx 0.7.8.7
libdmtx is a software library that enables programs to read and write Data Matrix barcodes of the modern ECC200 variety.
Loading...
Searching...
No Matches
dmtx.h File Reference

libdmtx - Data Matrix Encoding/Decoding Library Copyright 2008, 2009 Mike Laughton. More...

#include <time.h>

Go to the source code of this file.

Classes

struct  DmtxPixelLoc_struct
 像素坐标 More...
 
struct  DmtxVector2_struct
 二维向量 More...
 
struct  DmtxRay2_struct
 向量表示的直线(线段) More...
 
struct  DmtxByteList_struct
 
struct  DmtxEncodeStream_struct
 
struct  DmtxImage_struct
 
struct  DmtxPointFlow_struct
 图像像素点及其梯度流动方向 More...
 
struct  DmtxBestLine_struct
 
struct  DmtxRegion_struct
 二维码区域(包围框) More...
 
struct  DmtxMessage_struct
 DataMatrix编码内容 More...
 
struct  DmtxScanGrid_struct
 
struct  DmtxTime_struct
 
struct  DmtxDecode_struct
 
struct  DmtxEncode_struct
 
struct  DmtxChannel_struct
 
struct  DmtxChannelGroup_struct
 
struct  DmtxTriplet_struct
 
struct  DmtxQuadruplet_struct
 

Macros

#define M_PI   3.14159265358979323846
 
#define M_PI_2   1.57079632679489661923
 
#define DmtxUndefined   (-1)
 
#define DmtxPassFail   unsigned int
 
#define DmtxPass   1
 
#define DmtxFail   0
 
#define DmtxBoolean   unsigned int
 
#define DmtxTrue   1
 
#define DmtxFalse   0
 
#define DmtxFormatMatrix   0
 
#define DmtxFormatMosaic   1
 
#define DmtxSymbolSquareCount   24
 正方形二维码种类个数
 
#define DmtxSymbolRectCount   6
 长方形二维码种类个数
 
#define DmtxModuleOff   0x00
 bit0
 
#define DmtxModuleOnRed   0x01
 
 
#define DmtxModuleOnGreen   0x02
 绿
 
#define DmtxModuleOnBlue   0x04
 
 
#define DmtxModuleOnRGB   0x07
 OnRed | OnGreen | OnBlue.
 
#define DmtxModuleOn   DmtxModuleOnRGB
 bit1
 
#define DmtxModuleUnsure   0x08
 不确定
 
#define DmtxModuleAssigned   0x10
 已分配
 
#define DmtxModuleVisited   0x20
 已访问
 
#define DmtxModuleData   0x40
 
#define dmtxLogTrace(...)
 
#define dmtxLogDebug(...)
 
#define dmtxLogInfo(...)
 
#define dmtxLogWarn(...)
 
#define dmtxLogError(...)
 
#define dmtxLogFatal(...)
 
#define IN   /* 表示输入参数,指针指向的值不会修改 */
 
#define OUT   /* 表示输出参数,指针指向的值会修改,且不会读 */
 
#define INOUT   /* 表示输入输出参数,指针指向的值会修改,且会读取 */
 

Typedefs

typedef enum DmtxStatus_enum DmtxStatus
 
typedef enum DmtxScheme_enum DmtxScheme
 
typedef enum DmtxSymbolSize_enum DmtxSymbolSize
 
typedef enum DmtxDirection_enum DmtxDirection
 
typedef enum DmtxSymAttribute_enum DmtxSymAttribute
 
typedef enum DmtxCornerLoc_enum DmtxCornerLoc
 
typedef enum DmtxProperty_enum DmtxProperty
 
typedef enum DmtxPackOrder_enum DmtxPackOrder
 
typedef enum DmtxFlip_enum DmtxFlip
 
typedef enum DmtxLogLevel_enum DmtxLogLevel
 
typedef double DmtxMatrix3[3][3]
 DmtxMatrix3 类型定义,表示一个3x3的双精度浮点数矩阵
 
typedef struct DmtxPixelLoc_struct DmtxPixelLoc
 像素坐标
 
typedef struct DmtxVector2_struct DmtxVector2
 二维向量
 
typedef struct DmtxRay2_struct DmtxRay2
 向量表示的直线(线段)
 
typedef unsigned char DmtxByte
 
typedef struct DmtxByteList_struct DmtxByteList
 
typedef struct DmtxEncodeStream_struct DmtxEncodeStream
 
typedef struct DmtxImage_struct DmtxImage
 
typedef struct DmtxPointFlow_struct DmtxPointFlow
 图像像素点及其梯度流动方向
 
typedef struct DmtxBestLine_struct DmtxBestLine
 
typedef struct DmtxRegion_struct DmtxRegion
 二维码区域(包围框)
 
typedef struct DmtxMessage_struct DmtxMessage
 DataMatrix编码内容
 
typedef struct DmtxScanGrid_struct DmtxScanGrid
 
typedef struct DmtxTime_struct DmtxTime
 
typedef struct DmtxDecode_struct DmtxDecode
 
typedef struct DmtxEncode_struct DmtxEncode
 
typedef struct DmtxChannel_struct DmtxChannel
 
typedef struct DmtxChannelGroup_struct DmtxChannelGroup
 
typedef struct DmtxTriplet_struct DmtxTriplet
 
typedef struct DmtxQuadruplet_struct DmtxQuadruplet
 
typedef void(* DmtxCallbackBuildMatrixRegion) (DmtxRegion *region)
 
typedef void(* DmtxCallbackBuildMatrix) (DmtxMatrix3 matrix)
 
typedef void(* DmtxCallbackPlotPoint) (DmtxPixelLoc loc, float colorHue, int paneNbr, int dispType)
 
typedef void(* DmtxCallbackXfrmPlotPoint) (DmtxVector2 point, DmtxMatrix3 xfrm, int paneNbr, int dispType)
 
typedef void(* DmtxCallbackPlotModule) (DmtxDecode *info, DmtxRegion *region, int row, int col, float colorHue)
 
typedef void(* DmtxCallbackFinal) (DmtxDecode *decode, DmtxRegion *region)
 

Enumerations

enum  DmtxStatus_enum { DmtxStatusEncoding , DmtxStatusComplete , DmtxStatusInvalid , DmtxStatusFatal }
 
enum  DmtxScheme_enum {
  DmtxSchemeAutoFast = -2 , DmtxSchemeAutoBest = -1 , DmtxSchemeAscii = 0 , DmtxSchemeC40 ,
  DmtxSchemeText , DmtxSchemeX12 , DmtxSchemeEdifact , DmtxSchemeBase256
}
 
enum  DmtxSymbolSize_enum {
  DmtxSymbolRectAuto = -3 , DmtxSymbolSquareAuto = -2 , DmtxSymbolShapeAuto = -1 , DmtxSymbol10x10 = 0 ,
  DmtxSymbol12x12 , DmtxSymbol14x14 , DmtxSymbol16x16 , DmtxSymbol18x18 ,
  DmtxSymbol20x20 , DmtxSymbol22x22 , DmtxSymbol24x24 , DmtxSymbol26x26 ,
  DmtxSymbol32x32 , DmtxSymbol36x36 , DmtxSymbol40x40 , DmtxSymbol44x44 ,
  DmtxSymbol48x48 , DmtxSymbol52x52 , DmtxSymbol64x64 , DmtxSymbol72x72 ,
  DmtxSymbol80x80 , DmtxSymbol88x88 , DmtxSymbol96x96 , DmtxSymbol104x104 ,
  DmtxSymbol120x120 , DmtxSymbol132x132 , DmtxSymbol144x144 , DmtxSymbol8x18 ,
  DmtxSymbol8x32 , DmtxSymbol12x26 , DmtxSymbol12x36 , DmtxSymbol16x36 ,
  DmtxSymbol16x48
}
 
enum  DmtxDirection_enum {
  DmtxDirNone = 0x00 , DmtxDirUp = 0x01 << 0 , DmtxDirLeft = 0x01 << 1 , DmtxDirDown = 0x01 << 2 ,
  DmtxDirRight = 0x01 << 3 , DmtxDirHorizontal = DmtxDirLeft | DmtxDirRight , DmtxDirVertical = DmtxDirUp | DmtxDirDown , DmtxDirRightUp = DmtxDirRight | DmtxDirUp ,
  DmtxDirLeftDown = DmtxDirLeft | DmtxDirDown
}
 
enum  DmtxSymAttribute_enum {
  DmtxSymAttribSymbolRows , DmtxSymAttribSymbolCols , DmtxSymAttribDataRegionRows , DmtxSymAttribDataRegionCols ,
  DmtxSymAttribHorizDataRegions , DmtxSymAttribVertDataRegions , DmtxSymAttribMappingMatrixRows , DmtxSymAttribMappingMatrixCols ,
  DmtxSymAttribInterleavedBlocks , DmtxSymAttribBlockErrorWords , DmtxSymAttribBlockMaxCorrectable , DmtxSymAttribSymbolDataWords ,
  DmtxSymAttribSymbolErrorWords , DmtxSymAttribSymbolMaxCorrectable
}
 
enum  DmtxCornerLoc_enum { DmtxCorner00 = 0x01 << 0 , DmtxCorner10 = 0x01 << 1 , DmtxCorner11 = 0x01 << 2 , DmtxCorner01 = 0x01 << 3 }
 
enum  DmtxProperty_enum {
  DmtxPropScheme = 100 , DmtxPropSizeRequest , DmtxPropMarginSize , DmtxPropModuleSize ,
  DmtxPropFnc1 , DmtxPropEdgeMin = 200 , DmtxPropEdgeMax , DmtxPropScanGap ,
  DmtxPropSquareDevn , DmtxPropSymbolSize , DmtxPropEdgeThresh , DmtxPropWidth = 300 ,
  DmtxPropHeight , DmtxPropPixelPacking , DmtxPropBitsPerPixel , DmtxPropBytesPerPixel ,
  DmtxPropRowPadBytes , DmtxPropRowSizeBytes , DmtxPropImageFlip , DmtxPropChannelCount ,
  DmtxPropXmin = 400 , DmtxPropXmax , DmtxPropYmin , DmtxPropYmax ,
  DmtxPropScale
}
 
enum  DmtxPackOrder_enum {
  DmtxPackCustom = 100 , DmtxPack1bppK = 200 , DmtxPack8bppK = 300 , DmtxPack16bppRGB = 400 ,
  DmtxPack16bppRGBX , DmtxPack16bppXRGB , DmtxPack16bppBGR , DmtxPack16bppBGRX ,
  DmtxPack16bppXBGR , DmtxPack16bppYCbCr , DmtxPack24bppRGB = 500 , DmtxPack24bppBGR ,
  DmtxPack24bppYCbCr , DmtxPack32bppRGBX = 600 , DmtxPack32bppXRGB , DmtxPack32bppBGRX ,
  DmtxPack32bppXBGR , DmtxPack32bppCMYK
}
 
enum  DmtxFlip_enum { DmtxFlipNone = 0x00 , DmtxFlipX = 0x01 << 0 , DmtxFlipY = 0x01 << 1 }
 
enum  DmtxLogLevel_enum {
  DmtxLogTrace , DmtxLogDebug , DmtxLogInfo , DmtxLogWarn ,
  DmtxLogError , DmtxLogFatal
}
 

Functions

DmtxTime dmtxTimeNow (void)
 Generic 1 second resolution version.
 
DmtxTime dmtxTimeAdd (DmtxTime t, long msec)
 Add milliseconds to time t.
 
int dmtxTimeExceeded (DmtxTime timeout)
 Determine whether the received timeout has been exceeded.
 
DmtxEncodedmtxEncodeCreate (void)
 Initialize encode struct with default values.
 
DmtxPassFail dmtxEncodeDestroy (DmtxEncode **enc)
 Deinitialize encode struct.
 
DmtxPassFail dmtxEncodeSetProp (DmtxEncode *enc, int prop, int value)
 Set encoding behavior property.
 
int dmtxEncodeGetProp (DmtxEncode *enc, int prop)
 Get encoding behavior property.
 
DmtxPassFail dmtxEncodeDataMatrix (DmtxEncode *enc, int inputSize, unsigned char *inputString)
 Convert message into Data Matrix image.
 
DmtxPassFail dmtxEncodeDataMosaic (DmtxEncode *enc, int inputSize, unsigned char *inputString)
 Convert message into Data Mosaic image.
 
DmtxDecodedmtxDecodeCreate (DmtxImage *img, int scale)
 Initialize decode struct with default values.
 
DmtxPassFail dmtxDecodeDestroy (DmtxDecode **dec)
 Deinitialize decode struct.
 
DmtxPassFail dmtxDecodeSetProp (DmtxDecode *dec, int prop, int value)
 Set decoding behavior property.
 
int dmtxDecodeGetProp (DmtxDecode *dec, int prop)
 Get decoding behavior property.
 
unsigned char * dmtxDecodeGetCache (DmtxDecode *dec, int x, int y)
 Returns xxx.
 
DmtxPassFail dmtxDecodeGetPixelValue (DmtxDecode *dec, int x, int y, int channel, OUT int *value)
 获取图像像素
 
DmtxMessagedmtxDecodeMatrixRegion (DmtxDecode *dec, DmtxRegion *reg, int fix)
 解码拟合的二维码区域
 
DmtxMessagedmtxDecodePopulatedArray (int sizeIdx, INOUT DmtxMessage *msg, int fix)
 从DataMatrix数据区二进制矩阵解码,并将结果写入msg->output
 
DmtxMessagedmtxDecodeMosaicRegion (DmtxDecode *dec, DmtxRegion *reg, int fix)
 Convert fitted Data Mosaic region into a decoded message.
 
unsigned char * dmtxDecodeCreateDiagnostic (DmtxDecode *dec, OUT int *totalBytes, OUT int *headerBytes, int style)
 
DmtxRegiondmtxRegionCreate (DmtxRegion *reg)
 Create copy of existing region struct.
 
DmtxPassFail dmtxRegionDestroy (DmtxRegion **reg)
 Destroy region struct.
 
DmtxRegiondmtxRegionFindNext (DmtxDecode *dec, DmtxTime *timeout)
 寻找下一个二维码区域
 
DmtxRegiondmtxRegionScanPixel (DmtxDecode *dec, int x, int y)
 将坐标点(x,y)作为二维码L型框的边缘点去匹配二维码包围框
 
DmtxPassFail dmtxRegionUpdateCorners (DmtxDecode *dec, DmtxRegion *reg, DmtxVector2 p00, DmtxVector2 p10, DmtxVector2 p11, DmtxVector2 p01)
 
DmtxPassFail dmtxRegionUpdateXfrms (DmtxDecode *dec, DmtxRegion *reg)
 
DmtxMessagedmtxMessageCreate (int sizeIdx, int symbolFormat)
 Allocate memory for message.
 
DmtxPassFail dmtxMessageDestroy (DmtxMessage **msg)
 Free memory previously allocated for message.
 
DmtxImagedmtxImageCreate (unsigned char *pxl, int width, int height, int pack)
 libdmtx stores image data as a large one-dimensional array of packed pixels, reading from the array when scanning barcodes and writing to it when creating a barcode.
 
DmtxPassFail dmtxImageDestroy (DmtxImage **img)
 Free libdmtx image memory.
 
DmtxPassFail dmtxImageSetChannel (DmtxImage *img, int channelStart, int bitsPerChannel)
 设置图像的颜色通道信息,包括每个通道的起始位和位数。
 
DmtxPassFail dmtxImageSetProp (DmtxImage *img, int prop, int value)
 设置图像属性
 
int dmtxImageGetProp (DmtxImage *img, int prop)
 获取图像属性
 
int dmtxImageGetByteOffset (DmtxImage *img, int x, int y)
 根据给定的坐标 (x, y) 计算并返回图像中对应像素的字节偏移量
 
DmtxPassFail dmtxImageGetPixelValue (DmtxImage *img, int x, int y, int channel, OUT int *value)
 
DmtxPassFail dmtxImageSetPixelValue (DmtxImage *img, int x, int y, int channel, int value)
 设置指定坐标、通道的像素值
 
DmtxBoolean dmtxImageContainsInt (DmtxImage *img, int margin, int x, int y)
 判断坐标 (x, y) 是否在图像范围内
 
DmtxBoolean dmtxImageContainsFloat (DmtxImage *img, double x, double y)
 判断坐标 (x, y) 是否在图像范围内
 
DmtxVector2dmtxVector2AddTo (DmtxVector2 *v1, const DmtxVector2 *v2)
 
DmtxVector2dmtxVector2Add (OUT DmtxVector2 *vOut, const DmtxVector2 *v1, const DmtxVector2 *v2)
 向量相加
 
DmtxVector2dmtxVector2SubFrom (DmtxVector2 *v1, const DmtxVector2 *v2)
 
DmtxVector2dmtxVector2Sub (OUT DmtxVector2 *vOut, const DmtxVector2 *v1, const DmtxVector2 *v2)
 向量相减
 
DmtxVector2dmtxVector2ScaleBy (DmtxVector2 *v, double s)
 
DmtxVector2dmtxVector2Scale (OUT DmtxVector2 *vOut, const DmtxVector2 *v, double s)
 向量数乘
 
double dmtxVector2Cross (const DmtxVector2 *v1, const DmtxVector2 *v2)
 二维向量叉积
 
double dmtxVector2Norm (DmtxVector2 *v)
 
double dmtxVector2Dot (const DmtxVector2 *v1, const DmtxVector2 *v2)
 二维向量点积
 
double dmtxVector2Mag (const DmtxVector2 *v)
 二维向量的模
 
double dmtxDistanceFromRay2 (const DmtxRay2 *r, const DmtxVector2 *q)
 计算点到直线的垂直距离
 
double dmtxDistanceAlongRay2 (const DmtxRay2 *r, const DmtxVector2 *q)
 
DmtxPassFail dmtxRay2Intersect (OUT DmtxVector2 *point, const DmtxRay2 *p0, const DmtxRay2 *p1)
 判断两条直线是否相交,并计算交点。
 
DmtxPassFail dmtxPointAlongRay2 (OUT DmtxVector2 *point, const DmtxRay2 *r, double t)
 计算直线上特定位置的点
 
void dmtxMatrix3Copy (OUT DmtxMatrix3 m0, DmtxMatrix3 m1)
 复制3x3矩阵
 
void dmtxMatrix3Identity (OUT DmtxMatrix3 m)
 生成单位变换矩阵
 
void dmtxMatrix3Translate (OUT DmtxMatrix3 m, double tx, double ty)
 生成平移变换矩阵
 
void dmtxMatrix3Rotate (OUT DmtxMatrix3 m, double angle)
 生成旋转变换矩阵
 
void dmtxMatrix3Scale (OUT DmtxMatrix3 m, double sx, double sy)
 生成缩放变换矩阵
 
void dmtxMatrix3Shear (OUT DmtxMatrix3 m, double shx, double shy)
 生成剪切变换矩阵
 
void dmtxMatrix3LineSkewTop (OUT DmtxMatrix3 m, double b0, double b1, double sz)
 生成顶部线倾斜变换矩阵
 
void dmtxMatrix3LineSkewTopInv (OUT DmtxMatrix3 m, double b0, double b1, double sz)
 Generate top line skew transformation (inverse)
 
void dmtxMatrix3LineSkewSide (OUT DmtxMatrix3 m, double b0, double b1, double sz)
 Generate side line skew transformation.
 
void dmtxMatrix3LineSkewSideInv (OUT DmtxMatrix3 m, double b0, double b1, double sz)
 Generate side line skew transformation (inverse)
 
void dmtxMatrix3Multiply (OUT DmtxMatrix3 mOut, DmtxMatrix3 m0, DmtxMatrix3 m1)
 矩阵相乘
 
void dmtxMatrix3MultiplyBy (INOUT DmtxMatrix3 m0, DmtxMatrix3 m1)
 矩阵相乘
 
DmtxPassFail dmtxMatrix3VMultiply (OUT DmtxVector2 *vOut, DmtxVector2 *vIn, DmtxMatrix3 m)
 将向量与矩阵相乘
 
DmtxPassFail dmtxMatrix3VMultiplyBy (INOUT DmtxVector2 *v, DmtxMatrix3 m)
 将向量与矩阵相乘
 
void dmtxMatrix3Print (DmtxMatrix3 m)
 Print matrix contents to STDOUT.
 
int dmtxSymbolModuleStatus (DmtxMessage *message, int sizeIdx, int symbolRow, int symbolCol)
 receives symbol row and col and returns status DmtxModuleOn / !DmtxModuleOn (DmtxModuleOff) DmtxModuleAssigned DmtxModuleVisited DmtxModuleData / !DmtxModuleData (DmtxModuleAlignment) row and col are expressed in symbol coordinates, so (0,0) is the intersection of the "L"
 
int dmtxGetSymbolAttribute (int attribute, int sizeIdx)
 根据规格索引返回二维码规格各个参数
 
int dmtxGetBlockDataSize (int sizeIdx, int blockIdx)
 Retrieve data size for a specific symbol size and block number.
 
int getSizeIdxFromSymbolDimension (int rows, int cols)
 Retrieve symbol index from rows and columns.
 
DmtxByteList dmtxByteListBuild (DmtxByte *storage, int capacity)
 
void dmtxByteListInit (DmtxByteList *list, int length, DmtxByte value, DmtxPassFail *passFail)
 
void dmtxByteListClear (DmtxByteList *list)
 
DmtxBoolean dmtxByteListHasCapacity (DmtxByteList *list)
 
void dmtxByteListCopy (DmtxByteList *dst, const DmtxByteList *src, DmtxPassFail *passFail)
 
void dmtxByteListPush (DmtxByteList *list, DmtxByte value, DmtxPassFail *passFail)
 
DmtxByte dmtxByteListPop (DmtxByteList *list, DmtxPassFail *passFail)
 
void dmtxByteListPrint (DmtxByteList *list, char *prefix)
 
void dmtxLog (int level, const char *file, int line, const char *fmt,...)
 
void dmtxLogSetLevel (int level)
 
void dmtxLogSetQuiet (DmtxBoolean enable)
 
void dmtxCallbackBuildMatrixRegion (DmtxCallbackBuildMatrixRegion cb)
 
void dmtxCallbackBuildMatrix (DmtxCallbackBuildMatrix cb)
 
void dmtxCallbackPlotPoint (DmtxCallbackPlotPoint cb)
 
void dmtxCallbackXfrmPlotPoint (DmtxCallbackXfrmPlotPoint cb)
 
void dmtxCallbackPlotModule (DmtxCallbackPlotModule cb)
 
void dmtxCallbackFinal (DmtxCallbackFinal cb)
 
char * dmtxVersion (void)
 Use #include to merge the individual .c source files into a single combined file during preprocessing.
 

Detailed Description

libdmtx - Data Matrix Encoding/Decoding Library Copyright 2008, 2009 Mike Laughton.

All rights reserved. Copyright 2012-2016 Vadim A. Misbakh-Soloviov. All rights reserved. Copyright 2016 Tim Zaman. All rights reserved.

See LICENSE file in the main project directory for full terms of use and distribution.

Contact: Vadim A. Misbakh-Soloviov dmtx@.nosp@m.mva..nosp@m.name Mike Laughton mike@.nosp@m.drag.nosp@m.onfly.nosp@m.logi.nosp@m.c.com

Main libdmtx header

Definition in file dmtx.h.

Macro Definition Documentation

◆ DmtxBoolean

#define DmtxBoolean   unsigned int

Definition at line 46 of file dmtx.h.

◆ DmtxFail

#define DmtxFail   0

Definition at line 44 of file dmtx.h.

◆ DmtxFalse

#define DmtxFalse   0

Definition at line 48 of file dmtx.h.

◆ DmtxFormatMatrix

#define DmtxFormatMatrix   0

Definition at line 50 of file dmtx.h.

◆ DmtxFormatMosaic

#define DmtxFormatMosaic   1

Definition at line 51 of file dmtx.h.

◆ dmtxLogDebug

#define dmtxLogDebug ( ...)
Value:
dmtxLog(DmtxLogDebug, __FILE__, __LINE__, __VA_ARGS__)
@ DmtxLogDebug
Definition dmtx.h:252
void dmtxLog(int level, const char *file, int line, const char *fmt,...)
Definition dmtxlog.c:154

Definition at line 68 of file dmtx.h.

◆ dmtxLogError

#define dmtxLogError ( ...)
Value:
dmtxLog(DmtxLogError, __FILE__, __LINE__, __VA_ARGS__)
@ DmtxLogError
Definition dmtx.h:255

Definition at line 71 of file dmtx.h.

◆ dmtxLogFatal

#define dmtxLogFatal ( ...)
Value:
dmtxLog(DmtxLogFatal, __FILE__, __LINE__, __VA_ARGS__)
@ DmtxLogFatal
Definition dmtx.h:256

Definition at line 72 of file dmtx.h.

◆ dmtxLogInfo

#define dmtxLogInfo ( ...)
Value:
dmtxLog(DmtxLogInfo, __FILE__, __LINE__, __VA_ARGS__)
@ DmtxLogInfo
Definition dmtx.h:253

Definition at line 69 of file dmtx.h.

◆ dmtxLogTrace

#define dmtxLogTrace ( ...)
Value:
dmtxLog(DmtxLogTrace, __FILE__, __LINE__, __VA_ARGS__)
@ DmtxLogTrace
Definition dmtx.h:251

Definition at line 67 of file dmtx.h.

◆ dmtxLogWarn

#define dmtxLogWarn ( ...)
Value:
dmtxLog(DmtxLogWarn, __FILE__, __LINE__, __VA_ARGS__)
@ DmtxLogWarn
Definition dmtx.h:254

Definition at line 70 of file dmtx.h.

◆ DmtxModuleAssigned

#define DmtxModuleAssigned   0x10

已分配

Definition at line 63 of file dmtx.h.

◆ DmtxModuleData

#define DmtxModuleData   0x40

Definition at line 65 of file dmtx.h.

◆ DmtxModuleOff

#define DmtxModuleOff   0x00

bit0

Definition at line 56 of file dmtx.h.

◆ DmtxModuleOn

#define DmtxModuleOn   DmtxModuleOnRGB

bit1

Definition at line 61 of file dmtx.h.

◆ DmtxModuleOnBlue

#define DmtxModuleOnBlue   0x04

Definition at line 59 of file dmtx.h.

◆ DmtxModuleOnGreen

#define DmtxModuleOnGreen   0x02

绿

Definition at line 58 of file dmtx.h.

◆ DmtxModuleOnRed

#define DmtxModuleOnRed   0x01

Definition at line 57 of file dmtx.h.

◆ DmtxModuleOnRGB

#define DmtxModuleOnRGB   0x07

OnRed | OnGreen | OnBlue.

Definition at line 60 of file dmtx.h.

◆ DmtxModuleUnsure

#define DmtxModuleUnsure   0x08

不确定

Definition at line 62 of file dmtx.h.

◆ DmtxModuleVisited

#define DmtxModuleVisited   0x20

已访问

Definition at line 64 of file dmtx.h.

◆ DmtxPass

#define DmtxPass   1

Definition at line 43 of file dmtx.h.

◆ DmtxPassFail

#define DmtxPassFail   unsigned int

Definition at line 42 of file dmtx.h.

◆ DmtxSymbolRectCount

#define DmtxSymbolRectCount   6

长方形二维码种类个数

Definition at line 54 of file dmtx.h.

◆ DmtxSymbolSquareCount

#define DmtxSymbolSquareCount   24

正方形二维码种类个数

Definition at line 53 of file dmtx.h.

◆ DmtxTrue

#define DmtxTrue   1

Definition at line 47 of file dmtx.h.

◆ DmtxUndefined

#define DmtxUndefined   (-1)

Definition at line 40 of file dmtx.h.

◆ IN

#define IN   /* 表示输入参数,指针指向的值不会修改 */

Definition at line 74 of file dmtx.h.

◆ INOUT

#define INOUT   /* 表示输入输出参数,指针指向的值会修改,且会读取 */

Definition at line 76 of file dmtx.h.

◆ M_PI

#define M_PI   3.14159265358979323846

Definition at line 33 of file dmtx.h.

◆ M_PI_2

#define M_PI_2   1.57079632679489661923

Definition at line 37 of file dmtx.h.

◆ OUT

#define OUT   /* 表示输出参数,指针指向的值会修改,且不会读 */

Definition at line 75 of file dmtx.h.

Typedef Documentation

◆ DmtxBestLine

◆ DmtxByte

typedef unsigned char DmtxByte

Definition at line 293 of file dmtx.h.

◆ DmtxByteList

typedef struct DmtxByteList_struct DmtxByteList

◆ DmtxCallbackBuildMatrix

typedef void(* DmtxCallbackBuildMatrix) (DmtxMatrix3 matrix)

Definition at line 674 of file dmtx.h.

◆ DmtxCallbackBuildMatrixRegion

typedef void(* DmtxCallbackBuildMatrixRegion) (DmtxRegion *region)

Definition at line 673 of file dmtx.h.

◆ DmtxCallbackFinal

typedef void(* DmtxCallbackFinal) (DmtxDecode *decode, DmtxRegion *region)

Definition at line 678 of file dmtx.h.

◆ DmtxCallbackPlotModule

typedef void(* DmtxCallbackPlotModule) (DmtxDecode *info, DmtxRegion *region, int row, int col, float colorHue)

Definition at line 677 of file dmtx.h.

◆ DmtxCallbackPlotPoint

typedef void(* DmtxCallbackPlotPoint) (DmtxPixelLoc loc, float colorHue, int paneNbr, int dispType)

Definition at line 675 of file dmtx.h.

◆ DmtxCallbackXfrmPlotPoint

typedef void(* DmtxCallbackXfrmPlotPoint) (DmtxVector2 point, DmtxMatrix3 xfrm, int paneNbr, int dispType)

Definition at line 676 of file dmtx.h.

◆ DmtxChannel

typedef struct DmtxChannel_struct DmtxChannel

◆ DmtxChannelGroup

typedef struct DmtxChannelGroup_struct DmtxChannelGroup

◆ DmtxCornerLoc

◆ DmtxDecode

typedef struct DmtxDecode_struct DmtxDecode

◆ DmtxDirection

◆ DmtxEncode

typedef struct DmtxEncode_struct DmtxEncode

◆ DmtxEncodeStream

◆ DmtxFlip

typedef enum DmtxFlip_enum DmtxFlip

◆ DmtxImage

typedef struct DmtxImage_struct DmtxImage

◆ DmtxLogLevel

◆ DmtxMatrix3

typedef double DmtxMatrix3[3][3]

DmtxMatrix3 类型定义,表示一个3x3的双精度浮点数矩阵

Definition at line 262 of file dmtx.h.

◆ DmtxMessage

DataMatrix编码内容

◆ DmtxPackOrder

◆ DmtxPixelLoc

像素坐标

◆ DmtxPointFlow

图像像素点及其梯度流动方向

◆ DmtxProperty

◆ DmtxQuadruplet

typedef struct DmtxQuadruplet_struct DmtxQuadruplet

◆ DmtxRay2

typedef struct DmtxRay2_struct DmtxRay2

向量表示的直线(线段)

◆ DmtxRegion

typedef struct DmtxRegion_struct DmtxRegion

二维码区域(包围框)

◆ DmtxScanGrid

typedef struct DmtxScanGrid_struct DmtxScanGrid

◆ DmtxScheme

◆ DmtxStatus

◆ DmtxSymAttribute

◆ DmtxSymbolSize

◆ DmtxTime

typedef struct DmtxTime_struct DmtxTime

◆ DmtxTriplet

typedef struct DmtxTriplet_struct DmtxTriplet

◆ DmtxVector2

二维向量

Enumeration Type Documentation

◆ DmtxCornerLoc_enum

Enumerator
DmtxCorner00 
DmtxCorner10 
DmtxCorner11 
DmtxCorner01 

Definition at line 170 of file dmtx.h.

◆ DmtxDirection_enum

Enumerator
DmtxDirNone 
DmtxDirUp 
DmtxDirLeft 
DmtxDirDown 
DmtxDirRight 
DmtxDirHorizontal 
DmtxDirVertical 
DmtxDirRightUp 
DmtxDirLeftDown 

Definition at line 139 of file dmtx.h.

◆ DmtxFlip_enum

Enumerator
DmtxFlipNone 
DmtxFlipX 
DmtxFlipY 

Definition at line 242 of file dmtx.h.

◆ DmtxLogLevel_enum

Enumerator
DmtxLogTrace 
DmtxLogDebug 
DmtxLogInfo 
DmtxLogWarn 
DmtxLogError 
DmtxLogFatal 

Definition at line 249 of file dmtx.h.

◆ DmtxPackOrder_enum

Enumerator
DmtxPackCustom 
DmtxPack1bppK 
DmtxPack8bppK 
DmtxPack16bppRGB 
DmtxPack16bppRGBX 
DmtxPack16bppXRGB 
DmtxPack16bppBGR 
DmtxPack16bppBGRX 
DmtxPack16bppXBGR 
DmtxPack16bppYCbCr 
DmtxPack24bppRGB 
DmtxPack24bppBGR 
DmtxPack24bppYCbCr 
DmtxPack32bppRGBX 
DmtxPack32bppXRGB 
DmtxPack32bppBGRX 
DmtxPack32bppXBGR 
DmtxPack32bppCMYK 

Definition at line 214 of file dmtx.h.

◆ DmtxProperty_enum

Enumerator
DmtxPropScheme 
DmtxPropSizeRequest 
DmtxPropMarginSize 
DmtxPropModuleSize 
DmtxPropFnc1 
DmtxPropEdgeMin 
DmtxPropEdgeMax 
DmtxPropScanGap 
DmtxPropSquareDevn 
DmtxPropSymbolSize 
DmtxPropEdgeThresh 
DmtxPropWidth 

图像宽度

DmtxPropHeight 

图像高度

DmtxPropPixelPacking 

图像格式类型,像素打包方式 DmtxPackOrder

DmtxPropBitsPerPixel 

每像素所需要的bit数

DmtxPropBytesPerPixel 

每像素所需要的byte数

DmtxPropRowPadBytes 

每行像素在内存中的填充或对齐字节数

DmtxPropRowSizeBytes 

每一行(包括填充)在内存中的总字节数

DmtxPropImageFlip 

图像是否需要翻转,通常用于处理上下颠倒的图像 DmtxFlip

DmtxPropChannelCount 

图像通道数

DmtxPropXmin 

ROI X坐标最小值(如果未设置则为0)

DmtxPropXmax 

ROI X坐标最大值(如果未设置则为图像宽度-1)

DmtxPropYmin 

ROI Y坐标最小值(如果未设置则为0)

DmtxPropYmax 

ROI Y坐标最大值(如果未设置则为图像高度-1)

DmtxPropScale 

图像缩放比例

Definition at line 178 of file dmtx.h.

◆ DmtxScheme_enum

Enumerator
DmtxSchemeAutoFast 
DmtxSchemeAutoBest 
DmtxSchemeAscii 
DmtxSchemeC40 
DmtxSchemeText 
DmtxSchemeX12 
DmtxSchemeEdifact 
DmtxSchemeBase256 

Definition at line 86 of file dmtx.h.

◆ DmtxStatus_enum

Enumerator
DmtxStatusEncoding 
DmtxStatusComplete 
DmtxStatusInvalid 
DmtxStatusFatal 

Definition at line 78 of file dmtx.h.

◆ DmtxSymAttribute_enum

Enumerator
DmtxSymAttribSymbolRows 

二维码码元总行数(包括L形框和点线)

DmtxSymAttribSymbolCols 

二维码码元总列数(包括L形框和点线)

DmtxSymAttribDataRegionRows 

单区块二维码数据区码元行数(不包括L形框和点线)

DmtxSymAttribDataRegionCols 

单区块二维码数据区码元列数(不包括L形框和点线)

DmtxSymAttribHorizDataRegions 

水平方向区块个数

DmtxSymAttribVertDataRegions 

垂直方向区块个数

DmtxSymAttribMappingMatrixRows 

二维码数据区码元总行数(不包括L形框和点线)

DmtxSymAttribMappingMatrixCols 

二维码数据区码元总列数(不包括L形框和点线)

DmtxSymAttribInterleavedBlocks 
DmtxSymAttribBlockErrorWords 
DmtxSymAttribBlockMaxCorrectable 
DmtxSymAttribSymbolDataWords 
DmtxSymAttribSymbolErrorWords 
DmtxSymAttribSymbolMaxCorrectable 

Definition at line 152 of file dmtx.h.

◆ DmtxSymbolSize_enum

Enumerator
DmtxSymbolRectAuto 
DmtxSymbolSquareAuto 
DmtxSymbolShapeAuto 
DmtxSymbol10x10 
DmtxSymbol12x12 
DmtxSymbol14x14 
DmtxSymbol16x16 
DmtxSymbol18x18 
DmtxSymbol20x20 
DmtxSymbol22x22 
DmtxSymbol24x24 
DmtxSymbol26x26 
DmtxSymbol32x32 
DmtxSymbol36x36 
DmtxSymbol40x40 
DmtxSymbol44x44 
DmtxSymbol48x48 
DmtxSymbol52x52 
DmtxSymbol64x64 
DmtxSymbol72x72 
DmtxSymbol80x80 
DmtxSymbol88x88 
DmtxSymbol96x96 
DmtxSymbol104x104 
DmtxSymbol120x120 
DmtxSymbol132x132 
DmtxSymbol144x144 
DmtxSymbol8x18 
DmtxSymbol8x32 
DmtxSymbol12x26 
DmtxSymbol12x36 
DmtxSymbol16x36 
DmtxSymbol16x48 

Definition at line 98 of file dmtx.h.

Function Documentation

◆ dmtxByteListBuild()

DmtxByteList dmtxByteListBuild ( DmtxByte * storage,
int capacity )
extern

Definition at line 25 of file dmtxbytelist.c.

◆ dmtxByteListClear()

void dmtxByteListClear ( DmtxByteList * list)
extern

Definition at line 55 of file dmtxbytelist.c.

◆ dmtxByteListCopy()

void dmtxByteListCopy ( DmtxByteList * dst,
const DmtxByteList * src,
DmtxPassFail * passFail )
extern

Definition at line 74 of file dmtxbytelist.c.

◆ dmtxByteListHasCapacity()

DmtxBoolean dmtxByteListHasCapacity ( DmtxByteList * list)
extern

Definition at line 65 of file dmtxbytelist.c.

◆ dmtxByteListInit()

void dmtxByteListInit ( DmtxByteList * list,
int length,
DmtxByte value,
DmtxPassFail * passFail )
extern

Definition at line 40 of file dmtxbytelist.c.

◆ dmtxByteListPop()

DmtxByte dmtxByteListPop ( DmtxByteList * list,
DmtxPassFail * passFail )
extern

Definition at line 108 of file dmtxbytelist.c.

◆ dmtxByteListPrint()

void dmtxByteListPrint ( DmtxByteList * list,
char * prefix )
extern

Definition at line 119 of file dmtxbytelist.c.

◆ dmtxByteListPush()

void dmtxByteListPush ( DmtxByteList * list,
DmtxByte value,
DmtxPassFail * passFail )
extern

Definition at line 94 of file dmtxbytelist.c.

◆ dmtxCallbackBuildMatrix()

void dmtxCallbackBuildMatrix ( DmtxCallbackBuildMatrix cb)
extern

Definition at line 9 of file dmtxcallback.c.

◆ dmtxCallbackBuildMatrixRegion()

void dmtxCallbackBuildMatrixRegion ( DmtxCallbackBuildMatrixRegion cb)
extern

Definition at line 4 of file dmtxcallback.c.

◆ dmtxCallbackFinal()

void dmtxCallbackFinal ( DmtxCallbackFinal cb)
extern

Definition at line 29 of file dmtxcallback.c.

◆ dmtxCallbackPlotModule()

void dmtxCallbackPlotModule ( DmtxCallbackPlotModule cb)
extern

Definition at line 24 of file dmtxcallback.c.

◆ dmtxCallbackPlotPoint()

void dmtxCallbackPlotPoint ( DmtxCallbackPlotPoint cb)
extern

Definition at line 14 of file dmtxcallback.c.

◆ dmtxCallbackXfrmPlotPoint()

void dmtxCallbackXfrmPlotPoint ( DmtxCallbackXfrmPlotPoint cb)
extern

Definition at line 19 of file dmtxcallback.c.

◆ dmtxDecodeCreate()

DmtxDecode * dmtxDecodeCreate ( DmtxImage * img,
int scale )
extern

Initialize decode struct with default values.

Returns
Initialized DmtxDecode struct

Definition at line 32 of file dmtxdecode.c.

◆ dmtxDecodeCreateDiagnostic()

unsigned char * dmtxDecodeCreateDiagnostic ( DmtxDecode * dec,
OUT int * totalBytes,
OUT int * headerBytes,
int style )
extern

◆ dmtxDecodeDestroy()

DmtxPassFail dmtxDecodeDestroy ( DmtxDecode ** dec)
extern

Deinitialize decode struct.

Parameters
dec
Returns
void

Definition at line 77 of file dmtxdecode.c.

◆ dmtxDecodeGetCache()

unsigned char * dmtxDecodeGetCache ( DmtxDecode * dec,
int x,
int y )
extern

Returns xxx.

Parameters
dec
xScaled x coordinate
yScaled y coordinate
Returns
Scaled pixel offset

Definition at line 211 of file dmtxdecode.c.

◆ dmtxDecodeGetPixelValue()

DmtxPassFail dmtxDecodeGetPixelValue ( DmtxDecode * dec,
int x,
int y,
int channel,
OUT int * value )
extern

获取图像像素

Definition at line 233 of file dmtxdecode.c.

◆ dmtxDecodeGetProp()

int dmtxDecodeGetProp ( DmtxDecode * dec,
int prop )
extern

Get decoding behavior property.

Parameters
dec
prop
Returns
value

Definition at line 166 of file dmtxdecode.c.

◆ dmtxDecodeMatrixRegion()

DmtxMessage * dmtxDecodeMatrixRegion ( DmtxDecode * dec,
DmtxRegion * reg,
int fix )
extern

解码拟合的二维码区域

Definition at line 336 of file dmtxdecode.c.

◆ dmtxDecodeMosaicRegion()

DmtxMessage * dmtxDecodeMosaicRegion ( DmtxDecode * dec,
DmtxRegion * reg,
int fix )
extern

Convert fitted Data Mosaic region into a decoded message.

Parameters
dec
reg
fix
Returns
Decoded message

Consider performing a color cube fit here to identify exact RGB of all 6 "cube-like" corners based on pixels located within region. Then force each sample pixel to the "cube-like" corner based o which one is nearest "sqrt(dr^2+dg^2+db^2)" (except sqrt is unnecessary). colorPlane = reg->flowBegin.plane;

To find RGB values of primary colors, perform something like a histogram except instead of going from black to color N, go from (127,127,127) to color. Use color bins along with distance to identify value. An additional method will be required to get actual RGB instead of just a plane in 3D.

Definition at line 436 of file dmtxdecode.c.

◆ dmtxDecodePopulatedArray()

DmtxMessage * dmtxDecodePopulatedArray ( int sizeIdx,
INOUT DmtxMessage * msg,
int fix )
extern

从DataMatrix数据区二进制矩阵解码,并将结果写入msg->output

Parameters
[in]sizeIdx数据矩阵的尺寸索引,对应不同的符号大小。
[in,out]msg已经填充模块状态的解码消息结构体实例。
[in]fix纠错级别指示符,指定解码时使用的错误纠正能力, 默认DmtxUndefined
Note
使用此函数时,应将msg变量重新赋值为该函数的返回值,因为当返回NULL时,表示msg已被释放,不应再被使用。 示例用法:msg = dmtxDecodePopulatedArray(sizeidx, msg, fix);

Definition at line 390 of file dmtxdecode.c.

◆ dmtxDecodeSetProp()

DmtxPassFail dmtxDecodeSetProp ( DmtxDecode * dec,
int prop,
int value )
extern

Set decoding behavior property.

Parameters
dec
prop
value
Returns
DmtxPass | DmtxFail

Definition at line 101 of file dmtxdecode.c.

◆ dmtxDistanceAlongRay2()

double dmtxDistanceAlongRay2 ( const DmtxRay2 * r,
const DmtxVector2 * q )
extern

Definition at line 145 of file dmtxvector2.c.

◆ dmtxDistanceFromRay2()

double dmtxDistanceFromRay2 ( const DmtxRay2 * r,
const DmtxVector2 * q )
extern

计算点到直线的垂直距离

Definition at line 131 of file dmtxvector2.c.

◆ dmtxEncodeCreate()

DmtxEncode * dmtxEncodeCreate ( void )
extern

Initialize encode struct with default values.

Returns
Initialized DmtxEncode struct

Definition at line 32 of file dmtxencode.c.

◆ dmtxEncodeDataMatrix()

DmtxPassFail dmtxEncodeDataMatrix ( DmtxEncode * enc,
int inputSize,
unsigned char * inputString )
extern

Convert message into Data Matrix image.

Parameters
enc
inputSize
inputString
Returns
DmtxPass | DmtxFail

Definition at line 171 of file dmtxencode.c.

◆ dmtxEncodeDataMosaic()

DmtxPassFail dmtxEncodeDataMosaic ( DmtxEncode * enc,
int inputSize,
unsigned char * inputString )
extern

Convert message into Data Mosaic image.

1) count how many codewords it would take to encode the whole thing 2) take ceiling N of codeword count divided by 3 3) using minimum symbol size that can accomodate N codewords: 4) create several barcodes over iterations of increasing numbers of input codewords until you go one too far 5) if codewords remain after filling R, G, and B barcodes then go back to 3 and try with next larger size 6) take the 3 different images you created and write out a new barcode

Parameters
enc
inputSize
inputString
Returns
DmtxPass | DmtxFail

Definition at line 259 of file dmtxencode.c.

◆ dmtxEncodeDestroy()

DmtxPassFail dmtxEncodeDestroy ( DmtxEncode ** enc)
extern

Deinitialize encode struct.

Parameters
enc
Returns
void

Definition at line 70 of file dmtxencode.c.

◆ dmtxEncodeGetProp()

int dmtxEncodeGetProp ( DmtxEncode * enc,
int prop )
extern

Get encoding behavior property.

Parameters
enc
prop
Returns
value

Definition at line 146 of file dmtxencode.c.

◆ dmtxEncodeSetProp()

DmtxPassFail dmtxEncodeSetProp ( DmtxEncode * enc,
int prop,
int value )
extern

Set encoding behavior property.

Parameters
enc
prop
value
Returns
DmtxPass | DmtxFail

Definition at line 99 of file dmtxencode.c.

◆ dmtxGetBlockDataSize()

int dmtxGetBlockDataSize ( int sizeIdx,
int blockIdx )
extern

Retrieve data size for a specific symbol size and block number.

Parameters
sizeIdx
blockIdx
Returns
Attribute value

Definition at line 118 of file dmtxsymbol.c.

◆ dmtxGetSymbolAttribute()

int dmtxGetSymbolAttribute ( int attribute,
int sizeIdx )
extern

根据规格索引返回二维码规格各个参数

Parameters
[in]attribute属性 DmtxSymAttribute
[in]sizeIdx规格索引
Returns
属性值

Definition at line 45 of file dmtxsymbol.c.

◆ dmtxImageContainsFloat()

DmtxBoolean dmtxImageContainsFloat ( DmtxImage * img,
double x,
double y )
extern

判断坐标 (x, y) 是否在图像范围内

Parameters
[in]img
[in]xcoordinate
[in]ycoordinate
Returns
DmtxTrue | DmtxFalse

Definition at line 404 of file dmtximage.c.

◆ dmtxImageContainsInt()

DmtxBoolean dmtxImageContainsInt ( DmtxImage * img,
int margin,
int x,
int y )
extern

判断坐标 (x, y) 是否在图像范围内

Parameters
[in]img
[in]marginwidth
[in]xcoordinate
[in]ycoordinate
Returns
DmtxTrue | DmtxFalse

Definition at line 386 of file dmtximage.c.

◆ dmtxImageCreate()

DmtxImage * dmtxImageCreate ( unsigned char * pxl,
int width,
int height,
int pack )
extern

libdmtx stores image data as a large one-dimensional array of packed pixels, reading from the array when scanning barcodes and writing to it when creating a barcode.

Beyond this interaction the calling program is responsible for populating and dispatching pixels between the image array and the outside world, whether that means loading an image from a file, acquiring camera input, displaying output to a screen, saving to disk, etc...

By default, libdmtx treats the first pixel of an image array as the top-left corner of the physical image, with the final pixel landing at the bottom- right. However, if mapping a pixel buffer this way produces an inverted image the calling program can specify DmtxFlipY at image creation time to remove the inversion. This has a negligible effect on performance since it only modifies the pixel mapping math, and does not alter any pixel data.

Regardless of how an image is stored internally, all libdmtx functions consider coordinate (0,0) to mathematically represent the bottom-left pixel location of an image using a right-handed coordinate system.

libdmtx 将图像数据存储为一个大型一维数组,扫描条形码时从数组中读取,创建条形码时向数组中写入。 除了这种交互,调用程序还负责在图像数组和外部世界之间填充和调度像素, 无论是从文件中加载图像、获取摄像头输入、向屏幕显示输出、保存到磁盘等。

默认情况下,libdmtx 将图像数组的第一个像素视为物理图像的左上角,最后一个像素位于右下角。 不过,如果以这种方式映射像素缓冲区会产生反转图像,调用程序可以在创建图像时指定 DmtxFlipY 来消除反转。 这对性能的影响可以忽略不计,因为它只修改了像素映射数学,而不会改变任何像素数据。

无论图像内部如何存储,所有 libdmtx 函数都认为坐标(0,0)在数学上代表使用右手坐标系的图像左下角像素位置。

           (0,HEIGHT-1)        (WIDTH-1,HEIGHT-1)

     array pos = 0,1,2,3,...-----------+
                 |                     |
                 |                     |
                 |       libdmtx       |
                 |        image        |
                 |     coordinates     |
                 |                     |
                 |                     |
                 +---------...,N-2,N-1,N = array pos

               (0,0)              (WIDTH-1,0)

Notes:

  • OpenGL pixel arrays obtained with glReadPixels() are stored bottom-to-top; use DmtxFlipY
  • Many popular image formats (e.g., PNG, GIF) store rows top-to-bottom; use DmtxFlipNone

创建一个新的图像对象

Note
创建的图像对象需要在不再使用时通过调用 dmtxImageDestroy 进行销毁。

Definition at line 78 of file dmtximage.c.

◆ dmtxImageDestroy()

DmtxPassFail dmtxImageDestroy ( DmtxImage ** img)
extern

Free libdmtx image memory.

Parameters
[in]imgpointer to img location
Returns
DmtxFail | DmtxPass

Definition at line 167 of file dmtximage.c.

◆ dmtxImageGetByteOffset()

int dmtxImageGetByteOffset ( DmtxImage * img,
int x,
int y )
extern

根据给定的坐标 (x, y) 计算并返回图像中对应像素的字节偏移量

Definition at line 263 of file dmtximage.c.

◆ dmtxImageGetPixelValue()

DmtxPassFail dmtxImageGetPixelValue ( DmtxImage * img,
int x,
int y,
int channel,
OUT int * value )
extern

◆ dmtxImageGetProp()

int dmtxImageGetProp ( DmtxImage * img,
int prop )
extern

获取图像属性

Returns
失败返回 DmtxUndefined

Definition at line 228 of file dmtximage.c.

◆ dmtxImageSetChannel()

DmtxPassFail dmtxImageSetChannel ( DmtxImage * img,
int channelStart,
int bitsPerChannel )
extern

设置图像的颜色通道信息,包括每个通道的起始位和位数。

Definition at line 183 of file dmtximage.c.

◆ dmtxImageSetPixelValue()

DmtxPassFail dmtxImageSetPixelValue ( DmtxImage * img,
int x,
int y,
int channel,
int value )
extern

设置指定坐标、通道的像素值

Definition at line 337 of file dmtximage.c.

◆ dmtxImageSetProp()

DmtxPassFail dmtxImageSetProp ( DmtxImage * img,
int prop,
int value )
extern

设置图像属性

Definition at line 203 of file dmtximage.c.

◆ dmtxLog()

void dmtxLog ( int level,
const char * file,
int line,
const char * fmt,
... )
extern

Definition at line 154 of file dmtxlog.c.

◆ dmtxLogSetLevel()

void dmtxLogSetLevel ( int level)
extern

Definition at line 111 of file dmtxlog.c.

◆ dmtxLogSetQuiet()

void dmtxLogSetQuiet ( DmtxBoolean enable)
extern

Definition at line 116 of file dmtxlog.c.

◆ dmtxMatrix3Copy()

void dmtxMatrix3Copy ( OUT DmtxMatrix3 m0,
DmtxMatrix3 m1 )
extern

复制3x3矩阵

该函数将一个 3x3 矩阵的内容复制到另一个矩阵。

Parameters
[out]m0指向目标矩阵的指针,用于存储复制的结果
[in]m1指向源矩阵的指针,从中读取数据进行复制

Definition at line 34 of file dmtxmatrix3.c.

◆ dmtxMatrix3Identity()

void dmtxMatrix3Identity ( OUT DmtxMatrix3 m)
extern

生成单位变换矩阵

| 1  0  0 |

m = | 0 1 0 | | 0 0 1 |

        Transform "m"
  (doesn't change anything)
             |\

(0,1) x-—o +–+ \ (0,1) x-—o | | | \ | | | | | / | | +-—* +–+ / +-—* (0,0) (1,0) |/ (0,0) (1,0)

Definition at line 56 of file dmtxmatrix3.c.

◆ dmtxMatrix3LineSkewSide()

void dmtxMatrix3LineSkewSide ( OUT DmtxMatrix3 m,
double b0,
double b1,
double sz )
extern

Generate side line skew transformation.

Parameters
[out]m
[in]b0
[in]b1
[in]sz

Definition at line 234 of file dmtxmatrix3.c.

◆ dmtxMatrix3LineSkewSideInv()

void dmtxMatrix3LineSkewSideInv ( OUT DmtxMatrix3 m,
double b0,
double b1,
double sz )
extern

Generate side line skew transformation (inverse)

Parameters
[out]m
[in]b0
[in]b1
[in]sz

Definition at line 251 of file dmtxmatrix3.c.

◆ dmtxMatrix3LineSkewTop()

void dmtxMatrix3LineSkewTop ( OUT DmtxMatrix3 m,
double b0,
double b1,
double sz )
extern

生成顶部线倾斜变换矩阵

该函数用于创建一个变换矩阵,该矩阵用于对图像进行顶部线的倾斜变换。 这种变换通常用于校正图像中的透视失真。

Parameters
[out]m生成的矩阵
[in]b0基线起点的 y 坐标
[in]b1基线终点的 y 坐标
[in]sz变换后的高度
| b1/b0    0    (b1-b0)/(sz*b0) |
m = | 0 sz/b0 0 | | 0 0 1 |

(sz,b1) o /| Transform "m" / | / | +–+ / | | | (0,b0) x | | | | | +-+ +-+ (0,sz) +-—+ \ / (0,sz) x-—o | | \ / | | | | \/ | | +-—+ +-—+ (0,0) (sz,0) (0,0) (sz,0)

Definition at line 200 of file dmtxmatrix3.c.

◆ dmtxMatrix3LineSkewTopInv()

void dmtxMatrix3LineSkewTopInv ( OUT DmtxMatrix3 m,
double b0,
double b1,
double sz )
extern

Generate top line skew transformation (inverse)

Parameters
[out]m
[in]b0
[in]b1
[in]sz

Definition at line 217 of file dmtxmatrix3.c.

◆ dmtxMatrix3Multiply()

void dmtxMatrix3Multiply ( OUT DmtxMatrix3 mOut,
DmtxMatrix3 m0,
DmtxMatrix3 m1 )
extern

矩阵相乘

该函数用于将两个 3x3 矩阵相乘,并将结果存储在输出矩阵中。

Parameters
[out]mOut指向输出矩阵的指针,用于存储乘法结果
[in]m0指向第一个输入矩阵的指针
[in]m1指向第二个输入矩阵的指针

Definition at line 270 of file dmtxmatrix3.c.

◆ dmtxMatrix3MultiplyBy()

void dmtxMatrix3MultiplyBy ( INOUT DmtxMatrix3 m0,
DmtxMatrix3 m1 )
extern

矩阵相乘

该函数用于将两个 3x3 矩阵相乘,并将结果存储在第一个矩阵中。

Parameters
[in,out]m0指向第一个输入矩阵的指针,其内容将被修改为乘法的结果
[in]m1指向第二个输入矩阵的指针

Definition at line 294 of file dmtxmatrix3.c.

◆ dmtxMatrix3Print()

void dmtxMatrix3Print ( DmtxMatrix3 m)
extern

Print matrix contents to STDOUT.

Parameters
[in]m

Definition at line 353 of file dmtxmatrix3.c.

◆ dmtxMatrix3Rotate()

void dmtxMatrix3Rotate ( OUT DmtxMatrix3 m,
double angle )
extern

生成旋转变换矩阵

Parameters
[out]m生成的矩阵
[in]angle旋转的角度
|  cos(a)  sin(a)  0 |
m = | -sin(a) cos(a) 0 | | 0 0 1 | o Transform "m" / ___ / (0,1) x-—o |/ \ x * (cos(a),sin(a)) | | '– | / | | ___/ / a +-—* `+ - - - - - - (0,0) (1,0) (0,0)

Definition at line 107 of file dmtxmatrix3.c.

◆ dmtxMatrix3Scale()

void dmtxMatrix3Scale ( OUT DmtxMatrix3 m,
double sx,
double sy )
extern

生成缩放变换矩阵

Parameters
[out]m生成的矩阵
[in]sxx轴的缩放因子
[in]syy轴的缩放因子
| sx 0  0 |
m = | 0 sy 0 | | 0 0 1 |
         Transform "m"
             _____     (0,sy)  x-------o (sx,sy)
             \   |             |       |
(0,1) x-—o / | (0,1) +-—+ | | | / /| | | | | | \ / | | | +-—* ` +-—+–* (0,0) (1,0) (0,0) (sx,0)

Definition at line 141 of file dmtxmatrix3.c.

◆ dmtxMatrix3Shear()

void dmtxMatrix3Shear ( OUT DmtxMatrix3 m,
double shx,
double shy )
extern

生成剪切变换矩阵

剪切变换(shear transformation)是空间线性变换之一,是仿射变换的一种原始变换。 它指的是类似于四边形不稳定性那种性质,方形变平行四边形,任意一边都可以被拉长的过程。

XXX: 这里的X和Y方向是不是弄反了

Parameters
[out]m生成的矩阵
[in]shxx轴方向的剪切因子
[in]shyy轴方向的剪切因子
| 0    shy  0 |
m = | shx 0 0 | | 0 0 1 |

Definition at line 164 of file dmtxmatrix3.c.

◆ dmtxMatrix3Translate()

void dmtxMatrix3Translate ( OUT DmtxMatrix3 m,
double tx,
double ty )
extern

生成平移变换矩阵

Parameters
[out]m生成的矩阵
[in]tx沿 x 轴的平移量
[in]ty沿 y 轴的平移量
| 1  0  0 |
m = | 0 1 0 | | tx ty 1 |
        Transform "m"
            _____    (tx,1+ty)  x----o  (1+tx,1+ty)
            \   |               |    |
(0,1) x-—o / | (0,1) +-|–+ | | | / /| | +-—* (1+tx,ty) | | \ / | | +-—* ` +-—+ (0,0) (1,0) (0,0) (1,0)

Definition at line 82 of file dmtxmatrix3.c.

◆ dmtxMatrix3VMultiply()

DmtxPassFail dmtxMatrix3VMultiply ( OUT DmtxVector2 * vOut,
DmtxVector2 * vIn,
DmtxMatrix3 m )
extern

将向量与矩阵相乘

该函数用于将一个 3x3 矩阵与一个 2D 向量相乘,并将结果存储在输出向量中。

Parameters
[out]vOut指向输出向量的指针,用于存储乘法结果
[in]vIn指向输入向量的指针
[in]m要与向量相乘的 3x3 矩阵(仿射变换矩阵)
Returns
DmtxPass | DmtxFail

Definition at line 312 of file dmtxmatrix3.c.

◆ dmtxMatrix3VMultiplyBy()

DmtxPassFail dmtxMatrix3VMultiplyBy ( INOUT DmtxVector2 * v,
DmtxMatrix3 m )
extern

将向量与矩阵相乘

此函数将输入向量v与给定矩阵m相乘,并直接更新输入向量v为乘法的结果。

Parameters
[in,out]v输入向量同时也是输出向量,乘法操作后存储结果。
[in]m用于乘法运算的3x3矩阵。
Returns
DmtxPass | DmtxFail

Definition at line 338 of file dmtxmatrix3.c.

◆ dmtxMessageCreate()

DmtxMessage * dmtxMessageCreate ( int sizeIdx,
int symbolFormat )
extern

Allocate memory for message.

Parameters
sizeIdx
symbolFormatDmtxFormatMatrix | DmtxFormatMosaic
Returns
Address of allocated memory

Definition at line 30 of file dmtxmessage.c.

◆ dmtxMessageDestroy()

DmtxPassFail dmtxMessageDestroy ( DmtxMessage ** msg)
extern

Free memory previously allocated for message.

Parameters
msg
Returns
void

Definition at line 87 of file dmtxmessage.c.

◆ dmtxPointAlongRay2()

DmtxPassFail dmtxPointAlongRay2 ( OUT DmtxVector2 * point,
const DmtxRay2 * r,
double t )
extern

计算直线上特定位置的点

I = p + t·v

Parameters
[out]point点I的坐标。
[in]r直线
[in]t表示沿射线方向的位置参数(从射线起点开始测量的距离)。

Definition at line 195 of file dmtxvector2.c.

◆ dmtxRay2Intersect()

DmtxPassFail dmtxRay2Intersect ( OUT DmtxVector2 * point,
const DmtxRay2 * p0,
const DmtxRay2 * p1 )
extern

判断两条直线是否相交,并计算交点。

用向量叉乘求直线交点 https://www.cnblogs.com/zhb2000/p/vector-cross-product-solve-intersection.html

Parameters
point交点坐标(如果存在)
p0第一条直线
p1第二条直线
Returns
返回DmtxPass表示射线相交,并已计算出交点;返回DmtxFail表示射线不相交或几乎平行。

Definition at line 170 of file dmtxvector2.c.

◆ dmtxRegionCreate()

DmtxRegion * dmtxRegionCreate ( DmtxRegion * reg)
extern

Create copy of existing region struct.

Returns
Initialized DmtxRegion struct

Definition at line 32 of file dmtxregion.c.

◆ dmtxRegionDestroy()

DmtxPassFail dmtxRegionDestroy ( DmtxRegion ** reg)
extern

Destroy region struct.

Parameters
reg
Returns
void

Definition at line 51 of file dmtxregion.c.

◆ dmtxRegionFindNext()

DmtxRegion * dmtxRegionFindNext ( DmtxDecode * dec,
DmtxTime * timeout )
extern

寻找下一个二维码区域

Parameters
decPointer to DmtxDecode information struct
timeout超时时间 (如果为NULL则不限时)

Definition at line 69 of file dmtxregion.c.

◆ dmtxRegionScanPixel()

DmtxRegion * dmtxRegionScanPixel ( DmtxDecode * dec,
int x,
int y )
extern

将坐标点(x,y)作为二维码L型框的边缘点去匹配二维码包围框

Definition at line 100 of file dmtxregion.c.

◆ dmtxRegionUpdateCorners()

DmtxPassFail dmtxRegionUpdateCorners ( DmtxDecode * dec,
DmtxRegion * reg,
DmtxVector2 p00,
DmtxVector2 p10,
DmtxVector2 p11,
DmtxVector2 p01 )
extern

Definition at line 421 of file dmtxregion.c.

◆ dmtxRegionUpdateXfrms()

DmtxPassFail dmtxRegionUpdateXfrms ( DmtxDecode * dec,
DmtxRegion * reg )
extern

Definition at line 528 of file dmtxregion.c.

◆ dmtxSymbolModuleStatus()

int dmtxSymbolModuleStatus ( DmtxMessage * message,
int sizeIdx,
int symbolRow,
int symbolCol )
extern

receives symbol row and col and returns status DmtxModuleOn / !DmtxModuleOn (DmtxModuleOff) DmtxModuleAssigned DmtxModuleVisited DmtxModuleData / !DmtxModuleData (DmtxModuleAlignment) row and col are expressed in symbol coordinates, so (0,0) is the intersection of the "L"

Definition at line 30 of file dmtxplacemod.c.

◆ dmtxTimeAdd()

DmtxTime dmtxTimeAdd ( DmtxTime t,
long msec )
extern

Add milliseconds to time t.

Parameters
t
msec
Returns
Adjusted time

Definition at line 110 of file dmtxtime.c.

◆ dmtxTimeExceeded()

int dmtxTimeExceeded ( DmtxTime timeout)
extern

Determine whether the received timeout has been exceeded.

Parameters
timeout
Returns
1 (true) | 0 (false)

Definition at line 139 of file dmtxtime.c.

◆ dmtxTimeNow()

DmtxTime dmtxTimeNow ( void )
extern

Generic 1 second resolution version.

Returns
Time now

Definition at line 86 of file dmtxtime.c.

◆ dmtxVector2Add()

DmtxVector2 * dmtxVector2Add ( OUT DmtxVector2 * vOut,
const DmtxVector2 * v1,
const DmtxVector2 * v2 )
extern

向量相加

Definition at line 37 of file dmtxvector2.c.

◆ dmtxVector2AddTo()

DmtxVector2 * dmtxVector2AddTo ( DmtxVector2 * v1,
const DmtxVector2 * v2 )
extern

◆ dmtxVector2Cross()

double dmtxVector2Cross ( const DmtxVector2 * v1,
const DmtxVector2 * v2 )
extern

二维向量叉积

Definition at line 89 of file dmtxvector2.c.

◆ dmtxVector2Dot()

double dmtxVector2Dot ( const DmtxVector2 * v1,
const DmtxVector2 * v2 )
extern

二维向量点积

Definition at line 115 of file dmtxvector2.c.

◆ dmtxVector2Mag()

double dmtxVector2Mag ( const DmtxVector2 * v)
extern

二维向量的模

Definition at line 123 of file dmtxvector2.c.

◆ dmtxVector2Norm()

double dmtxVector2Norm ( DmtxVector2 * v)
extern

◆ dmtxVector2Scale()

DmtxVector2 * dmtxVector2Scale ( OUT DmtxVector2 * vOut,
const DmtxVector2 * v,
double s )
extern

向量数乘

Definition at line 79 of file dmtxvector2.c.

◆ dmtxVector2ScaleBy()

DmtxVector2 * dmtxVector2ScaleBy ( DmtxVector2 * v,
double s )
extern

◆ dmtxVector2Sub()

DmtxVector2 * dmtxVector2Sub ( OUT DmtxVector2 * vOut,
const DmtxVector2 * v1,
const DmtxVector2 * v2 )
extern

向量相减

Definition at line 58 of file dmtxvector2.c.

◆ dmtxVector2SubFrom()

DmtxVector2 * dmtxVector2SubFrom ( DmtxVector2 * v1,
const DmtxVector2 * v2 )
extern

◆ dmtxVersion()

char * dmtxVersion ( void )
extern

Use #include to merge the individual .c source files into a single combined file during preprocessing.

This allows the project to be organized in files of like-functionality while still keeping a clean namespace. Specifically, internal functions can be static without losing the ability to access them "externally" from the other source files in this list.

Definition at line 65 of file dmtx.c.

◆ getSizeIdxFromSymbolDimension()

int getSizeIdxFromSymbolDimension ( int rows,
int cols )
extern

Retrieve symbol index from rows and columns.

Parameters
rows
cols
Returns
sizeIdx value

Definition at line 26 of file dmtxsymbol.c.