A method for storing image data based on big data

Through bit layering and run-length matrix analysis of the image, combined with neural network and confusion matrix calculation, the most appropriate compression method and transmission sequence are determined, which solves the problem of edge detail loss during image data compression and achieves efficient image data transmission.

CN114745553BActive Publication Date: 2025-01-21SHENZHEN MEIMEI NETWORK TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210358905.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-06
Publication Date
2025-01-21
Estimated Expiration
2042-04-06

AI Technical Summary

Technical Problem

In the prior art, when image data is compressed, it is difficult to effectively retain edge detail information of the image, resulting in a decrease in image resolution and low transmission efficiency.

Method used

By bit-stratifying the grayscale image to be stored, the bit-run matrix of each enhancement layer is constructed, the long-run and short-run advantage metrics are calculated, the neural network is used to determine the most appropriate compression method, and a confusion matrix is ​​constructed to calculate edge detail preservation. situation, determine the transmission sequence for compression and transmission.

Benefits of technology

It improves the efficiency of image data transmission while completely retaining the edge details of the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114745553B_ABST
    Figure CN114745553B_ABST
Patent Text Reader

Abstract

The invention relates to an image data storage method based on big data. The method comprises the following steps: performing bit stratification on a grayscale image to be stored to obtain all enhanced layers, calculating a long run advantage metric value and a short run advantage metric value of each enhanced layer according to a bit run matrix of each enhanced layer, compressing each enhanced layer by using run-length coding and Hough coding to obtain a compression efficiency of each enhanced layer, obtaining a most suitable compression method for each enhanced layer by using a neural network, obtaining a grayscale image to be stored and an edge binary image of each enhanced layer to obtain a confusion matrix of each enhanced layer, calculating a recall rate and an error rate of edge detection of each enhanced layer to obtain an evaluation value of each enhanced layer, obtaining a transmission order according to the evaluation value, and storing image data according to the encoding method and transmission order of each enhanced layer by using a storage function of a big data system, thereby improving transmission efficiency and retaining edge details.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data, and in particular to an image data storage method based on big data. Background Art

[0002] As digital life becomes more and more normalized and the update of various hardware devices accelerates, the collected image data is growing at a geometric rate. This rapidly growing data has brought a huge burden to storage, processing and transmission. An important way to solve the data storage problem is data compression.

[0003] Data compression methods include run-length coding operators, Huffman coding operators, etc. Different coding methods have different advantages. For images, since there is a correlation between the current pixel and its neighboring pixels, run-length coding can achieve better compression efficiency. However, not all images are suitable for run-length coding, so it cannot be generalized. Specific targeted analysis is required to determine the appropriate coding method. The reading of image data consumes traffic and time. Usually, asymptotic image transmission is used. While reducing traffic and waiting time, it will lead to a decrease in image resolution, and edge detail information cannot be loaded in the first time. Summary of the invention

[0004] The present invention provides an image data storage method based on big data, which solves the problems of image data compression mode and edge details, and adopts the following technical solutions:

[0005] Perform bit stratification on the grayscale image to be stored to obtain all enhancement layers of the grayscale image to be stored;

[0006] Obtaining a bit run matrix of each enhancement layer according to the number of consecutive occurrences of the bit value of each enhancement layer, and calculating a long run advantage metric value and a short run advantage metric value of each enhancement layer according to the bit run matrix of each enhancement layer;

[0007] Compress each enhancement layer using different compression methods, and calculate the compression efficiency of each enhancement layer under each compression method;

[0008] Inputting the long-run advantage metric value and the short-run advantage metric value of each enhancement layer and the compression efficiency of the enhancement layer under different compression modes into a neural network, and obtaining the most suitable compression mode for each enhancement layer through the neural network;

[0009] Obtain an edge binary image of the grayscale image to be stored and an edge binary image of each enhancement layer;

[0010] Calculate the probability of edge pixels in the edge binary image of each enhancement layer being stored in the edge binary image of the grayscale image to be stored;

[0011] Calculate the probability of background pixels in the edge binary image of each enhancement layer being stored in the edge binary image of the grayscale image to be stored;

[0012] Construct a confusion matrix for each enhancement layer based on the probability of edge pixels and the probability of background pixels in the edge binary image of each enhancement layer;

[0013] Calculate the recall rate and error rate of each enhancement layer edge according to the confusion matrix of each enhancement layer, obtain the evaluation value of each enhancement layer according to the recall rate of each enhancement layer edge and the compression efficiency of the most suitable compression method of the enhancement layer, and determine the transmission order according to the evaluation value of each enhancement layer and the error rate of the enhancement layer edge;

[0014] The enhancement layer of the grayscale image to be stored is transmitted in a transmission order, and before each transmission, it is compressed according to the most suitable compression method for the enhancement layer to complete the image data storage.

[0015] The method for performing bit stratification on the grayscale image to be stored to obtain all enhancement layers is as follows:

[0016] The grayscale value of each pixel in the grayscale image to be stored is converted into binary. The grayscale value can be represented by an 8-bit binary code, where each bit is from the first high bit to the eighth high bit from left to right;

[0017] The first and second high bits are used as the first enhancement layer, and so on, to obtain four enhancement layers.

[0018] The calculation method of the long run advantage metric value and the short run advantage metric value of each enhancement layer is as follows:

[0019] Long run advantage measure L:

[0020]

[0021] Short-run advantage measure S:

[0022]

[0023] Among them, w bt It is the frequency of t consecutive occurrences of pixels with bit value b in each enhancement layer, and M and N are the image sizes.

[0024] The confusion matrix of each enhancement layer is:

[0025]

[0026] Among them, H is the confusion matrix of the enhancement layer, TP is the probability that the edge pixels in the edge binary image of the enhanced layer are correctly saved in the edge binary image of the grayscale image to be stored, TN is the probability that the edge pixels in the edge binary image of the enhanced layer are not correctly saved in the edge binary image of the grayscale image to be stored, FP is the probability that the background pixels in the edge binary image of the enhanced layer are not correctly saved in the edge binary image of the grayscale image to be stored, and FN is the probability that the background pixels in the edge binary image of the enhanced layer are correctly saved in the edge binary image of the grayscale image to be stored.

[0027] The calculation method of the recall rate of the enhancement layer edge is as follows:

[0028]

[0029] In the formula, R is the recall rate.

[0030] The error rate of the enhancement layer edge is calculated as follows:

[0031]

[0032] Where W is the error rate.

[0033] The calculation method of the evaluation value of each enhancement layer is:

[0034] Z=αη+βR

[0035] Where Z is the evaluation value of each enhancement layer, α and β are allocated artificially according to the emphasis on compression efficiency and recall rate, and α+β=1, and η is the compression efficiency of the most appropriate compression method for each enhancement layer.

[0036] The specific method for determining the transmission order is as follows:

[0037] Sort the enhancement layers according to the evaluation value of each enhancement layer;

[0038] According to the above ranking, from top to bottom, find the enhancement layer with the highest ranking and an error rate less than 0.2, which is the priority transmission layer;

[0039] The remaining enhancement layers are still transmitted in the order of the evaluation values.

[0040] The beneficial effects of the present invention are as follows: an enhancement layer is obtained by analyzing the bit-layered image data, a bit run matrix of each enhancement layer is obtained according to the number of consecutive occurrences of the bit value in the enhancement layer, a run advantage metric is obtained according to the bit run matrix of each enhancement layer, the compression efficiency of each enhancement layer under each encoding method is obtained using different encoding compression methods, the most suitable compression method for each enhancement layer is determined, an edge binary map of each enhancement layer is further obtained, a confusion matrix of the enhancement layer is obtained, the edge detail retention of each enhancement layer is obtained according to the confusion matrix, the transmission order is determined by using the edge detail retention and the compression efficiency, the enhancement layer is compressed according to the most suitable compression method and then transmitted according to the transmission order, the transmission efficiency is improved while the edge details are completely retained. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0042] Figure 1 It is a flow chart of a method for storing image data based on big data of the present invention;

[0043] Figure 2 It is a schematic diagram of enhancement layer and high bit division of an image data storage method based on big data of the present invention; DETAILED DESCRIPTION

[0044] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0045] An embodiment of an image data storage method based on big data of the present invention is as follows: Figure 1 As shown, including:

[0046] Step 1: Bit-stratify the grayscale image to be stored to obtain all enhanced layers of the grayscale image to be stored;

[0047] The purpose of this step is to perform bit-layering on the grayscale image to be stored, represent the grayscale value of each pixel using 8-bit binary data, and perform layered processing on the 8-bit binary data with two bits as a layer.

[0048] First, this embodiment builds a big data system for storing and analyzing data. Common architectures of big data systems include Hadoop, Spark, etc.

[0049] Then, the analysis function of the big data system is further used to perform bit stratification on the grayscale image to be stored, as follows:

[0050] (1) Convert the grayscale value of each pixel in the grayscale image to be stored into binary. The grayscale value can be represented by an 8-bit binary code, where each bit is from the first high bit to the eighth high bit from left to right, such as Figure 1 shown.

[0051] (2) The first and second high bits are used as the first enhancement layer, and so on, to obtain four enhancement layers, such as Figure 2 As shown. For each enhancement layer, there are only four bit values, namely 11, 10, 01, and 00. Taking the first enhancement layer as an example, when the grayscale value range is [192, 255], the bit value is 11; when the grayscale value range is [128, 191], the bit value is 10; when the grayscale value range is [64, 127], the bit value is 01; when the grayscale value range is [0, 63], the bit value is 00.

[0052] Step 2: obtaining a bit run matrix of each enhancement layer according to the number of consecutive occurrences of the bit value of each enhancement layer, and calculating a long run advantage metric value and a short run advantage metric value of each enhancement layer according to the bit run matrix of each enhancement layer;

[0053] The purpose of this step is to obtain the run-length advantage metric of the enhancement layer by constructing a bit run-length matrix, and then determine the encoding method of the enhancement layer in step 4.

[0054] It should be noted that image compression requires encoding of the image. There are many encoding methods. In this embodiment, the selected encoding methods are run-length encoding and Huffman encoding. The characteristics of the two are as follows:

[0055] (1) Run-length coding is suitable for scenarios where the image data itself contains a large amount of continuously repeated content, so as to ensure the compression efficiency of run-length coding.

[0056] (2) The coding efficiency of Huffman coding for different image data is different. When the probability of the image data is a negative power of 2, the coding efficiency reaches 100%. If the probability of the image data is equal, the coding efficiency is the lowest.

[0057] Among them, the run length can only be calculated when the two grayscale values ​​are equal in the original image data. Therefore, the probability of having a long run advantage, that is, a large number of continuously repeated contents, is small; for the image data after bit layering, in addition to the bit values ​​being equal when the grayscale values ​​are equal, the bit values ​​are also equal when the grayscale values ​​are within a specific range, and the run length can be calculated. Therefore, the probability of having a long run advantage, that is, a large number of continuously repeated contents, is increased.

[0058] Based on decimal grayscale values, the probability that n consecutive pixels have the same grayscale value is:

[0059]

[0060] After converting the grayscale value into 8-bit binary code and dividing the code into enhancement layers, the probability is:

[0061]

[0062] The image data after step one-bit layering has a higher probability of having a long run-length advantage, and is more suitable for image data compression using run-length coding; however, in this case, if the image data still has a short run-length advantage, it is more suitable for image data compression using Huffman coding.

[0063] The bit run matrix of the enhancement layer is a matrix composed of the lengths of the bit value parades (the number of times the bit values ​​appear consecutively). The bit run matrix is ​​defined as: The bit run matrix is ​​denoted as D[l,t], where l represents the number of possible values ​​of the bit value in a certain enhancement layer, and t represents the longest length of the bit value in the horizontal direction, that is, there are at most t consecutive l occurrences in the image, that is, the number of columns of the image.

[0064] For example: For the grayscale image img to be stored:

[0065] (1) Get its grayscale matrix as follows:

[0066]

[0067] (2) After converting it into binary code, the bit matrix corresponding to the first enhancement layer is:

[0068]

[0069] (3) The bit run matrix corresponding to the bit matrix corresponding to the first enhancement layer is:

[0070]

[0071] The bit run matrix D1[4,4], where the first 4 represents the number of possible bit values ​​[11, 10, 01, 00], that is, the first row of the image is 11, the second row is 10, the third row is 01, and the fourth row is 00. The second 4 represents the longest length of the bit value, that is, the number of columns of the image. The first column represents a run length of 4, the second column represents a run length of 3, the third column represents a run length of 2, and the fourth column represents a run length of 1.

[0072] In the bit matrix b1 obtained by (2), count the number of times the bit value 11 appears consecutively in the horizontal direction.

[0073] Among them, 11 appears 0 for 4 consecutive times, 11 appears 1 for 3 consecutive times, 11 appears 0 for 2 consecutive times, and 11 appears 1 for 1 consecutive time (it should be noted here that because all 11, 11, 11 have been calculated when calculating the number of times 11 appears 3 consecutive times, the 11 just calculated will not be included in the calculation when calculating the number of times 11 appears 1 time). Therefore, the first row of the bit run matrix D1[4,4] in (3) is 10, 01, 00. The bit run matrices of the remaining three enhancement layers can be obtained in this way.

[0074] Among them, the calculation method of the long run advantage metric value S and the short run advantage metric value L is as follows:

[0075]

[0076]

[0077] Among them, w bt It indicates the frequency of t consecutive occurrences of pixels with bit value b in each enhancement layer, which can be obtained through the bit run matrix. M and N are the image sizes.

[0078] Step 3: compress each enhancement layer using different compression methods, and calculate the compression efficiency of each enhancement layer under each compression method;

[0079] The purpose of this step is to use different compression methods to compress each enhancement layer and calculate the compression efficiency of each enhancement layer. The compression methods used in this embodiment are run-length coding and Huffman coding. The image is encoded by these two different coding methods to achieve compression.

[0080] The compression efficiency of each enhancement layer is calculated as:

[0081] (1) Obtain the number of bytes C required to store the original grayscale image, use run-length coding and Huffman coding to compress each enhancement layer of the layered grayscale image, and obtain the number of bytes Z required to store the compressed enhancement layer ij ;

[0082] (2) Calculate the corresponding compression efficiency η ij :

[0083]

[0084] Where i∈[1,2],j∈[1,4], and then calculate the corresponding compression efficiency η ij , i=1 indicates the use of run-length coding compression, i=2 indicates the use of Huffman coding compression, and j indicates the jth enhancement layer.

[0085] Step 4: inputting the long-run advantage metric value and the short-run advantage metric value of each enhancement layer and the compression efficiency of the enhancement layer under different compression methods into the neural network, and obtaining the most suitable compression method for each enhancement layer through the neural network;

[0086] The purpose of this step is to input the run-length advantage metric of each enhancement layer obtained in step 2 and the compression efficiency of each enhancement layer obtained in step 3 into the DNN neural network, so that the neural network can determine the compression method for the enhancement layer, obtain the most appropriate compression method for each enhancement layer, and compress the enhancement layer according to the most appropriate compression method.

[0087] Among them, the DNN neural network used to judge the compression method of the enhancement layer is binary classification. The structure is the Encoder-Decoder structure. The input is the run advantage metric of the enhancement layer, and the output is the binary classification result of the enhancement layer, that is, the most suitable compression method and encoding method for each enhancement layer are output. The loss used by the network is the cross entropy loss function.

[0088] Step 5: Obtain the edge binary image of the grayscale image to be stored and the edge binary image of each enhanced layer; calculate the probability of storing edge pixels in the edge binary image of the grayscale image to be stored in the edge binary image of each enhanced layer; calculate the probability of storing background pixels in the edge binary image of the grayscale image to be stored in the edge binary image of each enhanced layer; construct a confusion matrix for each enhanced layer according to the probability of edge pixels in the edge binary image of each enhanced layer and the probability of background pixels;

[0089] The purpose of this step is to obtain the edge detail preservation of the enhancement layer based on the edge binary map of the enhancement layer.

[0090] Among them, the method of obtaining the confusion matrix of each enhancement layer is as follows:

[0091] (1) Use the Canny operator to perform edge detection on the original grayscale image to be stored. The edge pixels are recorded as 1 and the background pixels are recorded as 0. The edge image is converted into an edge binary image, recorded as A0.

[0092] (2) Use the Canny operator to perform edge detection on each enhancement layer and the combination of multiple enhancement layers. The edge pixels are recorded as 1 and the background pixels are recorded as 0. The edge image is converted into an edge binary image, recorded as A1-A 15 .

[0093] (3) For the edge binary image A of the s-th enhancement layer s , get the confusion matrix H of the enhanced layer s :

[0094]

[0095] Among them, for the edge pixel point in the edge binary image A0, TP represents the edge binary image A of a certain enhancement layer s The probability of correctly saving in the edge binary image A0 is TN, and the probability of not saving is FP. s FN represents the probability of being incorrectly saved as an edge pixel; FN represents the probability of being correctly saved as a background pixel.

[0096] Step 6: Calculate the recall rate and error rate of each enhancement layer edge according to the confusion matrix of each enhancement layer, obtain the evaluation value of each enhancement layer according to the recall rate of each enhancement layer edge and the compression efficiency of the most suitable compression method of the enhancement layer, and determine the transmission order according to the evaluation value of each enhancement layer and the error rate of the enhancement layer edge;

[0097] The purpose of this step is to calculate the evaluation value of each enhancement layer and obtain the transmission order according to the evaluation value.

[0098] The recall rate R and error rate W of the edge of the enhancement layer are calculated using the following formula:

[0099]

[0100]

[0101] According to the compression efficiency η and recall rate R of the most suitable compression method for the enhancement layer, a weighted sum is performed to obtain the evaluation value Z:

[0102] Z=αη+βR

[0103] Among them, α and β are allocated manually according to the emphasis on compression efficiency and recall rate to ensure that α+β=1. Sort by evaluation value;

[0104] The rules for sorting by evaluation value are as follows:

[0105] (1) Sort the enhancement layers according to their evaluation values.

[0106] (2) According to the above ranking, from top to bottom, find the enhancement layer with a higher ranking and an error rate less than 0.2, and select it as the priority transmission layer.

[0107] (3) The remaining enhancement layers are still transmitted in the same order as before.

[0108] At this point, based on the analysis function of the big data system, the bit-layered image data is analyzed to obtain the run-length advantage measurement value and edge detail retention, and then determine the encoding method and transmission order.

[0109] Step 7: Transmit the enhancement layer of the grayscale image to be stored in the transmission order, and compress it according to the most appropriate compression method for the enhancement layer before each transmission to complete the image data storage.

[0110] The purpose of this step is to store the image data according to the encoding method and transmission order through the storage function of the big data system.

[0111] The priority transmission layer is transmitted first in the transmission order and then the remaining enhancement layers are transmitted. Each transmitted enhancement layer is compressed using the encoding method most suitable for the enhancement layer. In this way, the image data is stored.

[0112] In the progressive image transmission process, according to the transmission order of the above steps, the priority transmission layer is first transmitted and decoded. At the receiving end, the receiver can first obtain an image that preserves the approximate edge details, and then gradually transmit higher resolution detail images. Once the image meets the receiver's requirements or the receiver is no longer interested in the image content, the receiver can interrupt the transmission of the image.

[0113] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for storing image data based on big data, characterized in that: include: Perform bit stratification on the grayscale image to be stored to obtain all enhancement layers of the grayscale image to be stored; Obtaining a bit run matrix of each enhancement layer according to the number of consecutive occurrences of the bit value of each enhancement layer, and calculating a long run advantage metric value and a short run advantage metric value of each enhancement layer according to the bit run matrix of each enhancement layer; Compress each enhancement layer using different compression methods, and calculate the compression efficiency of each enhancement layer under each compression method; Inputting the long-run advantage metric value and the short-run advantage metric value of each enhancement layer and the compression efficiency of the enhancement layer under different compression modes into a neural network, and obtaining the most suitable compression mode for each enhancement layer through the neural network; Obtain an edge binary image of the grayscale image to be stored and an edge binary image of each enhancement layer; Calculate the probability of edge pixels in the edge binary image of each enhancement layer being stored in the edge binary image of the grayscale image to be stored; Calculate the probability of background pixels in the edge binary image of each enhancement layer being stored in the edge binary image of the grayscale image to be stored; Construct a confusion matrix for each enhancement layer based on the probability of edge pixels and the probability of background pixels in the edge binary image of each enhancement layer; Calculate the recall rate and error rate of each enhancement layer edge according to the confusion matrix of each enhancement layer, obtain the evaluation value of each enhancement layer according to the recall rate of each enhancement layer edge and the compression efficiency of the most suitable compression method of the enhancement layer, and determine the transmission order according to the evaluation value of each enhancement layer and the error rate of the enhancement layer edge; The enhancement layer of the grayscale image to be stored is transmitted in a transmission order, and before each transmission, it is compressed according to the most suitable compression method for the enhancement layer to complete the image data storage.

2. The image data storage method based on big data according to claim 1, characterized in that: The method for performing bit stratification on the grayscale image to be stored to obtain all enhancement layers is as follows: The grayscale value of each pixel in the grayscale image to be stored is converted into binary. The grayscale value can be represented by an 8-bit binary code, where each bit is from the first high bit to the eighth high bit from left to right; The first and second high bits are used as the first enhancement layer, and so on, to obtain four enhancement layers.

3. The image data storage method based on big data according to claim 1, characterized in that: The calculation method of the long run advantage metric value and the short run advantage metric value of each enhancement layer is as follows: Long run advantage measure L: Short-run advantage measure S: Among them, w bt is the frequency of t consecutive occurrences of pixels with bit value b in each enhancement layer, and M and N are the image sizes.

4. The method for storing image data based on big data according to claim 1, characterized in that: The confusion matrix of each enhancement layer is: Among them, H is the confusion matrix of the enhancement layer, TP is the probability that the edge pixels in the edge binary image of the enhanced layer are correctly saved in the edge binary image of the grayscale image to be stored, TN is the probability that the edge pixels in the edge binary image of the enhanced layer are not correctly saved in the edge binary image of the grayscale image to be stored, FP is the probability that the background pixels in the edge binary image of the enhanced layer are not correctly saved in the edge binary image of the grayscale image to be stored, and FN is the probability that the background pixels in the edge binary image of the enhanced layer are correctly saved in the edge binary image of the grayscale image to be stored.

5. The method for storing image data based on big data according to claim 4, characterized in that: The calculation method of the recall rate of the enhancement layer edge is as follows: In the formula, R is the recall rate.

6. The method for storing image data based on big data according to claim 4, characterized in that: The error rate of the enhancement layer edge is calculated as follows: Where W is the error rate.

7. The method for storing image data based on big data according to claim 1, characterized in that: The calculation method of the evaluation value of each enhancement layer is: Z=αη+βR Where Z is the evaluation value of each enhancement layer, α and β are allocated artificially according to the emphasis on compression efficiency and recall rate, and α+β=1, and η is the compression efficiency of the most appropriate compression method for each enhancement layer.

8. The method for storing image data based on big data according to claim 1, characterized in that: The specific method for determining the transmission order is as follows: Sort the enhancement layers according to the evaluation value of each enhancement layer; According to the above ranking, from top to bottom, find the enhancement layer with the highest ranking and an error rate less than 0.2, which is the priority transmission layer; The remaining enhancement layers are still transmitted in the order of the evaluation values.

Citation Information

Patent Citations

  • Compression method and device of binary image

    CN105516540A

  • image recompression processing method based on Huffman coding

    CN109819259A