CN117692576A - Dot matrix code, encoding method and decoding method thereof, controller and electronic equipment - Google Patents

Dot matrix code, encoding method and decoding method thereof, controller and electronic equipment Download PDF

Info

Publication number
CN117692576A
CN117692576A CN202311504013.8A CN202311504013A CN117692576A CN 117692576 A CN117692576 A CN 117692576A CN 202311504013 A CN202311504013 A CN 202311504013A CN 117692576 A CN117692576 A CN 117692576A
Authority
CN
China
Prior art keywords
code
information
matrix
area
coordinate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202311504013.8A
Other languages
Chinese (zh)
Other versions
CN117692576B (en
Inventor
肖凯平
唐峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Kaixin Microelectronics Technology Co ltd
Original Assignee
Zhuhai Kaixin Microelectronics Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Kaixin Microelectronics Technology Co ltd filed Critical Zhuhai Kaixin Microelectronics Technology Co ltd
Priority to CN202311504013.8A priority Critical patent/CN117692576B/en
Priority claimed from CN202311504013.8A external-priority patent/CN117692576B/en
Publication of CN117692576A publication Critical patent/CN117692576A/en
Application granted granted Critical
Publication of CN117692576B publication Critical patent/CN117692576B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Processing (AREA)

Abstract

The invention provides a dot matrix code, an encoding method, a decoding method, a controller and electronic equipment thereof; the decoding method of the dot matrix code comprises the following steps: acquiring a first code point image; the first code point image is used for displaying the dot matrix code obtained after encoding; performing contour recognition processing on the first code point image according to the positioning code, determining a complete code point information matrix under the condition that a group of user information code areas and page information code areas are recognized, and extracting the code point information matrix; extracting a page number information code area, an X coordinate information code area, a user information code area and a Y coordinate information code area in sequence in a code point information matrix; and respectively carrying out information analysis processing on the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area to correspondingly obtain the page number, the X coordinate, the user information and the Y coordinate, and finishing decoding. The recognition efficiency can be improved, the error rate can be reduced, and the use cost can be reduced.

Description

Dot matrix code, encoding method and decoding method thereof, controller and electronic equipment
Technical Field
The present invention relates to the field of dot matrix codes, and in particular, to a dot matrix code, and an encoding method, a decoding method, a controller, and an electronic device thereof.
Background
The dot matrix code pen is mainly applied to the application field of the electronic Internet of things, such as education, offices and the like. The dot matrix code pen collects dot matrix codes printed or printed on the surface of a medium through a camera in the pen, and information data recorded in the dot matrix codes are obtained through analysis and decoding. The dot matrix code is a kind of small dots printed or printed on the surface of medium according to specific regular code arrangement, the small dots are square or round, and the size is about 0.1 mm. Typically, the matrix code is arranged in code dot basic units across the writing medium, each code dot unit occupying a small block of locations. The relevant information of the track position of pen writing can be obtained under the writing application scene. In the related art, the efficiency of identifying effective information from the dot matrix code is lower, the error rate is higher, and the dot matrix code used at present needs to adopt a printer with higher precision to print when being printed, so that the use cost is higher.
Disclosure of Invention
The invention provides a dot matrix code, a coding method, a decoding device and electronic equipment thereof, which can improve the identification efficiency, reduce the bit error rate and reduce the use cost.
In a first aspect, an embodiment of the present invention provides a lattice code, including:
at least one code point information matrix, wherein a plurality of positioning codes are arranged in each code point information matrix;
The code point information matrix is divided into a rectangular page number information code area, an X coordinate information code area, a user information code area and a Y coordinate information code area by the positioning code;
the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area all comprise a first information unit positioned at the upper right, a second information unit positioned at the upper left, a third information unit positioned at the lower left and a fourth information unit positioned at the lower right;
each information unit comprises four information code points which are arranged in an oblique cross manner, wherein the information code points are first code points with a code value of 0 or second code points with a code value of 1; the first code points are hollow dots; the second code points are solid dots; the four information code points represent a binary value;
in the same dot matrix code, the information units in the user information code areas of the code point information matrixes are the same; in each of the dot matrix codes located on the same page, the information units in the page number information code region are all the same.
According to some embodiments of the invention, the code point information matrix is divided by the positioning code into a page number information code region located at the upper right, an X-coordinate information code region located at the upper left, a user information code region located at the lower left, and a Y-coordinate information code region located at the lower right;
Alternatively, the code point information matrix is divided by the positioning code into a page information code region located at the upper left, an X-coordinate information code region located at the upper right, a user information code region located at the lower right, and a Y-coordinate information code region located at the lower left.
In a second aspect, an embodiment of the present invention provides a method for encoding a matrix code, including:
setting at least one code point information matrix;
setting a plurality of positioning codes in each code point information matrix, and dividing the code point information matrix into a page number information code area, an X coordinate information code area, a user information code area and a Y coordinate information code area; the code point information matrix is characterized in that the page number information code area is positioned at the upper right, the X coordinate information code area is positioned at the upper left, the user information code area is positioned at the lower left, and the Y coordinate information code area is positioned at the lower right; or, in the code point information matrix, the page number information code area is positioned at the upper left, the X coordinate information code area is positioned at the upper right, the user information code area is positioned at the lower right, and the Y coordinate information code area is positioned at the lower left;
a first information unit positioned at the upper right, a second information unit positioned at the upper left, a third information unit positioned at the lower left and a fourth information unit positioned at the lower right are arranged in the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area;
Setting four information code points which are arranged in a cross shape in each information unit; the information code points are first code points with a code value of 0 or second code points with a code value of 1; the first code points are hollow dots; the second code points are solid dots; the four information code points represent a binary value;
generating the lattice code; in the same dot matrix code, the information units in the user information code areas of the code point information matrixes are set in the same mode so as to represent the same user information; in each of the dot matrix codes located on the same page, the information units in the page information code area are set in the same manner to characterize the same page information.
According to some embodiments of the invention, the encoding method further comprises:
analyzing the acquired PDF format file to obtain file content;
carrying out channel processing on the file content, and emptying K channel data of the file content or creating a spot color channel;
and drawing the dot matrix code on the K channel or the spot color channel in the PDF format file to obtain an original first code point image displayed with the dot matrix code.
In a third aspect, an embodiment of the present invention provides a decoding method of a dot matrix code, applied to the dot matrix code, where the dot matrix code includes: at least one code point information matrix, wherein a plurality of positioning codes are arranged in each code point information matrix; the code point information matrix is divided into a rectangular page number information code area, an X coordinate information code area, a user information code area and a Y coordinate information code area by the positioning code; the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area all comprise a first information unit positioned at the upper right, a second information unit positioned at the upper left, a third information unit positioned at the lower left and a fourth information unit positioned at the lower right; each information unit comprises four information code points which are arranged in an oblique cross manner, wherein the information code points are first code points with a code value of 0 or second code points with a code value of 1; the first code points are hollow dots; the second code points are solid dots; the four information code points represent a binary value; in the same dot matrix code, the information units in the user information code areas of the code point information matrixes are the same; the information units in the page information code areas are the same in the respective dot matrix codes located on the same page; the code point information matrix is divided into a page number information code area positioned at the upper right, an X coordinate information code area positioned at the upper left, a user information code area positioned at the lower left and a Y coordinate information code area positioned at the lower right by the positioning codes; or the code point information matrix is divided into a page number information code area positioned at the upper left, an X coordinate information code area positioned at the upper right, a user information code area positioned at the lower right and a Y coordinate information code area positioned at the lower left by the positioning code;
The decoding method comprises the following steps:
acquiring a first code point image; the first code point image is used for displaying the dot matrix code obtained after encoding;
performing contour recognition processing on the first code point image according to a positioning code, determining a complete code point information matrix under the condition that a group of user information code areas and page information code areas are recognized, and extracting the code point information matrix;
sequentially extracting the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area from the code point information matrix;
and respectively carrying out information analysis processing on the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area to correspondingly obtain a page number, an X coordinate, user information and a Y coordinate, and finishing decoding.
According to some embodiments of the present invention, the performing information analysis processing on the page information code area, the X-coordinate information code area, the user information code area, and the Y-coordinate information code area respectively, to obtain a page, an X-coordinate, user information, and a Y-coordinate, respectively, includes:
respectively carrying out information code point identification on the first information unit, the second information unit, the third information unit and the fourth information unit which are sequentially extracted from the page number information code area to obtain four binary number groups; converting the four binary number groups into decimal numbers to obtain the page number;
Respectively extracting the first information unit, the second information unit, the third information unit and the fourth information unit in the X coordinate information code region in sequence, and carrying out information code point identification to obtain four binary number groups; converting the four binary groups into decimal numbers to obtain the X coordinate;
respectively carrying out information code point identification on the first information unit, the second information unit, the third information unit and the fourth information unit which are sequentially extracted from the user information code region to obtain four binary number groups; converting the four binary groups into decimal numbers to obtain the user information;
respectively carrying out information code point identification on the first information unit, the second information unit, the third information unit and the fourth information unit which are sequentially extracted from the Y-coordinate information code region to obtain four binary number groups; and converting the four binary groups into decimal numbers to obtain the Y coordinate.
According to some embodiments of the present invention, the performing contour recognition processing on the first code point image according to a positioning code, determining a complete code point information matrix and extracting the code point information matrix when a group of the user information code area and the page information code area are recognized, includes:
Performing gray level binarization processing on the first code point image to obtain a gray level image;
pixel traversal is carried out in the gray level diagram, and code point position information of the positioning codes and the information code points is counted;
determining a dot matrix code area according to the code point position information and a connected component algorithm;
and determining a complete code point information matrix and extracting the code point information matrix every time a group of the user information code region positioned at the lower left corner and the page information code region positioned at the upper right corner are identified.
According to some embodiments of the invention, the acquiring the first code point image includes:
acquiring an original second code point image through an image acquisition device;
performing image enhancement processing on the second code point image to obtain an enhanced first code point image; wherein the image enhancement processing includes: noise reduction processing, smoothing processing, and filtering processing.
In a fourth aspect, embodiments of the present invention provide a controller comprising at least one processor and a memory for communicatively coupling with the at least one processor; the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of encoding a matrix code as claimed in any of the second aspects or to perform the method of decoding a matrix code as claimed in any of the third aspects.
In a fifth aspect, an embodiment of the present invention provides an electronic device, including a controller as described in the fourth aspect.
The embodiment of the invention comprises the following steps: when in coding, coding processing is carried out to obtain a dot matrix code comprising at least one code point information matrix; and a plurality of positioning codes set in each code point information matrix are divided into: a page number information code area, an X coordinate information code area, a user information code area, and a Y coordinate information code area; the code point information matrix comprises a code point information matrix, a page number information code area, a user information code area, a Y coordinate information code area and an X coordinate information code area, wherein the page number information code area is positioned at the upper right, the X coordinate information code area is positioned at the upper left, the user information code area is positioned at the lower left, and the Y coordinate information code area is positioned at the lower right; or the page number information code area is positioned at the left upper part, the X coordinate information code area is positioned at the right upper part, the user information code area is positioned at the right lower part, and the Y coordinate information code area is positioned at the left lower part in the code point information matrix; each information code region comprises a first information unit positioned at the upper right, a second information unit positioned at the upper left, a third information unit positioned at the lower left and a fourth information unit positioned at the lower right; each information unit includes four information code points arranged in a diagonal cross. The code point information matrix comprising the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area and the dot matrix comprising at least one code point information matrix are obtained through coding, and the graphic combination of the dot matrix can keep enough space distance so as to be convenient for printing by using a low-precision printer, thereby reducing the use cost. During decoding, performing contour recognition processing on the acquired first code point image according to the positioning code, determining a complete code point information matrix under the condition that a group of user information code areas and page information code areas are recognized, and extracting the code point information matrix; in the code point information matrix, respectively carrying out information analysis processing on the page information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area which are sequentially extracted, correspondingly obtaining the page, the X coordinate, the user information and the Y coordinate, and finishing decoding; as each code area in the code point information matrix in the dot matrix code is clear, the recognition efficiency is improved, and the error rate is reduced. That is, the embodiment of the invention can improve the recognition efficiency, reduce the error rate and reduce the use cost.
Drawings
Fig. 1A is a schematic diagram of a structure of a code point information matrix of a dot matrix code according to an embodiment of the present invention;
fig. 1B is a schematic diagram of a structure of a code point information matrix of a matrix code according to another embodiment of the present invention;
fig. 2 is a flow chart of a coding method of a matrix code according to an embodiment of the present invention;
fig. 3 is a flow chart illustrating a decoding method of a matrix code according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of an X-coordinate information code region according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of an incomplete information element provided by one embodiment of the present invention;
fig. 6 is a schematic diagram of a hardware structure of a controller according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the invention.
In the description of the present invention, a number means one or more, a number means two or more, and greater than, less than, exceeding, etc. are understood to not include the present number, and above, below, within, etc. are understood to include the present number. The description of the first and second is for the purpose of distinguishing between technical features only and should not be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated or implicitly indicating the precedence of the technical features indicated.
In the description of the present invention, unless explicitly defined otherwise, terms such as arrangement, installation, connection, etc. should be construed broadly and the specific meaning of the terms in the present invention can be reasonably determined by a person skilled in the art in combination with the specific contents of the technical scheme.
First, several terms involved in the present invention are explained:
CMYK channel processing: refers to processing different channels in the CMYK color space to achieve a particular effect. Common processing includes rotation, conversion, extraction, blending, binarization, median filtering, and the like. May be implemented by image processing software or a programming language.
CMYK spot channel processing: it means that in a CMYK image, processing is performed for a specific color channel. Such processes are commonly used in the printing industry to ensure that a particular color is accurately printed. It should be noted that the CMYK spot channel process needs to be performed before printing, as this process affects the final effect of the print.
Connected component algorithm: is an important algorithm in graph theory for finding connected components in undirected or directed graphs. In an undirected graph, the connected component refers to the largest sub-graph where there is a path between any two vertices. In a directed graph, a strongly connected component refers to the largest sub-graph where there is a directed path between any two vertices. Two common connected component algorithms are described below. For example, the Tarjan algorithm based on depth-first search assigns nodes into different strongly connected components by traversing each node in the graph.
The embodiment of the invention provides a dot matrix code, a coding method, a decoding method, a controller and electronic equipment thereof; the decoding method of the dot matrix code comprises the following steps: acquiring a first code point image; the first code point image is used for displaying the dot matrix code obtained after encoding; performing contour recognition processing on the first code point image according to the positioning code, determining a complete code point information matrix under the condition that a group of user information code areas and page information code areas are recognized, and extracting the code point information matrix; extracting a page number information code area, an X coordinate information code area, a user information code area and a Y coordinate information code area in sequence in a code point information matrix; and respectively carrying out information analysis processing on the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area to correspondingly obtain the page number, the X coordinate, the user information and the Y coordinate, and finishing decoding. The recognition efficiency can be improved, the error rate can be reduced, and the use cost can be reduced.
Embodiments of the present invention will be further described below based on the drawings.
In a first aspect, referring to fig. 1A, 1B and 4, the lattice code includes: at least one code point information matrix, wherein a plurality of positioning codes are arranged in each code point information matrix; the code point information matrix is divided into a rectangular page information code area A, X coordinate information code area B, a user information code area C and a Y coordinate information code area D by positioning codes; the page number information code area A, X coordinate information code area B, the user information code area C, and the Y coordinate information code area D each include a first information unit located at the upper right, a second information unit located at the upper left, a third information unit located at the lower left, and a fourth information unit located at the lower right; each information unit comprises four information code points which are arranged in an oblique cross manner, wherein the information code points are first code points with a code value of 0 or second code points with a code value of 1; the first code points are hollow dots; the second code points are solid dots; the four information code points represent a binary value; in the same dot matrix code, the information units in the user information code areas of the code point information matrixes are the same; the information units in the page information code area are the same in each dot matrix code located on the same page.
According to some embodiments of the present invention, referring to fig. 1A, the code point information matrix is divided into a page number information code region located at the upper right, an X-coordinate information code region located at the upper left, a user information code region located at the lower left, and a Y-coordinate information code region located at the lower right by a positioning code; alternatively, referring to fig. 1B, the code point information matrix is divided by the positioning code into a page number information code region located at the upper left, an X-coordinate information code region located at the upper right, a user information code region located at the lower right, and a Y-coordinate information code region located at the lower left.
It will be appreciated that a code point information matrix includes a page information code region A, X, a user information code region C, and a Y coordinate information code region D; each complete information code region comprises four information units, and one information unit comprises four information code points, namely 4*4 information code points; the code point information matrix includes 64 information code points in total, and can generate 2-64 data. The data information carrying capacity of the dot matrix code provided by the embodiment of the invention is large, coordinate data information and user information can be better carried, and various data application requirements can be met.
It will be appreciated that encoding with the positioning code and the information code points results in a code point information matrix comprising a page number information code region, an X-coordinate information code region, a user information code region and a Y-coordinate information code region, and a dot matrix code comprising at least one code point information matrix. In the dot matrix code, enough space distance can be kept between the combination of the positioning code and the information code graph, so that the printer with low precision is convenient to print, pen identification is improved, the error rate is reduced, and the use cost of a user is reduced.
In a second aspect, as shown in fig. 2, the encoding method of the lattice code provided in the embodiment of the present invention is applied to the lattice code as in the first aspect, where the encoding method includes, but is not limited to, steps S110 to S150.
Step S110: at least one code point information matrix is set.
Step S120: setting a plurality of positioning codes in each code point information matrix, and dividing the code point information matrix into a page number information code area, an X coordinate information code area, a user information code area and a Y coordinate information code area; the code point information matrix comprises a code point information matrix, a page number information code area, a user information code area, a Y coordinate information code area and an X coordinate information code area, wherein the page number information code area is positioned at the upper right, the X coordinate information code area is positioned at the upper left, the user information code area is positioned at the lower left, and the Y coordinate information code area is positioned at the lower right; or, the page number information code area is positioned at the left upper part, the X coordinate information code area is positioned at the right upper part, the user information code area is positioned at the right lower part, and the Y coordinate information code area is positioned at the left lower part in the code point information matrix.
Step S130: the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area are respectively provided with a first information unit positioned at the upper right, a second information unit positioned at the upper left, a third information unit positioned at the lower left and a fourth information unit positioned at the lower right.
Step S140: the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area are respectively provided with a first information unit positioned at the upper right, a second information unit positioned at the upper left, a third information unit positioned at the lower left and a fourth information unit positioned at the lower right.
Step S150: generating a dot matrix code; in the same dot matrix code, information units in the user information code areas of the code point information matrixes are set in the same mode to represent the same user information; in each dot matrix code located on the same page, information units in the page information code area are set in the same manner to characterize the same page information.
It should be noted that the lattice code includes three elements of a positioning code, a direction code and an information code, where the positioning code or the direction code is used to position the information code area and characterize the direction of the information code. The information code represents an information data identifier, and a plurality of information codes compose a meaning representing carrying information data.
It should be noted that, a complete code point information matrix may be determined by arranging a plurality of positioning code points, where a code point information matrix is an effective complete information area.
Generating a dot matrix code through steps S110 to S150; the method can utilize the positioning codes and the information code points to encode to obtain a code point information matrix comprising a page number information code area, an X coordinate information code area, a user information code area and a Y coordinate information code area, and a dot matrix code comprising at least one code point information matrix, wherein a sufficient space distance can be kept between graphic combinations of the dot matrix codes so as to facilitate printing by using a low-precision printer, and the use cost is reduced. And each code area in the dot matrix code is clear, which is beneficial to improving the recognition efficiency and reducing the error rate.
According to some embodiments of the invention, the encoding method further comprises: analyzing the acquired PDF format file to obtain file content; carrying out channel processing on file contents, and clearing K channel data of the file contents or creating a spot color channel; and drawing the dot matrix code on a K channel or a spot color channel in the PDF format file to obtain an original first code point image displayed with the dot matrix code.
After the dot matrix codes are obtained by coding, the dot matrix codes are drawn on a K channel or a spot special color channel of a PDF format file, and carbon-containing black ink is used in printing and printing, so that an image acquisition device on decoding equipment can acquire images which display carbon black color code points more clearly; the printing is facilitated by using the low-precision printer, and the use cost is reduced.
In an embodiment, specifically, the channel processing performed on the file content of the PDF format file provided by the user may be CMYK channel processing or CMYK spot channel processing; in the channel processing process, the k channel data of the file content is emptied, or a spot color channel is created; in addition, adobe Systems electronic document standards are used for PDF format file processing, and CMYK channel principles are involved, which are not described here.
In a third aspect, as shown in fig. 3, a decoding method of a lattice code according to an embodiment of the present invention is applied to the lattice code according to the first aspect, where the decoding method includes, but is not limited to, steps S210 to S240.
Step S210: acquiring a first code point image; the first code point image is used for displaying the dot matrix code obtained after encoding.
Step S220: and carrying out contour recognition processing on the first code point image according to the positioning code, determining a complete code point information matrix under the condition that a group of user information code areas and page information code areas are recognized, and extracting the code point information matrix.
Step S230: and sequentially extracting a page number information code area, an X coordinate information code area, a user information code area and a Y coordinate information code area from the code point information matrix.
Step S240: and respectively carrying out information analysis processing on the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area to correspondingly obtain the page number, the X coordinate, the user information and the Y coordinate, and finishing decoding.
After determining the code point information matrix, the X-coordinate information code area, the user information code area, and the Y-coordinate information code area are sequentially extracted in a counterclockwise direction from the page information code area located at the upper right corner in step S230. The extraction is orderly carried out, which is beneficial to improving the decoding efficiency.
Through the steps S210 to S240, the first code point image with better image quality can be identified, and the code point information matrix with clear code area can be quickly and accurately identified, so that the identification efficiency of the code point is improved, and the error rate during decoding is reduced.
According to some embodiments of the invention, step S210 includes, but is not limited to, having: and acquiring an original second code point image through an image acquisition device. Performing image enhancement processing on the second code point image to obtain an enhanced first code point image; wherein the image enhancement processing includes: noise reduction processing, smoothing processing, and filtering processing. The method is favorable for obtaining a first code point image with better image quality; the method is beneficial to improving the accuracy of the contour recognition extraction processing and the code region extraction processing which are carried out subsequently.
Specifically, the image acquisition device may be a camera; can be mounted on a decoding device such as a dot matrix pen.
According to some embodiments of the invention, step S220 includes, but is not limited to, steps S221 through S224.
Step S221: and carrying out gray level binarization processing on the first code point image to obtain a gray level image.
Step S222: and performing pixel traversal in the gray level diagram, and counting code point position information of the positioning codes and the information code points.
Step S223: and determining a dot matrix code area according to the code point position information and the connected component algorithm.
Step S224: and determining a complete code point information matrix and extracting the code point information matrix every time a group of user information code areas positioned at the lower left corner and page information code areas positioned at the upper right corner are identified.
Specifically, gray level binarization processing is performed on the first code point image, and black code points are converted into white (with a value of 255), and other areas are converted into black (with a value of 0). After binarization processing, pixel traversal can be performed in the gray level diagram, so that the positions of code points are counted. And finally, judging and separating a complete code point information matrix according to 5-point adjacent horizontal and vertical components by using a connected component algorithm, wherein the code point information matrix comprises an image data queue.
It can be understood that in the gray level binarization process, a general standard image recognition algorithm, such as a yuv gray level conversion algorithm, is adopted; an edge detection algorithm is used to identify the user information code region and the page information code region, determine a complete code point information matrix, and extract the code point information matrix.
It can be understood that, because the arrangement mode of the positioning codes is fixed, the outline recognition is performed according to the positioning codes, so that the complete code point information matrix can be determined and extracted relatively quickly.
It can be understood that the arrangement modes of the information codes of the four information units in the user information code area are different, and the represented binary number groups are different, so that different user information is represented; the arrangement modes of the information codes of the information units in the page number information code area are different, and the expressed binary number groups are different, so that different page number information is represented. Therefore, in the same page, when the dot matrix code includes a plurality of dot information matrices, the arrangement of the information codes of the information units in the user information code area in each dot information matrix is the same to represent the same user information, and the arrangement of the information codes of the information units in the page information code area is the same to represent the same page information. When a group of user information code areas positioned at the lower left corner and page information code areas positioned at the upper right corner are identified, a complete code point information matrix can be determined.
Even in the case where there is an incomplete information unit as shown in fig. 5, the information unit is determined by extracting the location code by the contour recognition algorithm. And each time a group of user information code areas positioned at the lower left corner and page information code areas positioned at the upper right corner are identified, a complete code point information matrix can be determined, and a complete code point information matrix is spliced for subsequent identification processing.
Through steps S221 to S224, the code point information matrix can be rapidly and accurately identified, the identification efficiency is improved, and the error rate is reduced.
According to some embodiments of the invention, step S240 includes, but is not limited to, steps S241 through S244.
Step S241: respectively carrying out information code point identification on a first information unit, a second information unit, a third information unit and a fourth information unit which are sequentially extracted from a page number information code area to obtain four binary number groups; and converting the four binary groups into decimal numbers to obtain page numbers.
Step S242: sequentially extracting a first information unit, a second information unit, a third information unit and a fourth information unit from the X coordinate information code region respectively, and carrying out information code point identification to obtain four binary number groups; and converting the four binary groups into decimal numbers to obtain an X coordinate.
Step S243: respectively carrying out information code point identification on a first information unit, a second information unit, a third information unit and a fourth information unit which are sequentially extracted from a user information code area to obtain four binary number groups; and converting the four binary groups into decimal system to obtain the user information.
Step S244: respectively carrying out information code point identification on a first information unit, a second information unit, a third information unit and a fourth information unit which are sequentially extracted from a Y-coordinate information code region to obtain four binary number groups; and converting the four binary groups into decimal numbers to obtain Y coordinates.
Sequentially extracting second, third and fourth information units in each code region in a counterclockwise order from the first information unit located at the upper right corner in each information code region through steps S241 to S244; the extraction is orderly carried out, which is beneficial to improving the decoding efficiency.
The specific process of obtaining the X coordinate by performing information analysis processing on the X coordinate information code region will be further described with reference to fig. 4.
And sequentially extracting a first information unit, a second information unit, a third information unit and a fourth information unit aiming at the X-coordinate information code region. In the first information unit, firstly acquiring a code value of an information code point positioned at the upper right corner, then sequentially accessing the rest information code points according to a anticlockwise sequence, and acquiring the code value, wherein the code value of a solid dot is 1, and the code value of a hollow dot is 0; the set of binary groups obtained from the first information unit is: [0] [0] =0; [0] [1] =0; [0] [2] =0; [0] [3] =1.
Similarly, a set of binary numbers obtained from the second information unit is: [1] [0] =0; [1] [1] =0; [1] [2] =0; [1] [3] =1.
The set of binary groups obtained from the third information unit is: [2] [0] =0; [2] [1] =1; [2] [2] =0; [2] [3] =0.
The set of binary groups obtained from the fourth information element is: [3] [0] =0; [3] [1] =0; [3] [2] =0; [3] [3] =1.
The binary array of 4 pieces 4*4 obtained from the X-coordinate information code region is then converted into decimal data. For example, when converting coordinate X: coordinate x= 0001 0001 0100 0001, decimal converting the binary, resulting in coordinate x=4417. Similarly, user information, page numbers, and Y coordinates can be obtained.
In summary, the embodiment of the present invention includes: when in coding, coding processing is carried out to obtain a dot matrix code comprising at least one code point information matrix; and a plurality of positioning codes set in each code point information matrix are divided into: a page information code region located at the upper right, an X-coordinate information code region located at the upper left, a user information code region located at the lower left, and a Y-coordinate information code region located at the lower right; each information code region comprises a first information unit positioned at the upper right, a second information unit positioned at the upper left, a third information unit positioned at the lower left and a fourth information unit positioned at the lower right; each information unit includes four information code points arranged in a diagonal cross. The code point information matrix comprising the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area and the dot matrix comprising at least one code point information matrix are obtained through coding, and the graphic combination of the dot matrix can keep enough space distance so as to be convenient for printing by using a low-precision printer, thereby reducing the use cost. During decoding, contour recognition processing is carried out on the acquired first code point image according to the positioning code, and a complete code point information matrix is determined and extracted under the condition that a group of user information code areas positioned at the lower left corner and page information code areas positioned at the upper right corner are recognized; in the code point information matrix, respectively carrying out information analysis processing on the page information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area which are sequentially extracted, correspondingly obtaining the page, the X coordinate, the user information and the Y coordinate, and finishing decoding; as each code area in the code point information matrix in the dot matrix code is clear, the recognition efficiency is improved, and the error rate is reduced. That is, the embodiment of the invention can improve the recognition efficiency, reduce the error rate and reduce the use cost.
In a fourth aspect, as shown in FIG. 6, an embodiment of the present invention provides a controller 600 comprising at least one processor 601 and a memory 602 for communicatively coupling with the at least one processor; the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of encoding a matrix code as in any of the second aspect or to perform the method of decoding a matrix code as in any of the third aspect.
The controller 600 further includes: input/output interface 603, communication interface 604, bus 605.
The processor 601 may be implemented by a general purpose central processing unit, a microprocessor, an application specific integrated circuit, or one or more integrated circuits, etc., and is configured to execute a related program to implement the technical solution provided in the embodiments of the present application;
the memory 602 may be implemented in the form of read-only memory, static storage, dynamic storage, random access memory, or the like. The memory 602 may store an operating system and other application programs, and when the technical solutions provided in the embodiments of the present application are implemented by software or firmware, relevant program codes are stored in the memory 602, and the encoding method and decoding method for executing the lattice codes of the embodiments of the present application are called by the processor 601.
An input/output interface 603 for implementing information input and output.
The communication interface 604 is configured to implement communication interaction between the apparatus and other devices, and may implement communication through a wired manner (such as USB, network cable, etc.), or may implement communication through a wireless manner (such as mobile network, WIFI, bluetooth, etc.).
The bus 605 transfers information between the various components of the device, such as the processor 601, memory 602, input/output interfaces 603, and communication interfaces 604.
Wherein the processor 601, the memory 602, the input/output interface 603 and the communication interface 604 are communicatively coupled to each other within the device via a bus 605.
The memory, as a non-transitory computer readable storage medium, may be used to store non-transitory software programs as well as non-transitory computer executable programs. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory optionally includes memory remotely located relative to the processor, the remote memory being connectable to the processor through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The apparatus embodiments described above are merely illustrative, in which the elements illustrated as separate components may or may not be physically separate, implemented to reside in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In a fifth aspect, an embodiment of the present invention provides an electronic device, including a controller as in the fourth aspect.
Specifically, the electronic device may be an encoding device, and may perform the encoding method of the matrix code provided in the embodiment of the present invention. The electronic device may also be a decoding device, for example: dot matrix code pen; the decoding method of the matrix code provided by the embodiment of the invention can be executed.
The embodiment of the invention provides a computer readable storage medium, which stores computer executable instructions for causing a computer to execute the encoding method and decoding method of a dot matrix code as provided by the embodiment of the invention.
Those of ordinary skill in the art will appreciate that all or some of the steps, systems, and methods disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as known to those skilled in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by a computer. Furthermore, as is well known to those of ordinary skill in the art, communication media typically include computer readable instructions, data structures, program modules, or other data in a modulated data signal, such as a carrier wave or other transport mechanism, and may include any information delivery media.
While the preferred embodiments of the present invention have been described in detail, the present invention is not limited to the above embodiments, and those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit and scope of the present invention.

Claims (10)

1. A lattice code, comprising:
at least one code point information matrix, wherein a plurality of positioning codes are arranged in each code point information matrix;
the code point information matrix is divided into a rectangular page number information code area, an X coordinate information code area, a user information code area and a Y coordinate information code area by the positioning code;
the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area all comprise a first information unit positioned at the upper right, a second information unit positioned at the upper left, a third information unit positioned at the lower left and a fourth information unit positioned at the lower right;
each information unit comprises four information code points which are arranged in an oblique cross manner, wherein the information code points are first code points with a code value of 0 or second code points with a code value of 1; the first code points are hollow dots; the second code points are solid dots; the four information code points represent a binary value;
In the same dot matrix code, the information units in the user information code areas of the code point information matrixes are the same; in each of the dot matrix codes located on the same page, the information units in the page number information code region are all the same.
2. The matrix code of claim 1, comprising:
the code point information matrix is divided into a page number information code area positioned at the upper right, an X coordinate information code area positioned at the upper left, a user information code area positioned at the lower left and a Y coordinate information code area positioned at the lower right by the positioning codes;
alternatively, the code point information matrix is divided by the positioning code into a page information code region located at the upper left, an X-coordinate information code region located at the upper right, a user information code region located at the lower right, and a Y-coordinate information code region located at the lower left.
3. A method for encoding a matrix code, comprising:
setting at least one code point information matrix;
setting a plurality of positioning codes in each code point information matrix, and dividing the code point information matrix into a page number information code area, an X coordinate information code area, a user information code area and a Y coordinate information code area; the code point information matrix is characterized in that the page number information code area is positioned at the upper right, the X coordinate information code area is positioned at the upper left, the user information code area is positioned at the lower left, and the Y coordinate information code area is positioned at the lower right; or, in the code point information matrix, the page number information code area is positioned at the upper left, the X coordinate information code area is positioned at the upper right, the user information code area is positioned at the lower right, and the Y coordinate information code area is positioned at the lower left;
A first information unit positioned at the upper right, a second information unit positioned at the upper left, a third information unit positioned at the lower left and a fourth information unit positioned at the lower right are arranged in the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area;
setting four information code points which are arranged in a cross shape in each information unit; the information code points are first code points with a code value of 0 or second code points with a code value of 1; the first code points are hollow dots; the second code points are solid dots; the four information code points represent a binary value;
generating the lattice code; in the same dot matrix code, the information units in the user information code areas of the code point information matrixes are set in the same mode so as to represent the same user information; in each of the dot matrix codes located on the same page, the information units in the page information code area are set in the same manner to characterize the same page information.
4. A method of encoding a matrix code according to claim 3, wherein the method of encoding further comprises:
Analyzing the acquired PDF format file to obtain file content;
carrying out channel processing on the file content, and emptying K channel data of the file content or creating a spot color channel;
and drawing the dot matrix code on the K channel or the spot color channel in the PDF format file to obtain an original first code point image displayed with the dot matrix code.
5. A decoding method of a lattice code, applied to a lattice code, the lattice code comprising: at least one code point information matrix, wherein a plurality of positioning codes are arranged in each code point information matrix; the code point information matrix is divided into a rectangular page number information code area, an X coordinate information code area, a user information code area and a Y coordinate information code area by the positioning code; the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area all comprise a first information unit positioned at the upper right, a second information unit positioned at the upper left, a third information unit positioned at the lower left and a fourth information unit positioned at the lower right; each information unit comprises four information code points which are arranged in an oblique cross manner, wherein the information code points are first code points with a code value of 0 or second code points with a code value of 1; the first code points are hollow dots; the second code points are solid dots; the four information code points represent a binary value; in the same dot matrix code, the information units in the user information code areas of the code point information matrixes are the same; the information units in the page information code areas are the same in the respective dot matrix codes located on the same page; the code point information matrix is divided into a page number information code area positioned at the upper right, an X coordinate information code area positioned at the upper left, a user information code area positioned at the lower left and a Y coordinate information code area positioned at the lower right by the positioning codes; or the code point information matrix is divided into a page number information code area positioned at the upper left, an X coordinate information code area positioned at the upper right, a user information code area positioned at the lower right and a Y coordinate information code area positioned at the lower left by the positioning code;
The decoding method comprises the following steps:
acquiring a first code point image; the first code point image is used for displaying the dot matrix code obtained after encoding;
performing contour recognition processing on the first code point image according to a positioning code, determining a complete code point information matrix under the condition that a group of user information code areas and page information code areas are recognized, and extracting the code point information matrix;
sequentially extracting the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area from the code point information matrix;
and respectively carrying out information analysis processing on the page number information code area, the X coordinate information code area, the user information code area and the Y coordinate information code area to correspondingly obtain a page number, an X coordinate, user information and a Y coordinate, and finishing decoding.
6. The method of decoding a dot matrix code according to claim 5, wherein the performing information analysis processing on the page information code region, the X-coordinate information code region, the user information code region, and the Y-coordinate information code region, respectively, to obtain a page, an X-coordinate, user information, and a Y-coordinate, respectively, includes:
Respectively carrying out information code point identification on the first information unit, the second information unit, the third information unit and the fourth information unit which are sequentially extracted from the page number information code area to obtain four binary number groups; converting the four binary number groups into decimal numbers to obtain the page number;
respectively extracting the first information unit, the second information unit, the third information unit and the fourth information unit in the X coordinate information code region in sequence, and carrying out information code point identification to obtain four binary number groups; converting the four binary groups into decimal numbers to obtain the X coordinate;
respectively carrying out information code point identification on the first information unit, the second information unit, the third information unit and the fourth information unit which are sequentially extracted from the user information code region to obtain four binary number groups; converting the four binary groups into decimal numbers to obtain the user information;
respectively carrying out information code point identification on the first information unit, the second information unit, the third information unit and the fourth information unit which are sequentially extracted from the Y-coordinate information code region to obtain four binary number groups; and converting the four binary groups into decimal numbers to obtain the Y coordinate.
7. The decoding method of the dot matrix code according to claim 5, wherein the performing contour recognition processing on the first dot image according to the positioning code, determining a complete dot information matrix and extracting the dot information matrix in the case that a group of the user information code area and the page information code area is recognized, comprises:
performing gray level binarization processing on the first code point image to obtain a gray level image;
pixel traversal is carried out in the gray level diagram, and code point position information of the positioning codes and the information code points is counted;
determining a dot matrix code area according to the code point position information and a connected component algorithm;
and determining a complete code point information matrix and extracting the code point information matrix every time a group of the user information code region positioned at the lower left corner and the page information code region positioned at the upper right corner are identified.
8. The method of decoding a dot matrix code according to claim 5, wherein the acquiring a first code point image comprises:
acquiring an original second code point image through an image acquisition device;
performing image enhancement processing on the second code point image to obtain an enhanced first code point image; wherein the image enhancement processing includes: noise reduction processing, smoothing processing, and filtering processing.
9. A controller comprising at least one processor and a memory for communication with the at least one processor; the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of encoding a matrix code as claimed in any one of claims 3 to 4 or to perform the method of decoding a matrix code as claimed in any one of claims 5 to 8.
10. An electronic device comprising the controller of claim 9.
CN202311504013.8A 2023-11-10 Dot matrix code, encoding method and decoding method thereof, controller and electronic equipment Active CN117692576B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311504013.8A CN117692576B (en) 2023-11-10 Dot matrix code, encoding method and decoding method thereof, controller and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311504013.8A CN117692576B (en) 2023-11-10 Dot matrix code, encoding method and decoding method thereof, controller and electronic equipment

Publications (2)

Publication Number Publication Date
CN117692576A true CN117692576A (en) 2024-03-12
CN117692576B CN117692576B (en) 2024-06-28

Family

ID=

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130206833A1 (en) * 2012-02-15 2013-08-15 International Business Machines Corporation Mapping an image to an object using a matrix code
CN106096488A (en) * 2016-07-20 2016-11-09 华南理工大学 A kind of recognition methods of some horizontal and vertical parity check code
CN111914714A (en) * 2020-07-24 2020-11-10 深圳市鹰硕教育服务股份有限公司 Lattice book interaction method
CN111914514A (en) * 2020-07-03 2020-11-10 深圳市鹰硕教育服务股份有限公司 Generation method of composite coding file, paper file and device
CN114565687A (en) * 2022-02-25 2022-05-31 复旦大学 Method, device, equipment and storage medium for encoding and decoding of data array code
CN114707623A (en) * 2022-06-06 2022-07-05 青岛罗博科技有限公司 Lattice code coding method and coding device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130206833A1 (en) * 2012-02-15 2013-08-15 International Business Machines Corporation Mapping an image to an object using a matrix code
CN106096488A (en) * 2016-07-20 2016-11-09 华南理工大学 A kind of recognition methods of some horizontal and vertical parity check code
CN111914514A (en) * 2020-07-03 2020-11-10 深圳市鹰硕教育服务股份有限公司 Generation method of composite coding file, paper file and device
CN111914714A (en) * 2020-07-24 2020-11-10 深圳市鹰硕教育服务股份有限公司 Lattice book interaction method
CN114565687A (en) * 2022-02-25 2022-05-31 复旦大学 Method, device, equipment and storage medium for encoding and decoding of data array code
CN114707623A (en) * 2022-06-06 2022-07-05 青岛罗博科技有限公司 Lattice code coding method and coding device

Similar Documents

Publication Publication Date Title
JP6139396B2 (en) Method and program for compressing binary image representing document
US8768052B2 (en) Image processing apparatus, image processing method, and non-transitory computer readable medium
CN109062521B (en) Print data processing method and device, computer device and storage medium
CN111340037B (en) Text layout analysis method and device, computer equipment and storage medium
CN101226594B (en) Pattern separating extraction device and pattern separating extraction method
US8086040B2 (en) Text representation method and apparatus
US20160379031A1 (en) High capacity 2d color barcode design and processing method for camera based applications
EP0949579A2 (en) Multiple size reductions for image segmentation
CN108319578B (en) Method for generating medium for data recording
CN117692576B (en) Dot matrix code, encoding method and decoding method thereof, controller and electronic equipment
CN112036294B (en) Method and device for automatically identifying paper form structure
CN110008782A (en) The acquisition methods and device of bar code information
CN113592831A (en) Method and device for detecting printing error and storage medium
CN117692576A (en) Dot matrix code, encoding method and decoding method thereof, controller and electronic equipment
CN111428446A (en) Questionnaire generation method, questionnaire identification method and questionnaire identification system
CN107330470B (en) Method and device for identifying picture
CN112883977A (en) License plate recognition method and device, electronic equipment and storage medium
JP2003046746A (en) Method and apparatus for processing image
CN113901936B (en) Hard-pen calligraphy field character grid section image extraction method, system and equipment
JP5517028B2 (en) Image processing device
JP2006093880A (en) Image processing apparatus and control method thereof, computer program, and computer-readable storage medium
CN116720487A (en) Automatic entry method, system and device for standing book data and storage medium
CN112733567B (en) Method and device for identifying two-dimension code of motor vehicle and computer readable storage medium
CN115757843B (en) Image labeling method, device, terminal equipment and storage medium
JP3253201B2 (en) Image processing device and image type determination method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant