Dot matrix generation and reading method
Patent Information
- Application Number
- CN202510861605.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2045-06-25
AI Technical Summary
[0008]针对现有技术存在的各种问题,本发明提供一种点阵生成及其读取方法,旨在解决闭环微点阵设计中的点阵不均匀、固定定位和可扩展的平铺问题,能够高效、灵活地处理不同数据类型,并支持加密功能,以满足溯源、物流管理等领域对信息编码与解码的多样化需求
本发明通过将原始信息、纠错信息和自定义安全信息综合处理后转换成点阵形式,有效提高了信息承载量,同时保证了信息的完整性和可恢复性。点阵图像作为一种新型的信息载体,相较于传统的二维码或条形码,能够在更小的面积内承载更多的信息,且读取过程更为高效便捷。
Smart Images

Figure CN120671706B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information processing technology, and specifically to a method for generating and reading dot matrix data. Background Technology
[0002] With the rapid development of information technology, traceability and logistics management are playing an increasingly important role in various industries. Currently, QR code or barcode technology is widely used in the industry for information transmission. These technologies rely on mature traceability system software and fast reading devices, including personal digital assistants (PDAs), to achieve rapid and convenient reading and querying of information, greatly improving logistics efficiency and product traceability capabilities.
[0003] In the field of anti-counterfeiting, information technology also plays a crucial role. Encrypted QR codes, as an important anti-counterfeiting measure, create QR codes by encrypting existing information or embedding unique security information within compatible general QR code recognition software. This not only verifies the origin of the QR code but also reduces the risk of counterfeiters creating counterfeit codes in bulk after the code packet is leaked. However, the added encryption step increases the decoding time required for encrypted QR codes. Furthermore, to maintain compatibility with regular QR codes, improved error correction capabilities are needed, often leading to an increase in the output code area. This, in turn, increases the time and area costs associated with traceability and other operations.
[0004] On the other hand, micro-dot matrix / dot matrix technology, as an emerging anti-counterfeiting method, converts information into binary and encodes it (including error correction). Then, it is printed at high resolution according to the designed positioning points and the order of the output binary data. Encryption steps are inserted during the information conversion process, forming a closed loop for generation and reading, effectively preventing the mass production of counterfeit codes. Micro-dot matrix technology is particularly suitable for scenarios where the area is too small to use QR codes or where higher security is required. Furthermore, by tiling or linking micro-dot matrix sub-blocks, they can also be used as background patterns to present large areas and carry more information. In addition, printing micro-dot matrices with invisible ink is exclusively for professional use, further enhancing the anti-counterfeiting effect.
[0005] However, whether it's a regular QR code, barcode, or a QR code incorporating micro-dot matrix technology, all face certain challenges in practical applications. First, these technologies all require a certain area to carry the information, and while encrypted QR codes improve security, they also increase the area of the output code and the reading time. Second, when these technologies are applied to anti-counterfeiting or traceability, the demand for ordinary consumers to participate in verification is increasingly prominent. Especially for products with high safety requirements, such as food, infant products, and pharmaceuticals, ordinary consumers not only want to verify authenticity but also often have traceability needs. However, if these codes are tampered with by criminals, easily obtaining information by scanning them could become a high-risk phishing attack, seriously threatening consumers' rights.
[0006] While the closed-loop design of micro-dot matrix technology enhances anti-counterfeiting capabilities, it also presents some challenges. For instance, the simple output method of 0 output and 1 blank inevitably leads to unevenness in the output dot matrix. Although obvious positioning points facilitate rapid location, the fixed positioning information can become a target for cracking after encryption and algorithmic uniform output are implemented. Furthermore, the presence of tiled positioning information can also cause unevenness in the dot matrix.
[0007] Therefore, how to develop a new anti-counterfeiting and traceability technology that can quickly and conveniently read information, ensure information security, prevent counterfeiting and tampering, and meet the different needs of ordinary consumers and professionals has become an urgent problem to be solved in the industry. Summary of the Invention
[0008] To address the various problems existing in the prior art, this invention provides a dot matrix generation and reading method, which aims to solve the problems of dot matrix non-uniformity, fixed positioning and scalable tiling in closed-loop micro dot matrix design. It can efficiently and flexibly handle different data types and support encryption functions to meet the diverse needs of information encoding and decoding in fields such as traceability and logistics management.
[0009] Furthermore, this invention integrates existing front-end software technologies (mini-programs, web pages, etc.) for acquiring high-quality images, enabling consumers to quickly and easily query and receive feedback on anti-counterfeiting and traceability information. Through ingenious design, this invention combines security information, error correction information, and original information, along with customized positioning information, effectively and quickly solving the aforementioned problems even with irregular micro-dot matrix output areas.
[0010] The present invention achieves the above objectives through the following technical solutions: A method for generating and reading a dot matrix includes: Steps for generating a dot matrix: Set the information output parameters; process the original information, error correction information, and custom security information to form an information sequence to be converted; convert the processed information sequence into a dot matrix format according to the set information output parameters; output the generated dot matrix image. Dot matrix reading steps: Preprocess the acquired raster image; Calculate the number N of connected regions in the raster image, and determine the center point of each connected region and the distance D(N,N) between the points; The corresponding ratio of distance d0 is adaptively calculated based on the distance between points D(N,N), and the image magnification is corrected to restore the original ratio of the dot matrix image. Using custom positioning information and length and width parameters, a positioning candidate is determined, and information is extracted from the dot matrix image according to the scanning method for decoding, and finally the decoded information is output.
[0011] According to a dot matrix generation and reading method provided by the present invention, information output parameters are set, including: Determine the region where each pair of bits corresponds to an output of s0×s0 pixels, and simultaneously determine the actual area and shape of the information point; where distance d0 is the distance between the output points corresponding to each pair of bits; Custom security information, which is a specific string or data used to enhance dot matrix security, is encoded in binary form so that it can be converted into a dot matrix along with other information; Based on the total bit length Len after combining the original information, error correction information, and security information, calculate and determine the length and width parameters W and H of the final dot matrix; Custom location information: Customized based on the overall layout of the dot matrix image and security requirements.
[0012] According to a dot matrix generation and reading method provided by the present invention, original information, error correction information, and custom security information are encoded, error-corrected, and encrypted as needed to form an information sequence to be converted, specifically including: The original information is formatted and standardized, with unified character encoding and removal of redundant characters; custom security information is directly encoded into binary. The preprocessed original information and binary encoding are converted into a binary bit stream using a preset encoding rule to form an initial information sequence. An error correction coding algorithm is applied to the initial information sequence to generate an error correction information sequence with error detection and correction capabilities by adding redundant check bits. The error correction code parameters are dynamically configured according to the importance of the information and the transmission environment. Based on security requirements, symmetric or asymmetric encryption algorithms are used to encrypt the error correction information sequence to generate an encrypted information sequence. The encrypted information sequence is concatenated with the unencrypted control information to form a complete information sequence to be converted; the control information is used to identify the information type, encoding method and error correction level to ensure that the receiving end can correctly parse the information content.
[0013] According to a dot matrix generation and reading method provided by the present invention, when processing custom security information, a string or data or its summary is selected from a predefined character set, string library or string generated according to specific needs as security information. The string or data is reserved as secret information when generating the dot matrix and is not directly displayed in the dot matrix image. The custom security information is converted into binary form according to ASCII code or other predetermined encoding method so that it can be encoded and converted together with other information during the dot matrix generation process.
[0014] According to a dot matrix generation and reading method provided by the present invention, when customizing positioning information, a security element as a secret is incorporated into the positioning information, which includes the positioning output code of the entire information range and the location information; In the process of calculating and outputting all encoded information and security information to form an information block, the arrangement of all information points, including positioning points, in the information block follows the following rules: Seamless arrangement rule: When it is necessary to present a seamless layout of all points to be arranged (including positioning points and information points), all points to be arranged are arranged according to the s0×s0 pixels and distance d0, and then filled in sequentially according to the predetermined geometric arrangement to ensure that adjacent information points are closely adjacent to each other without more blank intervals, so as to achieve the continuity and integrity of information blocks in space. Gap Arrangement Rule: When it is necessary to control the density of the entire output points, all points to be arranged are arranged in a white space manner. Specifically, according to the s0×s0 pixels and the distance d0, after arranging the points representing two bits, a certain blank area is left between the information representing two bits according to the preset white space ratio and white space mode, as well as the predetermined geometric arrangement. The white space ratio and white space mode are set based on at least one of the overall layout requirements of the information block and the density of the output. According to the method for generating and reading a dot matrix provided by the present invention, the dot matrix generation step further includes tiling of information blocks: Define the tiling rules for information blocks. These rules allow the bitmap image of an information block to be randomly tiled and expanded in any given area, either seamlessly or nearly seamlessly, or with no repetition in the area. During tiling, the edge information of adjacent information blocks can be connected by adding random numbers through a preset matching rule. During the tiling process, each information block can be dynamically generated based on the final length and width parameters W and H, the final output image size, and the internal logic of the bitmap image.
[0015] According to a dot matrix generation and reading method provided by the present invention, the calculation of the number of connected regions N, the center point, and the distance D(N,N) between points in the dot matrix reading step includes: Perform connected region analysis on the preprocessed raster image, identify and mark all connected regions in the image, and count the total number of connected regions as N; For each detected connected region, calculate the coordinates (xi, yi) of its geometric center point, where i = 1, 2, 3, ..., N, which serve as the representative position of the connected region; Based on the coordinates (xi, yi) of the center point of each connected region, calculate the Euclidean distance between any two center points and construct an N×N dimensional point distance matrix D(N,N), where the matrix element D(i,j) represents the distance between the center points of the i-th and j-th connected regions, and D(i,j)=D(j,i), and the diagonal element D(i,i)=0. Sort each column of the distance matrix D(N,N) from smallest to largest to obtain the sorted distance matrix Sd(N,N); extract the second row of the sorted matrix Sd(N,N), that is, when i=2, all elements of the distance set from each center point to its nearest neighbor other than itself, denoted as Sd(2,1:N). Calculate the arithmetic mean of all distance values in Sd(2,1:N), and use this mean as the average distance D0 between the output information points corresponding to every two bits in the bitmap image.
[0016] According to a dot matrix generation and reading method provided by the present invention, a scaling relationship between a preset distance d0 and an actual calculated average distance D0 is calculated, namely R=D0 / d0, where R represents the scaling factor of the dot matrix image relative to the preset standard during generation when it is actually read.
[0017] According to a dot matrix generation and reading method provided by the present invention, when determining location candidates, based on customized location information, location features that meet the information are searched in the dot matrix image, and all areas that may meet the location conditions are marked as location candidates. Based on the length and width parameters H and W of the dot matrix image, the validity of each positioning candidate is verified. The verification process includes at least checking whether the candidate area is within the effective range of the dot matrix image, whether the size of the candidate area matches the preset H and W parameters, and whether the candidate area meets other predefined positioning constraints. Each location candidate that passes the validity verification is treated as a candidate for an information block. According to the preset scanning method, information points are scanned in the location candidate area according to the preset path and order. Each scan acquires all bits of the information block.
[0018] According to a dot matrix generation and reading method provided by the present invention, the information bit sequence in an information block obtained by scanning is divided in reverse order when the dot matrix is generated to recover the original data information sequence; for the recovered data information sequence, the encoded information is extracted using custom security information, and then the error correction code decoding algorithm is applied to correct the errors that may occur during transmission or storage based on the previously embedded error correction information to obtain the accurate and error-free original information of the information block.
[0019] For the dot matrix output after tiling multiple information blocks, the above process can be repeated to obtain multiple blocks of original information after error correction, and the voting rule can be used to obtain the final accurate original information.
[0020] Therefore, the dot matrix generation and reading method of the present invention has the following significant advantages compared with the prior art: This invention effectively increases information carrying capacity while ensuring information integrity and recoverability by comprehensively processing original information, error correction information, and customized security information and converting them into a dot matrix format. As a novel information carrier, dot matrix images can carry more information in a smaller area compared to traditional QR codes or barcodes, and the reading process is more efficient and convenient.
[0021] The embedding of custom security information and the addition of error correction information enhance the anti-counterfeiting capabilities of the generated raster images. Even if the raster image is damaged to some extent during transmission or storage, the original data can be recovered through error correction information, thus ensuring the accuracy and security of the information. Furthermore, the application of custom positioning information and aspect ratio parameters further increases the difficulty of cracking, effectively preventing forgery and tampering.
[0022] This invention adaptively calculates the corresponding proportion of distance d0 by calculating the number of connected regions and the distance between points in a dot matrix image, and corrects the image magnification, so that the dot matrix image can maintain its original proportion under different magnifications or sizes of output, ensuring accurate reading and fast parsing of information. This is especially important for dot matrix images that need to be applied in different scenarios, such as printed materials and displays, and is also important for users who need to use different acquisition devices to acquire images, such as mobile phones and PDAs from different manufacturers.
[0023] By utilizing customized positioning information and length and width parameters, this invention can accurately identify potential positioning targets and extract information from the dot matrix image for decoding according to a preset scanning method. This flexible positioning and decoding mechanism not only improves reading efficiency but also enhances system compatibility and scalability. Both ordinary consumers and professionals can quickly and accurately obtain information from dot matrix images using appropriate reading devices or software.
[0024] The dot matrix generation and reading method of this invention has broad application prospects. In the fields of traceability and logistics management, it can serve as an important means of product identification and information transmission, improving logistics efficiency and product traceability capabilities. In the field of anti-counterfeiting, it can serve as an effective tool to prevent counterfeiting and tampering, protecting consumer rights. Furthermore, it can be applied to various fields such as invoices, certificates, and artworks, providing new solutions for information management and anti-counterfeiting in these areas.
[0025] In summary, the dot matrix generation and reading method of the present invention, through innovative technical means and flexible application mechanisms, achieves efficient information carrying and reading, enhanced anti-counterfeiting and security, adaptive image magnification correction, and broad application prospects, providing strong support for technological progress and industrial development in related fields.
[0026] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments. Attached Figure Description
[0027] Figure 1 This is a flowchart of an embodiment of a dot matrix generation and reading method according to the present invention.
[0028] Figure 2 This is a flowchart of the dot matrix generation steps in an embodiment of a dot matrix generation and reading method of the present invention.
[0029] Figure 3 This is a flowchart of the dot matrix reading step in an embodiment of a dot matrix generation and reading method of the present invention.
[0030] Figure 4 This is a schematic diagram of a design example for outputting every two bits in an embodiment of a dot matrix generation and reading method of the present invention.
[0031] Figure 5 This is a schematic diagram of a design example of two-bit output when s0 is an even number, in an embodiment of a dot matrix generation and reading method of the present invention.
[0032] Figure 6 This is a schematic diagram of a design example of positioning 1212 and positioning 0123 in an embodiment of a dot matrix generation and reading method of the present invention.
[0033] Figure 7 This is a schematic diagram of the scanning method (information storage) of 1 bit in an embodiment of a dot matrix generation and reading method of the present invention.
[0034] Figure 8 This is a schematic diagram of the dot matrix generation and reading system in an embodiment of the dot matrix generation and reading method of the present invention.
[0035] Figure 9This is a diagram showing the effect of different outputs in an embodiment of a dot matrix generation and reading method of the present invention. Detailed Implementation
[0036] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0037] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0038] See Figures 1 to 9 This embodiment provides a method for generating and reading a dot matrix, such as... Figures 1 to 3 As shown, the method includes: Steps for generating a dot matrix: Set the information output parameters; process the original information, error correction information, and custom security information to form an information sequence to be converted; convert the processed information sequence into a dot matrix format according to the set information output parameters; output the generated dot matrix image. Dot matrix reading steps: Preprocess the acquired raster image; Calculate the number N of connected regions in the raster image, and determine the center point of each connected region and the distance D(N,N) between the points; The corresponding ratio of distance d0 is adaptively calculated based on the distance between points D(N,N), and the image magnification is corrected to restore the original ratio of the dot matrix image. Using custom positioning information and length and width parameters, a positioning candidate is determined, and information is extracted from the dot matrix image according to the scanning method for decoding, and finally the decoded information is output.
[0039] In the above dot matrix generation steps, information output parameters are set, including: Determine the region where each pair of bits corresponds to an output of s0×s0 pixels; Determine the region where each pair of bits corresponds to an output of s0×s0 pixels, and simultaneously determine the actual area and shape of the information point; where distance d0 is the distance between the output points corresponding to each pair of bits. Alternatively, distance d0 can also be the straight-line distance from the center of the information point to its corresponding center point or reference point; Custom security information, which is a specific string or data used to enhance dot matrix security, is encoded in binary form so that it can be converted into a dot matrix along with other information; Based on the total bit length Len after combining the original information, error correction information, and security information, calculate and determine the length and width parameters W and H of the final dot matrix; Custom location information: Customized based on the overall layout of the dot matrix image and security requirements.
[0040] In the above dot matrix generation steps, the original information, error correction information, and custom security information are encoded, error-corrected, and encrypted as needed to form an information sequence to be converted, specifically including: The original information is formatted and standardized, with unified character encoding and removal of redundant characters; custom security information is directly encoded into binary. The preprocessed original information and binary encoding are converted into a binary bit stream using a preset encoding rule to form an initial information sequence. An error correction coding algorithm is applied to the initial information sequence to generate an error correction information sequence with error detection and correction capabilities by adding redundant check bits. The error correction code parameters are dynamically configured according to the importance of the information and the transmission environment. Based on security requirements, symmetric or asymmetric encryption algorithms are used to encrypt the error correction information sequence to generate an encrypted information sequence. The encrypted information sequence is concatenated with the unencrypted control information to form a complete information sequence to be converted; the control information is used to identify the information type, encoding method and error correction level to ensure that the receiving end can correctly parse the information content.
[0041] In this embodiment, when processing custom security information, a string or data or its summary is selected from a predefined character set, string library, or string generated according to specific needs as security information. This string or data is reserved as secret information when generating the dot matrix and is not directly displayed in the dot matrix image. The custom security information is converted into binary form according to ASCII code or other predetermined encoding methods so that it can be encoded and converted together with other information during the dot matrix generation process.
[0042] In this embodiment, when customizing the location information, a security element as a secret is incorporated into the location information. This location information includes the location output code and location information for the entire information range. In the process of calculating and outputting all encoded information and security information to form an information block, the arrangement of all information points, including positioning points, in the information block follows the following rules: Seamless arrangement rule: When the output points within an information block need to be laid out seamlessly, all the points to be arranged are filled in sequentially according to the pre-designed s0×s0 and d0 arrangement to represent two bits of information points, and the predetermined geometric arrangement, to ensure that adjacent information points are closely adjacent to each other without any more blank intervals, so as to achieve the continuity and integrity of the information block in space. Gap Arrangement Rules: When it is necessary to control the density of the entire output points, all information points, including the positioning points, are arranged using a white space method. Specifically, according to the pre-designed s0×s0 and d0, after arranging the information points representing two bits, a certain blank area is left between the information points according to the preset white space ratio and white space mode. The white space ratio and white space mode are set based on at least one of the overall layout requirements of the information block and the density of the output. In this embodiment, the location information is one of the security details, including the location output code that encompasses the entire information range (i.e., each location point is two bits) and the position (the simplest form is a rectangle: the top left, bottom left, top right, and bottom right bits represent the secret, but this is not found in the pattern itself; it is stored as a secret in the background). When customizing the location information, a security element is incorporated as a secret (this can be understood as each of the four location points being different, i.e., using eight bits to describe the location information as a secret, which is needed for subsequent traversal location candidate and decoding scan). Therefore, during the dot matrix generation process, even completely identical information can have different forms in different batches.
[0043] The dot matrix generation step also includes: Define the tiling rules for information blocks. These rules allow the bitmap images of information blocks to be randomly tiled and expanded in any given area, either seamlessly or nearly seamlessly, or with no repetition in the area. During tiling, the edge information of adjacent information blocks can be connected by adding random numbers through a preset matching rule. During the tiling process, each information block can be dynamically generated based on the final length and width parameters W and H, the final output image size, and the internal logic of the bitmap image.
[0044] In the dot matrix reading step, the calculation of the number of connected regions N, the center point, and the distance between points D(N,N) includes: Perform connected region analysis on the preprocessed raster image, identify and mark all connected regions in the image, and count the total number of connected regions as N; For each detected connected region, calculate the coordinates (xi, yi) of its geometric center point, where i = 1, 2, 3, ..., N, which serve as the representative position of the connected region; Based on the coordinates (xi, yi) of the center point of each connected region, calculate the Euclidean distance between any two center points and construct an N×N dimensional point distance matrix D(N,N), where the matrix element D(i,j) represents the distance between the center points of the i-th and j-th connected regions, and D(i,j)=D(j,i), and the diagonal element D(i,i)=0. Sort each column of the distance matrix D(N,N) from smallest to largest to obtain the sorted distance matrix Sd(N,N); extract the second row of the sorted matrix Sd(N,N), that is, when i=2, all elements of the distance set from each center point to its nearest neighbor other than itself, denoted as Sd(2,1:N). Calculate the arithmetic mean of all distance values in Sd(2,1:N), and use this mean as the average distance D0 between the output information points corresponding to every two bits in the bitmap image.
[0045] Based on the preset distance d0 and the actual calculated average distance D0, the scaling relationship between the two is calculated as R=D0 / d0, where R represents the scaling factor of the bitmap image relative to the preset standard during actual reading.
[0046] When identifying potential locations, based on custom location information, the system searches for location features in the dot matrix image that match the information, and marks all possible locations that meet the location criteria as potential locations. Based on the length and width parameters H and W of the dot matrix image, the validity of each positioning candidate is verified. The verification process includes at least checking whether the candidate area is within the effective range of the dot matrix image, whether the size of the candidate area matches the preset H and W parameters, and whether the candidate area meets other predefined positioning constraints. For each location candidate group that passes the validity verification, it is treated as a candidate for an information block. According to the preset scanning method, the information points are scanned in the location candidate area according to the preset path and order, and all bits of the information block are obtained in each scan.
[0047] The information bit sequence in an information block obtained by scanning is divided in reverse order when the dot matrix is generated to recover the original data information sequence. For the recovered data information sequence, the encoded information is extracted using custom security information, and then the error correction code decoding algorithm is applied to correct any errors that may occur during transmission or storage based on the previously embedded error correction information, so as to obtain the accurate original information of the information block.
[0048] For the dot matrix output after tiling multiple information blocks, the above process is repeated to obtain multiple blocks of original information after error correction, and the voting rule is used to obtain the final accurate original information.
[0049] In practical applications, the dot matrix generation and reading method provided in this embodiment is specifically designed as follows: (I) Information output parameter design and dot matrix generation a) Data version; b) Number of pixels output per two bits (s0×s0); c) Two-bit output information; d) Security information; e) Error correction code (can use conventional RS, BCH, etc.); f) Dimensional parameters W, H; g) Positioning information; h) Encryption method (can use conventional DES, AES, etc.); i) Tiling method; j) Scanning method.
[0050] (ii) Dot matrix reading a) Image preprocessing, including noise reduction and binarization (both can be done using conventional methods); b) Line fitting, if image correction is required; c) Calculate the number of connected regions N, the center point, and the distance between points D(N,N); d) Adaptively calculate the distance D0 corresponding to d0 and its proportion; e) Use other parameters to determine the location candidates and decode; f) Repeat e until the overall image processing is completed and the decoded information is output.
[0051] The data information version (3 bits) in this embodiment includes: Numeric only (000), Numeric + English characters (001), ASCII code (010), Chinese characters (011), and whether to encrypt 1 bit: In the case of only numbers (000), directly convert to binary; There are a total of 26 × 2 + 10 = 52 characters, including numbers and English letters (001), and each character is encoded with 6 bits. ASCII code (010): ASCII code (0-127), including characters that cannot be displayed, has a total of 128 characters, which can be directly encoded according to ASCII code. Each character is 7 bits (in actual use, it can be extended to 8 bits to include characters that cannot be displayed). Chinese characters (011): Chinese character encoding, encoded according to national standard Chinese character encoding (such as GB2312, GBK, etc.).
[0052] This embodiment supports multiple data types, including numbers, English characters, ASCII codes, and Chinese characters, and enables flexible switching through version identifiers, meeting diverse needs in different application scenarios.
[0053] The design specifies the number of pixels (s0×s0) output for every two bits, representing the distance (d0) between the information points of the two bits and the area of the information point (this parameter can be set to a specific area, including output shapes such as circles and squares, as well as special shapes such as pentagrams and triangles; hereinafter, it is set to 1 pixel). Here, s0 can be either odd or even, meaning that every two bits will output a square with an area of s0×s0; for example... Figure 4 The values of s0 in (a), (b), and (c) are 7, and the values of d0 are 2, 2.83, and 2.24 respectively. These values are different from the angle of the center point, but the area of each value is 1 pixel or the set size. Figure 5 As shown, s0 is an even number 8, and d0 is 2; for example Figure 4 and Figure 5 As shown, there are 24 possible combinations of 0, 1, 2, and 3 for each pair of bits after determining a certain direction, which is 4 × 3 × 2 × 1. Figure 4 This is represented as a design example with two bits output each (there are 24 combinations for each angular distance). Figure 5 This represents a two-bit output design example when s0 is even (same as above, there are 24 possible designs for each angular distance).
[0054] In this embodiment, the custom security information is used as a secret and encoded as binary; for example, the secret AnQuan in the data information mode (10) has an ASCII code of 65 110 81 117 97 110, which is then converted to binary. In addition, when processing the custom security information and the encoded data, a simple XOR can be used, or an encryption algorithm such as DES can be used.
[0055] The error correction code in this embodiment can be a conventional RS, BCH, etc.
[0056] In this embodiment, the length and width parameters W and H are calculated based on the bit length Len, which is the combination of the original information, error correction information, and security information (encrypted if necessary). The minimum area or perimeter is calculated using W and H, or W and H are set according to a specified area. Since the total number of bits for all information is Len, and each bit is grouped in pairs, the number of information groups is Len / 2. If Len is odd, zeros are padded to make it even. Adding the four groups of positioning information, the total is (Len / 2) + 16 groups. Calculated according to the area of a square, W = H = sqrt((Len / 2) + 16) rounded up. For example, if Len is 85, then sqrt(43 + 16) = 7.68. Therefore, W = H = 8.
[0057] In this embodiment, given the aforementioned security information, the location information is considered one of the secrets. For example, 1212 and 0123 are respectively... Figure 6 As shown (clockwise).
[0058] In this embodiment, the scanning method is selected based on the scanning method identifier: If the scanning method is set to 0, then the zigzag scanning method is used to fill the dot matrix with 32 sets of data in a zigzag path.
[0059] If the scanning method is marked as 1, then the conventional scanning method is used to fill the 32 sets of data into the dot matrix in sequence.
[0060] like Figure 7 As shown, Figure 7 The data consists of 10 bits of information, 32 bits of error correction code, and 22 bits of security information, totaling 64 bits. If equal-length encryption is used, the output will be 64 bits, which are then grouped into two bits and filled into the dot matrix according to the design method of scanning method b), forming the basic dot matrix of the information block containing specific information.
[0061] In this embodiment, the formed dot matrix image, i.e., an information block, is allowed to be randomly tiled and expanded in any given area, either seamlessly or nearly seamlessly, or with no repetition of areas. When tiling the information block, the edge information of adjacent information blocks is connected by a preset matching rule. Based on satisfying the matching rule, the connection of edge information can be further optimized by adding random numbers to enhance the complexity and security of the overall image after tiling. During the tiling process, each information block dynamically generates a complete information block that meets the requirements based on the final determined length and width parameters W and H and the final output image size, combined with the internal logical relationship of the dot matrix image itself. This ensures that the overall image after tiling meets the information carrying and display requirements while having good layout rationality and data integrity.
[0062] Image preprocessing in this embodiment includes noise reduction and binarization. Noise reduction can be achieved first using mean filtering or median filtering. Adaptive binarization can be performed using the Otsu method or a percentage method, specifically including: Noise Removal: The mean filtering algorithm or the median filtering algorithm is used to remove noise from the raster image. The mean filtering algorithm replaces the center pixel value by calculating the average value of the pixel values in a local area of the image to smooth the image and reduce noise. The median filtering algorithm replaces the center pixel value by selecting the median value of the pixel values in a local area of the image to effectively remove isolated noise points such as salt and pepper noise.
[0063] Binarization Processing: Based on the image after noise reduction, an adaptive binarization method is used for image segmentation. Specifically, the Otsu method or the percentage method is selected to determine the binarization threshold. The Otsu method automatically determines the optimal threshold by maximizing the inter-class variance, dividing the image into foreground and background. The percentage method selects a specific percentage position as the threshold based on the distribution of pixel values in the image, setting the area with pixel values higher than the threshold as the foreground and the area with pixel values lower than the threshold as the background, thereby achieving image binarization.
[0064] In this embodiment, the number of connected regions N, the center point, and the distance between points D(N,N) are calculated. Let the coordinates of the center point of each of the N connected regions be (xi, yi), i = 1, 2, 3, ..., N. The pairwise distances D(N,N) are represented by a symmetric matrix with a diagonal of 0. Sort each column in ascending order to obtain Sd(N,N). Sd(2,1:N) represents all distances to the nearest neighbor, and their average is the distance D0 between two bits. The ratio of d0 is calculated, leading to the ratio R = D0 / d0. When image correction is required after image preprocessing, the following linear fitting and correction method is used: Line fitting steps: A conventional line fitting algorithm is used to perform line fitting on the center points of the preprocessed dot matrix image. This algorithm includes, but is not limited to, the Hough transform algorithm, to obtain multiple possible fitted lines in the image. From the majority of fitted lines, a suitable fitted line for correction is selected. The selection criteria are: lines with an angle range within ±45 degrees, and lines perpendicular to these lines; simultaneously, the center points contained on these lines must satisfy the condition that the distances between any two points are approximately integer multiples, and the number of center points conforming to this integer multiple relationship accounts for more than 95% of the total number of center points on the line. This ensures that the selected line is a line composed of the center points of the information points in the dot matrix image, avoiding the information points themselves appearing on the lines used to determine direction and interfering with the correction process. Image correction steps: Magnification and rotation correction: Based on the selected correction fitting line, calculate the magnification scaling ratio and rotation angle of the image. By performing corresponding scaling and rotation operations on the image, the initial correction of the image is achieved, so that the raster image reaches a relatively standard state in the overall scale and direction. Inverse perspective transformation correction (optional): If perspective distortion still exists in the image after magnification and rotation correction, the corresponding ratio of distance d0 is adaptively calculated based on the distance between points D(N,N), and the intersection of fitted straight lines near the four corners of the dot matrix image is selected as control points. Based on the relationship between the actual and ideal positions of these control points, the inverse perspective transformation matrix is calculated, and the image is processed using this matrix to eliminate perspective distortion, thereby restoring the dot matrix image to a standard rectangle or an image conforming to a preset shape, thus ensuring accurate reading of dot matrix information in the future.
[0065] During the bitmap image reading process, the following operations are specifically performed for the image localization and information decoding steps: Location candidate acquisition: Based on pre-defined location information as a key identifier for location in the dot matrix image, a specific matching algorithm or feature recognition method is used to search for feature regions in the pre-processed dot matrix image that match the secret information, thereby obtaining multiple location candidate positions; these location candidate positions are determined based on the potential locations where the secret information may appear in the image, providing candidate points for subsequent image location and information extraction; Candidate location validation: Based on a predefined block size, dot matrix image height H, and width W, which define the standard size and structural features of the dot matrix image, for each group of candidate locations, the image region centered on it is checked to see if it meets the size and structural requirements specified by H and W. Specifically, the pixel distribution, dot matrix spacing, number of feature points, and other parameters within the region are calculated and compared with theoretical values derived based on a block size, H, and W. If the comparison result is within a preset error range, the candidate location group is determined to be valid, meaning that this group of locations is highly likely to be the actual location of the dot matrix image. Information Acquisition and Decoding: For candidate positions of a confirmed positioning group, information is extracted bit by bit from the dot matrix image according to the scanning method in the generation parameter j set when generating the dot matrix image, using the corresponding scanning path and rules. During the extraction process, information is read in groups of two bits. Subsequently, the read information sequence is reversed to restore the original data arrangement order when generating the dot matrix image. Then, the preset error correction code decoding algorithm is used to perform error correction decoding on the reversed data sequence to remove errors that may be introduced during transmission or storage, thus obtaining the accurate original information of the information block. Overall Processing and Output: For the positions of multiple candidate localization groups obtained in the image, repeat the above steps of candidate localization acquisition, candidate validity determination, information acquisition and decoding until the entire bitmap image is fully processed. During the processing, if there are differences in the results obtained from different information blocks, an election mechanism is used to integrate the results. Specifically, the occurrence frequency of each possible result is counted, and the result with the most occurrences (i.e., the highest number of votes) is used as the final decoded information output, thereby improving the accuracy and reliability of the decoding results and ensuring that the original information can be accurately extracted from the complex bitmap image.
[0066] In other words, after the raster image is tiled, multiple information blocks are formed in the image. During the decoding process, even if the information of some information blocks is damaged due to various reasons (such as partial occlusion or damage to the image), the decoding result corresponding to each information block can still be obtained through the decoding operation. Subsequently, the decoding results of each information block are voted on using the above-mentioned election mechanism, and the final output information is determined based on the voting results. In this way, the redundant information carried by multiple information blocks in the tiled image is fully utilized, the fault tolerance of the entire information extraction process to image damage and interference is enhanced, and the accuracy and completeness of information extraction are further improved.
[0067] like Figure 8 As shown, this embodiment also provides a dot matrix generation and reading system, which includes: Matrix generation unit: The parameter setting module is used to set the information output parameters; The generation module processes the raw information, error correction information, and custom security information to form an information sequence to be converted; based on the set information output parameters, it converts the processed information sequence into a dot matrix format to generate a dot matrix image. The output module is used to output the generated raster image; Dot matrix reading unit: The image acquisition module is used to acquire raster images; The image preprocessing module is used to preprocess the acquired raster image; The decoding and output information module is used to extract information from the dot matrix image according to the scanning method, decode it, and finally output the decoded information. The parameter reading module is used to read relevant parameters that may be contained in the bitmap image according to actual needs, providing comprehensive parameter support for accurate decoding and processing of the bitmap image.
[0068] Therefore, this embodiment has the following unique design and operation process in the bitmap image generation and reading process: The information code consists of original information, error correction information, and custom security information. During the information encoding stage, the above three types of information are integrated according to preset rules to form a complete information sequence. To enhance information security, all integrated information can be encrypted again. The encryption algorithm can be flexibly selected according to actual security needs to ensure the confidentiality and integrity of information during transmission and storage.
[0069] The positioning information and length and width (H and W) parameters of the custom bitmap image can be set flexibly according to the actual application scenario and needs. For the same original information, different positioning information, length and width parameters and subsequent bitmap generation rules can generate bitmap images with different appearances, achieve diversified output effects and meet the display needs of different scenarios. During the dot matrix image generation process, the information in the information code is encoded in groups of two bits according to preset rules, and the information of each two bits is output to different positions in the dot matrix image according to the encoding rules. Through the dot matrix generation algorithm, it is ensured that the information bits can be relatively evenly distributed in the image when the entire dot matrix image is output, avoiding information that is too concentrated or sparse, thereby improving the stability and reading accuracy of the dot matrix image.
[0070] In the process of generating bitmap images, another unique bitmap generation method can also be used to ensure that each center point in the bitmap image has output information. This design facilitates subsequent linear fitting and positioning operations. When reading the bitmap image, by calculating the distance between points in the information code, key information such as image magnification and rotation angle can be calculated adaptively and quickly. This information provides an important prerequisite for image correction (such as when there is deformation) and subsequent decoding work. When applying dot matrix image tiling, the layout of the dot matrix image is not limited by a fixed position based on the customized positioning information, and can be flexibly adjusted according to the actual available area. During the tiling process, random or security information can be added to the outer area of the dot matrix image or other suitable locations. This additional information not only increases the complexity and security of the dot matrix image, but also allows for cross-verification with the actual security code in the information code, further enhancing the security and reliability of the information. In terms of the dot matrix generation method, when each center point has an output, this design also makes the distribution of center points in the dot matrix image regular, facilitating linear fitting and positioning operations. When reading the dot matrix image, by calculating the distance between each point in the information code, key information such as image magnification and rotation angle can be adaptively and quickly calculated. This information can serve as a crucial prerequisite for subsequent work such as image correction (if necessary) and decoding. Unlike traditional QR code algorithms, the method provided in this embodiment does not require all the necessary parameters and secret information for decoding to be embedded in the dot matrix image during the dot matrix generation process. By designing custom positioning and security information, combined with externally stored or transmitted secret information, secure storage and retrieval of information are achieved, making the dot matrix image itself difficult to crack and enhancing information security.
[0071] When it is necessary to tile a dot matrix image to adapt to carriers of different sizes or shapes, the method provided in this embodiment can flexibly adjust the dot matrix layout by customizing positioning information, without being restricted by traditional positions; random information or security information can be added to the outer area of the dot matrix according to the actual area. This information not only increases the complexity and security of the dot matrix, but can also be mutually verified with the security code in the information code to ensure information integrity.
[0072] During the dot matrix generation process, by optimizing the scanning method and information distribution strategy, the output positions of every two bits are relatively uniform, avoiding reading difficulties caused by information concentration. During reading, by calculating the distance between the points representing two bits, key parameters such as image magnification can be quickly and adaptively calculated, providing the prerequisites for image correction (if necessary) and decoding. Unlike traditional QR code algorithms, this method does not require all the parameters and secret information needed for decoding to be embedded in the dot matrix. Through a custom positioning and security information verification mechanism, it achieves both flexibility and security. When the dot matrix is tiled, the random information or security information added on the periphery can be mutually verified with the security code in the real data, further enhancing the information anti-counterfeiting capability.
[0073] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0074] The above embodiments are merely preferred embodiments of the present invention and should not be construed as limiting the scope of protection of the present invention. Any non-substantial changes and substitutions made by those skilled in the art based on the present invention shall fall within the scope of protection claimed by the present invention.
Claims
1. A method for generating and reading a dot matrix, characterized in that, include: Steps for generating a dot matrix: Set the information output parameters; The original information, error correction information, and custom security information are processed to form an information sequence to be transformed; Based on the set information output parameters, the processed information sequence is converted into a dot matrix format; Output the generated raster image; Dot matrix reading steps: Preprocess the acquired raster image; Calculate the number N of connected regions in the raster image, and determine the center point of each connected region and the distance D(N,N) between the points; The corresponding ratio of distance d0 is adaptively calculated based on the distance between points D(N,N), and the image magnification is corrected to restore the original ratio of the dot matrix image. Using custom positioning information and length and width parameters, a positioning candidate is determined, and information is extracted from the dot matrix image according to the scanning method for decoding, and finally the decoded information is output. When customizing location information, a security element as a secret is incorporated into the location information, which includes the location output code and location information for the entire information range; In the process of calculating and outputting all the encoded information and security information to form an information block, the arrangement of all points containing positioning points in the information block follows the following rules: Seamless arrangement rule: When it is necessary to present a seamless layout of all points to be arranged, all points to be arranged are arranged according to s0×s0 pixels and distance d0, and then filled in sequentially according to the predetermined geometric arrangement to ensure that adjacent information points are closely adjacent to each other without more blank intervals, so as to achieve the continuity and integrity of information blocks in space. Gap Arrangement Rule: When it is necessary to control the density of the entire output points, all points to be arranged are arranged using a white space method. Specifically, after arranging the points representing two bits according to the s0×s0 pixels and the distance d0, a certain blank area is left between the information representing two bits according to the preset white space ratio and white space mode, as well as the predetermined geometric arrangement. The white space ratio and white space mode are set based on at least one of the overall layout requirements of the information block and the density of the output.
2. The method according to claim 1, characterized in that, Configure information output parameters, including: Determine the region where each pair of bits corresponds to an output of s0×s0 pixels, and simultaneously determine the actual area and shape of the information point; where distance d0 is the distance between the output points corresponding to each pair of bits; Custom security information, which is a specific string or data used to enhance dot matrix security, is encoded in binary form so that it can be converted into a dot matrix along with other information; Based on the total bit length Len after combining the original information, error correction information, and security information, calculate and determine the length and width parameters W and H of the final dot matrix; Custom location information: Customized based on the overall layout of the dot matrix image and security requirements.
3. The method according to claim 1, characterized in that, The original information, error correction information, and custom security information are encoded, error-corrected, and encrypted as needed to form an information sequence to be converted, specifically including: The original information is formatted and standardized, with unified character encoding and removal of redundant characters; custom security information is directly encoded into binary. The preprocessed original information and binary encoding are converted into a binary bit stream using a preset encoding rule to form an initial information sequence. An error correction coding algorithm is applied to the initial information sequence to generate an error correction information sequence with error detection and correction capabilities by adding redundant check bits. The error correction code parameters are dynamically configured according to the importance of the information and the transmission environment. Based on security requirements, symmetric or asymmetric encryption algorithms are used to encrypt the error correction information sequence to generate an encrypted information sequence. The encrypted information sequence is concatenated with the unencrypted control information to form a complete information sequence to be converted; the control information is used to identify the information type, encoding method and error correction level to ensure that the receiving end can correctly parse the information content.
4. The method according to claim 1, characterized in that: When processing custom security information, a string or data or its summary is selected from a predefined character set, string library or string generated according to specific needs as security information. This string or data is reserved as secret information when generating the dot matrix and is not directly displayed in the dot matrix image. Custom security information is converted into binary form according to ASCII code or other predetermined encoding methods so that it can be encoded and converted together with other information during the dot matrix generation process.
5. The method according to claim 1, characterized in that, The dot matrix generation step also includes tiling of information blocks, including: Define the tiling rules for information blocks. These rules allow for seamless, near-seamless, or non-repeating random tiling expansion within any given region based on the bitmap image of an information block. During tiling, the edge information of adjacent information blocks is connected through a preset matching rule. In the tiling process, each information block can be dynamically generated based on the final length and width parameters W and H, the final output image size, and the internal logic of the bitmap image.
6. The method according to claim 1, characterized in that, In the dot matrix reading step, the calculation of the number of connected regions N, the center point, and the distance between points D(N,N) includes: Perform connected region analysis on the preprocessed raster image, identify and mark all connected regions in the image, and count the total number of connected regions as N; For each detected connected region, calculate the coordinates (xi, yi) of its geometric center point, where i = 1, 2, 3, ..., N, which serve as the representative position of the connected region; Based on the coordinates (xi, yi) of the center point of each connected region, calculate the Euclidean distance between any two center points and construct an N×N dimensional point distance matrix D(N,N), where the matrix element D(i,j) represents the distance between the center points of the i-th and j-th connected regions, and D(i,j)=D(j,i), and the diagonal element D(i,i)=0. Sort each column of the distance matrix D(N,N) from smallest to largest to obtain the sorted distance matrix Sd(N,N); extract the second row of the sorted matrix Sd(N,N), that is, when i=2, all elements of the distance set from each center point to its nearest neighbor other than itself, denoted as Sd(2,1:N). Calculate the arithmetic mean of all distance values in Sd(2,1:N), and use this mean as the average distance D0 between the output information points corresponding to every two bits in the bitmap image.
7. The method according to claim 6, characterized in that: Based on the preset distance d0 and the actual calculated average distance D0, the scaling relationship between the two is calculated as R=D0 / d0, where R represents the scaling factor of the bitmap image relative to the preset standard during actual reading.
8. The method according to claim 7, characterized in that: When identifying potential locations, based on custom location information, the system searches for location features in the dot matrix image that match the information, and marks all possible locations that meet the location criteria as potential locations. Based on the length and width parameters H and W of the dot matrix image, the validity of each positioning candidate is verified. The verification process includes at least checking whether the candidate area is within the effective range of the dot matrix image, whether the size of the candidate area matches the preset H and W parameters, and whether the candidate area meets other predefined positioning constraints. Each location candidate that passes the validity verification is treated as a candidate for an information block. According to the preset scanning method, information points are scanned in the location candidate area according to the preset path and order. Each scan acquires all bits of the information block.
9. The method according to claim 8, characterized in that: The information bit sequence in an information block obtained by scanning is divided in reverse order when the dot matrix is generated to recover the original data information sequence of the information block; the encoded information is extracted using custom security information from the recovered data information sequence, and then the error correction code decoding algorithm is applied to correct the errors that may occur during transmission or storage based on the previously embedded error correction information to obtain the accurate original information of the information block. For the dot matrix output after tiling multiple information blocks, the above process can be repeated to obtain multiple blocks of corrected original information, and the voting rule can be used to obtain the final accurate original information.
Citation Information
Patent Citations
Hexagonal information encoding article process and system
CN1039672A
Literature chart extraction and classification method and system, computer equipment and storage medium
CN118135582A