DM Code and QR code is the mainstream of the two-dimensional code, in which the QR code capacity, capacity density for 16KB,DM code capacity to a smaller size, can be encoded in only the area of 25mm² 30 numbers, but DM code fault tolerance is higher, so the actual industrial production often use DM code as a product label.
Dmdecoder is a more useful DM code parsing software, including a DLL and a lib, using this library is also easier we first look at the composition
The first step in using the library is to import the library path and library functions as follows
//Import DLL#defineDll_export __declspec (dllexport)extern "C"Dll_exportint_stdcall Datamatrix_decode (Const Char*filename); //Datamatrix_decode_rt---real-time processing of images captured by the device//imageData: Pointer to image data area (24-bit bitmap)//Width : Image width//Height : Image Heightextern "C"Dll_exportint_stdcall Datamatrix_decode_rt (unsignedChar* ImageData,intWidthintheight); extern "C"Dll_exportint_stdcall Datamatrix_output (unsignedChar* message);
And the decoding process is like this.
Char* File = (Char*)malloc(Sourcefilepath.getlength () +1);//image path to decode for(inti =0; I < Sourcefilepath.getlength (); i++) {File[i]=Sourcefilepath.getat (i); } file[sourcefilepath.getlength ()]=0; intLength = Datamatrix_decode (file);//decodes and returns the code word length (returns 1 if decoding fails) if(length>0) {unsignedChar* Message = (unsignedChar*)malloc(sizeof(Char) * (length+1)); Datamatrix_output (message);//Save the decoded code word to the arrayMessage[length] =0; Convertstring.empty (); Convertstring.appendformat ("%s", message); CString Show; Show. Empty (); Show= Convertstring.left (Convertstring.getlength ()- A); ((CEdit*) GetDlgItem (Idc_edit_covert_result))SetWindowText (show); Free(message); }
The complete MFC project is as follows
Notice that the copyright mark on the tail tonxong.com removed.
Project path
http://download.csdn.net/detail/dengrengong/8608187
DM QR Code identification Library Dmdecoder using--MFC routines