接上节内容,在项目上添加了读取图片并解码的程序,并且定位二维码位置;
基于qt和libdmtx库生成DataMatrix的工程,
DataMatrix开源的编码及识别库libdmtx的github:https://github.com/dmtx/libdmtx;
我用qt写的完整工程在:https://github.com/abcvincent/dmtxMaker;
github->doc中有DataMatrix国际标准文件和知乎的详解QR码的文档;
效果如下:

其中红线标注的是二维码的L边;
先贴出libdmtx库里的例子:
/* 3) DECODE the Data Matrix barcode from the copied image */
img = dmtxImageCreate(pxl, width, height, DmtxPack24bppRGB);//创建dmtxImage
assert(img != NULL);
dec = dmtxDecodeCreate(img, 1);//解码img
assert(dec != NULL);
reg = dmtxRegionFindNext(dec, NULL);//查找下一个?
if(reg != NULL) {
msg = dmtxDecodeMatrixRegion(dec, reg, DmtxUndefined);//获取解码信息
fprintf(stdout, "msg-&g

5万+

被折叠的 条评论
为什么被折叠?



