📄 dmtx.h
字号:
typedef struct DmtxPointFlow_struct { int plane; int arrive; int depart; int mag; DmtxPixelLoc loc;} DmtxPointFlow;/** * @struct DmtxBestLine * @brief DmtxBestLine */typedef struct DmtxBestLine_struct { int angle; int hOffset; int mag; int stepBeg; int stepPos; int stepNeg; int distSq; double devn; DmtxPixelLoc locBeg; DmtxPixelLoc locPos; DmtxPixelLoc locNeg;} DmtxBestLine;/** * @struct DmtxRegion * @brief DmtxRegion */typedef struct DmtxRegion_struct { int found; /* DMTX_REGION_FOUND | DMTX_REGION_NOT_FOUND | DMTX_REGION_EOF */ /* Trail blazing values */ int jumpToPos; /* */ int jumpToNeg; /* */ int stepsTotal; /* */ DmtxPixelLoc finalPos; /* */ DmtxPixelLoc finalNeg; /* */ DmtxPixelLoc boundMin; /* */ DmtxPixelLoc boundMax; /* */ DmtxPointFlow flowBegin; /* */ /* Orientation values */ int polarity; /* */ int stepR; int stepT; DmtxPixelLoc locR; /* remove if stepR works above */ DmtxPixelLoc locT; /* remove if stepT works above */ /* Region fitting values */ int leftKnown; /* known == 1; unknown == 0 */ int leftAngle; /* hough angle of left edge */ DmtxPixelLoc leftLoc; /* known (arbitrary) location on left edge */ DmtxBestLine leftLine; /* */ int bottomKnown; /* known == 1; unknown == 0 */ int bottomAngle; /* hough angle of bottom edge */ DmtxPixelLoc bottomLoc; /* known (arbitrary) location on bottom edge */ DmtxBestLine bottomLine; /* */ int topKnown; /* known == 1; unknown == 0 */ int topAngle; /* hough angle of top edge */ DmtxPixelLoc topLoc; /* known (arbitrary) location on top edge */ int rightKnown; /* known == 1; unknown == 0 */ int rightAngle; /* hough angle of right edge */ DmtxPixelLoc rightLoc; /* known (arbitrary) location on right edge */ /* Region calibration values */ int onColor; /* */ int offColor; /* */ int sizeIdx; /* Index of arrays that store Data Matrix constants */ int symbolRows; /* Number of total rows in symbol including alignment patterns */ int symbolCols; /* Number of total columns in symbol including alignment patterns */ int mappingRows; /* Number of data rows in symbol */ int mappingCols; /* Number of data columns in symbol */ /* Transform values */ DmtxMatrix3 raw2fit; /* 3x3 transformation from raw image to fitted barcode grid */ DmtxMatrix3 fit2raw; /* 3x3 transformation from fitted barcode grid to raw image */} DmtxRegion;/** * @struct DmtxMessage * @brief DmtxMessage */typedef struct DmtxMessage_struct { int arraySize; /* mappingRows * mappingCols */ int codeSize; /* Size of encoded data (data words + error words) */ int outputSize; /* Size of buffer used to hold decoded data */ int outputIdx; /* Internal index used to store output progress */ unsigned char *array; /* Pointer to internal representation of scanned Data Matrix modules */ unsigned char *code; /* Pointer to internal storage of code words (data and error) */ unsigned char *output; /* Pointer to internal storage of decoded output */} DmtxMessage;/** * @struct DmtxScanGrid * @brief DmtxScanGrid */typedef struct DmtxScanGrid_struct { /* set once */ int minExtent; /* Smallest cross size used in scan */ int maxExtent; /* Size of bounding grid region (2^N - 1) */ int xOffset; /* Offset to obtain image X coordinate */ int yOffset; /* Offset to obtain image Y coordinate */ int xMin; /* Minimum X in image coordinate system */ int xMax; /* Maximum X in image coordinate system */ int yMin; /* Minimum Y in image coordinate system */ int yMax; /* Maximum Y in image coordinate system */ /* reset for each level */ int total; /* Total number of crosses at this size */ int extent; /* Length/width of cross in pixels */ int jumpSize; /* Distance in pixels between cross centers */ int pixelTotal; /* Total pixel count within an individual cross path */ int startPos; /* X and Y coordinate of first cross center in pattern */ /* reset for each cross */ int pixelCount; /* Progress (pixel count) within current cross pattern */ int xCenter; /* X center of current cross pattern */ int yCenter; /* Y center of current cross pattern */} DmtxScanGrid;/** * @struct DmtxDecode * @brief DmtxDecode */typedef struct DmtxDecode_struct { DmtxImage *image; DmtxScanGrid grid; int edgeMin; int edgeMax; int scanGap; double squareDevn; int sizeIdxExpected; int edgeThresh; int shrinkMin; int shrinkMax;} DmtxDecode;/** * @struct DmtxTime * @brief DmtxTime */typedef struct DmtxTime_struct { time_t sec; unsigned long usec;} DmtxTime;/** * @struct DmtxEncode * @brief DmtxEncode */typedef struct DmtxEncode_struct { int moduleSize; int marginSize; DmtxEncodeMethod method; DmtxSchemeEncode scheme; DmtxMessage *message; DmtxImage *image; DmtxRegion region; DmtxMatrix3 xfrm; /* XXX still necessary? */ DmtxMatrix3 rxfrm; /* XXX still necessary? */} DmtxEncode;/** * @struct DmtxChannel * @brief DmtxChannel */typedef struct DmtxChannel_struct { DmtxSchemeEncode encScheme; /* current encodation scheme */ int invalid; /* channel status (invalid if non-zero) */ unsigned char *inputPtr; /* pointer to current input character */ unsigned char *inputStop; /* pointer to position after final input character */ int encodedLength; /* encoded length (units of 2/3 bits) */ int currentLength; /* current length (units of 2/3 bits) */ int firstCodeWord; /* */ unsigned char encodedWords[1558]; /* array of encoded codewords */} DmtxChannel;/* Wrap in a struct for fast copies *//** * @struct DmtxChannelGroup * @brief DmtxChannelGroup */typedef struct DmtxChannelGroup_struct { DmtxChannel channel[6];} DmtxChannelGroup;/** * @struct DmtxTriplet * @brief DmtxTriplet */typedef struct DmtxTriplet_struct { unsigned char value[3];} DmtxTriplet;/** * @struct DmtxQuadruplet * @brief DmtxQuadruplet */typedef struct DmtxQuadruplet_struct { unsigned char value[4];} DmtxQuadruplet;/* dmtxtime.c */extern DmtxTime dmtxTimeNow(void);extern DmtxTime dmtxTimeAdd(DmtxTime t, long msec);extern int dmtxTimeExceeded(DmtxTime timeout);/* dmtxencode.c */extern DmtxEncode dmtxEncodeStructInit(void);extern void dmtxEncodeStructDeInit(DmtxEncode *enc);extern int dmtxEncodeDataMatrix(DmtxEncode *enc, int n, unsigned char *s, int sizeIdxRequest);extern int dmtxEncodeDataMosaic(DmtxEncode *enc, int n, unsigned char *s, int sizeIdxRequest);/* dmtxdecode.c */extern DmtxDecode dmtxDecodeStructInit(DmtxImage *img);extern void dmtxDecodeStructDeInit(DmtxDecode *dec);extern int dmtxDecodeSetProp(DmtxDecode *dec, int prop, int value);extern DmtxMessage *dmtxDecodeMatrixRegion(DmtxImage *img, DmtxRegion *reg, int fix);extern DmtxMessage *dmtxDecodeMosaicRegion(DmtxImage *img, DmtxRegion *reg, int fix);extern DmtxMessage *dmtxMessageMalloc(int sizeIdx, int symbolFormat);extern void dmtxMessageFree(DmtxMessage **mesg);/* dmtxregion.c */extern DmtxRegion dmtxDecodeFindNextRegion(DmtxDecode *decode, DmtxTime *timeout);extern DmtxRegion dmtxRegionScanPixel(DmtxDecode *decode, DmtxPixelLoc loc);extern int dmtxRegionUpdateCorners(DmtxDecode *dec, DmtxRegion *reg, DmtxVector2 p00, DmtxVector2 p10, DmtxVector2 p11, DmtxVector2 p01);extern int dmtxRegionUpdateXfrms(DmtxDecode *dec, DmtxRegion *reg);/* dmtximage.c */extern DmtxImage *dmtxImageMalloc(int width, int height);extern int dmtxImageFree(DmtxImage **img);extern int dmtxImageSetProp(DmtxImage *img, int prop, int value);extern int dmtxImageGetProp(DmtxImage *img, int prop);extern int dmtxImageGetOffset(DmtxImage *img, int x, int y);extern int dmtxImageSetRgb(DmtxImage *img, int x, int y, DmtxRgb rgb);extern int dmtxImageGetRgb(DmtxImage *img, int x, int y, DmtxRgb rgb);extern int dmtxImageGetColor(DmtxImage *img, int x, int y, int colorPlane);extern int dmtxImageContainsInt(DmtxImage *img, int margin, int x, int y);extern int dmtxImageContainsFloat(DmtxImage *img, double x, double y);/* dmtxvector2.c */extern DmtxVector2 *dmtxVector2AddTo(DmtxVector2 *v1, const DmtxVector2 *v2);extern DmtxVector2 *dmtxVector2Add(DmtxVector2 *vOut, const DmtxVector2 *v1, const DmtxVector2 *v2);extern DmtxVector2 *dmtxVector2SubFrom(DmtxVector2 *v1, const DmtxVector2 *v2);extern DmtxVector2 *dmtxVector2Sub(DmtxVector2 *vOut, const DmtxVector2 *v1, const DmtxVector2 *v2);extern DmtxVector2 *dmtxVector2ScaleBy(DmtxVector2 *v, double s);extern DmtxVector2 *dmtxVector2Scale(DmtxVector2 *vOut, const DmtxVector2 *v, double s);extern double dmtxVector2Cross(const DmtxVector2 *v1, const DmtxVector2 *v2);extern double dmtxVector2Norm(DmtxVector2 *v);extern double dmtxVector2Dot(const DmtxVector2 *v1, const DmtxVector2 *v2);extern double dmtxVector2Mag(const DmtxVector2 *v);extern double dmtxDistanceFromRay2(const DmtxRay2 *r, const DmtxVector2 *q);extern double dmtxDistanceAlongRay2(const DmtxRay2 *r, const DmtxVector2 *q);extern int dmtxRay2Intersect(DmtxVector2 *point, const DmtxRay2 *p0, const DmtxRay2 *p1);extern int dmtxPointAlongRay2(DmtxVector2 *point, const DmtxRay2 *r, double t);/* dmtxmatrix3.c */extern void dmtxMatrix3Copy(DmtxMatrix3 m0, DmtxMatrix3 m1);extern void dmtxMatrix3Identity(DmtxMatrix3 m);extern void dmtxMatrix3Translate(DmtxMatrix3 m, double tx, double ty);extern void dmtxMatrix3Rotate(DmtxMatrix3 m, double angle);extern void dmtxMatrix3Scale(DmtxMatrix3 m, double sx, double sy);extern void dmtxMatrix3Shear(DmtxMatrix3 m, double shx, double shy);extern void dmtxMatrix3LineSkewTop(DmtxMatrix3 m, double b0, double b1, double sz);extern void dmtxMatrix3LineSkewTopInv(DmtxMatrix3 m, double b0, double b1, double sz);extern void dmtxMatrix3LineSkewSide(DmtxMatrix3 m, double b0, double b1, double sz);extern void dmtxMatrix3LineSkewSideInv(DmtxMatrix3 m, double b0, double b1, double sz);extern void dmtxMatrix3Multiply(DmtxMatrix3 mOut, DmtxMatrix3 m0, DmtxMatrix3 m1);extern void dmtxMatrix3MultiplyBy(DmtxMatrix3 m0, DmtxMatrix3 m1);extern int dmtxMatrix3VMultiply(DmtxVector2 *vOut, DmtxVector2 *vIn, DmtxMatrix3 m);extern int dmtxMatrix3VMultiplyBy(DmtxVector2 *v, DmtxMatrix3 m);extern void dmtxMatrix3Print(DmtxMatrix3 m);/* dmtxcolor3.c */extern void dmtxColor3FromImage2(DmtxColor3 *color, DmtxImage *img, DmtxVector2 p);extern DmtxColor3 *dmtxColor3FromPixel(DmtxColor3 *color, DmtxRgb rgb);extern void dmtxPixelFromColor3(DmtxRgb rgb, DmtxColor3 *color);extern DmtxColor3 dmtxColor3AlongRay3(DmtxRay3 *ray, double dist);extern DmtxColor3 *dmtxColor3AddTo(DmtxColor3 *v1, DmtxColor3 *v2);extern DmtxColor3 *dmtxColor3Add(DmtxColor3 *vOut, DmtxColor3 *v1, DmtxColor3 *v2);extern DmtxColor3 *dmtxColor3SubFrom(DmtxColor3 *v1, DmtxColor3 *v2);extern DmtxColor3 *dmtxColor3Sub(DmtxColor3 *vOut, DmtxColor3 *v1, DmtxColor3 *v2);extern DmtxColor3 *dmtxColor3ScaleBy(DmtxColor3 *v, double s);extern DmtxColor3 *dmtxColor3Scale(DmtxColor3 *vOut, DmtxColor3 *v, double s);extern DmtxColor3 *dmtxColor3Cross(DmtxColor3 *vOut, DmtxColor3 *v1, DmtxColor3 *v2);extern double dmtxColor3Norm(DmtxColor3 *v);extern double dmtxColor3Dot(DmtxColor3 *v1, DmtxColor3 *v2);extern double dmtxColor3MagSquared(DmtxColor3 *v);extern double dmtxColor3Mag(DmtxColor3 *v);extern double dmtxDistanceFromRay3(DmtxRay3 *r, DmtxColor3 *q);extern double dmtxDistanceAlongRay3(DmtxRay3 *r, DmtxColor3 *q);extern int dmtxPointAlongRay3(DmtxColor3 *point, DmtxRay3 *r, double t);/* dmtxsymbol.c */extern int dmtxSymbolModuleStatus(DmtxMessage *mapping, int sizeIdx, int row, int col);extern int dmtxGetSymbolAttribute(int attribute, int sizeIdx);extern int dmtxGetBlockDataSize(int sizeIdx, int blockIdx);extern char *dmtxVersion(void);#ifdef __cplusplus}#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -