Use of Data Matrix code

I. Introduction       

        Data Matrix, formerly known as Data code, was invented in 1989 by the American International Data Matrix (ID Matrix). Data Matrix can be divided into two types: ECC000-140 and ECC200. ECC000-140 has a variety of different levels of error correction functions, while ECC200 uses the Reed-Solomon algorithm to generate polynomials to calculate error correction codes. Its size can be determined according to It needs to be printed in different sizes, but the error correction code used should match the size. Because its algorithm is easier and the size is more flexible, ECC200 is generally more common. 【Baidu Encyclopedia】

        Currently, the libraries that can implement detection and identification include libdmtx library and zxing. Here we take the libdmtx library as an example for detection and identification.

2. Environment configuration and compilation

        In the c++ windows vs environment, environment configuration is still a bit troublesome. Download the required libdmtx source files from the above link (I am using version 0.7.5).

  1. Create a new vs project. Here I am creating a new project compiled into a static library;
  2. Unzip the downloaded libdmtx file and copy all files (24 files) in the libdmtx-0.7.5/ directory to the root directory of the new project; as shown below;

  3. Add the copied files to the project file structure, as shown in the figure below;

  4. Modify the precompiled header properties (do not use precompiled headers), as shown in the figure below;

  5. Select to compile to C code, as shown in the figure below;

  6. Add the two header files #include "dmtx.h" and #include "dmtxstatic.h" to each .c file under the source file in step 3 above;
  7. Add float.h, stdio.h, limits.h, assert.h, and math.h files to dmtx.h; comment out the .c file included in the dmtx.c file;
  8. Find the project and copy it into the definition of CHKERR, CHKSCHEME, CHKSIZE, CALLBACK_MATRIX, ISDIGIT, CALLBACK_POINT_PLOT, etc. into dmtx.h;
  9. Replace the snprintf function in the static library program with the sprintf_s function;
  10. If an error such as the one shown in the figure below occurs, you can delete the static declaration and definition of the function (the method I used), or you can use a non-static function for secondary encapsulation (large workload);
     

        If you follow the above operations, you will probably be able to compile the static library as shown below. The first nine steps are easy to operate. The tenth step takes time. If you use it, you can move here . This is my adjusted code.

 3. Application

        Install and compile in the above way to get the dynamic library in the Windows environment. You can refer to the following usage methods. First create a new QRCode attribute table, as shown below:

         The configuration includes the directory and library directory, as follows:

         Finally configure additional dependencies as follows:

         After I re-encapsulate it, the results are as follows:

 

Guess you like

Origin blog.csdn.net/qq_31112205/article/details/127648291