Data transmission method, device and equipment
By using the erasure coding encoding mechanism in data transmission to process data blocks and generate QR code image groups, the problem of low data transmission stability caused by the failure of QR code recognition in the prior art is solved, and the efficiency and stability of data transmission are achieved.
Patent Information
- Application Number
- CN202110582995.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-27
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2041-05-27
AI Technical Summary
In the prior art, when large amounts of data are transmitted, the failure of QR code reading leads to low data transmission stability.
The data block is processed using the erasure coding encoding mechanism, a QR code image group is generated, and a QR code image set is sent to the image reading device through the image generation device. After receiving the reading device, the packet is identified according to the data block marking, and the data block information is restored using the erasure coding encoding mechanism, and finally the transmission information is restored.
The data blocks are converted into QR code image groups through the erasure coding encoding mechanism, which improves the security and transmission stability of the data. Even if some QR code images are lost or cannot be read, the data block information can be restored, improving the effectiveness and stability of data transmission.
Smart Images

Figure CN113326711B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data, and in particular to a data transmission method, device and equipment. Background Art
[0002] A QR code uses a specific geometric pattern of black and white distributed in a two-dimensional direction according to a certain rule to represent information, where black and white represent the binary "0" and "1" bits. In this way, data transmission can be achieved by converting information into a QR code and then reading it with a reading device (image input device or optical scanning device).
[0003] At present, in order to solve the problem of large-scale data transmission, there is a method of arranging and displaying multiple QR codes, and then reading all the QR code data through a reading device and splicing and restoring the data to be transmitted. However, this method requires the data to be transmitted to be processed in segments. In this way, when restoring the data to be transmitted, each QR code needs to be correctly read to restore the data to be transmitted. Failure to read any QR code will result in failure to restore the transmitted data, making the data transmission stability low.
[0004] Therefore, the industry is in urgent need of a technical solution that can solve the above technical problems. Summary of the invention
[0005] The embodiments of this specification provide a data transmission method, apparatus and device, which can effectively improve the stability of data transmission.
[0006] The data transmission method, device and equipment provided in this specification are implemented in the following ways.
[0007] A data transmission method is applied to an image generation device, the method comprising: obtaining information byte codes corresponding to transmission information; dividing the information byte codes into blocks to obtain multiple data blocks; processing each data block according to an erasure code encoding mechanism to obtain a two-dimensional code image group corresponding to each data block; obtaining a two-dimensional code image set corresponding to the transmission information based on the two-dimensional code image group corresponding to each data block; and sending the two-dimensional code image set corresponding to the transmission information to an image reading device.
[0008] A data transmission method is applied to an image reading device, the method comprising: receiving a two-dimensional code image set sent by an image generating device; wherein the two-dimensional code image set comprises a plurality of two-dimensional code images; obtaining data information included in each two-dimensional code image; wherein the data information comprises a data block identifier; grouping the data information according to the data block identifier to obtain a plurality of data information groups; restoring each data information group to data block information based on an erasure code encoding mechanism; and splicing all data block information to obtain transmission information corresponding to the two-dimensional code image set.
[0009] A data transmission method is applied to a data transmission system, the data transmission system includes an image generating device and an image reading device, the method includes: the image generating device obtains information byte codes corresponding to transmission information; the information byte codes are divided into blocks to obtain multiple data blocks; each data block is processed according to an erasure code encoding mechanism to obtain a two-dimensional code image group corresponding to each data block; based on the two-dimensional code image group corresponding to each data block, a two-dimensional code image set corresponding to the transmission information is obtained; the two-dimensional code image set corresponding to the transmission information is sent to an image reading device; the image reading device receives the two-dimensional code image set; data information included in each two-dimensional code image in the two-dimensional code image set is obtained; wherein the data information includes a data block identifier; the data information is grouped according to the data block identifier to obtain multiple data information groups; each data information group is restored to data block information based on the erasure code encoding mechanism; all data block information are spliced to obtain the transmission information corresponding to the two-dimensional code image set.
[0010] A data transmission device includes: an acquisition module for acquiring information byte codes corresponding to transmission information; a block division module for dividing the information byte codes into blocks to obtain multiple data blocks; a processing module for processing each data block according to an erasure code encoding mechanism to obtain a two-dimensional code image group corresponding to each data block; an acquisition module for obtaining a two-dimensional code image set corresponding to the transmission information based on the two-dimensional code image group corresponding to each data block; and a sending module for sending the two-dimensional code image set corresponding to the transmission information to an image reading device.
[0011] A data transmission device includes: a receiving module for receiving a two-dimensional code image set sent by an image generating device; wherein the two-dimensional code image set includes multiple two-dimensional code images; an acquisition module for acquiring data information included in each two-dimensional code image; wherein the data information includes a data block identifier; a grouping module for grouping the data information according to the data block identifier to obtain multiple data information groups; a restoration module for restoring each data information group to data block information based on an erasure code encoding mechanism; and an acquisition module for splicing all data block information to obtain transmission information corresponding to the two-dimensional code image set.
[0012] A data transmission device includes at least one processor and a memory storing computer executable instructions, wherein when the processor executes the instructions, the steps of any method embodiment in the embodiments of this specification are implemented.
[0013] A computer-readable storage medium stores computer instructions, which, when executed, implement the steps of any method embodiment in the embodiments of this specification.
[0014] This specification provides a data transmission method, device and equipment. In some embodiments, the information byte code corresponding to the transmission information can be obtained, the information byte code can be divided into blocks, and multiple data blocks can be obtained; each data block can also be processed according to the erasure code encoding mechanism to obtain the two-dimensional code image group corresponding to each data block, and based on the two-dimensional code image group corresponding to each data block, the two-dimensional code image set corresponding to the transmission information can be obtained. Further, the two-dimensional code image set corresponding to the transmission information can be sent to the image reading device so that the image reading device obtains the data information included in each two-dimensional code image, wherein the data information includes a data block identifier; the data information is grouped according to the data block identifier to obtain multiple data information groups; each data information group is restored to data block information based on the erasure code encoding mechanism; all data block information is spliced to obtain the transmission information corresponding to the two-dimensional code image set. Since each data block is converted into a two-dimensional code image based on the erasure code encoding mechanism, the data is discretely distributed into more data slices, and the data is effectively encrypted, so that the data security is greatly improved. Since each data information group is restored to data block information based on the erasure code encoding mechanism, when part of the two-dimensional code image is missing or part of the two-dimensional code image cannot be read, the data block information can still be restored, thereby greatly improving the effectiveness and stability of data transmission. The implementation scheme provided in this specification can effectively improve the stability of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings described herein are used to provide a further understanding of this specification, constitute a part of this specification, and do not constitute a limitation of this specification. In the drawings:
[0016] Figure 1 It is a scenario diagram of a data transmission method provided in this specification;
[0017] Figure 2 It is a flowchart of an embodiment of a data transmission method provided in this specification;
[0018] Figure 3 This is a schematic diagram of a process for generating a coding matrix provided in this specification;
[0019] Figure 4 is a flowchart of another embodiment of a data transmission method provided in this specification;
[0020] Figure 5 This is a schematic diagram of a data transmission scenario provided in this specification;
[0021] Figure 6 It is a flowchart of a specific embodiment of a data transmission method provided in this specification;
[0022] Figure 7 It is a schematic diagram of the module structure of an embodiment of a data transmission device provided in this specification;
[0023] Figure 8 is a schematic diagram of the module structure of another embodiment of a data transmission device provided in this specification;
[0024] Fig. 9 This is a hardware structure block diagram of an embodiment of a data transmission server provided in this specification. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments in this specification, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field without creative work based on one or more embodiments in this specification shall fall within the scope of protection of the embodiments of this specification.
[0026] like Figure 1 As shown, Figure 1It is a scenario diagram of a data transmission method provided in this specification. Among them, the data transmission method can be applied to a data transmission system. The data transmission system may include an image generation device 101 and an image reading device 102. Among them, the image generation device 101 may obtain the information byte code corresponding to the transmission information; divide the information byte code into blocks to obtain multiple data blocks; process each data block according to the erasure code encoding mechanism to obtain the two-dimensional code image group corresponding to each data block; based on the two-dimensional code image group corresponding to each data block, obtain the two-dimensional code image set corresponding to the transmission information; send the two-dimensional code image set corresponding to the transmission information to the image reading device 102. The image reading device 102 may receive the two-dimensional code image set; obtain the data information included in each two-dimensional code image in the two-dimensional code image set; wherein the data information includes a data block identifier; group the data information according to the data block identifier to obtain multiple data information groups; restore each data information group to data block information based on the erasure code encoding mechanism; splice all data block information to obtain the transmission information corresponding to the two-dimensional code image set. Since each data block is converted into a two-dimensional code image group based on the erasure code encoding mechanism, the data is discretely distributed into more data pieces, and the data is effectively encrypted, thereby greatly improving data security. Since each data information group is restored to data block information based on the erasure code encoding mechanism, the data block information can still be restored when part of the two-dimensional code image is missing or cannot be read, thereby greatly improving the effectiveness and stability of data transmission.
[0027] The image generation device 101 can be used to convert the transmission information into a two-dimensional code image. The image generation device 101 can be a terminal device (such as a smart phone, tablet computer, laptop computer, etc.) or software (such as an image generation application, etc.) operated by a user, or a single server, server cluster, etc.
[0028] The image recognition device 102 can be used to recognize the QR code image and restore the corresponding transmission information based on the QR code image. The image recognition device 102 can be a terminal device (such as a smart phone, tablet computer, laptop computer, etc.) or software (such as an image scanning application, image recognition application, etc.) operated by a user, or a single server, server cluster, etc. The image recognition device 102 can also be called a data restoration device.
[0029] In the embodiments of this specification, the data transmission process may be applicable to a situation where there is no wired communication between the image generating device 101 and the image reading device 102, or may be applicable to other communication situations (such as communication via WIFI, Bluetooth, etc.).
[0030] In the embodiments of this specification, the image generation device 101 and the image reading device 102 can complete all processing steps based on the agreed upon generation matrix. In some implementation scenarios, a generation matrix can be generated by the image generation device, and then encoded into a two-dimensional code image, which is scanned and read by the image reading device, thereby completing the synchronization of both parties using the same generation matrix. Among them, the generation matrix is a suitable matrix selected when performing erasure code encoding. If the generation matrix is unknown, the original information cannot be decoded through the two-dimensional code, so that the generation matrix can ensure data security. The generation matrix can use a Vandermonde matrix (Vandermonde) or a Cauchy matrix (Cauchy). The generation matrix is generated according to mathematical theories such as Vandermonde and Cauchy, so the sub-matrices it includes are all reversible matrices.
[0031] In some implementation scenarios, the image recognition device 102 can restore information using an asynchronous restoration method. In some implementation scenarios, the restored information can be saved as an image file. Furthermore, the image files can be named in a certain order, thereby reducing the order of images and data blocks during parsing, thereby improving data processing efficiency.
[0032] The following is an example of a specific application scenario to illustrate the implementation plan of this specification. Specifically, Figure 2 It is a flowchart of an embodiment of a data transmission method provided in this specification. Although this specification provides method operation steps or device structures as shown in the following embodiments or drawings, the method or device may include more or fewer operation steps or module units after partial combination based on routine or no creative labor.
[0033] It should be noted that the following embodiments described from the perspective of an image generation device do not limit the technical solutions in other application scenarios that can be extended based on this specification. Figure 2 As shown, an embodiment of a data transmission method provided in this specification may include the following steps.
[0034] S20: Obtain the information bytecode corresponding to the transmission information.
[0035] The transmission information can be any information that needs to be transmitted through the QR code. The information byte code can be understood as a data stream that can be read according to bytes.
[0036] In some embodiments, the step of obtaining the information bytecode corresponding to the transmission information may include: obtaining the transmission information; encoding the transmission information into bytecode data; and adding data end mark information to the end of the bytecode data to obtain the information bytecode.
[0037] For example, in some implementation scenarios, the information to be transmitted can be first encoded into bytecode data (for data located on a storage medium, it is read as bytecode), and then the data end mark information is spliced at the end to form a data stream that can be read by byte with a data capacity of M (Byte), that is, the information bytecode is obtained. Among them, the transmission information can support the situation of containing multiple files, and the data end mark information spliced at the end indicates whether the transmission information has been processed. The data end mark information can be used to determine whether the information encoding is completed. For example, the transmission information is not limited to a single file. As long as the agreed data end mark information is not seen, the entire process of encoding the information into a QR code will not end. When all files are processed, the data end mark information is spliced at the end, and finally the data end mark information is also converted into the QR code. In the data restoration stage, whether the processing is completed also needs to be based on whether the data end mark information appears. In some implementation scenarios, the data end mark information can be a special character combination that contains invisible characters and does not appear in the body of the information, such as \0\1\0\0\1.
[0038] S22: Divide the information bytecode into blocks to obtain multiple data blocks.
[0039] In the embodiments of this specification, after obtaining the information byte code corresponding to the transmission information, the information byte code can be divided into blocks to obtain multiple data blocks.
[0040] In some embodiments, after obtaining the information byte code corresponding to the transmission information, the information byte code can be segmented in byte order to form multiple data blocks with the same capacity.
[0041] For example, in some implementation scenarios, after obtaining the information byte code corresponding to the transmission information (that is, the data stream that can be read by bytes), the data stream can be segmented in byte order to form s data blocks D each with a capacity of m (Byte). i , i = 0, 1, ..., s-1. In some implementation scenarios, when the data stream is segmented by bytes, the capacity of the last data block cannot reach m (Byte). In this case, the insufficient number of data bits in the last data block can be padded with zeros to keep the size of each data block consistent.
[0042] S24: Process each data block according to the erasure code encoding mechanism to obtain a two-dimensional code image group corresponding to each data block.
[0043] In the embodiments of the present specification, after obtaining a plurality of data blocks, each data block may be processed according to an erasure code encoding mechanism to obtain a two-dimensional code image group corresponding to each data block.
[0044] In some embodiments, processing each data block according to the erasure code encoding mechanism to obtain a two-dimensional code image group corresponding to each data block may include: constructing a generator matrix for erasure code encoding; wherein the number of rows of the generator matrix is greater than the number of columns, and the sub-matrices included in the generator matrix are all reversible matrices; slicing the data block to obtain data slices corresponding to the data block; based on the data slices corresponding to the data block, generating a data matrix corresponding to the data block; wherein the number of rows of the data matrix is equal to the number of columns of the generator matrix; generating a coding matrix based on the generator matrix and the data matrix; performing two-dimensional code encoding on each row in the coding matrix to obtain a two-dimensional code image group corresponding to the data block.
[0045] Among them, erasure coding is a data protection coding method that first divides the original data into data blocks of equal size, and then encodes the data blocks into check blocks. When several data blocks or check blocks are lost, erasure coding technology can ensure that the original data can still be recovered. From RAID (Redundant Array of Independent Hard Disks) to distributed storage systems, erasure codes are widely used in storage systems. They can be used to prevent partial data loss or data inaccessibility caused by data server crashes. The generator matrix is a suitable matrix selected when encoding with erasure codes. If the generator matrix is unknown, the original information cannot be decoded through the QR code. It can be seen that the use of the generator matrix can ensure data security.
[0046] In some implementation scenarios, the generator matrix may be a Vandermonde matrix, a Cauchy matrix, etc. Since the generator matrix is generated according to mathematical theories such as Vandermonde and Cauchy, the sub-matrices included therein are all reversible matrices.
[0047] For example, in some implementation scenarios, the generator matrix of the constructed erasure code can be recorded as GM. That is:
[0048]
[0049] The generator matrix GM is a block matrix of k×n (k>n) dimensions, which includes k times n sub-matrices, each sub-matrix is of n×n dimensions, and each sub-matrix is a reversible matrix.
[0050] In some implementation scenarios, after constructing the erasure code generator matrix, the data block can be fragmented to obtain data slices corresponding to the data block. For example, in some implementation scenarios, one data block D can be taken from multiple data blocks. i , whose size is m (Byte), then read the data block in byte order and distribute it to n data pieces P j , j = 0, 1, ..., n-1. Where n is the number of columns of the generator matrix GM. m can be divided by n.
[0051] In some implementation scenarios, after obtaining the data slices corresponding to the data block, all the data slices can be arranged in sequence to generate an n-row data matrix, which can be denoted as DM. For example, for the data block [b0, b1, ..., b m-1 ]have:
[0052]
[0053] Among them, b0, b1, ..., b m-1 etc. respectively represent a byte in the data block, m represents the total number of bytes included in the data block, P j represents a data slice, and n data slices can be stacked to form the DM on the right, that is, n rows in the DM represent n data slices. j Medium j , b j+n It reflects the subscript rule, combined with P j The rule with DM is that the byte subscript increases horizontally by n. One data block can correspond to one DM, and DM corresponds to data blocks one to one. DM consists of n data slices.
[0054] In some implementation scenarios, after generating the data matrix corresponding to the data block, the product of the generator matrix GM and the data matrix DM can be calculated (the calculation is based on a finite field) to generate the encoding matrix as follows:
[0055]
[0056] The number of rows in the coding matrix is k, and each row can be understood as a discrete slice. After n data slices are encoded with erasure codes, k discrete slices can be obtained. The coding matrix can be understood as the result of erasure coding the i-th data block.
[0057] In the embodiments of this specification, by calculating the product of the generator matrix and the data matrix, not only can the obtained encoding matrix contain more data slices than the data matrix, but the data can also be discretely distributed to each data slice.
[0058] In some implementation scenarios, after generating the coding matrix, each row in the coding matrix can be encoded with a two-dimensional code to obtain a two-dimensional code image group corresponding to the data block. Among them, one data block corresponds to one two-dimensional code image group, and one data block can be restored according to the content of one two-dimensional code image group. In some implementation scenarios, when restoring information, the two-dimensional code image in a two-dimensional code image group may be missing. For example, in some implementation scenarios, each row of data in the k-row coding matrix generated above can be encoded with a two-dimensional code to generate k two-dimensional code images, and these k two-dimensional code images are used as a two-dimensional code image group corresponding to a data block.
[0059] In some embodiments, before encoding each row in the encoding matrix, the method may include: inserting a data block identifier and a data slice identifier at the starting position of each row in the encoding matrix to obtain the identified encoding matrix; performing two-dimensional code encoding on each row in the identified encoding matrix to obtain a two-dimensional code image group corresponding to the data block. The data block identifier and the data slice identifier may be represented by a serial number. The data slice identifier may be understood as the identifier corresponding to the above-mentioned discrete slice.
[0060] For example, in some implementation scenarios, after the encoding matrix is generated, the data block number i and the row number j where the discrete slice is located can be inserted at the starting position of each row of data, that is:
[0061]
[0062] Among them, i0, i1, ..., i in the first column k-1 Indicates the data block number (i.e., data block identifier). Since the above is processed for one data block, the corresponding data block number is the same, denoted as i. In the second column, 0, 1, ..., k-1 respectively represent the row number of the discrete slice (i.e., data slice identifier).
[0063] like Figure 3 As shown, Figure 3 This is a flow chart of generating a coding matrix provided in this specification, which includes data blocks (1-13 bytes), data matrix DM (data matrix DM is generated by distributing data blocks into multiple data slices P0, P1, P2, P3), generation matrix GM, and coding matrix of inserted data block sequence number i (ii in the figure) and row number (0, 1, 2, 3, 4, 5) of discrete slices.
[0064] Furthermore, each row of data in the k-row matrix generated by inserting the data block sequence number and the row number of the discrete piece can be encoded with a two-dimensional code to generate k two-dimensional code images, and these k two-dimensional code images can be used as a two-dimensional code image group corresponding to a data block.
[0065] Furthermore, the above steps can be performed on each data block to obtain the two-dimensional code image group corresponding to all data blocks. It should be noted that the process of obtaining the two-dimensional code image group corresponding to each data block is similar and can be referenced to each other, so it will not be described in detail.
[0066] S26: Based on the two-dimensional code image group corresponding to each data block, obtain a two-dimensional code image set corresponding to the transmission information.
[0067] In the embodiment of the present specification, after obtaining the two-dimensional code image group corresponding to each data block, a two-dimensional code image set corresponding to the transmission information can be obtained based on the two-dimensional code image groups corresponding to all data blocks. The two-dimensional code image set may include multiple two-dimensional code image groups. Each two-dimensional code image group may include multiple two-dimensional code images.
[0068] In some embodiments, the two-dimensional code image group corresponding to each data block can be arranged according to the data block identifier to obtain a two-dimensional code image set corresponding to the transmission information. Of course, the above is only an exemplary description, and the method of obtaining a two-dimensional code image set based on the two-dimensional code image group corresponding to each data block is not limited to the above example. Under the inspiration of the technical essence of this application, technical personnel in the relevant field may also make other changes, but as long as the functions and effects achieved are the same or similar to those of this application, they should be covered within the protection scope of this application.
[0069] S28: Sending the two-dimensional code image set corresponding to the transmission information to an image reading device.
[0070] In the embodiments of the present specification, after obtaining the set of two-dimensional code images corresponding to the transmission information, the set of two-dimensional code images corresponding to the transmission information can be sent to the image reading device, so that the image reading device can recognize the two-dimensional code images in the set of two-dimensional code images after receiving them, thereby restoring the corresponding transmission information. In the process of sending the set of two-dimensional code images corresponding to the transmission information to the image reading device, part of the two-dimensional code images can be lost in each two-dimensional code image group.
[0071] In some embodiments, when generating a two-dimensional code image group at a time, a certain calculation formula needs to be satisfied, and the calculation needs to be performed based on the maximum capacity of the two-dimensional code. Taking the two-dimensional code capacity of 512 (Byte), the generation matrix GM = k × n, k = 6, n = 4, and the total data volume M (Byte) as an example, assuming that the required data block sequence number i occupies 2 bytes, the upper limit of the supported data block is 65536 blocks, the number of data pieces is equal to k, and its sequence number occupies 1 byte, then the data capacity of the two-dimensional code excluding the sequence number is 512-2-1 = 509 (Byte).
[0072] The data block capacity m=4×509=2036 (Byte), the number of data blocks s=M / 2036 (pieces), s≤65536.
[0073] The data slice size is 2036 / n=2036 / 4=509 (Byte), and the erasure code is performed. The data with the total length of 3 (Byte) is concatenated with the data block number i and the row number j where the discrete slice is located on the left side of each row of the result, and k=6 data slices to be encoded are obtained:
[0074]
[0075] Furthermore, the six data pieces to be encoded may be encoded in two-dimensional codes to obtain corresponding two-dimensional code image groups.
[0076] In the embodiments of this specification, by dispersing a data block information, the originally continuous data is dispersed in different data slices, and then the data is discretely distributed into more data slices after erasure coding, so that the data can be effectively encrypted, thereby improving the security of transmitted data.
[0077] In the embodiments of the present specification, each data block is converted into a two-dimensional code image group based on an erasure code encoding mechanism, so that the data can be discretely distributed into more data slices. While the data is effectively encrypted, the data block information can be restored when part of the two-dimensional code image is missing or cannot be read, thereby greatly improving the effectiveness and stability of data transmission.
[0078] Of course, the above is only an exemplary description, and the embodiments of this specification are not limited to the above examples. Technical personnel in the relevant field may make other changes based on the technical essence of this application. However, as long as the functions and effects achieved are the same or similar to those of this application, they should be included in the scope of protection of this application.
[0079] The above embodiment describes the implementation scheme of the data transmission method from the perspective of the image generation device. Based on the above embodiment description, this specification also provides a data transmission method applied to an image reading device. Figure 4 As shown, Figure 4 1 is a flow chart of another embodiment of a data transmission method provided in this specification. Specifically, in one embodiment, the method may include the following steps.
[0080] S30: Receive a two-dimensional code image set sent by an image generating device; wherein the two-dimensional code image set includes a plurality of two-dimensional code images.
[0081] The image generating device may be an image input device or an optical scanning device, etc.
[0082] In some embodiments, the QR code image set sent by the image generation device may be a complete QR code image set generated by the image generation device (all of which can be recognized), or a QR code image set with some QR code images missing, or a complete QR code image set with some unrecognizable QR code images, etc. The QR code image set may include multiple QR code images.
[0083] It should be noted that for the generator matrix GM=k×n used in the generation stage of the two-dimensional code image set, k>n, a two-dimensional code image group allows kn two-dimensional code images to be unreadable due to clarity and other issues. That is, in the two-dimensional code image group corresponding to each data block generated based on the erasure code encoding mechanism, some data (i.e., two-dimensional code images) are allowed to be lost, and the number of allowed losses is the difference between the number of rows and columns of the generator matrix GM, i.e., kn two-dimensional code images. Among them, the fact that the two-dimensional code image is not clear enough and cannot be read can indicate that this part of the data is lost.
[0084] S32: Acquire data information included in each two-dimensional code image; wherein the data information includes a data block identifier.
[0085] In the embodiments of this specification, after receiving the set of two-dimensional code images sent by the image generation device, the data information included in each two-dimensional code image can be obtained. The data information may include a data block identifier, a data slice identifier, data content, etc. The data block identifier is also called a data block serial number. The data slice identifier is also called a data slice serial number and a row number where a discrete slice is located.
[0086] In some embodiments, after receiving the set of two-dimensional code images, an image recognition device may be used to read the two-dimensional code images to obtain data information included in each two-dimensional code image.
[0087] For example, in some implementation scenarios, after receiving a set of two-dimensional code images, multiple two-dimensional code images can be read to obtain the data information corresponding to each two-dimensional code image, and the data block number i of the 1st and 2nd bytes and the data slice number j of the 3rd byte in the data information can be obtained. Among them, two-dimensional code images with the same data block number correspond to the same data block. Among them, the data information corresponding to each two-dimensional code image is encoded by byte code, and its 1st and 2nd bytes represent the data block number (i.e., data block identifier), and the 3rd byte represents the data slice number (i.e., data slice identifier). The data information corresponding to each two-dimensional code image can correspond to a data slice.
[0088] S34: Grouping the data information according to the data block identifier to obtain multiple data information groups.
[0089] In the embodiments of this specification, after obtaining the data information included in each two-dimensional code image, the data information can be grouped according to the data block identifier to obtain multiple data information groups.
[0090] Since two-dimensional code images with the same data block number correspond to the same data block, in the embodiments of this specification, data information can be grouped according to the data block number to obtain multiple data information groups.
[0091] In the embodiments of this specification, grouping data information according to data block identifiers to obtain multiple data information groups can be understood as grouping data slices belonging to one data block into one group, so that corresponding information can be restored later according to the data slices corresponding to each data block.
[0092] S36: Restore each data information group to data block information based on the erasure code encoding mechanism.
[0093] In the embodiment of the present specification, after obtaining multiple data information groups, each data information group can be restored to data block information based on an erasure code encoding mechanism.
[0094] In some embodiments, the erasure code encoding mechanism based on which each data information group is restored to data block information may include: constructing a generator matrix for erasure code encoding; wherein the number of rows of the generator matrix is greater than the number of columns, and the sub-matrices included in the generator matrix are all reversible matrices; obtaining a data slice identifier corresponding to each data information in the data information group; generating a data matrix based on the data information included in the data information group and the data slice identifier corresponding to the data information; wherein the number of rows of the data matrix is equal to the number of columns of the generator matrix; according to the data slice identifier corresponding to each row in the data matrix, obtaining the corresponding row from the generator matrix to generate a decoding matrix; wherein the number of rows and columns of the decoding matrix are both equal to the number of columns of the generator matrix, and the decoding matrix is a sub-matrix of the generator matrix; based on the data matrix and the decoding matrix, obtaining the data block information corresponding to the data information group.
[0095] In the embodiments of this specification, the erasure code generator matrix constructed is the same as the generator matrix constructed in the image generation device. The specific construction method can refer to the description in the above-mentioned related embodiments, and will not be described in detail.
[0096] In some implementation scenarios, after constructing a generator matrix for erasure code encoding, the data slice identifier corresponding to each data information in the data information group can be obtained, and then a data matrix can be generated based on the data information included in the data information group and the data slice identifier corresponding to the data information.
[0097] In some implementation scenarios, generating a data matrix based on the data information included in the data information group and the data slice identifier corresponding to the data information may include: selecting a preset number of data information from the data information group as a row, and generating a first matrix according to the data slice identifier corresponding to the selected data information; wherein the number of rows of the first matrix is equal to the number of columns of the generated matrix; and deleting the data block identifier and the data slice identifier at the starting position of each row in the first matrix to obtain a data matrix.
[0098] For example, in some implementation scenarios, any n data information in a data information group can be taken as a row of data and arranged in order of data slice number j to form a first matrix DM' with n rows, and then the first three columns of data of the first matrix DM' are removed to obtain a data matrix DM" that does not contain data block number i and data slice number j. Among them, the number of rows of the data matrix DM" is equal to the number of columns of the generating matrix GM.
[0099] In some implementation scenarios, after the data matrix is generated, the corresponding row can be obtained from the generation matrix according to the data slice identifier corresponding to each row in the data matrix to generate a decoding matrix.
[0100] For example, in some implementation scenarios, the corresponding rows in GM can be obtained in sequence according to the value of the data slice number j corresponding to each row in the data matrix to form an n×n dimensional decoding matrix GM′. Since the decoding matrix GM′ is a submatrix of the generating matrix GM, the decoding matrix GM′ is reversible.
[0101] In some implementation scenarios, after obtaining the data matrix and the decoding matrix, the data transmitted by each data information group can be restored based on the erasure code principle, that is, the matrix DM representing the data block information is obtained:
[0102] DM=GM′ -1 ×DM″
[0103] Among them, GM′ -1 It represents the inverse matrix of GM′, and the size of the data block information DM is m (Byte).
[0104] After obtaining the matrix DM representing the data block information, the DM bytecode information can be read from the upper left to the lower right to obtain the data block information and the corresponding data block sequence number i.
[0105] Furthermore, the above steps may be performed on each data information group, thereby obtaining data block information corresponding to all data information groups. It should be noted that the process of obtaining data block information corresponding to each data information group is similar and can be referenced to each other, so it will not be described in detail.
[0106] S38: All data block information is spliced to obtain transmission information corresponding to the two-dimensional code image set.
[0107] In the embodiments of the present specification, after obtaining the data block information corresponding to each data information group, all the data block information may be spliced to obtain the transmission information corresponding to the two-dimensional code image set.
[0108] In some embodiments, the splicing of all data block information to obtain the transmission information corresponding to the two-dimensional code image set may include: splicing all data block information according to the data block identifier corresponding to each data block information; when data end mark information appears in the data block information, removing the data end mark information to obtain a splicing result; and using the splicing result as the transmission information corresponding to the two-dimensional code image set.
[0109] For example, in some implementation scenarios, all data block information may be concatenated in order of data block sequence number i (excluding the zero padding at the end) until data end flag information appears at the end of the data block, and the transmitted data is formed after the data end flag information is removed.
[0110] like Figure 5 As shown, Figure 5 It is a schematic diagram of a data transmission scenario provided in this specification. Among them, in the stage of generating a two-dimensional code image set (i.e., generating a group of images), the data slices P1-P4 are processed into 6 two-dimensional codes, which are recorded as the original group of images (including QR1, QR2, QR3, QR4, QR5, QR6), indicating that a 6×4-dimensional generating matrix GM is used in the middle. In the stage of reading the two-dimensional code image set (i.e., reading the group of images), only 4 two-dimensional codes remain after QR2 and QR5 are lost, which are recorded as recognizable groups of images (including QR1, QR3, QR4, QR6, and the information included is not symmetrical with P1-P4 on the right), assuming DM'. When restoring, the data of the 2nd and 5th rows in GM are removed accordingly to obtain the 4×4 GM submatrix GM', and GM' and DM' are used to perform operations to obtain the P1-P4 data slices on the right (recorded as restored data slices). It can be seen that although the two-dimensional code image corresponding to the transmitted information is lost, the initial 4 data slices can still be restored using the present application solution.
[0111] In the embodiments of the present specification, the data sender and the data receiver pre-agree on a generation matrix, so that a third party cannot parse out part of the data through the QR code image without obtaining the generation matrix, and cannot obtain the overall transmission data, thereby greatly improving data security.
[0112] In the embodiments of this specification, each data information group is restored to data block information based on an erasure code encoding mechanism. In this way, when part of the QR code image is missing or cannot be read, the data block information can still be restored, thereby greatly improving the effectiveness and stability of data transmission.
[0113] In the embodiments of this specification, the data sender (image generation device) can improve the speed of QR code generation by optimizing the generation algorithm (such as using the multi-core performance of the computer CPU to generate QR codes in parallel with multi-threading). The image storage processing and image analysis processing of the data receiver (image reading device) are asynchronous, and the image storage processing can use a high-speed image reading device to increase the transmission speed of the QR code image from the source to the target.
[0114] In the embodiments of this specification, based on the erasure code encoding mechanism, a certain fault tolerance mechanism is provided for the possible reading ambiguity, reading omission, etc. in the high-speed image reading process. Among them, since the fault tolerance rate can be controlled by adjusting the number of rows k of the erasure code generation matrix GM, by weighing the k value and the image reading speed, the high-speed image reading device can be used as much as possible to increase the transmission speed to adapt to the high-speed generation of the two-dimensional code by the data generator.
[0115] The above test method is described below with a specific implementation scenario. However, it should be noted that this specific embodiment is only for better illustrating the present application and does not constitute an improper limitation on the present application. Figure 6 As shown, Figure 6 This is a flowchart of a specific embodiment of a data transmission method provided in this specification. In this specific embodiment, it includes an image group generation stage (i.e., a two-dimensional code image set generation stage) and a data restoration stage (i.e., a two-dimensional code image set reading stage). The image group generation stage can be completed by an image generation device, and the data restoration stage can be completed by an image reading device.
[0116] In this embodiment, a generator matrix GM for erasure code encoding is generated in advance.
[0117] In this embodiment, in the image group generation stage, the transmission information is first converted into byte codes and zeros are added at the end to obtain information byte codes with a total capacity of M (Byte); secondly, the information byte codes are divided into data blocks to obtain data blocks D i , i = 0, 1, ..., s-1. Further, a data block is fragmented to obtain the data slice P corresponding to the data block j , j=0,1,…,n-1, based on the erasure code principle, the data slice is converted into k two-dimensional code images to obtain a two-dimensional code image group corresponding to a single data block. Where k>n, the information header of each two-dimensional code image carries the data block number i. The same process is performed on each data block to obtain a two-dimensional code image group corresponding to all data blocks, that is, a set of two-dimensional code images corresponding to the transmitted information.
[0118] Furthermore, all the QR code images in the QR code image set can be rotated through the screen of the image generating device. Accordingly, the QR code images played on the screen of the image generating device can be scanned by the image reading device to obtain all the QR code images. Furthermore, the QR code image can be read to obtain the data information of each QR code image, and the data information can be grouped according to the header data block sequence number i to obtain multiple data information groups. For a data information group, the data information group can be restored into multiple data slices (n data slices) based on the erasure code principle, and the multiple data slices can be spliced to obtain the data block corresponding to a single data information group. The same processing is performed for each data information group to obtain the data blocks corresponding to all data information groups. Finally, all the data blocks are spliced to obtain the original information byte code, and the trailing zero data is removed to complete the data transmission.
[0119] In the above embodiments, the erasure code principle can be understood as an erasure code encoding mechanism. When converting a data slice into a two-dimensional code based on the erasure code principle and restoring a data information group into multiple data slices based on the erasure code principle, the generator matrix GM used is the same.
[0120] In the embodiments of this specification, the transmission information is encoded into multiple QR codes based on the erasure code principle, forming a QR code image set that allows some QR codes to be lost and can be decoded to restore the information to be transmitted, which can greatly improve the information security and information transmission stability.
[0121] Of course, the above is only an exemplary description, and the embodiments of this specification are not limited to the above examples. Technical personnel in the relevant field may make other changes based on the technical essence of this application. However, as long as the functions and effects achieved are the same or similar to those of this application, they should be included in the scope of protection of this application.
[0122] From the above description, it can be seen that the embodiment of the present application can obtain the information byte code corresponding to the transmission information, divide the information byte code into blocks, and obtain multiple data blocks; each data block can also be processed according to the erasure code encoding mechanism to obtain the two-dimensional code image group corresponding to each data block, and based on the two-dimensional code image group corresponding to each data block, the two-dimensional code image set corresponding to the transmission information can be obtained. Further, the two-dimensional code image set corresponding to the transmission information can be sent to the image reading device so that the image reading device can obtain the data information included in each two-dimensional code image, wherein the data information includes a data block identifier; the data information is grouped according to the data block identifier to obtain multiple data information groups; each data information group is restored to data block information based on the erasure code encoding mechanism; all data block information is spliced to obtain the transmission information corresponding to the two-dimensional code image set. Since each data block is converted into a two-dimensional code image based on the erasure code encoding mechanism, the data is discretely distributed into more data slices, and the data is effectively encrypted, thereby greatly improving the data security. Since each data information group is restored to data block information based on the erasure code encoding mechanism, the data block information can still be restored when part of the QR code image is missing or cannot be read, thereby greatly improving the effectiveness and stability of data transmission.
[0123] In this specification, each embodiment of the above method is described in a progressive manner, and the same or similar parts between the embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments. For relevant parts, refer to the partial description of the method embodiment.
[0124] Based on the above-mentioned data transmission method, one or more embodiments of this specification also provide a data transmission device. The device may include a system (including a distributed system), software (application), module, component, server, client, etc. using the method described in the embodiment of this specification and a device combined with necessary implementation hardware. Based on the same innovative concept, the device in one or more embodiments provided in the embodiment of this specification is as described in the following embodiments. Since the implementation scheme and method of the device to solve the problem are similar, the implementation of the specific device in the embodiment of this specification can refer to the implementation of the aforementioned method, and the repetitions will not be repeated. As used below, the term "unit" or "module" can implement a combination of software and / or hardware of predetermined functions. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0125] Specifically, Figure 7 is a schematic diagram of a module structure of an embodiment of a data transmission device provided in this specification, such as Figure 7As shown, a data transmission device provided in this specification may include: an acquisition module 120, a block module 122, a processing module 124, an acquisition module 126, and a sending module 128.
[0126] The acquisition module 120 may be used to acquire the information byte code corresponding to the transmission information;
[0127] A block module 122 may be used to block the information byte code to obtain multiple data blocks;
[0128] The processing module 124 may be used to process each data block according to the erasure code encoding mechanism to obtain a two-dimensional code image group corresponding to each data block;
[0129] The obtaining module 126 may be used to obtain the two-dimensional code image set corresponding to the transmission information based on the two-dimensional code image group corresponding to each data block;
[0130] The sending module 128 may be used to send the two-dimensional code image set corresponding to the transmission information to an image reading device.
[0131] Figure 8 is a schematic diagram of a module structure of another embodiment of a data transmission device provided in this specification, such as Figure 8 As shown, a data transmission device provided in this specification may include: a receiving module 130 , an acquiring module 132 , a grouping module 134 , a restoring module 136 , and an obtaining module 138 .
[0132] The receiving module 130 may be used to receive a two-dimensional code image set sent by an image generating device; wherein the two-dimensional code image set includes a plurality of two-dimensional code images;
[0133] The acquisition module 132 may be used to acquire data information included in each two-dimensional code image; wherein the data information includes a data block identifier;
[0134] A grouping module 134 may be used to group the data information according to the data block identifier to obtain multiple data information groups;
[0135] A restoration module 136 may be used to restore each data information group to data block information based on an erasure coding mechanism;
[0136] The acquisition module 138 may be used to splice all the data block information to obtain the transmission information corresponding to the two-dimensional code image set.
[0137] It should be noted that the above-mentioned device may also include other implementation modes according to the description of the method embodiment. The specific implementation mode may refer to the description of the relevant method embodiment, which will not be described one by one here.
[0138] This specification also provides an embodiment of a data transmission device, including a processor and a memory for storing processor executable instructions, wherein the instructions are executed by the processor to implement the steps of any of the above methods. For example, when the instructions are executed by the processor, the following steps are implemented: obtaining information byte codes corresponding to the transmission information; dividing the information byte codes into blocks to obtain multiple data blocks; processing each data block according to the erasure code encoding mechanism to obtain a two-dimensional code image group corresponding to each data block; based on the two-dimensional code image group corresponding to each data block, obtaining a two-dimensional code image set corresponding to the transmission information; and sending the two-dimensional code image set corresponding to the transmission information to an image reading device.
[0139] It should be noted that the above-mentioned device may also include other implementations according to the description of the method or device embodiment. The specific implementation methods can refer to the description of the relevant method embodiments, which will not be described one by one here.
[0140] The method embodiments provided in this specification can be executed in a mobile terminal, a computer terminal, a server or a similar computing device. Taking running on a server as an example, Fig. 9 1 is a hardware structure block diagram of an embodiment of a data transmission server provided in this specification. The server may be a data transmission device or a data transmission equipment in the above embodiment. Fig. 9 As shown, the server 10 may include one or more (only one is shown in the figure) processors 100 (the processor 100 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 200 for storing data, and a transmission module 300 for communication functions. A person skilled in the art can understand that Fig. 9 The structure shown is only for illustration and does not limit the structure of the above electronic device. Fig. 9 More or fewer components shown in the figure may also include other processing hardware, such as a database or multi-level cache, GPU, or other hardware with Fig. 9 Different configurations are shown.
[0141] The memory 200 can be used to store software programs and modules of application software, such as program instructions / modules corresponding to the data transmission method in the embodiment of this specification. The processor 100 executes various functional applications and data processing by running the software programs and modules stored in the memory 200. The memory 200 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 200 may further include a memory remotely arranged relative to the processor 100, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0142] The transmission module 300 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission module 300 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission module 300 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0143] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0144] The methods or devices described in the above embodiments provided in this specification can implement business logic through computer programs and record them on storage media, and the storage media can be read and executed by computers to achieve the effects of the solutions described in the embodiments of this specification. The storage medium may include a physical device for storing information, which is usually to digitize the information and then store it in a medium using electrical, magnetic or optical methods. The storage medium may include: devices that use electrical energy to store information, such as various types of memories, such as RAM, ROM, etc.; devices that use magnetic energy to store information, such as hard disks, floppy disks, magnetic tapes, magnetic core memories, bubble memories, and U disks; devices that use optical methods to store information, such as CDs or DVDs. Of course, there are other types of readable storage media, such as quantum memories, graphene memories, and so on.
[0145] The above-mentioned data transmission method or device embodiments provided in this specification can be implemented by a processor in a computer executing corresponding program instructions, such as using the C++ language of the Windows operating system to implement it on a PC, on a Linux system, or other methods such as using Android or iOS system programming languages to implement it on a smart terminal, as well as based on the processing logic of a quantum computer.
[0146] It should be noted that the devices, equipment, and systems described in the specification may also include other implementation methods according to the description of the relevant method embodiments. The specific implementation methods can refer to the description of the corresponding method embodiments, which will not be described one by one here.
[0147] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the hardware + program embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0148] For the convenience of description, the above devices are described in various modules according to their functions. Of course, when implementing one or more of the present specification, the functions of some modules can be implemented in the same or more software and / or hardware, and the modules that implement the same function can also be implemented by a combination of multiple sub-modules or sub-units.
[0149] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, devices, equipment, and systems according to the embodiments of the present invention. It should be understood that it can be implemented by computer program instructions, and these computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the specified function. These computer program instructions can also be stored in a computer-readable memory that can guide the computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, and the instruction device is implemented in the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0150] Those skilled in the art will appreciate that one or more embodiments of the present specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present specification may be provided in the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware.
[0151] The above is only an example of one or more embodiments of this specification and is not intended to limit one or more embodiments of this specification. For those skilled in the art, one or more embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application should be included in the scope of the claims.
Claims
1. A data transmission method, characterized in that: Applied in an image generating device, the method comprises: Get the information bytecode corresponding to the transmission information; Dividing the information bytecode into blocks to obtain multiple data blocks; Each data block is processed according to the erasure code encoding mechanism to obtain a two-dimensional code image group corresponding to each data block; Based on the two-dimensional code image group corresponding to each data block, obtaining a two-dimensional code image set corresponding to the transmission information; Sending the two-dimensional code image set corresponding to the transmission information to an image reading device; The method of processing each data block according to the erasure code encoding mechanism to obtain a two-dimensional code image group corresponding to each data block includes: Construct the generator matrix of the erasure code; the generator matrix GM is expressed as follows: The generator matrix GM is a block matrix of k×n (k>n) dimensions, and the generator matrix includes k times n sub-matrices, each sub-matrix is n×n dimensions, and each sub-matrix is a reversible matrix; Take a data block Di from multiple data blocks, read the data block Di in byte order and distribute it to n data slices Pj (j=0, 1, ..., n-1), arrange all data slices corresponding to the data block Di in sequence, and generate a data matrix with n rows. The data matrix DM is expressed as follows: Among them, b0, b1, ..., b m-1 Respectively represent a byte in the data block, m represents the total number of bytes included in the data block, P j represents a data slice, and n rows in the data matrix DM represent n data slices; The product of the generator matrix and the data matrix is calculated to generate a coding matrix, as follows: Among them, the number of rows of the encoding matrix is k, and n data slices are encoded with erasure codes to obtain k discrete slices; Perform two-dimensional code encoding on each row in the encoding matrix to obtain a two-dimensional code image group corresponding to the data block.
2. The method according to claim 1, characterized in that The step of obtaining the information bytecode corresponding to the transmission information includes: Get transmission information; encoding the transmission information into bytecode data; Data end mark information is added to the end of the bytecode data to obtain the information bytecode.
3. The method according to claim 1, characterized in that Before encoding each row in the encoding matrix, the method includes: Inserting a data block identifier and a data slice identifier at the start position of each row in the encoding matrix to obtain an identified encoding matrix; Perform two-dimensional code encoding on each row in the marked encoding matrix to obtain a two-dimensional code image group corresponding to the data block.
4. A data transmission method, characterized in that: Applied to an image reading device, the method comprises: Receiving a two-dimensional code image set sent by an image generating device; wherein the two-dimensional code image set includes a plurality of two-dimensional code images; Acquire data information included in each two-dimensional code image; wherein the data information includes a data block identifier; Grouping the data information according to the data block identifier to obtain multiple data information groups; Restore each data information group to data block information based on the erasure code encoding mechanism; All data block information is spliced to obtain transmission information corresponding to the two-dimensional code image set; The data information also includes a data slice identifier; The method of restoring each data information group to data block information based on the erasure code encoding mechanism includes: Constructing a generator matrix for erasure code encoding; wherein the number of rows of the generator matrix is greater than the number of columns, and the sub-matrices included in the generator matrix are all reversible matrices; Obtaining a data slice identifier corresponding to each data information in the data information group; Selecting a preset number of data information from the data information group as a row, and generating a first matrix according to the data slice identifiers corresponding to the selected data information; wherein the number of rows of the first matrix is equal to the number of columns of the generated matrix; Deleting the data block identifier and the data slice identifier at the start position of each row in the first matrix to obtain a data matrix; wherein the number of rows of the data matrix is equal to the number of columns of the generator matrix; According to the data slice identifier corresponding to each row in the data matrix, the corresponding row is obtained from the generator matrix to generate a decoding matrix; wherein the number of rows and columns of the decoding matrix are equal to the number of columns of the generator matrix, and the decoding matrix is a submatrix of the generator matrix; The product of the inverse matrix of the decoding matrix and the data matrix is calculated, and each byte code information in the product is concatenated from the upper left to the lower right to obtain the data block information corresponding to the data information group.
5. The method according to claim 4, characterized in that The step of splicing all the data block information to obtain the transmission information corresponding to the two-dimensional code image set includes: All data block information is spliced according to the data block identifier corresponding to each data block information; When data end mark information appears in the data block information, the data end mark information is removed to obtain a splicing result; The splicing result is used as the transmission information corresponding to the two-dimensional code image set.
6. A data transmission method, characterized in that: Applied to a data transmission system, the data transmission system includes an image generating device and an image reading device, and the method includes: The image generation device obtains the information byte code corresponding to the transmission information; divides the information byte code into blocks to obtain multiple data blocks; processes each data block according to the erasure code encoding mechanism to obtain a two-dimensional code image group corresponding to each data block; based on the two-dimensional code image group corresponding to each data block, obtains a two-dimensional code image set corresponding to the transmission information; and sends the two-dimensional code image set corresponding to the transmission information to the image reading device; The image reading device receives the two-dimensional code image set; obtains data information included in each two-dimensional code image in the two-dimensional code image set; wherein the data information includes a data block identifier; groups the data information according to the data block identifier to obtain a plurality of data information groups; restores each data information group to data block information based on an erasure code encoding mechanism; and splices all data block information to obtain transmission information corresponding to the two-dimensional code image set; The method of processing each data block according to the erasure code encoding mechanism to obtain a two-dimensional code image group corresponding to each data block includes: Construct the generator matrix of the erasure code; the generator matrix GM is expressed as follows: The generator matrix GM is a block matrix of k×n (k>n) dimensions, and the generator matrix includes k times n sub-matrices, each sub-matrix is n×n dimensions, and each sub-matrix is a reversible matrix; Take a data block Di from multiple data blocks, read the data block Di in byte order and distribute it to n data slices Pj (j=0, 1, ..., n-1), arrange all data slices corresponding to the data block Di in sequence, and generate a data matrix with n rows. The data matrix DM is expressed as follows: Among them, b0, b1, ..., b m-1 Respectively represent a byte in the data block, m represents the total number of bytes included in the data block, P j represents a data slice, and n rows in the data matrix DM represent n data slices; The product of the generator matrix and the data matrix is calculated to generate a coding matrix, as follows: Among them, the number of rows of the encoding matrix is k, and n data slices are encoded with erasure codes to obtain k discrete slices; Performing two-dimensional code encoding on each row in the encoding matrix to obtain a two-dimensional code image group corresponding to the data block; The data information also includes a data slice identifier; The method of restoring each data information group to data block information based on the erasure code encoding mechanism includes: Constructing a generator matrix for erasure code encoding; wherein the number of rows of the generator matrix is greater than the number of columns, and the sub-matrices included in the generator matrix are all reversible matrices; Obtaining a data slice identifier corresponding to each data information in the data information group; Selecting a preset number of data information from the data information group as a row, and generating a first matrix according to the data slice identifiers corresponding to the selected data information; wherein the number of rows of the first matrix is equal to the number of columns of the generated matrix; Deleting the data block identifier and the data slice identifier at the start position of each row in the first matrix to obtain a data matrix; wherein the number of rows of the data matrix is equal to the number of columns of the generator matrix; According to the data slice identifier corresponding to each row in the data matrix, the corresponding row is obtained from the generator matrix to generate a decoding matrix; wherein the number of rows and columns of the decoding matrix are equal to the number of columns of the generator matrix, and the decoding matrix is a submatrix of the generator matrix; The product of the inverse matrix of the decoding matrix and the data matrix is calculated, and each byte code information in the product is concatenated from the upper left to the lower right to obtain the data block information corresponding to the data information group.
7. A data transmission device, characterized in that: include: An acquisition module, used to acquire information bytecode corresponding to the transmission information; A block division module, used for dividing the information byte code into blocks to obtain multiple data blocks; A processing module, used for processing each data block according to the erasure code encoding mechanism to obtain a two-dimensional code image group corresponding to each data block; An acquisition module, used for acquiring a set of two-dimensional code images corresponding to the transmission information based on the two-dimensional code image group corresponding to each data block; A sending module, used for sending the two-dimensional code image set corresponding to the transmission information to an image reading device; The processing module is specifically used for: Construct the generator matrix of the erasure code; the generator matrix GM is expressed as follows: The generator matrix GM is a block matrix of k×n (k>n) dimensions, and the generator matrix includes k times n sub-matrices, each sub-matrix is n×n dimensions, and each sub-matrix is a reversible matrix; Take a data block Di from multiple data blocks, read the data block Di in byte order and distribute it to n data slices Pj (j=0, 1, ..., n-1), arrange all data slices corresponding to the data block Di in sequence, and generate a data matrix with n rows. The data matrix DM is expressed as follows: Among them, b0, b1, ..., b m-1 Respectively represent a byte in the data block, m represents the total number of bytes included in the data block, P j represents a data slice, and n rows in the data matrix DM represent n data slices; The product of the generator matrix and the data matrix is calculated to generate a coding matrix, as follows: Among them, the number of rows of the encoding matrix is k, and n data slices are encoded with erasure codes to obtain k discrete slices; Perform two-dimensional code encoding on each row in the encoding matrix to obtain a two-dimensional code image group corresponding to the data block.
8. A data transmission device, characterized in that: include: A receiving module, used for receiving a two-dimensional code image set sent by an image generating device; wherein the two-dimensional code image set includes a plurality of two-dimensional code images; An acquisition module, used to acquire data information included in each two-dimensional code image; wherein the data information includes a data block identifier; A grouping module, used for grouping the data information according to the data block identifier to obtain multiple data information groups; A restoration module, used for restoring each data information group to data block information based on an erasure code encoding mechanism; An acquisition module, used to splice all data block information to obtain transmission information corresponding to the two-dimensional code image set; The data information also includes a data slice identifier; The restoration module is specifically used for: Constructing a generator matrix for erasure code encoding; wherein the number of rows of the generator matrix is greater than the number of columns, and the sub-matrices included in the generator matrix are all reversible matrices; Obtaining a data slice identifier corresponding to each data information in the data information group; Selecting a preset number of data information from the data information group as a row, and generating a first matrix according to the data slice identifiers corresponding to the selected data information; wherein the number of rows of the first matrix is equal to the number of columns of the generated matrix; Deleting the data block identifier and the data slice identifier at the start position of each row in the first matrix to obtain a data matrix; wherein the number of rows of the data matrix is equal to the number of columns of the generator matrix; According to the data slice identifier corresponding to each row in the data matrix, the corresponding row is obtained from the generator matrix to generate a decoding matrix; wherein the number of rows and columns of the decoding matrix are equal to the number of columns of the generator matrix, and the decoding matrix is a submatrix of the generator matrix; The product of the inverse matrix of the decoding matrix and the data matrix is calculated, and each byte code information in the product is concatenated from the upper left to the lower right to obtain the data block information corresponding to the data information group.
9. A data transmission device, characterized in that: The method comprises at least one processor and a memory storing computer executable instructions, wherein the processor implements the steps of the method according to any one of claims 1 to 6 when executing the instructions.
10. A computer-readable storage medium, characterized in that: Computer instructions are stored thereon, and when the instructions are executed, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Data block reconstruction method based on erasure codes
CN104461781A
Two-dimensional code ferrying method, encoding method, decoding method and decoding device
CN110941971A