A data decoding method for rectangular grayscale dot matrix images used for data storage

Through the data decoding method of rectangular grayscale lattice images, using grayscale statistics and Reed-Solomon coding algorithm, the problem of insufficient storage capacity of black and white rectangular lattice images is solved, the data storage density and recovery reliability are improved, and the data storage is adapted to massive data storage. and media contamination of the environment.

CN114820827BActive Publication Date: 2024-10-15YICUN (SHANGHAI) INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210483542.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-06
Publication Date
2024-10-15
Estimated Expiration
2042-05-06

AI Technical Summary

Technical Problem

The existing black and white rectangular dot matrix image encoding scheme cannot meet the needs of massive data storage due to limited storage capacity, and the data recovery rate is low under the influence of media contamination and environmental noise.

Method used

Using the data decoding method of rectangular grayscale dot matrix image, find the auxiliary positioning point through the template matching algorithm of grayscale statistics, calculate the MTF value, perform unsharpening processing, read the pixel mean array, use Reed-Solomon decoding and vertical and horizontal Encoding algorithms decode data, improving storage density and data integrity.

Benefits of technology

It achieves an increase in data storage density, can adjust the storage capacity according to the accuracy of the printing device, meets the demand for massive data storage, and improves the reliability of data recovery under the influence of media contamination and noise.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114820827B_ABST
    Figure CN114820827B_ABST
Patent Text Reader

Abstract

The invention discloses a data decoding method for a rectangular grayscale dot matrix image for data storage, comprising the following steps: step 1: loading the image in the form of a grayscale bitmap; step 2: finding four auxiliary positioning points of the image; the finding method is as follows: step 2.1: searching for the frame position, the top and bottom positions pl, pm, and the left and right positions pl, pr from the four edges of the image through 4 equally divided points to the center respectively; step 2.2: calculating the horizontal scale parameters rh and rv of the image to be encoded according to the position of the frame and the provided encoded image size information; step 2.3: the data that can be stored can be adjusted according to the accuracy and amplitude of the printing device, making full use of grayscale multi-color to greatly improve the high density of data storage to meet the needs of mass data storage; and because the horizontal and vertical RS encoding + data dispersion algorithm is adopted, the probability of restoration under the influence of medium contamination and environmental noise is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data storage, and in particular relates to a data decoding method for a rectangular grayscale dot matrix image used for data storage. Background Art

[0002] With the development of Internet and big data technology, global data is growing explosively, and PB-level data is becoming more and more common. Massive data also has a "temperature". As it grows exponentially, it also has hierarchical characteristics. According to the access frequency from high to low, data can be classified into hot data, warm data, and cold data.

[0003] On the one hand, the value of cold data is not necessarily lower than that of hot data, and it will become more important over time. Therefore, it is also necessary to ensure the long-term and secure storage of massive cold data. On the other hand, infrequently accessed cold data occupies a large amount of online storage resources, causing serious waste of resources and needs to be transferred to offline storage in a timely manner.

[0004] At present, the carriers suitable for long-term offline data storage are film and glass media. Unlike hard disks and optical disks that rely on rotational access, film and glass media use rectangular dot matrix images to maximize the storage area of ​​film, glass and other media, achieving the purpose of mass storage.

[0005] Rectangular dot images have a wide range of applications, such as Hanxin Code, QR Code, Data Matrix, etc. However, these rectangular image codes were originally designed for label information data exchange, and in order to adapt to the data reading capabilities of ordinary devices, they were designed with only black and white representing a single bit of 0 and 1, respectively, and there is a small unit area size limit, resulting in a small storage capacity for data, with a maximum capacity of <5k. Therefore, this type of encoding cannot adapt to massive data storage. Summary of the invention

[0006] The purpose of the present invention is to provide a data decoding method for a rectangular grayscale dot matrix image for data storage in order to solve the above problems, thereby solving the problems mentioned in the background technology.

[0007] In order to solve the above problems, the present invention provides a technical solution:

[0008] A data decoding method for a rectangular grayscale dot matrix image for data storage comprises the following steps:

[0009] Step 1: Load the image as a grayscale bitmap;

[0010] Step 2: Find four auxiliary positioning points of the image;

[0011] Here’s how to find it:

[0012] Step 2.1: Search for the border position from the four edges of the image through 4 equally divided points toward the center, the top and bottom positions pl, pm, and the left and right positions pl, pr;

[0013] Step 2.2: Calculate the horizontal scale parameters rh and rv of the image to be encoded according to the position of the border and the provided encoded image size information;

[0014] Step 2.3: Find the black and white cross lines using a template matching algorithm based on grayscale statistics according to the parameters of step 2.1 and step 2.2 of the four borders;

[0015] Step 3: Use the four auxiliary positioning points found in step 2 to locate the color block reference bar, the surrounding MTF reference line pair bars, the height and width of the data area and metadata area, and the starting pixel position;

[0016] Step 4: Calculate the MTF values ​​of the four sides of the image using the MTF reference lines around the image according to the formula and then calculate the average of the four MTF values;

[0017] Step 5: When the mean value of MTF is lower than 50% and higher than 25%, the image is sharpened by means of an unsharp mask algorithm;

[0018] Step 6: Calculate the pixel size and starting position of each data point using the metadata area location and height and width information calculated in step 3;

[0019] Step 7: Start reading and generating a pixel mean value array from the reading starting point parameter calculated in step 6;

[0020] Step 7.1: Use the height and width parameters of the data points calculated in step 6 to read the pixel array of the specified area and calculate the mean of the pixel array;

[0021] Step 7.2: Read the height value of the pixel occupied by the starting point offset downward by one data point, and read the mean value of the next pixel group according to step 7.1;

[0022] Repeat step 7 to read data from left to right until the entire metadata area is read;

[0023] Step 8: Demodulate the meta information data;

[0024] Step 8.1: Traverse the pixel mean array read in step 7, and convert it into an array of bit values ​​v by judging the byte value c according to the formula:

[0025] Step 8.2: Combine the 8 bit value arrays formed in step 8.1 into a byte value from high to low, and generate a meta-information array to be decoded;

[0026] Step 9: Decode the meta information data. The meta information data to be decoded contains a Reed-Solomon error correction code length of p'. Then, a Reed-Solomon decoding attempt is performed on the meta information data according to the parameters of (p', p'-32, 33);

[0027] Step 10: After decoding is successful, the decoded data is converted into a string, and the color scale number C, the coding matrix number K, the coding matrix data row number M, the vertical coding length M', the coding matrix data column number N, the horizontal coding length information N', the image size, the coding rule version information, the data CRC32 value and the frame number are parsed and extracted in JSON format;

[0028] Step 11: Read C grayscale mean value arrays according to the color scale number parameter C extracted from the meta information data and the starting position and height and width information of the color scale reference bar obtained in step 3;

[0029] Step 12: Calculate the pixel size and starting position of each data point using the data area location and height and width information calculated in step 3;

[0030] Step 13: Start reading and generating a pixel mean array from the reading starting point parameter calculated in step 12, and read data from left to right and from top to bottom with the height and width of the data point pixel as the step length until all the data are read to form an array to be demodulated;

[0031] Step 14: demodulate data;

[0032] Step 14.1: traverse the pixel mean array, compare the value with the value range of the grayscale array formed in step 11, and map the corresponding grayscale array index value into a bit group data;

[0033] Step 14.2: At this time, the size of the bit group array is the length of the pixel mean array * n. The bit group array is traversed, and the bit group data is bit-concatenated and demodulated from high to low bits in groups of n to form a byte array;

[0034] Step 15: Decode the data;

[0035] Step 15.1: Generate K decoding matrices of size (M+M')*(N+N');

[0036] Step 15.2: traverse the matrix data to be decoded, and write the data into the decoding matrices A1 to AK respectively, which is the reverse operation of the encoding operation A.5.4;

[0037] Step 15.3: Perform vertical ReedSolomon decoding and horizontal ReedSolomon decoding on the Ak matrix;

[0038] Step 15.3.1: Perform Reed-Solomon decoding on each of the N+N' column vectors [a1y, a2y, ..., aMy] of the matrix Ak with parameters (M+M', M, M'+1) once;

[0039] Step 15.3.2: Try Reed-Solomon decoding of the M row vectors [ax1, ax2, ..., axN] (x>=1, x<=M) of the matrix Ak with (N+N', N, N'+1) as parameters respectively;

[0040] Step 15.4: extract A1[1~M; 1~N]~AK[1~M; 1~N] sub-matrix data from K decoding matrices and concatenate them head to tail to form restored data;

[0041] Step 16: Calculate the CRC32 value of the restored data and compare it with the CRC32 parameter value extracted from the meta information. If the two are the same, data restoration is completed; if they are different, data restoration fails.

[0042] Preferably, in step 4, L max is the maximum brightness, L min is the minimum brightness.

[0043] Preferably, in step 5, when the mean value of MTF is higher than 50%, no sharpening process is required, and when the mean value of MTF is lower than 25%, it is regarded as invalid image data.

[0044] Preferably, in step 5, the unsharp mask algorithm first extracts low frequencies, and then subtracts the low frequencies from the original image to obtain high frequencies.

[0045] Preferably, in step 14.2, the value n=log2C.

[0046] Preferably, in step 15.3, the value k is in the range of k≥1, k≤K.

[0047] Preferably, in step 15.3.1, the range of the value y is y≥1, y≤N+N'.

[0048] Preferably, in step 15.3.2, the value x≥1,x≤M.

[0049] The beneficial effects of the present invention are: solving the problem that the original black and white rectangular dot matrix image data storage solution cannot be used for mass data storage due to limited storage capacity, and designing a set of rectangular image encoding solutions by improving data storage density and data storage integrity;

[0050] The advantage is that the stored data can be adjusted according to the accuracy and amplitude of the printing equipment, and the full use of grayscale and multi-color greatly improves the high density of data storage to meet the needs of massive data storage; and because of the use of horizontal and vertical RS encoding + data dispersion algorithm, the probability of restoration is improved under the influence of media damage and environmental noise. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] For ease of explanation, the present invention is described in detail with reference to the following specific implementations and the accompanying drawings.

[0052] Figure 1 It is a schematic diagram of the coding and decoding matrix of the present invention;

[0053] Figure 2 It is a schematic diagram of the frame of the present invention;

[0054] Figure 3 It is a schematic diagram of the data area border of the present invention;

[0055] Figure 4 It is a schematic diagram of positioning punctuation points of the present invention;

[0056] Figure 5 A schematic diagram of a reference line pair of transfer functions of the present invention;

[0057] Figure 6 A schematic diagram of a color reference bar of the present invention;

[0058] Figure 7 is a schematic diagram of visual metadata of the present invention;

[0059] Figure 8 It is a schematic diagram of the metadata storage area of ​​the present invention;

[0060] Fig. 9 It is a schematic diagram of the data area of ​​the present invention. DETAILED DESCRIPTION

[0061] like Figure 1-9 As shown, this specific implementation adopts the following technical solutions:

[0062] Example:

[0063] A data decoding method for a rectangular grayscale dot matrix image for data storage comprises the following steps: Step 1: loading the image in the form of a grayscale bitmap; Step 2: finding four auxiliary positioning points of the image;

[0064] The search method is as follows: Step 2.1: Search for the border position from the four edges of the image through 4 equally divided points to the center, the top and bottom positions pl, pm, the left and right positions pl, pr; Step 2.2: Calculate the horizontal scale parameters rh and rv of the image to be encoded according to the position of the border and the provided encoded image size information; Step 2.3: Use the template matching algorithm based on grayscale statistics to find the black and white cross lines according to the parameters of steps 2.1 and 2.2 of the four borders; Step 3: Use the four auxiliary positioning points found in step 2 to locate the color block reference bar, the surrounding MTF reference line pairs, the data area, the height and width of the metadata area, and the starting pixel position; Step 4: Use the surrounding MTF reference line pairs according to the formula Calculate the MTF values ​​of the four sides of the image and then calculate the average of the four MTF values; Step 5: When the average MTF is lower than 50% and higher than 25%, sharpen the image by means of an unsharp mask algorithm; Step 6: Calculate the pixel size and starting position of each data point by using the metadata area positioning and height and width information calculated in Step 3; Step 7: Read and generate a pixel mean array starting from the reading starting point parameters calculated in Step 6; Step 7.1: Use the height and width parameters of the data points calculated in Step 6 to read the pixel array of the specified area and calculate the mean of the pixel array; Step 7.2: Read the height value of the pixel point occupied by the data point offset downward from the starting point, and read the mean of the next pixel group according to Step 7.1; Repeat Step 7 to read data from left to right until the entire metadata area is read; Step 8: Demodulate the metadata data; Step 8.1: Traverse the pixel mean array read in Step 7, and convert it into an array of bit values ​​v by judging the byte value c according to the formula:

[0065]

[0066] Step 8.2: Combine the 8 bit value arrays formed in step 8.1 into a byte value from high to low, and generate a meta-information array to be decoded; Step 9: Decode the meta-information data. The meta-information data to be decoded contains a Reed-Solomon error correction code length of p', and then try to perform Reed-Solomon decoding on the meta-information data according to the parameters of (p', p'-32, 33); Step 10: After successful decoding, convert the decoded data into a string, parse and extract the color level number C, the number of encoding matrices K, the number of rows of encoding matrix data M, the vertical encoding length M', the number of columns of encoding matrix data N, the horizontal encoding length information N', the image size, the encoding rule version information, the data CRC32 value and the frame number in JSON format; Step 11: Read C grayscale color level mean arrays according to the color level number parameter C extracted from the meta-information data and the starting position and height and width information of the color level reference bar obtained in step 3; Step 12: Calculate the grayscale color level through step 3 The pixel size and starting position of each data point are calculated based on the data area positioning and height and width information; Step 13: Read and generate the pixel mean array from the reading starting point parameters calculated in Step 12, and read the data from left to right and from top to bottom with the height and width of the data point pixels as the step length until the entire data is read to form an array to be demodulated; Step 14: Demodulate the data; Step 14.1: Traverse the pixel mean array, compare the value with the value range of the grayscale array formed in Step 11, and map the corresponding grayscale array index value into a bit group data; Step 14.2: The size of the bit group array at this time is the pixel mean array length * n, traverse the bit group array, and demodulate the bit group data from high to low in groups of n into a byte array; Step 15: Decode the data; Step 15.1: Generate K decoding matrices of size (M+M')*(N+N'); Step 15.2: Traverse the matrix data to be decoded, and write the data into the decoding matrix A respectively in turn 1 ~A K In step 15.3, the reverse operation of encoding operation A.5.4 is performed. k Matrix A is decoded vertically and horizontally by ReedSolomon decoding; Step 15.3.1: Matrix A k The N+N' column vectors [a 1y ,a 2y ,...,a My ] Try Reed-Solomon decoding with (M+M', M, M'+1) as parameters once; Step 15.3.2: For matrix A k The M row vectors [a x1 ,a x2 ,...,a xN](x>=1,x<=M) respectively try Reed-Solomon decoding with (N+N', N, N'+1) as parameters; Step 15.4: Extract A from K decoding matrices 1 [1~M; 1~N]~A K [1~M; 1~N] The sub-matrix data are concatenated head to tail into restored data; Step 16: Calculate the CRC32 value of the restored data and compare it with the CRC32 parameter value extracted from the meta information. If the two are the same, data restoration is completed; if they are different, data restoration fails.

[0067] Among them, in step 4, L max is the maximum brightness, L min is the minimum brightness.

[0068] Among them, in step 5, when the mean value of MTF is higher than 50%, no sharpening processing is required, and when the mean value of MTF is lower than 25%, it will be regarded as invalid image data.

[0069] Among them, in step 5, the unsharp mask algorithm first extracts the low frequency, and then subtracts the low frequency from the original image to obtain the high frequency.

[0070] Wherein, in step 14.2, the value n=log2C.

[0071] Wherein, in step 15.3, the range of the value k is k≥1, k≤K.

[0072] Among them, in step 15.3.1, the range of the value y is y≥1, y≤N+N'.

[0073] In step 15.3.2, the value x≥1,x≤M.

[0074] The above shows and describes the basic principles and main features of the present invention and the advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions are only for illustrating the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which shall fall within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the attached claims and their equivalents.

Claims

1. A data decoding method for a rectangular grayscale dot matrix image for data storage, characterized in that: The steps include: Step 1: Load the image as a grayscale bitmap; Step 2: Find four auxiliary positioning points of the image; Here’s how to find it: Step 2.1: Search for the border position from the four edges of the image through 4 equally divided points toward the center, the top and bottom positions pt, pm, and the left and right positions pl, pr; Step 2.2: Calculate the horizontal scale parameters rh and rv of the image to be encoded according to the position of the border and the provided encoded image size information; Step 2.3: Find the black and white cross lines using a template matching algorithm based on grayscale statistics according to the parameters of step 2.1 and step 2.2 of the four borders; Step 3: Use the four auxiliary positioning points found in step 2 to locate the color scale reference bar, the surrounding MTF reference line pair bars, the height and width of the data area and metadata area, and the starting pixel position; Step 4: Use the MTF reference lines around the bar according to the formula Calculate the MTF values ​​of the four sides of the image and then calculate the average of the four MTF values; Step 5: When the mean value of MTF is lower than 50% and higher than 25%, the image is sharpened by means of an unsharp mask algorithm; Step 6: Calculate the pixel size and starting position of each data point using the metadata area location and height and width information calculated in step 3; Step 7: Start reading and generating a pixel mean value array from the reading starting point parameter calculated in step 6; Step 7.1: Use the height and width parameters of the data points calculated in step 6 to read the pixel array of the specified area and calculate the mean of the pixel array; Step 7.2: Read the height value of the pixel occupied by the starting point offset downward by one data point, and read the mean value of the next pixel group according to step 7.1; Repeat step 7 to read data from left to right until the entire metadata area is read; Step 8: Demodulate the meta information data; Step 8.1: Traverse the pixel mean array read in step 7, and convert it into an array of bit values ​​v by judging the byte value c according to the formula: Step 8.2: Combine the 8 bit value arrays formed in step 8.1 into a byte value from high to low, and generate a meta-information array to be decoded; Step 9: Decode the meta information data. The meta information data to be decoded contains a Reed-Solomon error correction code length of p'. Then, a Reed-Solomon decoding attempt is performed on the meta information data according to the parameters of (p', p'-32, 33); Step 10: After decoding is successful, the decoded data is converted into a string, and the color scale number C, the coding matrix number K, the coding matrix data row number M, the vertical coding length M', the coding matrix data column number N, the horizontal coding length information N', the image size, the coding rule version information, the data CRC32 value and the frame number are parsed and extracted in JSON format; Step 11: Read C grayscale mean value arrays according to the color scale number parameter C extracted from the meta information data and the starting position and height and width information of the color scale reference bar obtained in step 3; Step 12: Calculate the pixel size and starting position of each data point using the data area location and height and width information calculated in step 3; Step 13: Start reading and generating a pixel mean array from the reading starting point parameter calculated in step 12, and read data from left to right and from top to bottom with the height and width of the data point pixel as the step length until all the data are read to form an array to be demodulated; Step 14: demodulate data; Step 14.1: traverse the pixel mean array, compare the value with the value range of the grayscale array formed in step 11, and map the corresponding grayscale array index value into a bit group data; Step 14.2: At this time, the size of the bit group array is the length of the pixel mean array * n. The bit group array is traversed, and the bit group data is bit-concatenated and demodulated from high to low bits in groups of n to form a byte array; Step 15: Decode the data; Step 15.1: Generate K decoding matrices of size (M+M')*(N+N'); Step 15.2: Traverse the matrix data to be decoded and write the data into the decoding matrices A1 to A1 respectively. K In, it is the reverse operation of the encoding operation; Step 15.3: A k The matrix performs vertical ReedSolomon decoding and horizontal ReedSolomon decoding; Step 15.3.1: For the matrix A k The N+N' column vectors [a 1y ,a 2y ,...,a My ] Try Reed-Solomon decoding with (M+M',M,M'+1) as parameters once; Step 15.3.2: Matrix A k The M row vectors [a x1 ,a x2 ,...,a xN ]x>=1,x<=M try Reed-Solomon decoding with N+N', N, N'+1 as parameters respectively; Step 15.4: Extract A1[1~M; 1~N]~A from K decoding matrices K [1~M; 1~N] The sub-matrix data is concatenated head to tail to form the restored data; Step 16: Calculate the CRC32 value of the restored data and compare it with the CRC32 parameter value extracted from the meta information. If the two are the same, data restoration is completed; if they are different, data restoration fails.

2. The method for decoding rectangular grayscale dot matrix images for data storage according to claim 1, characterized in that: In step 4, L max is the maximum brightness, L min is the minimum brightness.

3. The method for decoding rectangular grayscale dot matrix images for data storage according to claim 1, characterized in that: In step 5, when the mean value of MTF is higher than 50%, no sharpening process is required, and when the mean value of MTF is lower than 25%, it is regarded as invalid image data.

4. The method for decoding rectangular grayscale dot matrix images for data storage according to claim 1, characterized in that: In step 5, the unsharp mask algorithm first extracts the low frequency, and then subtracts the low frequency from the original image to obtain the high frequency.

5. The method for decoding rectangular grayscale dot matrix images for data storage according to claim 1, characterized in that: In step 14.2, the value n=log2C.

6. The method for decoding rectangular grayscale dot matrix images for data storage according to claim 1, characterized in that: In step 15.3, the value k is in the range of k≥1, k≤K.

7. The method for decoding rectangular grayscale dot matrix images for data storage according to claim 1, characterized in that: Step 15.3.1, the range of the value y is y≥1,y≤N+N'.

8. The method for decoding rectangular grayscale dot matrix images for data storage according to claim 1, characterized in that: In step 15.3.2, the value x≥1,x≤M.