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.
|
libdmtx - Data Matrix Encoding/Decoding Library Copyright 2008, 2009 Mike Laughton. More...
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dmtx.h"
#include "dmtxstatic.h"
Go to the source code of this file.
Functions | |
DmtxDecode * | dmtxDecodeCreate (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) |
获取图像像素 | |
static void | cacheFillQuad (DmtxDecode *dec, DmtxPixelLoc p0, DmtxPixelLoc p1, DmtxPixelLoc p2, DmtxPixelLoc p3) |
Fill the region covered by the quadrilateral given by (p0,p1,p2,p3) in the cache. | |
DmtxMessage * | dmtxDecodeMatrixRegion (DmtxDecode *dec, DmtxRegion *reg, int fix) |
解码拟合的二维码区域 | |
DmtxMessage * | dmtxDecodePopulatedArray (int sizeIdx, INOUT DmtxMessage *msg, int fix) |
从DataMatrix数据区二进制矩阵解码,并将结果写入msg->output | |
DmtxMessage * | dmtxDecodeMosaicRegion (DmtxDecode *dec, DmtxRegion *reg, int fix) |
Convert fitted Data Mosaic region into a decoded message. | |
unsigned char * | dmtxDecodeCreateDiagnostic (DmtxDecode *dec, int *totalBytes, int *headerBytes, int style) |
static void | tallyModuleJumps (DmtxDecode *dec, DmtxRegion *reg, INOUT int tally[][24], int xOrigin, int yOrigin, int mapWidth, int mapHeight, DmtxDirection dir) |
通过指定方向对判断bit为1的码元位置记录对应的值 | |
static DmtxPassFail | populateArrayFromMatrix (DmtxDecode *dec, DmtxRegion *reg, OUT DmtxMessage *msg) |
根据模块颜色填充数组以确定码字值。 | |
libdmtx - Data Matrix Encoding/Decoding Library Copyright 2008, 2009 Mike Laughton.
All rights reserved. Copyright 2009 Mackenzie Straight. 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
Decode regions
Definition in file dmtxdecode.c.
|
static |
Fill the region covered by the quadrilateral given by (p0,p1,p2,p3) in the cache.
Definition at line 272 of file dmtxdecode.c.
|
extern |
Initialize decode struct with default values.
Definition at line 32 of file dmtxdecode.c.
|
extern |
Definition at line 499 of file dmtxdecode.c.
|
extern |
|
extern |
Returns xxx.
dec | |
x | Scaled x coordinate |
y | Scaled y coordinate |
Definition at line 211 of file dmtxdecode.c.
|
extern |
获取图像像素
Definition at line 233 of file dmtxdecode.c.
|
extern |
Get decoding behavior property.
dec | |
prop |
Definition at line 166 of file dmtxdecode.c.
|
extern |
解码拟合的二维码区域
Definition at line 336 of file dmtxdecode.c.
|
extern |
Convert fitted Data Mosaic region into a decoded message.
dec | |
reg | |
fix |
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.
DmtxMessage * dmtxDecodePopulatedArray | ( | int | sizeIdx, |
INOUT DmtxMessage * | msg, | ||
int | fix ) |
从DataMatrix数据区二进制矩阵解码,并将结果写入msg->output
[in] | sizeIdx | 数据矩阵的尺寸索引,对应不同的符号大小。 |
[in,out] | msg | 已经填充模块状态的解码消息结构体实例。 |
[in] | fix | 纠错级别指示符,指定解码时使用的错误纠正能力, 默认DmtxUndefined |
Definition at line 390 of file dmtxdecode.c.
|
extern |
Set decoding behavior property.
dec | |
prop | |
value |
Definition at line 101 of file dmtxdecode.c.
|
static |
根据模块颜色填充数组以确定码字值。
此函数遍历数据矩阵的各个区域,统计每个模块的颜色跳变,以推断出每个模块是黑(代表1)还是白(代表0)。 这一过程对于解码数据矩阵中的信息至关重要。函数首先计算整个符号的区域数量、区域尺寸等关键属性, 然后根据模块颜色对比和累加的“跳跃”计数来确定每个模块的状态,最后更新消息数组以反映解码结果。
[in] | dec | 解码上下文,包含解码配置和辅助函数。 |
[in] | reg | 当前处理的数据矩阵区域信息。 |
[out] | msg | 根据图像更新array |
从四个方向对图像满足跳变的点求和
对下面2x3的数据区域的计算流程: |XX | | XX XX|
首先 weightFactor = 2 * (2(高) + 3(宽) + 2) = 14
该方向上**判断为1**的码元位置记录值,记录的内容为 宽/高-码元位置坐标
对上面得到的4个矩阵求和可得: |14 | | 14 14|
Definition at line 705 of file dmtxdecode.c.
|
static |
通过指定方向对判断bit为1的码元位置记录对应的值
此函数遍历数据矩阵区域中的模块,根据模块颜色跳变的阈值来累加计数器(tally), 以此推断模块的明暗状态(代表二进制值)。它支持向上、向下、向左、向右四个方向的遍历。
[in] | dec | 解码上下文,包含解码配置和辅助函数 |
[in] | reg | 当前处理的数据矩阵区域信息 |
[in,out] | tally | 二维数组,用于累加模块状态的计数 |
[in] | xOrigin | 起始位置X坐标 |
[in] | yOrigin | 起始位置Y坐标 |
[in] | mapWidth | 单区块码元宽度 |
[in] | mapHeight | 单区块码元高度 |
[in] | dir | 遍历方向 |
Definition at line 596 of file dmtxdecode.c.