Local encryption and camouflage method of JPEG images based on DCT coefficient scrambling and fusion

By using the method based on the fusion and fusion of DCT coefficients, local encryption and disguise of JPEG images is solved, and the problems of image encryption affecting quality and irreversibility in the prior art are achieved, and the effects of lossless restoration and rapid hiding are achieved.

CN118890418BActive Publication Date: 2024-12-10GUANGDONG MICROPATTERN SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411371291.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2024-12-10
Estimated Expiration
2044-09-29

AI Technical Summary

Technical Problem

Existing JPEG image encryption algorithms cannot protect private content without damaging image quality, and irreversible mosaic technology causes the original information to be unable to be restored.

Method used

The local encryption and disguise method of JPEG image based on the DCT coefficient fusion is adopted. The DCT coefficient matrix is ​​obtained by decoding the quantization coefficient matrix, and the secondary diagonal coefficient is cleared as the mark bits. The DCT coefficient matrix set of the ROI region is constructed to perform the chassis sum 180-degree rotation operation hides the main content in the medium and high frequency coefficients, and completes the disguise through replacement operations.

Benefits of technology

It realizes the encryption and disguise of local content of JPEG images, ensures coefficient sparsity, avoids file enlargement, and can restore image content losslessly, with the advantages of fast hiding and selective encryption and decryption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118890418B_ABST
    Figure CN118890418B_ABST
Patent Text Reader

Abstract

The invention discloses a JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion, which relates to the technical field of JPEG image information protection. The 8×8 DCT quantization coefficient matrix of the brightness and chromaticity space of the JPEG image is obtained by decoding the JPEG image. Then, the sub-diagonal coefficient of the DCT coefficient matrix is ​​cleared to reserve a mark bit. Then, the DCT coefficient matrix set S1 of the ROI area to be protected is identified and constructed, and the scrambling and 180-degree rotation operations are performed on it to encrypt it, so as to obtain the encrypted DCT coefficient matrix set S2. This step effectively ensures the coefficient sparsity, avoids the increase of the file, and hides the main content in the medium and high frequency coefficients through the rotation operation. Finally, the ROI area S2 set is fused with the set S through the replacement operation, and a mark is set on the sub-diagonal line to indicate the encryption and camouflage status. The whole process realizes the encryption of the ROI area content and camouflages the encrypted area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of JPEG image information protection, in particular to a JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion. Background Art

[0002] JPEG images play an important role in digital media. As a widely used image compression standard, JPEG has become the preferred format for transmitting and storing images on the Internet with its efficient compression ratio and excellent image quality. Whether it is photo sharing on social media or product display on e-commerce platforms, JPEG images play an irreplaceable role.

[0003] However, with the popularization of digital media, JPEG images often contain a lot of private information, such as faces, documents, etc. The leakage of this private information may not only cause inconvenience to individuals, but may even cause serious security issues. Therefore, it is particularly important to protect the content of JPEG images.

[0004] At present, although there are some encryption algorithms that can be used to protect image content, these algorithms are often not user-friendly. The encrypted file cannot display the image content normally, which makes it impossible for users to preview the image without decryption, greatly reducing the convenience of use. Although mosaic technology can achieve partial encryption of images, this method is an irreversible information loss. Once applied, the original image information cannot be restored. Summary of the invention

[0005] In order to solve the above-mentioned technical problem of information protection of JPEG images, the present invention provides a JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion. The following technical solution is adopted:

[0006] Based on the JPEG image local encryption and camouflage method of DCT coefficient scrambling fusion, the local position of the ROI of the JPEG image that needs to be protected is determined. The following steps complete the protection of the content of the local position of the ROI:

[0007] Step 1, decoding the quantization coefficient matrix of the image to be processed to obtain a DCT coefficient matrix;

[0008] Step 2, clearing the DCT coefficients of the sub-diagonal lines of all DCT coefficient matrices to reserve a mark bit;

[0009] Step 3, constructing a DCT coefficient matrix set of the ROI region, finding all DCT coefficient matrices involved in the local position of the ROI that needs to be camouflaged and protected, and constructing these into a DCT coefficient matrix set corresponding to the ROI region, recorded as S1;

[0010] Step 4: ROI area content encryption operation, clear the DCT coefficients below the sub-diagonal of each DCT coefficient matrix in S1 to reserve fusion space, and then randomly exchange all the non-zero coefficients above the sub-diagonal to scramble the content. After the scrambling operation is completed, these matrices are rotated 180 degrees to obtain the DCT coefficient matrix set S2;

[0011] Step 5, ROI area camouflage operation, prepare the DCT coefficient matrix replacement set S corresponding to the ROI area, which is the camouflage content, and replace all DCT coefficients above the secondary diagonal of each DCT coefficient matrix in S to the corresponding position of the corresponding DCT coefficient matrix in S2 to complete the fusion camouflage.

[0012] By adopting the above technical solution, first, the quantization coefficient matrix of the processed image is decoded to obtain the DCT coefficient matrix. Then, by clearing the reserved mark bit of the sub-diagonal coefficient of the DCT coefficient matrix, it will be used to determine whether camouflage encryption is performed, while ensuring that the image quality does not change significantly. Then, the DCT coefficient matrix set S1 of the ROI area to be protected is identified and constructed, and the encrypted DCT coefficient matrix set S2 is obtained by performing scrambling and 180-degree rotation operations. The coefficient sparsity is effectively guaranteed, the file size is avoided, and the main content is hidden in the medium and high frequency coefficients through the rotation operation. Finally, the ROI area S2 set is merged with the set S through the replacement operation to complete the camouflage operation, and a mark is set on the sub-diagonal to indicate the encryption and camouflage status. Since the mark modifies the intermediate frequency signal of the DCT coefficient matrix, it will not cause significant changes in the image content visible to the naked eye.

[0013] The entire process realizes the encryption of ROI area content and camouflage of the encrypted area.

[0014] Scrambling is performed between non-zero coefficients, which can effectively ensure the sparseness of the coefficients of the DCT coefficient matrix before and after scrambling, and avoid the increase of image files. The 180-degree rotation operation transplants the main content of the image to the mid-high frequency coefficients. These main contents will not be expressed perceptibly by the naked eye in the image, thus realizing the rapid hiding of real content.

[0015] Optionally, in step 1, the JPEG image to be processed is decoded to obtain an 8×8 DCT quantization coefficient matrix in all luminance and chrominance spaces of the image.

[0016] By adopting the above technical solution, the JPEG image to be processed is decoded to obtain an 8×8 DCT quantization coefficient matrix in all brightness and chromaticity spaces of the image, referred to as a DCT coefficient matrix.

[0017] Optionally, in step 4 and step 5, the part below the secondary diagonal and the part above the secondary diagonal do not include the secondary diagonal.

[0018] By adopting the above technical solution, this is because the sub-diagonal line here is used alone to mark whether the block is an encrypted block, and there is overlap before and after the sub-diagonal line is rotated, which is not suitable for scrambling and fusion operations.

[0019] Optionally, the DCT coefficient matrix replacement set S and the DCT coefficient matrices in the DCT coefficient matrix set S2 are in a one-to-one correspondence.

[0020] Optionally, the decryption process of the partially encrypted and disguised JPEG image is the opposite of the encryption process, which sequentially performs JPEG decoding, finds the marked DCT matrix, inversely rotates the matrix and performs inverse scrambling operations, and finally restores each DCT coefficient matrix, thereby completing the restoration of the entire JPEG image content.

[0021] Optionally, the decryption process includes the following steps:

[0022] Step a, decoding the encrypted JPEG image to obtain the 8×8 DCT coefficient matrix in all luminance and chrominance spaces;

[0023] Step b, detecting the marking position;

[0024] Step c, restore the DCT coefficient matrix of the ROI area:

[0025] For all DCT coefficient matrices marked as encrypted camouflage, the DCT coefficients on and above the diagonal are cleared to zero to erase the camouflage information, then the DCT coefficient matrix is ​​rotated 180 degrees, and the non-zero DCT coefficients above the sub-diagonal are descrambled in combination with the decryption key K to restore the original DCT coefficient matrix.

[0026] Optionally, in step b, if there is a non-zero value on the secondary diagonal of a DCT coefficient matrix, it means that the DCT coefficient matrix has undergone an encryption and disguise operation, and enters step c for restoration. If these coefficients are all zero, it means that the DCT coefficient matrix is ​​the original content, and the DCT coefficient matrix directly skips the subsequent decryption step.

[0027] By adopting the above technical solution, it is possible to achieve lossless restoration of JPEG images that have been partially encrypted and disguised, without damaging the image content due to encryption. The restoration algorithm realizes the perception and decryption of the encrypted area. Compared with traditional encryption and decryption, the encryption and decryption in the present invention have the advantage of local selectivity. At the same time, it has the advantages of fast speed of traditional encryption algorithms and lossless restoration of the original content of the image.

[0028] In summary, the present invention includes at least the following beneficial technical effects:

[0029] The present invention can provide a JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion. First, the 8×8 DCT quantization coefficient matrix of the brightness and chromaticity space of the JPEG image is obtained by decoding the JPEG image. Then, by clearing the reserved flag bit of the sub-diagonal coefficient of the DCT coefficient matrix, it is used to determine whether the camouflage encryption is performed, while ensuring that the image quality does not change significantly. Then, the DCT coefficient matrix set S1 of the ROI area to be protected is identified and constructed, and the scrambling and 180-degree rotation operations are performed on it to encrypt it, and the encrypted DCT coefficient matrix set S2 is obtained. This step effectively ensures the coefficient sparsity, avoids the increase of the file, and hides the main content in the medium and high frequency coefficients through the rotation operation. Finally, the ROI area S2 set is fused with the set S through the replacement operation to complete the camouflage operation, and a mark is set on the sub-diagonal to indicate the encryption and camouflage status. The entire process realizes the encryption of the ROI area content and camouflages the encrypted area. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 It is a flow chart of a JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion of the present invention;

[0031] Figure 2 It is a schematic diagram of a specific embodiment of the JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion of the present invention, in which all DCT coefficient matrices in the JPEG image are subjected to zeroing of the secondary diagonal;

[0032] Figure 3 It is a schematic diagram of two DCT coefficient matrices included in the S1 set in a specific embodiment of the JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion of the present invention;

[0033] Figure 4 It is a schematic diagram of the S2 set after the scrambling operation is completed in a specific embodiment of the JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion of the present invention;

[0034] Figure 5 It is a schematic diagram of the ROI area camouflage operation in a specific embodiment of the JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion of the present invention. DETAILED DESCRIPTION

[0035] The present invention is further described in detail below in conjunction with the accompanying drawings. The embodiment of the present invention discloses a JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion.

[0036] Reference Figure 1-Figure 5, based on the JPEG image local encryption and camouflage method of DCT coefficient scrambling fusion, determine the local position of the JPEG image ROI that needs to be protected, and complete the protection of the content of the local position of the ROI in the following steps:

[0037] Step 1, decoding the quantization coefficient matrix of the image to be processed to obtain a DCT coefficient matrix;

[0038] Step 2, clearing the DCT coefficients of the sub-diagonal lines of all DCT coefficient matrices to reserve a mark bit;

[0039] Step 3, constructing a DCT coefficient matrix set of the ROI region, finding all DCT coefficient matrices involved in the local position of the ROI that needs to be camouflaged and protected, and constructing these into a DCT coefficient matrix set corresponding to the ROI region, recorded as S1;

[0040] Step 4: ROI area content encryption operation, clear the DCT coefficients below the sub-diagonal of each DCT coefficient matrix in S1 to reserve fusion space, and then randomly exchange all the non-zero coefficients above the sub-diagonal to scramble the content. After the scrambling operation is completed, these matrices are rotated 180 degrees to obtain the DCT coefficient matrix set S2;

[0041] Step 5, ROI area camouflage operation, prepare the DCT coefficient matrix replacement set S corresponding to the ROI area, which is the camouflage content, and replace all DCT coefficients above the secondary diagonal of each DCT coefficient matrix in S to the corresponding position of the corresponding DCT coefficient matrix in S2 to complete the fusion camouflage.

[0042] First, the quantization coefficient matrix of the processed image is decoded to obtain the DCT coefficient matrix. Next, by clearing the reserved flag bit of the sub-diagonal coefficient of the DCT coefficient matrix, it is used to determine whether camouflage encryption is performed, while ensuring that the image quality does not change significantly. Then, the DCT coefficient matrix set S1 of the ROI area to be protected is identified and constructed, and it is encrypted by scrambling and 180-degree rotation operations to obtain the encrypted DCT coefficient matrix set S2. The coefficient sparsity is effectively guaranteed, the file size is avoided, and the main content is hidden in the medium and high frequency coefficients through the rotation operation. Finally, the ROI area S2 set is merged with the set S through the replacement operation to complete the camouflage operation, and a mark is set on the sub-diagonal to indicate the encryption and camouflage status. Since the mark modifies the intermediate frequency signal of the DCT coefficient matrix, it will not cause significant changes in the image content visible to the naked eye.

[0043] The entire process realizes the encryption of ROI area content and camouflage of the encrypted area.

[0044] Scrambling is performed between non-zero coefficients, which can effectively ensure the sparseness of the coefficients of the DCT coefficient matrix before and after scrambling, and avoid the increase of image files. The 180-degree rotation operation transplants the main content of the image to the mid-high frequency coefficients. These main contents will not be expressed perceptibly by the naked eye in the image, thus realizing the rapid hiding of real content.

[0045] In step 1, the JPEG image to be processed is decoded to obtain an 8×8 DCT quantization coefficient matrix in all luminance and chrominance spaces of the image.

[0046] The JPEG image to be processed is decoded to obtain an 8×8 DCT quantization coefficient matrix in all brightness and chromaticity spaces of the image, referred to as the DCT coefficient matrix.

[0047] In step 4 and step 5, the sub-diagonal line is not included below the sub-diagonal line and above the sub-diagonal line.

[0048] The DCT coefficient matrix replacement set S and the DCT coefficient matrices in the DCT coefficient matrix set S2 are in a one-to-one correspondence.

[0049] The decryption process of a partially encrypted and disguised JPEG image is the opposite of the encryption process. It sequentially performs JPEG decoding, finds the marked DCT matrix, inversely rotates the matrix, and performs inverse scrambling operations, and finally restores each DCT coefficient matrix, thereby completing the restoration of the entire JPEG image content.

[0050] The decryption process consists of the following steps:

[0051] Step a, decoding the encrypted JPEG image to obtain the 8×8 DCT coefficient matrix in all luminance and chrominance spaces;

[0052] Step b, detecting the marking position;

[0053] Step c, restore the DCT coefficient matrix of the ROI area:

[0054] For all DCT coefficient matrices marked as encrypted camouflage, the DCT coefficients on and above the diagonal are cleared to zero to erase the camouflage information, then the DCT coefficient matrix is ​​rotated 180 degrees, and the non-zero DCT coefficients above the sub-diagonal are descrambled in combination with the decryption key K to restore the original DCT coefficient matrix.

[0055] In step b, if there is a non-zero value on the secondary diagonal of a DCT coefficient matrix, it means that the DCT coefficient matrix has been encrypted and disguised, and enters step c for restoration. If these coefficients are all zero, it means that the DCT coefficient matrix is ​​the original content, and the DCT coefficient matrix directly skips the subsequent decryption step.

[0056] It can achieve lossless restoration of partially encrypted and disguised JPEG images without causing damage to the image content due to encryption.

[0057] The following specific embodiments are used to illustrate the implementation principle of the JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion:

[0058] Take the encryption and decryption of the area covered by two DCT blocks in a grayscale JPEG image as an example:

[0059] 1. Decode the quantization coefficient matrix:

[0060] Decode the JPEG image to be processed to obtain the 8×8 DCT quantization coefficient matrix in all luminance and chrominance spaces of the image. Since the JPEG image is a grayscale image, there is only the DCT coefficient matrix in the luminance space.

[0061] 2. Reserved mark position:

[0062] The DCT coefficients of the sub-diagonal of all DCT coefficient matrices are cleared to reserve a mark bit, which will be used to mark whether the DCT coefficient matrix has been camouflaged and encrypted, so as to facilitate targeted decryption later. Figure 2 As shown, all DCT coefficient matrices in the JPEG image have undergone zeroing of the sub-diagonal lines.

[0063] 3. Construct the DCT coefficient matrix set of the ROI area:

[0064] Find all DCT coefficient matrices involved in the region of interest (ROI) that needs to be camouflaged and protected, and construct them into a DCT coefficient matrix set corresponding to the ROI region, denoted as S1. Here, it is assumed that the ROI region only includes two DCT coefficient matrices, which are constructed into a DCT coefficient matrix set S1 corresponding to the ROI region. Figure 3 As shown, the S1 set contains two DCT coefficient matrices.

[0065] 4. ROI area content encryption operation:

[0066] The DCT coefficients below the sub-diagonal (excluding the sub-diagonal) of each DCT coefficient matrix in S1 are cleared to reserve fusion space, and then all non-zero coefficients above the sub-diagonal (excluding the sub-diagonal) are randomly exchanged to scramble the content. After the scrambling operation is completed, these matrices are rotated 180 degrees to obtain the DCT coefficient matrix set S2. Figure 4 As shown, it can be seen that S1 and S2 have the same sparsity in the matrix, which is helpful to control the impact of this step on the size of the final image file.

[0067] 5.ROI area camouflage operation:

[0068] Prepare a replacement set S of the DCT coefficient matrix corresponding to the ROI area, which is the camouflaged content. The DCT coefficient matrices in the S and S2 sets are in a one-to-one correspondence. All DCT coefficients above the sub-diagonal (excluding the sub-diagonal) of each DCT coefficient matrix in S are replaced with the corresponding positions of the corresponding DCT coefficient matrix in S2 to complete the fusion camouflage. Finally, set any coefficient of the sub-diagonal to 1 to mark that the DCT coefficient matrix has been encrypted. This step can effectively replace the main image content in S with S2 to achieve camouflage of the encrypted area, such as Figure 5 As shown, it is more conducive to protecting the original content of the ROI area in the image.

[0069] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion, characterized in that: Determine the ROI local position of the JPEG image that needs to be protected. The following steps are used to protect the content of the ROI local position: Step 1, decode the JPEG image to be processed to obtain the 8×8 DCT coefficient matrix of all brightness and chromaticity spaces of the image; Step 2, clearing the DCT coefficients of the sub-diagonal lines of all DCT coefficient matrices to reserve a mark bit; Step 3, constructing a DCT coefficient matrix set of the ROI region, finding all DCT coefficient matrices involved in the local position of the ROI that needs to be camouflaged and protected, and constructing these into a DCT coefficient matrix set corresponding to the ROI region, recorded as S1; Step 4: ROI area content encryption operation, clear the DCT coefficients below the sub-diagonal of each DCT coefficient matrix in S1 to reserve fusion space, and then randomly exchange all the non-zero coefficients above the sub-diagonal to scramble the content. After the scrambling operation is completed, these matrices are rotated 180 degrees to obtain the DCT coefficient matrix set S2; Step 5: ROI area camouflage operation. Prepare a DCT coefficient matrix replacement set S corresponding to the ROI area. The replacement set is the camouflage content. Replace all DCT coefficients above the sub-diagonal of each DCT coefficient matrix in S with the corresponding position of the corresponding DCT coefficient matrix in S2 to complete the fusion camouflage. In step 4 and step 5, the sub-diagonal line is not included below the sub-diagonal line and above the sub-diagonal line.

2. The JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion according to claim 1 is characterized in that: The DCT coefficient matrix replacement set S and the DCT coefficient matrices in the DCT coefficient matrix set S2 are in a one-to-one correspondence.

3. The JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion according to claim 1 is characterized in that: The decryption process of a partially encrypted and disguised JPEG image is the opposite of the encryption process. It sequentially performs JPEG decoding, finds the marked DCT matrix, inversely rotates the matrix, and performs inverse scrambling operations, and finally restores each DCT coefficient matrix, thereby completing the restoration of the entire JPEG image content.

4. The JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion according to claim 3 is characterized in that: The decryption process consists of the following steps: Step a, decoding the encrypted JPEG image to obtain the 8×8 DCT coefficient matrix in all luminance and chrominance spaces; Step b, detecting the marking position; Step c, restore the DCT coefficient matrix of the ROI area: For all DCT coefficient matrices marked as encrypted camouflage, the DCT coefficients on and above the diagonal are cleared to zero to erase the camouflage information, then the DCT coefficient matrix is ​​rotated 180 degrees, and the non-zero DCT coefficients above the sub-diagonal are descrambled in combination with the decryption key K to restore the original DCT coefficient matrix.

5. The JPEG image local encryption and camouflage method based on DCT coefficient scrambling fusion according to claim 4 is characterized in that: In step b, if there is a non-zero value on the secondary diagonal of a DCT coefficient matrix, it means that the DCT coefficient matrix has been encrypted and disguised, and enters step c for restoration. If these coefficients are all zero, it means that the DCT coefficient matrix is ​​the original content, and the DCT coefficient matrix directly skips the subsequent decryption step.