Joint joint photographic experts group (JPEG) image encryption method based on Attention U-Net
Through the joint JPEG image encryption method based on Attention U-Net, the problems of incompatibility with the JPEG standard, increase image volume and decrease image quality in the prior art are solved, and the balance of compatibility with JPEG standard, compression efficiency and image quality is achieved.
Patent Information
- Application Number
- CN202411966481.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-25
AI Technical Summary
The existing JPEG-based image encryption technology has problems such as incompatible with the JPEG standard, significant increase in image volume after encryption, and poor image quality after decryption.
Using the joint JPEG image encryption method based on Attention U-Net, the image is divided into pixel blocks of different sizes through the Attention U-Net network, DCT transformation and coefficient allocation are performed, and triple encryption is achieved by combining quantization, disruption and information hiding technologies.
While ensuring the balance of encryption and compression performance, this method is compatible with JPEG compression standards, improving the quality of the decrypted image and avoiding the problem of significant increase in volume.
Smart Images

Figure CN119893001A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image encryption, and in particular relates to a joint JPEG image encryption method based on Attention U-Net. Background Art
[0002] With the rapid development of the Internet, JPEG-based joint image encryption technology is gaining increasing attention. This encryption technology not only ensures the efficiency of encrypted transmission, but also takes into account the security of multimedia data, providing an important guarantee for protecting user privacy. However, the existing JPEG-based encryption technology still faces some urgent problems, including incompatibility with the JPEG standard, a significant increase in the size of the encrypted image, and poor image quality after decryption. Encryption technology that is incompatible with the JPEG standard may not be correctly decoded when using standard JPEG decoding, increasing the risk of sensitive information exposure and posing a severe test on the availability and security of the system. The significant increase in the size of the encrypted image not only weakens the security of the information, but also creates obstacles to efficient transmission. In addition, the poor quality of the decrypted image further affects the user experience and reduces the practicality of the encryption technology.
[0003] In the prior art, Zeng et al. [Ji, Xiao-yong, et al. "A new security solution to JPEG using hyper-chaotic system and modified zigzag scan coding." Communications in Nonlinear Science and Numerical Simulation 22.1-3 (2015): 321-333.] proposed to encrypt the coefficients in the range of [-64, -5) ∪ (5, 63] and scramble the identifier position used to distinguish each quantization block. This method achieves good results in compression performance and security, but due to the scrambling operation of the identifier, garbled characters may appear during decoding, and there is a problem of format incompatibility. Li et al. [Peiya Li, Kwok-Tung Lo, "Joint image encryption and compression schemes based on 16×16dct." Journal of Visual Communication and Image Representation, 58:12–24, 2019.] 16×16 DCT is used to replace 8×8 DCT in JPEG. This method improves compression efficiency and adds various encryption technologies and random allocation mechanisms to achieve image encryption. However, this method directly replaces 8×8 with 16×16, which will eliminate some detail information. For images with more detail information, the restoration effect is not ideal.
[0004] Therefore, the present invention provides a joint JPEG image encryption method based on Attention U-Net to solve the problems raised by the above background technology. Summary of the invention
[0005] In view of the problems raised by the above background technology, the purpose of the present invention is to provide a joint JPEG image encryption method based on Attention U-Net, which ensures compatibility with the JPEG compression standard while taking into account both image quality and compression efficiency.
[0006] In order to achieve the above technical objectives, the technical solution adopted by the present invention is as follows:
[0007] The joint JPEG image encryption method based on AttentionU-Net includes the following steps:
[0008] S1: Use the Attention U-Net network to divide the image to be encrypted into several pixel blocks {a1, a2, ..., a N}, where N is the total number of pixel blocks of different sizes after segmentation, traversing {a1, a2, ..., a N}, and extract the texture complexity, and determine whether the pixel block is a 16×16 or 8×8 pixel sub-block based on the texture complexity. After the pixel sub-block division is completed, the pixel block of size (S, S) is subjected to a DCT transformation of size S, where S = 8 or 16. The pixel sub-blocks after DCT transformation are recorded as {d1, d2, ..., d M}, wherein M is the total number of 8×8 and 16×16 pixel sub-blocks;
[0009] S2: traverse {d1,d2,...,d M}, for each pixel sub-block in d M Under the control of the key, the pixel blocks of size 16×16 are randomly distributed into four 8×8 pixel blocks according to the law of decreasing energy from the upper left corner to the lower right corner;
[0010] S3: All 8×8 pixel blocks are quantized and randomly shuffled, and then a zigzag scanning operation is performed;
[0011] S4: Using information hiding method to embed the segmentation information into the AC coefficients after zigzag scanning;
[0012] S5: Perform Huffman coding on the DC coefficient and the AC coefficient respectively to complete encryption.
[0013] It is further defined that in S1, a gray level co-occurrence matrix is used to extract the texture complexity of the pixel block.
[0014] Further defined, the block division process in S1 is as follows:
[0015] S1-1: The encrypted image is divided into several pixel blocks {a1, a2, ..., a N};
[0016] S1-2: Select a1, a2, ..., a in sequence N , quantize the gray level of each pixel block and divide it into 16×16 pixel sub-blocks;
[0017] S1-3: For each pixel sub-block, select the pixel distance as 2, obtain the gray level co-occurrence matrix in four directions, and then extract multiple texture features of the four gray level co-occurrence matrices;
[0018] S1-4: taking the average value of the texture features in four directions of the pixel sub-block;
[0019] S1-5: assigning weights to the texture features through mean square error to obtain the final texture complexity of the pixel sub-block;
[0020] S1-6: Use the interquartile range as the final texture complexity of the pixel block.
[0021] It is further defined that the texture features in S1-3 include energy, entropy, contrast, correlation and inverse difference, a total of 5 types.
[0022] It is further defined that in S1-6, the threshold of the texture complexity is set to 5.8. If the texture complexity is lower than 5.8, the pixel block is divided into 16×16 sub-blocks. If it is higher than 5.8, it is divided into 8×8 pixel sub-blocks.
[0023] It is further defined that the coefficient allocation process in S2 comprises the following steps:
[0024] S2-1: D M It is converted into a one-dimensional vector through zigzag scanning and recorded as {p1,p2,...,p 256};
[0025] S2-2: From a binary key K consisting of 0 and 1 seg Select 5 bits from
[0026] S2-3: Convert the first 3 bits of S2-2 into decimal numbers and record them as α, and convert the last 2 bits into decimal numbers and record them as β;
[0027] S2-4: Set {p1,p2,...,p 256} into the βth one-dimensional vector;
[0028] S2-5: Repeat S2-2 to S2-4 until {p1,p2,...,p 256} are all assigned to a one-dimensional vector;
[0029] S2-6: Convert the one-dimensional vector in S2-5 into a pixel block by reverse zigzag scanning.
[0030] It is further defined that the one-dimensional vector in S2-5 is four one-dimensional vectors of 1×64, and the pixel block converted by reverse zigzag scanning in S2-6 is an 8×8 pixel block.
[0031] Further defined, in order to prevent the data overflow problem, S3 adopts the following quantization process:
[0032] The quantification formula is:
[0033]
[0034] Among them, Y(k,l) is the image matrix to be processed, Q(k,l) is the quantization coefficient matrix, and Yq(k,l) is the image matrix processed by the quantization coefficient matrix.
[0035] Further defined, it also includes a quantization factor QF, the quantization factor QF is used to control the quality of the compressed image, and each single quantization factor QF corresponds to a single coefficient quantization matrix, denoted as scaleQT, and different quantization factors QF complete the quantization operation through the corresponding scaleQT, and the generation formula of scaleQT is:
[0036]
[0037] scaleQT=round(QT×scaleQF)
[0038] Among them, round() represents the rounding operation.
[0039] The joint JPEG image encryption method based on Attention U-Net provided by the present invention has the following beneficial effects:
[0040] 1. The present invention adopts triple encryption to protect image information. The first encryption segmentation is performed according to Attention U-Net. After segmentation, DCT changes of corresponding sizes are performed on blocks of different sizes to maintain the compression efficiency of the image as much as possible. The second encryption distributes the coefficients in the 16×16 block to four 8×8 blocks according to the law that the energy decreases from the upper left corner to the lower right corner, so that each allocated block still follows the law of decreasing energy. The third encryption hides the segmentation information in the AC coefficient, so that the segmentation information is kept confidential to others other than the two communicating parties. This triple encryption not only ensures encryption, but also takes into account the impact of encryption operation on compression performance, thus achieving a balance between encryption effect and compression performance.
[0041] 2. The present invention uses two different pixel blocks to replace the original 8×8 blocks of JPEG, effectively achieving a balance between compression efficiency and decrypted image quality.
[0042] 3. The present invention is compatible with the JPEG compression format, ensuring the format compatibility of encryption and decryption. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The present invention can be further illustrated by the non-limiting examples given in the accompanying drawings;
[0044] Figure 1It is a flow chart of an embodiment of a joint JPEG image encryption method based on Attention U-Net of the present invention;
[0045] Figure 2 It is a schematic diagram of grayscale quantization of an embodiment of a joint JPEG image encryption method based on Attention U-Net of the present invention;
[0046] Figure 3 This is a graph of pixel depth-peak signal-to-noise ratio of an embodiment of the joint JPEG image encryption method based on Attention U-Net of the present invention and the JPEG compression standard. DETAILED DESCRIPTION
[0047] In order to enable those skilled in the art to better understand the present invention, the technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments. The technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings 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 the field without creative work are within the scope of protection of the present invention.
[0048] It should be noted that all directional indications in the embodiments of the present invention (such as up, down, left, right, front, back, etc.) are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.
[0049] In addition, the descriptions of "first", "second", etc. in the present invention are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on the ability of ordinary technicians in the field to implement. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0050] Example:
[0051] like Figure 1 As shown, the joint JPEG image encryption method based on Attention U-Net of the present invention comprises the following steps:
[0052] S1: Use the Attention U-Net network to divide the image to be encrypted into several pixel blocks {a1, a2, ..., a N}, where N is the total number of pixel blocks of different sizes after segmentation, traversing {a1, a2, ..., a N}, and extract the texture complexity, and determine whether the pixel block is a 16×16 or 8×8 pixel sub-block based on the texture complexity. After the pixel sub-block division is completed, the pixel block of size (S, S) is subjected to a DCT transformation of size S, where S = 8 or 16. The pixel sub-blocks after DCT transformation are recorded as {d1, d2, ..., d M}, wherein M is the total number of 8×8 and 16×16 pixel sub-blocks;
[0053] S2: traverse {d1,d2,...,d M}, for each pixel sub-block in d M Under the control of the key, the pixel blocks of size 16×16 are randomly distributed into four 8×8 pixel blocks according to the law of decreasing energy from the upper left corner to the lower right corner;
[0054] S3: All 8×8 pixel blocks are quantized and randomly shuffled, and then a zigzag scanning operation is performed;
[0055] S4: Using information hiding method to embed the segmentation information into the AC coefficients after zigzag scanning;
[0056] S5: Perform Huffman coding on the DC coefficient and the AC coefficient respectively to complete encryption.
[0057] In the practical application of this embodiment, specifically, this embodiment mainly includes the following steps: image segmentation and DCT transformation, coefficient allocation, quantization and scrambling, information embedding and Huffman coding, and its main processing processes are all covered in Figure 1 The main module architecture is shown in .
[0058] S1: Image segmentation and DCT transformation
[0059] S1-1: Image Segmentation Using Attention U-Net
[0060] Specifically, the input image to be encrypted is preprocessed to obtain an image format suitable for deep learning network processing. Then, the preprocessed image is segmented through the Attention U-Net network, which includes an encoder module for extracting multi-scale features and a decoder module for restoring image resolution; an attention module is set between the encoder and the decoder, and the attention module adaptively assigns weights to the encoder features according to the guiding features of the decoder to highlight the segmentation target area and suppress background noise;
[0061] Secondly, the encrypted image is divided into several pixel blocks {a1, a2, ..., a N The principle is that for each pixel block, the texture complexity inside it is similar to a certain extent. Therefore, each pixel block is taken as a whole, and the texture complexity is used as the standard for dividing the whole block.
[0062] S1-2: Image area grayscale quantization
[0063] For each pixel block a i , firstly, grayscale quantization is performed. The specific process is as follows Figure 2 As shown in the figure, if the pixel value is in the interval [1,16], it is quantized to 0; if the pixel value is in the interval [17,32], it is quantized to 1. And so on, the quantization operation of the entire pixel block is completed, which is recorded as {a1',a2',...,a N '};
[0064] S1-3: Calculate the gray-level co-occurrence matrix
[0065] For each pixel block a i ', further divided into 16×16 sub-blocks, denoted as Where P is the pixel block a i 'The total number of sub-blocks included.
[0066] For each Select the pixel distance as 2 to obtain the gray level co-occurrence matrix in four directions, denoted as g i,j,k . Where k is [0, 1, 2, 3], representing 4 directions respectively. The creation process of the gray level co-occurrence matrix is as follows:
[0067] Take the calculation of the gray-level co-occurrence matrix in the vertical downward direction as an example, and the same is true for other directions.
[0068] ① Create a 16×16 matrix g i,j,0 ;
[0069] ②For For each pixel (i,j) in , find its corresponding pixel (i+2,j). (If there is no corresponding pixel, do not consider the pixel)
[0070] ③Record the grayscale values of these two positions (g1, g2), and i,j,0 The corresponding position in the is incremented by the following formula:
[0071] g i,j,0 (g1,g2)+=1
[0072] S1-4: Extracting 5 texture features from 4 co-occurrence matrices
[0073] For each co-occurrence matrix g i,j,k , it is necessary to calculate five texture features: energy, entropy, contrast, correlation and inverse difference.
[0074] Energy ASM reflects the uniformity of image distribution and the coarseness of texture. When the element values of the gray level co-occurrence matrix are closer, the energy value is smaller. The calculation formula of ASM is as follows:
[0075]
[0076] Among them, g represents the grayscale formula matrix, and i and j represent pixel coordinates.
[0077] Specifically, entropy ENT reflects the amount of information contained in the image and is used to indicate the complexity of the texture. The more chaotic the image, the greater the entropy value. The calculation formula of ENT is as follows:
[0078]
[0079] Specifically, contrast CON reflects the clarity of the image. The deeper the texture, the clearer it is and the greater the contrast. The calculation formula of contrast CON is as follows:
[0080]
[0081] Specifically, the correlation COR reflects the similarity of the gray level co-occurrence matrix in rows and columns. The more uniform the image distribution, the greater the correlation. The calculation formula of COR is as follows:
[0082]
[0083] Among them, μ1 and μ2 are the means of the co-occurrence matrix in the row and column directions, respectively, and σ1 and σ2 are the mean square errors in the row and column directions of the co-occurrence matrix, respectively.
[0084] Specifically, the inverse variance IDM reflects the homogeneity of the image texture. If there is a lack of texture variation between different regions, the inverse variance value is small. The calculation formula of IDM is as follows:
[0085]
[0086] S1-5: Find the average value of 5 texture features in 4 directions
[0087] S1-6: Calculation sub-block The texture complexity
[0088] Specifically, currently a sub-block There are 5 texture features in total. This step will unify the 5 features into one index to represent the texture complexity of the sub-block. The specific idea is to use the mean square error to assign weights to the 5 texture features. The specific calculation process is as follows:
[0089] W=(γ1+γ2+γ3+γ4+γ5) / 5
[0090] MSE i =(γ i -W) 2 ,1≤i≤5
[0091]
[0092] Among them, γ1-γ5 represent the average values of ASM, ENT, CON, COR and IDM respectively, and f represents the sub-block The texture complexity.
[0093] S1-7: Using the interquartile range as the texture complexity of the pixel block
[0094] Specifically, for a pixel block a i After calculating the texture complexity f of each 16×16 sub-block inside it, sort f from large to small. Record the lower quartile, that is, the value at the 75% position, as Q1; record the upper quartile, that is, the value at the 25% position, as Q3. The calculation formula for the quartile difference is as follows:
[0095] Q 31 =Q3-Q1
[0096] The interquartile range Q 31 As the pixel block a i The texture complexity.
[0097] After the image segmentation of S1-1, it only ensures that the same pixel block has similar texture complexity, but it cannot determine whether the overall texture complexity in the block is large or small. The interquartile range can measure the degree of discreteness of a set of data. The smaller the value, the more concentrated the data in the pixel block and the more uniform the texture of the pixel block; conversely, if the value is larger, it means that the data in the pixel block is more dispersed and the texture difference of the pixel block is greater.
[0098] S1-8: Compare the quartile difference with the threshold to determine the pixel block size
[0099] Based on experimental experience, the threshold is set to 5.8. When the quartile difference of a pixel block is less than 5.8, the texture in the pixel block is considered to be relatively uniform, and the pixel block is divided into 16×16 sub-blocks; when the quartile difference of a pixel block is greater than 5.8, the texture difference in the pixel block is considered to be large, and the pixel block is divided into 8×8 sub-blocks.
[0100] When the texture within the pixel block is relatively uniform, dividing it into larger blocks can greatly improve the compression efficiency with less loss of image information; when the texture difference within the pixel block is large, these areas are generally detailed information of the image, and dividing it into smaller blocks helps to protect the image quality.
[0101] S1-9: Perform DCT transformation
[0102] Specifically, a DCT transform of size S is performed on the S×S block, where S=8, 16. DCT transform can convert data in the spatial domain into the transform domain, and the change of each coefficient in the transform domain will cause the change of all pixels in the spatial domain.
[0103] After completing the DCT transformation of all blocks, we get the array {d1, d2, ..., d M}, where M is the total number of 8×8 and 16×16 blocks.
[0104] S2: Coefficient allocation
[0105] Specifically, traverse {d1,d2,...,d M}, if block d k The size of d is 16×16, then k The coefficients of are randomly distributed to four 8×8 blocks under the control of the key according to the law of decreasing energy from the upper left corner to the lower right corner. Where k represents the kth block.
[0106] S2-1: Zigzag Scan
[0107] Specifically, d k It is converted into a one-dimensional vector through zigzag scanning and represented as {p1,p2,...,p 256}. DCT transform concentrates the energy of the image in the upper left corner of the matrix. These coefficients are called low-frequency coefficients. The coefficients in the lower right corner have less energy and are called high-frequency coefficients. Zigzag scanning can save the low-frequency coefficients as much as possible at the head of the one-dimensional array. These coefficients save most of the information of the image and can effectively protect the image information in subsequent encryption operations.
[0108] S2-2: Select bits from the key
[0109] Use BLAKE-256 to generate a binary key consisting of 0s and 1s, and pick 5 bits from the key.
[0110] S2-3: Split the selected bits and distribute the data
[0111] Specifically, the first three bits of the selected bits are converted to decimal α, and the remaining two bits are converted to decimal β. α represents the number of bits from {p1, p2, ..., p 256} selects α+1 pixels, and β means putting the selected pixels into the β+1th one-dimensional vector.
[0112] The value of α is 3, which takes into account the compression efficiency and the protection of low-frequency coefficients. If α is too small, it will lead to too many allocations, affecting the encryption time; it is worth noting that if α is too large, the low-frequency coefficients will be allocated to the back of the vector, which does not meet the requirement of energy concentration in the upper left corner and will have a greater impact on the image quality.
[0113] Repeat the above process until the entire {p1,p2,...,p 256} is allocated into 4 one-dimensional arrays of length 64.
[0114] S2-4: Reverse zigzag scanning
[0115] The four one-dimensional vectors are converted into 8×8 blocks through reverse zigzag scanning. After coefficient allocation in S2-3, these 8×8 blocks also conform to the characteristic that low-frequency coefficients are concentrated in the upper left corner of the matrix, which helps to protect the image in the subsequent quantization process.
[0116] S3: Quantization and scrambling
[0117] S3-1: Quantization operation:
[0118] The quantification formula is:
[0119]
[0120] Among them, Y(k,l) is the image matrix to be processed, referred to as Y; Q(k,l) is the quantization coefficient matrix, referred to as Q; Yq(k,l) is the image matrix after being processed by the quantization coefficient matrix, referred to as Y q The quantization coefficient matrix is defined as follows:
[0121] Q=[1611101624405161;1212141926586055; 1413162440576956; 1417222951878062; 182237566810910377; 243555648110411392; 49647887103121120101;7292959811210010399];
[0125] In the practical application of this embodiment, a quantization factor QF is used to control the quality of the compressed image. The larger the QF, the higher the image quality and the larger the corresponding volume; conversely, the lower the image quality, the smaller the corresponding volume. Each QF corresponds to a coefficient quantization matrix, denoted as scaleQT. In different QF cases, the corresponding scaleQT is used to complete the quantization operation. The generation formula of scaleQT is:
[0126]
[0127] scaleQT=round(QT×scaleQF)
[0128] Among them, round() represents the rounding operation.
[0129] In addition, special cases of data overflow need to be considered. The Huffman coding range of JPEG compression is [-1024, 1023]. Since we used DCT-16 variation in S1-5, the coefficient range in the block becomes [-2048, 2047], so data overflow processing is required. When the coefficients in the quantization matrix are all greater than or equal to 2, the coefficient range after quantization can be controlled within [-1024, 1023], and the maximum QF corresponding to the quantization matrix with coefficients greater than 2 is 92. Therefore, when QF is greater than 92, the quantization matrix with QF=92 is used to increase the original quantization matrix to achieve data overflow processing.
[0130] The corresponding quantization matrices for special cases are listed below:
[0131] When the quantization factor QF>92,
[0132] scaleQT'=[322346810;222349109; 223469119; 23458141310; 346911171612;4691013171815;
[0135] 810121416191916;1215151618161616].
[0136] S3-2: Disruption Operation
[0137] Specifically, this step uses 8×8 blocks as the basic unit of operation, including column shuffle and row shuffle. Assuming that the length and width of the image are m and n bits respectively, the specific operation is as follows:
[0138] The columns are shuffled and m / 8 lengths are selected from the key. The number of bits is converted into m / 8 decimal numbers. For each column, a decimal number controls the shift down operation until all columns are shifted, and the column shuffle is completed.
[0139] Row shuffle is similar to column shuffle, except that n / 8 rows are selected. The number of bits, the subsequent operations are the same as the column shuffle.
[0140] S3-3: Zigzag Scan
[0141] Perform a zigzag scan on all 8×8 blocks and convert them into a one-dimensional vector of length 64.
[0142] S4: Information Embedding
[0143] In order for the receiver to successfully decrypt, the segmentation information of the image needs to be transmitted to the receiver, so the segmentation information is embedded in the AC coefficients.
[0144] The specific formula for information hiding is as follows:
[0145]
[0146] Among them, AC i Indicates the AC coefficient of the i-th position; sign() indicates AC i The positive or negative number is 1, and the negative number is -1. Represents the modified AC coefficient of the ith bit.
[0147] According to the above formula, when AC i When the absolute value of is greater than 1, it is not used as a location for information hiding. And, if the data of this bit is a positive number, add 1; if it is a negative number, subtract 1. i When the absolute value of is equal to 1, the bit is selected as the location for information hiding. And if the embedded information is 1, then the embedded The absolute value is 2; if the embedded information is 0, then the embedded The absolute value is 1.
[0148] Specifically, when extracting information, if the If greater than 2, Minus 1; if the read is equal to 2, then Subtract 1 and read out the embedded information 1; if the read is equal to 1, then Remain unchanged and read out the embedded information 0; if the read is equal to 0, then Remains unchanged; if the read If it is equal to -1, Remain unchanged and read out the embedded information 0; if the read is equal to -2, then Add 1 and read out the embedded information 1; if the read Less than -2, then Add 1.
[0149] S5: Huffman coding
[0150] The DC coefficient and the AC coefficient are encoded using the Huffman coding standard of the JPEG compression standard.
[0151] In summary, in the above embodiment, we compare with the JPEG compression standard, use the USC-SIPI and UCID image sets as test images, and test the pixel depth (BPP) and peak signal-to-noise ratio (PSNR) of the two methods respectively. Using the pixel depth as the horizontal axis and the peak signal-to-noise ratio as the vertical axis, the pixel depth-peak signal-to-noise ratio curves of the two methods are plotted, as shown in FIG. Figure 3 As shown in Figure 2, it can be seen that under the premise of realizing image encryption, the proposed method still has good performance in compression performance and image quality.
[0152] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present invention. Therefore, all equivalent modifications or changes made by those with ordinary knowledge in the technical field without departing from the spirit and technical ideas disclosed by the present invention should still be covered by the claims of the present invention.
Claims
1. A joint JPEG image encryption method based on Attention U-Net, characterized in that: The steps include: S1: Use the Attention U-Net network to divide the image to be encrypted into several pixel blocks {a1, a2, ..., a N }, where N is the total number of pixel blocks of different sizes after segmentation, traversing {a1, a2, ..., a N }, and extract the texture complexity, and determine whether the pixel block is a 16×16 or 8×8 pixel sub-block based on the texture complexity. After the pixel sub-block division is completed, the pixel block of size (S, S) is subjected to a DCT transformation of size S, where S = 8 or 16. The pixel sub-blocks after DCT transformation are recorded as {d1, d2, ..., d M }, wherein M is the total number of 8×8 and 16×16 pixel sub-blocks; S2: traverse {d1,d2,...,d M }, for each pixel sub-block in d M Under the control of the key, the pixel blocks of size 16×16 are randomly distributed into four 8×8 pixel blocks according to the law of decreasing energy from the upper left corner to the lower right corner; S3: All 8×8 pixel blocks are quantized and randomly shuffled, and then a zigzag scanning operation is performed; S4: Using information hiding method to embed the segmentation information into the AC coefficients after zigzag scanning; S5: Perform Huffman coding on the DC coefficient and the AC coefficient respectively to complete encryption.
2. The joint JPEG image encryption method based on Attention U-Net according to claim 1, characterized in that: In S1, a gray level co-occurrence matrix is used to extract the texture complexity of the pixel block.
3. The joint JPEG image encryption method based on Attention U-Net according to claim 1, characterized in that: The block division process in S1 is as follows: S1-1: The encrypted image is divided into several pixel blocks {a1, a2, ..., a N }; S1-2: Select a1, a2, ..., a in sequence N , quantize the gray level of each pixel block and divide it into 16×16 pixel sub-blocks; S1-3: For each pixel sub-block, select the pixel distance as 2, obtain the gray level co-occurrence matrix in four directions, and then extract multiple texture features of the four gray level co-occurrence matrices; S1-4: taking the average value of the texture features in four directions of the pixel sub-block; S1-5: assigning weights to the texture features through mean square error to obtain the final texture complexity of the pixel sub-block; S1-6: Use the interquartile range as the final texture complexity of the pixel block.
4. The joint JPEG image encryption method based on Attention U-Net according to claim 3, characterized in that: The texture features in S1-3 include energy, entropy, contrast, correlation and inverse difference, which are five in total.
5. The joint JPEG image encryption method based on Attention U-Net according to claim 3, characterized in that: In S1-6, the threshold of the texture complexity is set to 5.
8. If the texture complexity is lower than 5.8, the pixel block is divided into 16×16 sub-blocks. If it is higher than 5.8, it is divided into 8×8 pixel sub-blocks.
6. The joint JPEG image encryption method based on Attention U-Net according to claim 1, characterized in that: The coefficient allocation process in S2 includes the following steps: S2-1: D M It is converted into a one-dimensional vector through zigzag scanning and recorded as {p1,p2,...,p 256 }; S2-2: From a binary key K consisting of 0 and 1 seg Select 5 bits from S2-3: Convert the first 3 bits of S2-2 into decimal numbers and record them as α, and convert the last 2 bits into decimal numbers and record them as β; S2-4: Set {p1,p2,...,p 256 } into the βth one-dimensional vector; S2-5: Repeat S2-2 to S2-4 until {p1,p2,...,p 256 } are all assigned to a one-dimensional vector; S2-6: Convert the one-dimensional vector in S2-5 into a pixel block by reverse zigzag scanning.
7. The method for joint JPEG image encryption based on Attention U-Net according to claim 6, characterized in that: The one-dimensional vectors in S2-5 are four 1×64 one-dimensional vectors, and the pixel blocks converted by reverse zigzag scanning in S2-6 are 8×8 pixel blocks.
8. The joint JPEG image encryption method based on Attention U-Net according to claim 1, characterized in that: In order to prevent the data overflow problem, S3 adopts the following quantization process: The quantification formula is: Among them, Y(k,l) is the image matrix to be processed, Q(k,l) is the quantization coefficient matrix, and Yq(k,l) is the image matrix processed by the quantization coefficient matrix.
9. The method for joint JPEG image encryption based on Attention U-Net according to claim 8, characterized in that: It also includes a quantization factor QF, which is used to control the quality of the compressed image. Each single quantization factor QF corresponds to a single coefficient quantization matrix, which is denoted as scaleQT. Different quantization factors QF complete the quantization operation through the corresponding scaleQT. The generation formula of scaleQT is: scaleQT=round(QT×scaleQF) Among them, round() represents the rounding operation.