An Image Hiding Method Based on Restricted Boltzmann Machine and Parallel Compressed Sensing
By employing an image hiding method based on restricted Boltzmann machines and parallel compressed sensing, the problems of low randomness and high computational complexity in existing technologies for chaotic sequences are solved, achieving efficient image encryption and embedding, and improving the anti-attack capability and robustness of encrypted images.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2026-03-10
AI Technical Summary
Existing image encryption methods generate chaotic sequences with low randomness and high computational complexity, and the encrypted images have poor resistance to attacks and robustness, especially when transmitted in public channels, they are easy to attract the attention of attackers.
An image hiding method based on Restricted Boltzmann Machine (RBM) and Parallel Compressed Sensing is adopted. The RBM is initialized by generating a hybrid sequence through hash value generation. Random sequences are generated and subjected to sparsification, scrambling, and thresholding. Compressed sensing is performed using a random measurement matrix, followed by rotation scrambling and diffusion. Finally, the ciphertext image is embedded into the frequency coefficients of the carrier image, and the embedding depth is dynamically adjusted.
It improves the randomness of the generated sequence, enhances image processing efficiency and the anti-attack capability and robustness of encrypted images, and achieves high-quality image reconstruction at a low compression ratio.
Smart Images

Figure CN119402600B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image encryption technology, and more specifically, to an image hiding method based on restricted Boltzmann machines and parallel compressed sensing. Background Technology
[0002] With the rapid development of digital communication, multimedia, and digital network technologies, images, as a typical type of multimedia data, are widely used for information transmission and have gradually become an important part of modern communication. Images are widely popular due to their strong visual expressiveness and low storage requirements. However, images often contain a large amount of potentially sensitive information, possibly involving confidential content. If transmitted directly on public networks, they are highly susceptible to unauthorized reading and could even trigger serious information security incidents. Therefore, how to effectively protect the security and privacy of images has become a hot topic of research for researchers.
[0003] For existing image security schemes, encrypting the image is the most direct and effective method. To improve image security, researchers have incorporated chaos theory, DNA encoding, and quantum transformations into encryption methods. However, these methods primarily aim to generate unreadable ciphertext images. If transmitted over public channels, the white noise in the ciphertext image can easily arouse the curiosity of attackers, potentially increasing the probability of the image being compromised.
[0004] Currently, image encryption methods based on compressed sensing (CS) technology have received widespread attention. These methods encrypt plaintext images into ciphertext images and then embed the ciphertext images into a carrier image to generate a visually secure encrypted image. For example, existing patent documents disclose an image encryption method based on compressed sensing, which includes sparsifying and thresholding the input image to generate a coefficient matrix P2; generating a chaotic sequence using a two-dimensional discrete Standard chaotic system; scrambling the coefficient matrix P2 using the chaotic sequence to obtain a sparse matrix P3; constructing a measurement matrix of size M×N based on Welch bounds; using compressed sensing, compressing the sparse matrix P3 through the measurement matrix to obtain a real matrix P4; quantizing the real matrix P4 to obtain an intermediate ciphertext image; and performing dynamic DNA diffusion on the intermediate ciphertext image to obtain the final ciphertext image. However, most image encryption methods based on compressed sensing (CS) technology, including the aforementioned prior art, require image reconstruction at the receiving end and depend on the measurement matrix used, resulting in high computational complexity. Furthermore, existing embedding strategies mainly adopt fixed embedding mechanisms, and their robustness still has considerable room for improvement. Summary of the Invention
[0005] To overcome the shortcomings of the prior art, such as low randomness, high computational complexity, and poor anti-attack capability and robustness of generated chaotic sequences, this invention provides an image hiding method based on restricted Boltzmann machines and parallel compressed sensing. This method can effectively improve the randomness of the sequence, significantly improve image processing efficiency, and achieve high-quality image reconstruction at a low compression ratio. In addition, the encrypted images generated by this invention have higher anti-attack capability and robustness.
[0006] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows:
[0007] An image hiding method based on Restricted Boltzmann Machine and Parallel Compressed Sensing includes the following steps:
[0008] S1: Obtain the plaintext image P and calculate the hash value of the plaintext image P. Generate two mixed sequences, combine1 and combine2, based on the hash value.
[0009] S2: Initialize the restricted Boltzmann machine using the two mixed sequences combine1 and combine2, iteratively update the initialized restricted Boltzmann machine, and generate random sequences seqx, seqy and seqz;
[0010] S3: Sparsify the plaintext image P to generate a sparse matrix P1, randomly scramble the sparse matrix P1 to generate a scrambled matrix P2, and perform thresholding on the scrambled matrix P2 to obtain matrix P3.
[0011] S4: Generate a measurement matrix using a random sequence seqy, and use the measurement matrix to perform compressed sensing on matrix P3 to generate a compressed matrix P4; quantize the compressed matrix P4 to generate a quantized matrix P5;
[0012] S5: Divide the quantization matrix P5 into several sub-block matrices, rotate and scramble each sub-block matrix and then reassemble them to obtain the spliced matrix P6; rotate and scramble the spliced matrix P6 as a whole to obtain matrix P7.
[0013] S6: Rearrange the random sequence seqx to generate a rearrangement matrix Z, and further generate an index matrix I using the rearrangement matrix Z. Z Using the rearrangement matrix Z and the index matrix I Z A diffusion operation is performed on the matrix P7 to obtain the ciphertext image cipher;
[0014] S7: Introduce the carrier image Q, perform lifting wavelet transform on the carrier image Q to obtain frequency coefficients, split the cipher image cipher, use the random sequence seqz to control the embedding depth, embed the split cipher image cipher into the frequency coefficients, perform inverse lifting wavelet transform on the embedded frequency coefficients, and obtain the final cipher image S.
[0015] Preferably, step S1 includes:
[0016] S1.1: Calculate the hash value of the plaintext image P using the hash function SHA-256, wherein the hash value is in 64-bit hexadecimal format;
[0017] S1.2: Construct the following mathematical model, and substitute the hash value into the mathematical model to generate two initial values s0 and s1:
[0018]
[0019] The hex2dec function is used to convert hexadecimal to decimal.
[0020] S1.3: Substitute the initial values s0 and s1 into the Logistic mapping and Cubic mapping respectively, and perform size... v ·size h +size v +size h Perform +100 iterations, discarding the results of the first 100 iterations, to obtain sequences seq1 and seq2. Merge sequences seq1 and seq2 to obtain the combined sequence. seq1 ;
[0021] Substitute the initial values s0 and s1 into the Logistic mapping and Cubic mapping respectively, and then perform size calculations. v Perform +100 iterations, discarding the results of the first 100 iterations, to obtain sequences seq3 and seq4. Merge sequences seq3 and seq4 to obtain the combined sequence. seq2 ;
[0022] The merger is represented as follows:
[0023]
[0024] Where, size v For the input layer dimension of the restricted Boltzmann machine, size h Let be the hidden layer dimension of the restricted Boltzmann machine.
[0025] Preferably, step S2 includes:
[0026] S2.1: Initialize the vector x, weight matrix w, visible layer offset v, and hidden layer offset h of the restricted Boltzmann machine using the two hybrid sequences combine1 and combine2, specifically as follows:
[0027]
[0028] Where x0, w0, v0 and h0 are the initial values of vector x, weight matrix w, visible layer offset v and hidden layer offset h, respectively;
[0029] S2.2: Calculate the pixel values of the plaintext image P and determine the iteration number t of the restricted Boltzmann machine, then calculate the keys key1 and key2, specifically as follows:
[0030]
[0031] Where M and N are the number of rows and columns of pixels in the plaintext image P, respectively;
[0032] S2.3: Substitute keys key1 and key2 into the Logistic and Cubic mappings respectively, iteratively generate d1 and d2, and calculate the perturbation factor d to update vector x, specifically:
[0033]
[0034] Where x′ is the vector x after iterative update;
[0035] S2.4: Update the weight matrix w, visible layer offset v, and hidden layer offset h of the initialized restricted Boltzmann machine using contrastive divergence; then combine forward and backward propagation to update vector x′ to obtain vector x″;
[0036]
[0037] Where w′, h′, and v′ are the updated weight matrix w, the visible layer offset v, and the hidden layer offset h, respectively;
[0038] S2.5: Obtain random sequences seqx, seqy, and seqz of length M*N from vector x″, specifically:
[0039]
[0040] Preferably, step S3 includes:
[0041] S3.1: Sparsify the plaintext image P to generate a sparse matrix P1 of size M×N:
[0042] P1=Ψ×P×ΨT
[0043] Where Ψ is the orthogonal wavelet matrix of SWT;
[0044] S3.2: Randomly shuffle the sparse matrix P1 using a two-dimensional Cat mapping:
[0045]
[0046] Where (x1,y1) is the pixel position in the plaintext image after sparsification, (x2,y2) is the pixel position in the image after random scrambling, and a and b are the first and second hyperparameters;
[0047] After several iterations, a scrambling matrix P2 is generated.
[0048] S3.3: Apply a threshold to the scrambling matrix P2, setting the sparsity of the columns of the scrambling matrix P2 to:
[0049]
[0050] Where CR is the compression ratio; θ and α are the third and fourth hyperparameters determined by the reconstruction method; the threshold of each column of the scrambling matrix P2 is the absolute value of the Kth largest element in that column. Elements in each column of the scrambling matrix P2 whose absolute values are less than the corresponding thresholds are set to zero to obtain matrix P3.
[0051] Preferably, step S4 includes:
[0052] S4.1: Generate N measurement matrices Φ using a random sequence seqy. i Using the i-th measurement matrix Φ i Sampling the i-th column of matrix P3 yields a compressed matrix P4 of size V×N, where V=M×CR;
[0053] S4.2: Quantize the pixel values of the compression matrix P4 into integers in the range [0, 255] to generate the quantization matrix P5:
[0054]
[0055] Among them, P max and P min These represent the maximum and minimum pixel values of the compression matrix P4, respectively.
[0056] Preferably, step S5 includes:
[0057] S5.1: Divide the quantization matrix P5 into several sub-block matrices, each sub-block matrix having a side length l of:
[0058]
[0059] Where avg represents the pixel mean of the quantization matrix P5;
[0060] S5.2: Rotate and scramble each of the sub-block matrices and then reassemble them to obtain the spliced matrix P6; rotate and scramble the spliced matrix P6 as a whole to obtain matrix P7.
[0061] Preferably, step S6 includes:
[0062] S6.1: Rearrange the random sequence seqx to generate a rearranged matrix Z of the same size as matrix P7:
[0063]
[0064] Where seqx′ represents the rearranged random sequence seqx;
[0065] S6.2: Sort each column of the rearranged matrix Z to further generate the index matrix I. Z :
[0066]
[0067] S6.3: Using the rearrangement matrix Z and the index matrix I Z Perform a diffusion operation on the matrix P7 to obtain the ciphertext image:
[0068]
[0069] Preferably, step S7 includes:
[0070] S7.1: Introduce the carrier image Q and perform preprocessing:
[0071] Q' = ceil(10 + 233 / 255 * Q)
[0072] Where Q' is the preprocessed carrier image;
[0073] The preprocessed carrier image Q' is subjected to lifting wavelet transform to obtain four frequency coefficient matrices of the same size: CA, CH, CV, and CD.
[0074] S7.2: Decompose the random sequence seqz into three subsequences and rearrange them into matrices sseq1, sseq2 and sseq3 of the same size as the frequency coefficient matrix;
[0075] S7.3: Split the ciphertext image into three matrices CH1, CV1, and CD1, as follows:
[0076]
[0077] S7.4: Use matrices sseq1, sseq2, and sseq3 to control the embedding depth and calculate the embedding shifts CHshift, CVshift, and CDshift:
[0078]
[0079] S7.5: Based on the embedded displacement, embed matrices CH1, CV1, and CD1 into the corresponding frequency coefficient matrices to obtain three embedded frequency coefficient matrices CH2, CV2, and CD2:
[0080]
[0081] S7.6: Perform inverse lifting wavelet transform on matrices CA, CH2, CV2, and CD2 to obtain the final densely packed image S:
[0082] S=ilwt2(CA,CH2,CV2,CD2,LS)
[0083] Here, LS represents the wavelet lifting scheme object.
[0084] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-described method.
[0085] The present invention also provides an electronic device, including a processor and a memory, the memory storing computer-readable instructions, which, when executed by the processor, perform the steps of the method described above.
[0086] Compared with the prior art, the beneficial effects of the technical solution of the present invention are:
[0087] This invention provides an image hiding method based on Restricted Boltzmann Machine (RBM) and Parallel Compressed Sensing (PCS). The method includes two stages: encryption and embedding. In the encryption stage, the plaintext image is sequentially subjected to sparse decomposition, image scrambling, and thresholding. Then, a measurement matrix is constructed using a random sequence for parallel PCS. Next, the image is quantized, and further rotation scrambling and random diffusion are performed to obtain the ciphertext image. In the embedding stage, the ciphertext image information is embedded into different wavelet coefficients of the carrier image using LWT (Low Wavelet Transformer), and the embedding depth is dynamically selected according to the random sequence to improve the concealment and security of the embedded information.
[0088] This invention designs a pseudo-random sequence generation method based on a Restricted Boltzmann Machine (RBM), which improves the randomness of the generated sequences. Secondly, this invention constructs a novel parallel compressed sensing (CS) method. By constructing an optimized measurement matrix, it can not only significantly improve image processing efficiency but also achieve high-quality image reconstruction at a low compression ratio. In addition, this invention also adopts a dynamic embedding strategy, which enhances the anti-attack capability and robustness of encrypted images by dynamically adjusting the embedding depth during the embedding process. Attached Figure Description
[0089] Figure 1 This is a flowchart of an image hiding method based on a restricted Boltzmann machine and parallel compressed sensing, as provided in Example 1.
[0090] Figure 2 This is a framework diagram of an image hiding method based on a restricted Boltzmann machine and parallel compressed sensing, as provided in Example 2.
[0091] Figure 3 This is a structural diagram of the restricted Boltzmann machine provided in Example 2.
[0092] Figure 4 This is a schematic diagram of rotation scrambling provided in Example 2.
[0093] Figure 5 This is a schematic diagram of the plaintext image Clock provided in Example 2.
[0094] Figure 6 This is a schematic diagram of the carrier image Goldhill provided in Example 2.
[0095] Figure 7 This is a schematic diagram of the ciphertext image Clock provided in Example 2.
[0096] Figure 8 This is a schematic diagram of the Goldhill image provided in Example 2.
[0097] Figure 9 This is a schematic diagram of the decrypted image Clock provided in Example 2.
[0098] Figure 10 This is a histogram of the plaintext image Clock provided in Example 2.
[0099] Figure 11 This is a histogram of the carrier image Goldhill provided in Example 2.
[0100] Figure 12The histogram of the ciphertext image Clock provided in Example 2
[0101] Figure 13 This is a histogram of the Goldhill image provided in Example 2. Detailed Implementation
[0102] The accompanying drawings are for illustrative purposes only and should not be construed as limiting the scope of this patent.
[0103] To better illustrate this embodiment, some parts in the accompanying drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions;
[0104] It will be understood by those skilled in the art that certain well-known structures and their descriptions may be omitted in the accompanying drawings.
[0105] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.
[0106] Example 1
[0107] like Figure 1 As shown, this embodiment provides an image hiding method based on a restricted Boltzmann machine and parallel compressed sensing, including the following steps:
[0108] S1: Obtain the plaintext image P and calculate the hash value of the plaintext image P. Generate two mixed sequences, combine1 and combine2, based on the hash value.
[0109] S2: Initialize the restricted Boltzmann machine using the two mixed sequences combine1 and combine2, iteratively update the initialized restricted Boltzmann machine, and generate random sequences seqx, seqy and seqz;
[0110] S3: Sparsify the plaintext image P to generate a sparse matrix P1, randomly scramble the sparse matrix P1 to generate a scrambled matrix P2, and perform thresholding on the scrambled matrix P2 to obtain matrix P3.
[0111] S4: Generate a measurement matrix using a random sequence seqy, and use the measurement matrix to perform compressed sensing on matrix P3 to generate a compressed matrix P4; quantize the compressed matrix P4 to generate a quantized matrix P5;
[0112] S5: Divide the quantization matrix P5 into several sub-block matrices, rotate and scramble each sub-block matrix and then reassemble them to obtain the spliced matrix P6; rotate and scramble the spliced matrix P6 as a whole to obtain matrix P7.
[0113] S6: Rearrange the random sequence seqx to generate a rearrangement matrix Z, and further generate an index matrix I using the rearrangement matrix Z. Z Using the rearrangement matrix Z and the index matrix I Z A diffusion operation is performed on the matrix P7 to obtain the ciphertext image cipher;
[0114] S7: Introduce the carrier image Q, perform lifting wavelet transform on the carrier image Q to obtain frequency coefficients, split the cipher image cipher, use the random sequence seqz to control the embedding depth, embed the split cipher image cipher into the frequency coefficients, perform inverse lifting wavelet transform on the embedded frequency coefficients, and obtain the final cipher image S.
[0115] In the specific implementation process, the plaintext image P is first obtained and the hash value of the plaintext image P is calculated. Based on the hash value, two mixed sequences, combine1 and combine2, are generated.
[0116] The restricted Boltzmann machine is initialized using two mixed sequences, combine1 and combine2. The initialized restricted Boltzmann machine is iteratively updated to generate random sequences seqx, seqy and seqz.
[0117] The plaintext image P is sparsified to generate a sparse matrix P1. The sparse matrix P1 is randomly scrambled to generate a scrambled matrix P2. The scrambled matrix P2 is thresholded to obtain matrix P3.
[0118] A measurement matrix is generated using a random sequence seqy. The measurement matrix is then used to perform compressed sensing on matrix P3 to generate a compressed matrix P4. The compressed matrix P4 is then quantized to generate a quantized matrix P5.
[0119] The quantization matrix P5 is divided into several sub-block matrices. Each sub-block matrix is rotated and scrambled and then reassembled to obtain the concatenated matrix P6. The concatenated matrix P6 is rotated and scrambled as a whole to obtain matrix P7.
[0120] The random sequence seqx is rearranged to generate a rearrangement matrix Z, and the rearrangement matrix Z is further used to generate an index matrix I. Z Using the rearrangement matrix Z and the index matrix I Z Perform a diffusion operation on matrix P7 to obtain the ciphertext image cipher;
[0121] Finally, the carrier image Q is introduced, and the carrier image Q is subjected to lifting wavelet transform to obtain frequency coefficients. The cipher image is split, and the embedding depth is controlled by the random sequence seqz. The split cipher image is embedded into the frequency coefficients, and the inverse lifting wavelet transform is performed on the embedded frequency coefficients to obtain the final cipher image S.
[0122] This method can effectively improve the randomness of the sequence, while significantly improving the efficiency of image processing. It can also achieve high-quality image reconstruction at a low compression ratio. In addition, the encrypted images generated by this method have higher resistance to attacks and greater robustness.
[0123] Example 2
[0124] This embodiment provides an image hiding method based on a restricted Boltzmann machine and parallel compressed sensing, including the following steps:
[0125] S1: Obtain the plaintext image P and calculate the hash value of the plaintext image P. Generate two mixed sequences, combine1 and combine2, based on the hash value.
[0126] S2: Initialize the restricted Boltzmann machine using the two mixed sequences combine1 and combine2, iteratively update the initialized restricted Boltzmann machine, and generate random sequences seqx, seqy and seqz;
[0127] S3: Sparsify the plaintext image P to generate a sparse matrix P1, randomly scramble the sparse matrix P1 to generate a scrambled matrix P2, and perform thresholding on the scrambled matrix P2 to obtain matrix P3.
[0128] S4: Generate a measurement matrix using a random sequence seqy, and use the measurement matrix to perform compressed sensing on matrix P3 to generate a compressed matrix P4; quantize the compressed matrix P4 to generate a quantized matrix P5;
[0129] S5: Divide the quantization matrix P5 into several sub-block matrices, rotate and scramble each sub-block matrix and then reassemble them to obtain the spliced matrix P6; rotate and scramble the spliced matrix P6 as a whole to obtain matrix P7.
[0130] S6: Rearrange the random sequence seqx to generate a rearrangement matrix Z, and further generate an index matrix I using the rearrangement matrix Z. Z Using the rearrangement matrix Z and the index matrix I Z A diffusion operation is performed on the matrix P7 to obtain the ciphertext image cipher;
[0131] S7: Introduce the carrier image Q, perform lifting wavelet transform on the carrier image Q to obtain frequency coefficients, split the cipher image cipher, use the random sequence seqz to control the embedding depth, embed the split cipher image cipher into the frequency coefficients, perform inverse lifting wavelet transform on the embedded frequency coefficients, and obtain the final cipher image S.
[0132] Step S1 includes:
[0133] S1.1: Calculate the hash value of the plaintext image P using the hash function SHA-256. The hash value is in 64-bit hexadecimal format. In this embodiment, other hash functions can also be used to calculate the hash value.
[0134] S1.2: Construct the following mathematical model, and substitute the hash value into the mathematical model to generate two initial values s0 and s1:
[0135]
[0136] The hex2dec function is used to convert hexadecimal to decimal.
[0137] S1.3: Substitute the initial values s0 and s1 into the Logistic mapping and Cubic mapping respectively, and perform size... v ·size h +size v +size h Perform +100 iterations, discarding the results of the first 100 iterations, to obtain sequences seq1 and seq2. Merge sequences seq1 and seq2 to obtain the combined sequence. seq1 ;
[0138] Substitute the initial values s0 and s1 into the Logistic mapping and Cubic mapping respectively, and then perform size calculations. v Perform +100 iterations, discarding the results of the first 100 iterations, to obtain sequences seq3 and seq4. Merge sequences seq3 and seq4 to obtain the combined sequence. seq2 ;
[0139] It should be noted that in this embodiment, the number of iterations is just enough to generate the number of random numbers required for encryption. The first 100 are discarded in order to eliminate the influence of the initial value and achieve a stable chaotic state. Discarding more iterations is also feasible, but the encryption time will increase.
[0140] The merger is represented as follows:
[0141]
[0142] Where, size v For the input layer dimension of the restricted Boltzmann machine, size h The hidden layer dimension of the restricted Boltzmann machine;
[0143] Step S2 includes:
[0144] S2.1: Initialize the vector x, weight matrix w, visible layer offset v, and hidden layer offset h of the restricted Boltzmann machine using the two hybrid sequences combine1 and combine2, specifically as follows:
[0145]
[0146] Where x0, w0, v0 and h0 are the initial values of vector x, weight matrix w, visible layer offset v and hidden layer offset h, respectively;
[0147] S2.2: Calculate the pixel values of the plaintext image P and determine the iteration number t of the restricted Boltzmann machine, then calculate the keys key1 and key2, specifically as follows:
[0148]
[0149] Where M and N are the number of rows and columns of pixels in the plaintext image P, respectively;
[0150] S2.3: Substitute keys key1 and key2 into the Logistic and Cubic mappings respectively, iteratively generate d1 and d2, and calculate the perturbation factor d to update vector x, specifically:
[0151]
[0152] Where x′ is the vector x after iterative update;
[0153] S2.4: Update the weight matrix w, visible layer offset v, and hidden layer offset h of the initialized restricted Boltzmann machine using contrastive divergence; then update the vector x′ through forward and backward propagation to obtain the vector x”.
[0154]
[0155] Where w′, h′, and v′ are the updated weight matrix w, the visible layer offset v, and the hidden layer offset h, respectively;
[0156] S2.5: Obtain random sequences seqx, seqy, and seqz of length M*N from vector x″, specifically:
[0157]
[0158] Step S3 includes:
[0159] S3.1: Sparsify the plaintext image P to generate a sparse matrix P1 of size M×N:
[0160] P1=Ψ×P×Ψ T
[0161] Where Ψ is the orthogonal wavelet matrix of SWT;
[0162] S3.2: Randomly shuffle the sparse matrix P1 using a two-dimensional Cat mapping:
[0163]
[0164] Where (x1,y1) is the pixel position in the plaintext image after sparsification, (x2,y2) is the pixel position in the image after random scrambling, and a and b are the first and second hyperparameters;
[0165] After several iterations, a scrambling matrix P2 is generated.
[0166] S3.3: Apply a threshold to the scrambling matrix P2, setting the sparsity of the columns of the scrambling matrix P2 to:
[0167]
[0168] Where CR is the compression ratio; θ and α are the third and fourth hyperparameters determined by the reconstruction method; the threshold of each column of the scrambling matrix P2 is the absolute value of the Kth largest element in that column. Elements in each column of the scrambling matrix P2 whose absolute values are less than the corresponding thresholds are set to zero to obtain matrix P3.
[0169] Step S4 includes:
[0170] S4.1: Generate N measurement matrices Φ using a random sequence seqy. i Using the i-th measurement matrix Φ i Sampling the i-th column of matrix P3 yields a compressed matrix P4 of size V×N, where V=M×CR;
[0171] S4.2: Quantize the pixel values of the compression matrix P4 into integers in the range [0, 255] to generate the quantization matrix P5:
[0172]
[0173] Among them, P max and P min These are the maximum and minimum pixel values of the compression matrix P4, respectively;
[0174] Step S5 includes:
[0175] S5.1: Divide the quantization matrix P5 into several sub-block matrices, each sub-block matrix having a side length l of:
[0176]
[0177] Where avg represents the pixel mean of the quantization matrix P5;
[0178] S5.2: Rotate and scramble each of the sub-block matrices and then reassemble them to obtain the spliced matrix P6; rotate and scramble the spliced matrix P6 as a whole to obtain matrix P7;
[0179] Step S6 includes:
[0180] S6.1: Rearrange the random sequence seqx to generate a rearranged matrix Z of the same size as matrix P7:
[0181]
[0182] Where seqx′ represents the rearranged random sequence seqx;
[0183] S6.2: Sort each column of the rearranged matrix Z to further generate the index matrix I. Z :
[0184]
[0185] S6.3: Using the rearrangement matrix Z and the index matrix I Z Perform a diffusion operation on the matrix P7 to obtain the ciphertext image:
[0186]
[0187] Step S7 includes:
[0188] S7.1: Introduce the carrier image Q and perform preprocessing:
[0189] Q' = ceil(10 + 233 / 255 * Q)
[0190] Where Q' is the preprocessed carrier image;
[0191] The preprocessed carrier image Q' is subjected to lifting wavelet transform to obtain four frequency coefficient matrices of the same size: CA, CH, CV, and CD.
[0192] S7.2: Decompose the random sequence seqz into three subsequences and rearrange them into matrices sseq1, sseq2 and sseq3 of the same size as the frequency coefficient matrix;
[0193] S7.3: Split the ciphertext image into three matrices CH1, CV1, and CD1, as follows:
[0194]
[0195] S7.4: Use matrices sseq1, sseq2, and sseq3 to control the embedding depth and calculate the embedding shifts CHshift, CVshift, and CDshift:
[0196]
[0197] S7.5: Based on the embedded displacement, embed matrices CH1, CV1, and CD1 into the corresponding frequency coefficient matrices to obtain three embedded frequency coefficient matrices CH2, CV2, and CD2:
[0198]
[0199] S7.6: Perform inverse lifting wavelet transform on matrices CA, CH2, CV2, and CD2 to obtain the final densely packed image S:
[0200]
[0201] Here, LS stands for Lifting Scheme Object, which stores the lifting structure information of the Haar wavelet and includes the wavelet transform method and parameters for performing integer-to-integer conversion.
[0202] In the specific implementation process, such as Figure 2 As shown, firstly, a plaintext image P is obtained and its hash value is calculated. Based on the hash value, two mixed sequences, combine1 and combine2, are generated.
[0203] Specifically, the hash value of the plaintext image P is calculated using the hash function SHA-256, and the hash value is in 64-bit hexadecimal format.
[0204] Construct the following mathematical model, and substitute the hash value into the mathematical model to generate two initial values s0 and s1:
[0205]
[0206] The hex2dec function is used to convert hexadecimal to decimal.
[0207] Substitute the initial values s0 and s1 into the Logistic mapping and Cubic mapping respectively, and perform size... v ·size h +size v +size hPerform +100 iterations, discarding the results of the first 100 iterations, to obtain sequences seq1 and seq2. Merge sequences seq1 and seq2 to obtain the combined sequence. seq1 ;
[0208] Substitute the initial values s0 and s1 into the Logistic mapping and Cubic mapping respectively, and then perform size calculations. v Perform +100 iterations, discarding the results of the first 100 iterations, to obtain sequences seq3 and seq4. Merge sequences seq3 and seq4 to obtain the combined sequence. seq2 ;
[0209] The merger is represented as follows:
[0210]
[0211] Where, size v For the input layer dimension of the restricted Boltzmann machine, size h The hidden layer dimension of the restricted Boltzmann machine;
[0212] The restricted Boltzmann machine is initialized using the two mixed sequences combine1 and combine2. The initialized restricted Boltzmann machine is iteratively updated to generate random sequences seqx, seqy and seqz.
[0213] Specifically, the initial values of the vector x, weight matrix w, visible layer offset v, and hidden layer offset h of the restricted Boltzmann machine are initialized using the two hybrid sequences combine1 and combine2, as follows: Figure 3 The diagram shown is a structural diagram of a confined Boltzmann machine, specifically:
[0214]
[0215] Where x0, w0, v0 and h0 are the initial values of vector x, weight matrix w, visible layer offset v and hidden layer offset h, respectively;
[0216] Calculate the pixel values of the plaintext image P and determine the iteration number t of the restricted Boltzmann machine, then calculate the keys key1 and key2, specifically as follows:
[0217]
[0218] Where M and N are the number of rows and columns of pixels in the plaintext image P, respectively;
[0219] Substitute keys key1 and key2 into the Logistic and Cubic mappings respectively, iteratively generate d1 and d2, and calculate the perturbation factor d to update vector x, specifically:
[0220]
[0221] Where x′ is the vector x after iterative update;
[0222] The weight matrix w, visible layer offset v, and hidden layer offset h of the initialized restricted Boltzmann machine are updated using contrastive divergence; then, vector x′ is updated by combining forward and backward propagation to obtain vector x″.
[0223]
[0224] Where w′, h′, and v′ are the updated weight matrix w, the visible layer offset v, and the hidden layer offset h, respectively;
[0225] From the vector x″, we obtain random sequences seqx, seqy, and seqz of length M*N, specifically as follows:
[0226]
[0227] The plaintext image P is then sparsified to generate a sparse matrix P1 of size M×N:
[0228] P1=Ψ×P×Ψ T
[0229] Where Ψ is the orthogonal wavelet matrix of SWT;
[0230] The sparse matrix P1 is randomly scrambled using a two-dimensional Cat mapping:
[0231]
[0232] Where (x1,y1) is the pixel position in the plaintext image after sparsification, (x2,y2) is the pixel position in the image after random scrambling, and a and b are the first and second hyperparameters;
[0233] After several iterations, a scrambling matrix P2 is generated.
[0234] Thresholding is applied to the scrambling matrix P2, setting the sparsity of the columns of the scrambling matrix P2 to:
[0235]
[0236] Where CR is the compression ratio; θ and α are the third and fourth hyperparameters determined by the reconstruction method; the threshold of each column of the scrambling matrix P2 is the absolute value of the Kth largest element in that column. Elements in each column of the scrambling matrix P2 whose absolute values are less than the corresponding thresholds are set to zero to obtain matrix P3.
[0237] Next, N measurement matrices Φ are generated using a random sequence seqy. i Using the i-th measurement matrix Φ i Sampling the i-th column of matrix P3 yields a compressed matrix P4 of size V×N, where V=M×CR;
[0238] The pixel values of the compression matrix P4 are quantized into integers in the range [0, 255] to generate the quantization matrix P5:
[0239]
[0240] Among them, P max and P min These are the maximum and minimum pixel values of the compression matrix P4, respectively;
[0241] The quantization matrix P5 is then divided into several sub-block matrices, each with a side length l:
[0242]
[0243] Where avg represents the pixel mean of the quantization matrix P5;
[0244] Each of the sub-block matrices is rotated and scrambled separately, then reassembled to obtain the assembled matrix P6; the assembled matrix P6 is then rotated and scrambled as a whole to obtain matrix P7; as follows. Figure 4 The diagram shown is a schematic of rotation scrambling;
[0245] The random sequence seqx is then rearranged to generate a rearranged matrix Z of the same size as matrix P7:
[0246]
[0247] Where seqx′ represents the rearranged random sequence seqx;
[0248] Sort each column of the rearranged matrix Z to generate the index matrix I. Z :
[0249]
[0250] Using the rearrangement matrix Z and the index matrix I Z Perform a diffusion operation on the matrix P7 to obtain the ciphertext image:
[0251]
[0252] Finally, the carrier image Q is introduced and preprocessed:
[0253] Q' = ceil(10 + 233 / 255 * Q)
[0254] Where Q' is the preprocessed carrier image;
[0255] The preprocessed carrier image Q' is subjected to lifting wavelet transform to obtain four frequency coefficient matrices of the same size: CA, CH, CV, and CD.
[0256] The random sequence seqz is decomposed into three subsequences and rearranged into matrices sseq1, sseq2 and sseq3 of the same size as the frequency coefficient matrix;
[0257] The ciphertext image is split into three matrices CH1, CV1, and CD1, as follows:
[0258]
[0259] The embedding depth of each coefficient is dynamically controlled using matrices sseq1, sseq2, and sseq3, and the embedding shifts CHshift, CVshift, and CDshift are calculated:
[0260]
[0261] Based on the embedded displacement, matrices CH1, CV1, and CD1 are embedded into their corresponding frequency coefficient matrices, resulting in three embedded frequency coefficient matrices CH2, CV2, and CD2:
[0262]
[0263] Perform inverse lifting wavelet transform on matrices CA, CH2, CV2, and CD2 to obtain the final densely packed image S:
[0264]
[0265] Here, LS represents the wavelet lifting scheme object, which stores the lifting structure information of the Haar wavelet and includes the wavelet transform method and parameters for performing integer-to-integer conversion;
[0266] This embodiment also provides a simulation experiment, such as Figure 5 The image shown is a plaintext image of Clock, as shown below. Figure 6 The image shown is the carrier image Goldhill; this method is used to... Figure 5 The plaintext image Clock is encrypted to obtain the following: Figure 7 The encrypted image shown willFigure 7 The ciphertext image shown is embedded in Figure 6 From the carrier image, we obtain the following: Figure 8 The image shown is a confidential image; Figure 8 The encrypted image is decrypted to obtain... Figure 9 The decrypted image shown demonstrates that this method can achieve high-quality image hiding.
[0267] This embodiment also includes statistics on... Figures 5 to 8 The grayscale histogram, such as Figures 10 to 13 The figures shown are the histograms of the plaintext image Clock, the carrier image Goldhill, the ciphertext image, and the ciphertext image, respectively; [The text then repeats itself, so the translation stops.] Figures 10 to 13 It can be seen that this method has high security and strong robustness;
[0268] This method can effectively improve the randomness of the sequence, while significantly improving the efficiency of image processing. It can also achieve high-quality image reconstruction at a low compression ratio. In addition, the encrypted images generated by this method have higher resistance to attacks and greater robustness.
[0269] The same or similar labels correspond to the same or similar parts;
[0270] The terms used to describe positional relationships in the accompanying drawings are for illustrative purposes only and should not be construed as limiting this patent.
[0271] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the implementation of the present invention. Those skilled in the art can make other variations or modifications based on the above description. It is neither necessary nor possible to exhaustively describe all embodiments here. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the claims of the present invention.
Claims
1. An image hiding method based on restricted Boltzmann machine and parallel compressive sensing, characterized in that, The method comprises the following steps: S1: obtaining a plaintext image P and calculating a hash value hash of the plaintext image P, generating two mixed sequences combine1 and combine2 based on the hash value hash; S2: initializing a restricted Boltzmann machine using the two mixed sequences combine1 and combine2, iteratively updating the initialized restricted Boltzmann machine, and generating random sequences seqx, seqy and seqz; S3: sparsifying the plaintext image P to generate a sparse matrix P1, randomly shuffling the sparse matrix P1 to generate a shuffled matrix P2, and performing threshold processing on the shuffled matrix P2 to obtain a matrix P3; S4: generating a measurement matrix using the random sequence seqy, performing compressed sensing on the matrix P3 using the measurement matrix to generate a compressed matrix P4, and quantizing the compressed matrix P4 to generate a quantized matrix P5; S5: dividing the quantized matrix P5 into a plurality of sub-block matrices, rotating and shuffling each of the sub-block matrices, and then reassembling to obtain an assembled matrix P6; and rotating and shuffling the assembled matrix P6 as a whole to obtain a matrix P7; S6: rearranging the random sequence seqx to generate a rearrangement matrix Z, and further generating an index matrix I using the rearrangement matrix Z Z , and further generating an index matrix I using the rearrangement matrix Z and the index matrix I Z performing a diffusion operation on the matrix P7 to obtain a ciphertext image cipher; S7: introducing a carrier image Q, performing lifting wavelet transform on the carrier image Q to obtain frequency coefficients, splitting a ciphertext image cipher, controlling embedding depth using the random sequence seqz, embedding the split ciphertext image cipher into the frequency coefficients, and performing inverse lifting wavelet transform on the embedded frequency coefficients to obtain a final stego-image S.
2. The image hiding method based on the restricted Boltzmann machine and parallel compressive sensing according to claim 1, characterized in that, The step S1 comprises: S1.1: calculating a hash value hash of the plaintext image P using a hash function SHA-256, wherein the hash value hash is in the format of 64-bit hexadecimal; S1.2: constructing the following mathematical model, substituting the hash value hash into the mathematical model, and generating two initial values s0 and s1: wherein the hex2dec function is used to convert hexadecimal to decimal; S1.3: Substitute the initial values s0 and s1 into the Logistic and Cubic maps, respectively, and iterate size v • size h + size v + size h + 100 iterations, and discard the first 100 iterations to obtain sequences seq1 and seq2, and combine the sequences seq1 and seq2 to obtain a combined sequence combined seq1 ; Again, the initial values s0 and s1 are substituted into the Logistic map and the Cubic map, respectively, to perform size v + 100 iterations, and discard the results of the first 100 iterations to obtain sequences seq3 and seq4, and combine the sequences seq3 and seq4 to obtain a mixed sequence combined seq2 ; The combination is represented as: where size v is the input layer dimension of the restricted Boltzmann machine, size h is the hidden layer dimension of the restricted Boltzmann machine.
3. The image hiding method based on the restricted Boltzmann machine and parallel compressive sensing according to claim 2, characterized in that, The step S2 comprises: S2.1: initializing the initial values of the vector x, the weight matrix w, the visible layer offset v and the hidden layer offset h of the restricted Boltzmann machine using the two mixed sequences combine1 and combine2, specifically: wherein x0, w0, v0 and h0 are the initial values of the vector x, the weight matrix w, the visible layer offset v and the hidden layer offset h, respectively; S2.2: calculating the pixel values of the plaintext image P and determining the number of iterations t of the restricted Boltzmann machine, and then calculating the keys key1 and key2, specifically: wherein M and N are the number of rows and columns of pixels in the plaintext image P, respectively; S2.3: substituting the keys key1 and key2 into the Logistic mapping and the Cubic mapping, respectively, to iteratively generate d1 and d2, and calculating a perturbation factor d for updating the vector x, specifically: wherein x' is the iteratively updated vector x; S2.4: updating the initialized restricted Boltzmann machine weight matrix w, visible layer offset v and hidden layer offset h by using the way of contrast divergence; then obtaining vector x" by combining the forward propagation and backward propagation update vector x'; wherein w', h' and v' are the updated weight matrix w, visible layer offset v and hidden layer offset h respectively; S2.5: obtaining random sequences seqx, seqy and seqz with length of M*N from vector x", specifically:
4. The image hiding method based on the restricted Boltzmann machine and parallel compressive sensing according to claim 3, characterized in that, The step S3 comprises: S3.1: sparse processing the plaintext image P to generate a sparse matrix P1 with size of M*N: P1 = Ψ x P x Ψ T wherein Ψ is the orthogonal wavelet matrix of SWT; S3.2: using two-dimensional Cat mapping to randomly scramble the sparse matrix P1: wherein (x1, y1) is the pixel position in the sparse plaintext image, (x2, y2) is the pixel position in the scrambled image, a and b are the first and second hyperparameters; generating a scrambled matrix P2 after continuous iteration for several times; S3.3: threshold processing the scrambled matrix P2, setting the sparsity of the scrambled matrix P2 column as: wherein CR is the compression rate; θ and a are the third and fourth hyperparameters determined by reconstruction method; the threshold of each column of the scrambled matrix P2 is the absolute value of the Kth largest element in the column, and the elements in each column of the scrambled matrix P2 whose absolute value is less than the corresponding threshold are set to zero to obtain the matrix P3.
5. The image hiding method based on the restricted Boltzmann machine and parallel compressive sensing according to claim 4, characterized in that, The step S4 comprises: S4.1: Generate N measurement matrices Φ with random sequence seqy i i Sample the i-th column of matrix P3 to obtain a compressed matrix P4 of size V x N, where V = M x CR; S4.2: quantizing the pixel value of the compressed matrix P4 to an integer in the interval [0, 255] to generate a quantized matrix P5: where P max and P min are the maximum and minimum values of the compressed matrix P4 pixel values, respectively.
6. The image hiding method based on the restricted Boltzmann machine and parallel compressive sensing according to claim 5, characterized in that, The step S5 comprises: S5.1: dividing the quantized matrix P5 into several sub-block matrices, and the side length l of each sub-block matrix is: wherein avg represents the average of the pixels of the quantized matrix P5; S5.2: rotating and scrambling each sub-block matrix respectively, reassembling to obtain an assembled matrix P6, and rotating and scrambling the assembled matrix P6 as a whole to obtain a matrix P7.
7. The image hiding method based on the restricted Boltzmann machine and parallel compressive sensing according to claim 6, characterized in that, The step S6 comprises: S6.1: rearranging the random sequence seqx to generate a rearranged matrix Z consistent with the size of the matrix P7: wherein seqx' represents the rearranged random sequence seqx; S6.2: Sort each column of the rearranged matrix Z, further generating an index matrix I Z : S6.3: Utilize the rearrangement matrix Z and the index matrix I Z A diffusion operation is performed on the matrix P7 to obtain a ciphertext image cipher:
8. The image hiding method based on the restricted Boltzmann machine and parallel compressive sensing according to claim 7, characterized in that, The step S7 comprises: S7.1: introducing a carrier image Q and preprocessing: Q' = ceil(10 + 233 / 255*Q) wherein Q' is the preprocessed carrier image; performing lifting wavelet transform on the preprocessed carrier image Q' to obtain four frequency coefficient matrices CA, CH, CV and CD with the same size; S7.2: decomposing the random sequence seqz into three sub-sequences, and rearranging them into matrices sseq1, sseq2 and sseq3 with the same size as the frequency coefficient matrix; S7.3: splitting the ciphertext image cipher to generate three matrices CH1, CV1 and CD1, expressed as: S7.4: using the matrices sseq1, sseq2 and sseq3 to control the embedding depth, and calculating the embedding shift amount CHshift, CVshift and CDshift: S7.5: Embed the matrices CH1, CV1 and CD1 into corresponding frequency coefficient matrices according to the embedded displacement amount, to obtain three embedded frequency coefficient matrices CH2, CV2 and CD2: S7.6: Perform inverse lifting wavelet transform on the matrices CA, CH2, CV2 and CD2 to obtain the final stego image S: S = ilwt2(CA, CH2, CV2, CD2, LS) where LS represents a wavelet lifting scheme object.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that The computer program is executed by a processor to implement the steps in the method of any one of claims 1-8.
10. An electronic device, comprising: A processor and a memory are included, and the memory stores computer readable instructions, when the computer readable instructions are executed by the processor, the steps in the method of any one of claims 1-8 are executed.
Citation Information
Patent Citations
Image encryption method based on integer wavelet transform and compressed sensing
CN113115053A
Apparatus and method for predicting compression quality of image in electronic device
US20230102895A1