Encrypted image RDH method of hierarchical block variable length coding based on MSB plane prediction

By adopting hierarchical block variable-length encoding technology based on MSB plane prediction in encrypted images, the problems of low embedding capacity and insufficient security in the existing RDHEI methods are solved, efficient data embedding and lossless recovery are achieved, and overall security is improved.

CN120128741APending Publication Date: 2025-06-10CHONGQING UNIV OF POSTS & TELECOMM
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510273545.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-10
Publication Date
2025-06-10

AI Technical Summary

Technical Problem

When the existing RDHEI method embeds data in encrypted images, the embedding capacity is low, the security is insufficient, and the calculation complexity is high, making it difficult to embed a large amount of data in the encrypted images, while ensuring lossless recovery and high security of the images.

Method used

The encrypted image RDH method of hierarchical block variable-length encoding based on MSB plane prediction is used to divide the bit plane from the MSB plane by dividing the absolute value of the prediction error image from the MSB plane, and decomposing it into blocks of different levels according to the local smoothness. The hierarchical threshold is used to determine whether to further block, and the blocks are compressed to make room for data embedding.

Benefits of technology

It significantly improves the data embedding capacity in encrypted images, ensures lossless recovery of images, and improves overall security, reduces the overhead of auxiliary information, and reduces the risk of auxiliary information being intercepted or tampered.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120128741A_ABST
    Figure CN120128741A_ABST
Patent Text Reader

Abstract

The invention requests to protect an encrypted image RDH method of hierarchical block variable length coding based on MSB plane prediction, and belongs to the field of information hiding. Comprising the following main steps: S1, carrying out prediction error calculation on an original image, and generating an absolute value image and a symbol graph of a prediction error; s2, dividing a bit plane of the absolute value image, decomposing the bit plane into blocks of different levels according to local smoothness, and judging whether the blocks are further divided or not through a layering threshold value Ti; s3, after packaging the compressed auxiliary information, encrypting the compressed auxiliary information by using a stream cipher, and embedding secret data in an encrypted image; and S4, the receiver extracts data and recovers the original image according to different keys. Compared with the existing method, the method provided by the invention has the following main advantages: (1) through a dynamic partitioning strategy, the method adapts to sparse '1' distribution of different regions, and the embedding capacity is improved; and (2) by utilizing high prediction precision of MED and combining efficient compression of hierarchical block variable length coding, an embedding space is vacated to the greatest extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information hiding, and in particular to an encrypted image RDH method based on MSB plane prediction and hierarchical block variable length coding. Background Art

[0002] With the rapid development of information technology, the storage, transmission and processing requirements of image data are increasing day by day, especially in the fields of cloud computing, medical image processing and military multimedia archive management. To protect the privacy and security of image data, users usually encrypt the images before uploading them to the cloud or other storage platforms. However, when the cloud server processes these encrypted images, it often needs to embed additional information (such as time stamps, copyright information, user identifiers, etc.) for image management, tracking and verification. Therefore, how to embed data in encrypted images while ensuring the security and reversibility of the images has become an important research topic.

[0003] Reversible Data Hiding (RDH) is a technique for embedding secret data in images, and its core feature is the ability to losslessly recover the original image after extracting the embedded data. RDH technology has a wide range of applications in the fields of medical image processing, military multimedia archive management, image transcoding, etc. For example, when embedding patient information in medical images, it is necessary to ensure the lossless recovery of the images to avoid diagnostic errors; when embedding confidential information in military archives, it is necessary to ensure the security of the data.

[0004] Traditional RDH techniques are mainly divided into the following categories: Difference Expansion (DE): Embed data by expanding pixel differences, which has a high embedding capacity but may introduce large distortions. Histogram Shifting (HS): Embed data by shifting the image histogram, which has low distortion but limited embedding capacity. Prediction-Error Expansion (PE): Embed data by expanding prediction errors, which combines the advantages of difference expansion and histogram shifting, and has a high embedding capacity and low distortion. Multiple Histograms Modification: Embed data by modifying multiple histograms, which further improves the embedding capacity and image quality. However, traditional RDH techniques mainly target unencrypted images and cannot be directly applied to encrypted images. With the increasing demand for cloud computing and privacy protection, how to perform Reversible Data Hiding in Encrypted Images (RDHEI) has become a new research direction.

[0005] The RDHEI technique aims to embed data in encrypted images while ensuring the security and reversibility of the images. According to the timing and method of data embedding, the existing RDHEI methods are mainly divided into the following three categories: Reserving Room Before Encryption (RRBE). The RRBE method reserves redundant space by utilizing the correlation between pixels before image encryption. Data hiders can use this space to embed data after encryption. The advantage of the RRBE method is that it can achieve a relatively high embedding capacity. However, since the image needs to be preprocessed before encryption, it may expose some image information and reduce security. Typical RRBE methods include: RRBE based on histogram shifting: Reserve space by shifting the image histogram, and data hiders can embed data after encryption. RRBE based on prediction error expansion: Reserve space by expanding the prediction error, which has a relatively high embedding capacity. Vacating Room Before Encryption (VRBE). The VRBE method vacates space while encrypting the image, partially retaining the correlation between pixels. The advantage of the VRBE method is that it can achieve a relatively high embedding capacity while partially maintaining the security of the image. Typical VRBE methods include: VRBE based on block rearrangement: Vacate space by rearranging image blocks, and data hiders can embed data after encryption. VRBE based on bit-plane compression: Vacate space by compressing the bit-planes of the image, which has a relatively high embedding capacity. Vacating Room After Encryption (VRAE). The VRAE method embeds data by modifying encrypted pixels after image encryption. The advantage of the VRAE method is that it does not require preprocessing of the image before encryption. However, since the correlation between pixels in the encrypted image is lost, it is difficult to achieve a high embedding capacity and lossless recovery. Typical VRAE methods include: VRAE based on LSB replacement: Embed data by replacing the least significant bit (LSB) of the encrypted image, with a relatively low embedding capacity. VRAE based on block permutation: Embed data by permuting encrypted image blocks, which has a relatively high embedding capacity. Although the existing RDHEI methods have solved the problem of data embedding in encrypted images to a certain extent, there are still the following limitations such as low embedding capacity and insufficient security. It is difficult for existing methods to embed a large amount of data in encrypted images. Especially in the VRAE method, due to the loss of correlation between pixels in the encrypted image, the embedding capacity is limited. And some RRBE and VRBE methods will expose auxiliary information when embedding data, resulting in a reduction in the security of the encrypted image. For example, the RRBE method based on histogram shifting may expose the histogram information of the image, and the VRBE method based on bit-plane compression may expose the bit-plane information of the image.To address the deficiencies of existing RDHEI methods in terms of embedding capacity and security, the present invention proposes an encrypted image RDH method based on MSB plane prediction and hierarchical block variable-length coding.

[0006] After retrieval, the application publication number is CN116582344A, which is a reversible information hiding method for encrypted images with bit-plane compression and block rearrangement. First, the image owner obtains the prediction error image corresponding to the original carrier image and divides it into blocks, then compresses the bit planes and statistical feature data of each block; secondly, the low-order bit planes of each block are swapped and all blocks are rearranged, and then the statistical feature data is counted, and the rearranged image is encrypted with an encryption key; then all the feature data together form all the auxiliary information and Huffman coding is used to reduce the length of the auxiliary information, and all the auxiliary information is embedded into the encrypted image and sent to the information hider. The information hider encrypts the secret information with a hiding key, then embeds it into the received image and sends it to the receiver. The receiver performs image restoration and data extraction operations on the received image according to the different keys it has.

[0007] In the above invention, the prediction error image corresponding to the original carrier image is divided into blocks, and the bit planes and statistical feature data of each block are compressed, then the low-order bit planes of each block are swapped and all blocks are rearranged, and then the statistical feature data is counted again. In this process, bit-plane compression may cause some information loss, thus affecting the restoration quality of the image and the reliable extraction of the hidden information. And block rearrangement may also introduce new image distortion, affecting the quality of the restored image. At the same time, although the above invention can compress the bit planes to free up some space, the fixed block rearrangement and coding cannot adapt to local sparsity differences, which may lead to ineffective compression of some blocks and limit the available space. The present invention takes into account the above problems and adopts a hierarchical block variable-length coding scheme based on MSB prediction for data hiding. By utilizing the characteristic that most of the high-bit bits of the pixel values in the prediction error image are '0', the bit-plane blocks are compressed starting from the MSB plane and the coding length is adjusted according to the size of the blocks, improving the compression efficiency. The present invention can achieve a larger information hiding capacity while maintaining the image quality, and at the same time reduce the overhead of the auxiliary information, reducing the risk of the auxiliary information being intercepted or tampered with, thereby improving the overall security. Summary of the Invention

[0008] The present invention aims to provide an encrypted image RDH method based on MSB plane prediction and hierarchical block variable-length coding to solve the problems of low embedding capacity, insufficient security and high computational complexity in the prior art. Through the present invention, a large amount of data can be efficiently embedded in the encrypted image while ensuring the lossless restoration of the image and high security. The technical solution of the present invention is as follows:

[0009] An encrypted image RDH method based on MSB plane prediction and hierarchical block variable length coding, characterized by comprising the following steps:

[0010] S1. Calculate the prediction error of the original image to generate the absolute value image and sign map of the prediction error;

[0011] S2. Divide the absolute value image of the prediction error from the MSB plane, and then decompose the bit plane into blocks of different levels according to local smoothness. Through the hierarchical threshold T i , determine whether to further divide the block, and compress the corresponding block to free up space for data embedding;

[0012] S3. After encapsulating the compressed bit plane, sign plane and other auxiliary information, encrypt it using a stream cipher, embed the secret data in the encrypted image, and retain the redundant space through LSB replacement to ensure reversibility;

[0013] S4. The receiver extracts the embedded data according to the encryption key and data hiding key, and losslessly restores the original image through the auxiliary information.

[0014] According to the encrypted image RDH method based on MSB plane prediction and hierarchical block variable length coding described in claim 1, characterized in that the method for calculating the prediction error and generating the absolute value image and sign map of the prediction error in step S1 specifically includes: the original image I, with a size of M×N, where the value range of each pixel value x(i,j) is [0,255]. For each pixel x(i,j) in the image, use the Median Edge Detector (MED) to calculate its predicted value x p (i,j). For each pixel x(i,j), calculate the prediction error e x (i,j) to generate the prediction error map E(i,j). The value range of the prediction error e x (i,j) is [-255,255]. Store the absolute value of the prediction error e x (i,j) in the absolute value image E p (i,j) of the image. Among them, e p (i,j) represents the pixel value of the i-th row and j-th column in the E p (i,j) image, and the value range is [0,255]. In order to record the sign (positive or negative) of the prediction error e x (i,j), generate the sign map e sign . The sign map e sign is a binary image, which is used to restore the sign of the prediction error (1 represents positive, 0 represents negative) in the image restoration stage.

[0015] The encrypted image RDH method based on MSB plane prediction and hierarchical block variable length coding according to claim 1, wherein the method for bit plane division of the absolute value of the prediction error from the MSB in step S2 specifically includes:

[0016] For the absolute value E of the prediction error p (i,j) the pixel value e of each pixel in the image p (i,j), convert it to an 8-bit binary number, extract each binary bit one by one, and form an independent binary matrix B k (i,j), where k represents the value of the k-th bit plane (k = 1 is the MSB, k = 8 is the LSB). Finally, decompose the absolute value E of the prediction error p (i,j) into 8 independent binary bit planes.

[0017] The encrypted image RDH method based on MSB plane prediction and hierarchical block variable length coding according to claim 1, wherein the method for dividing the bit plane of the block in step S2 specifically includes:

[0018] Starting from the high-order bit plane, for a single bit plane, select an appropriate basic block m×m, and according to the number n of "1"s in the block 1 And the threshold T i To determine whether to continue decomposition. If the number n of "1"s in the block 1 = 0, the block type is defined as a Type-I block. If the number 0 < n of "1"s in the block 1 ≤T i Then the block type is defined as a Type-II block. If the number n of "1"s in the block 1 >T i Then decompose the sub-block into smaller sub-blocks, and the sub-block has its own threshold T i , and so on, recursively process each sub-block. After all sub-blocks are encoded, merge the auxiliary information such as the labels and structure information of each layer to form a complete compressed bit stream.

[0019] The encrypted image RDH method based on MSB plane prediction and hierarchical block variable length coding according to claim 1, wherein in step S3, the encryption method for the auxiliary information and the compressed bit plane specifically includes:

[0020] Calculate the embeddable space and free up space S k , the number of bits reduced by compression, that is, S k = the size of the original bit plane - the length of the compressed code. Select the available bit planes and only keep the bit planes where S k > 0. Package the compressed code and the auxiliary information, where the auxiliary information includes the seed pixel value, the block size, the sign bit plane, and the number n of compressed bit planes p . Package the file Ic Format:

[0021] I c = [np, W 1 , es, x seed , C 1 , C 2 ,..., C np , uncompressed bit plane]

[0022] Using the image encryption key K e Generate a pseudo-random key stream r e , with the same length as I c , and perform bitwise XOR encryption on I c . To keep the image size consistent, generate random redundant bits r rand , and adjust the total length to M × N × 8 bits. Write the redundant length n r into the LSBs of the last log 2 (M × N × 8) pixels of the encrypted image.

[0023] According to the encrypted image RDH method based on MSB plane prediction and hierarchical block variable length coding described in claim 1, characterized in that, in step S3, the method for encrypting and embedding secret data specifically includes:

[0024] Remove the redundant bits r c from I rand , retain the valid data part I e , and extract the embeddable space. Then the effective space is:

[0025]

[0026] Using the data hiding key K h Generate a key stream r h , and encrypt the secret data S O . Divide S h into three parts: length label, encrypted data, and random padding, and construct an embedding stream. Replace it into the reserved space of I e to generate a marked encrypted image I s , and perform bit reversal on I s to further enhance security.

[0027] According to the encrypted image RDH method based on MSB plane prediction and hierarchical block variable length coding described in claim 1, characterized in that, in step S4, the method for extracting data and restoring the original image specifically includes:

[0028] In the proposed method, data extraction and image restoration can be carried out separately; therefore, three cases are considered; if the receiver only has the data hiding key K e, the receiver can extract additional data from the marked encrypted image without loss; if the receiver only has the encryption key, the marked encrypted image can be directly decrypted; if the receiver has both K e and K h keys, the receiver can first extract the embedded data in a lossless manner; next, the original image can be reconstructed.

[0029] The advantages and beneficial effects of the present invention are as follows:

[0030] High embedding capacity: Through the global zero-value high-plane compression technology of the prediction error image, the present invention significantly improves the data embedding capacity in the encrypted image. Compared with existing methods, the present invention can embed more secret data in the encrypted image. Especially in natural images, due to the small prediction error and more zero-value high planes, a large amount of embedding space can be released after compression. Through variable-length coding, the length of the auxiliary information is further reduced, thus providing more embedding space for secret data.

[0031] High security: The proposed scheme of the present invention performs excellently in terms of security, ensuring the security of the carrier image and the embedded data through stream cipher encryption. First, the compressed prediction error bit plane and auxiliary information are XOR encrypted with the random sequence generated by the key, making the pixel gray distribution of the encrypted image and the marked encrypted image close to completely random, and the original content cannot be recognized visually and statistically; and the compression process based on hierarchical block variable-length coding only depends on the local features of the prediction error map before encryption and does not disclose the image structure information. In addition, the embedded data is seamlessly integrated into the encrypted image after secondary encryption and random scrambling, and the attacker cannot distinguish the carrier and the secret information even if intercepting the ciphertext, further improving the security of the data.

[0032] Lossless recovery: During the data embedding and extraction process, the present invention can completely restore the original image to ensure the distortion-free of the image. Through the prediction error calculation and the recording of the sign map, the receiver can accurately restore the pixel values of the original image. During the data extraction and image recovery process, the present invention realizes efficient lossless recovery through the auxiliary information. Description of the Drawings

[0033] Figure 1 is the flowchart of the present invention; Detailed Embodiment

[0034] The embodiments of the present invention will be described in detail below. The examples of the embodiments are shown in the drawings, where the same or similar reference numerals represent the same or similar elements or elements with the same or similar functions from beginning to end. The embodiments described below with reference to the drawings are exemplary and are only used to explain the present invention and should not be construed as a limitation of the present invention.

[0035] The present invention provides an RDH method for encrypted images based on MSB-plane prediction and hierarchical block variable-length coding, which includes the following steps:

[0036] S1. Calculate the prediction error of the original image to generate the absolute value image and sign image of the prediction error;

[0037] S2. Divide the absolute value image of the prediction error from the MSB plane, and then decompose the bit plane into blocks of different levels according to local smoothness. Through the hierarchical threshold T i , determine whether to further divide the block, and compress the corresponding block to free up space for data embedding;

[0038] S3. After encapsulating the compressed bit plane, sign plane and other auxiliary information, encrypt it using a stream cipher, embed the secret data in the encrypted image, and retain the redundant space through LSB replacement to ensure reversibility;

[0039] S4. The receiver extracts the embedded data according to the encryption key and data hiding key, and losslessly restores the original image through the auxiliary information.

[0040] Figure 1 The flowchart of the framework proposed by the method of the present invention is described. It can be seen from the flowchart that there are an image owner and a receiver. At the image owner's end, first use a predictor to predict the original image, and process to obtain the absolute value image of the prediction error. Perform hierarchical block variable-length coding on the absolute value image of the prediction error, compress the image, and free up space. XOR encrypt the compressed image to obtain the final encrypted image. In the encrypted image, hide and encrypt the secret information and embed it into the compressed space of the encrypted image. After receiving the encrypted image, restore the hidden data and the original image according to different encryption keys and hiding keys.

[0041] Further, the calculation of the prediction error of the original image in step S1 to generate the absolute value image and sign image of the prediction error specifically includes:

[0042] First, predict the original image I with size M×N pixels through the MED predictor. The specific steps of the prediction are as follows:

[0043] Step 1: The pixels in the first row and first column of the image (i.e., i = 1 or j = 1) are used as seed pixels and directly retained without prediction.

[0044] Step 2: For non-seed pixels x(i,j) (i>1 and j>1), its predicted value x p (i,j) is calculated according to the pixel values of the left neighbor (x(i,j - 1)), upper neighbor (x(i - 1,j)), and upper left neighbor (x(i - 1,j - 1)):

[0045]

[0046] Prediction error value, prediction error e x (i, j) is the difference between the actual pixel value x(i, j) and the predicted value x p (i, j):

[0047] e x (i, j) = x(i, j) - x p (i, j)

[0048] There are negative values in the prediction error image. To facilitate processing, the sign graph is used to record the positive and negative nature of the error, and a binary matrix e sign (i, j) is generated:

[0049]

[0050] Furthermore, in step S2, the absolute value image of the prediction error is divided from the MSB plane, and then the bit plane is decomposed into different levels of blocks according to the local smoothness. Through the hierarchical threshold T i , it is judged whether to further divide the blocks, and the corresponding blocks are compressed to free up space for data embedding, which specifically includes:

[0051] Decomposition of the absolute value of the prediction error: The absolute value map E p (i, j) of the error is decomposed into 8 bit planes, and each bit plane corresponds to a certain bit in the binary representation:

[0052]

[0053] Finally, an 8-bit plane binary matrix is generated. The MSB plane contains a large range of structural information, which is sparse and mainly "0". The LSB plane contains detailed noise, which is dense and the "0" and "1" are randomly distributed. Processing is carried out sequentially from the MSB to the LSB, and the high-order plane is preferentially compressed to maximize the embedding space.

[0054] Hierarchical block division:

[0055] Step 1: Divide the bit plane of a binary matrix composed of 0s and 1s into basic blocks W 1 ×W 1 , and the basic block size is usually 16×16 bits.

[0056] Step 2: Determine whether to further divide the blocks according to the number n 1 of "1"s in the block and the preset hierarchical threshold T i . Among them, T i :

[0057]

[0058] Step 3: Count the number of "1"s in the current block to obtain the value of N1 in the current block. If n 1 >T i , divide the current block into smaller sub-blocks (e.g., 16×16 → 4 8×8 sub-blocks). Recursively perform the block judgment on the new sub-blocks until the minimum block size (e.g., 4×4) is reached or n 1 ≤T i . And add a hierarchical label to each block (e.g., "00" represents 16×16, "01" represents 8×8, "10" represents 4×4), and record the block structure.

[0059] Block type and coding: For a block where all pixels within the block are 0, it is defined as Type-I and encoded with a single bit 0; for a block where the number of 1s within the block satisfies 0 < n 1 ≤T i , it is defined as Type-II, mark the type of the block with 01, record the position of the first 1 within the block and the distance difference of subsequent 1s, and record the data with variable-length coding; for the case where the number of 1s within the block n 1 >T i , it is defined as Type-III, mark the type of the block with "10", and directly store the original binary bitmap without compression.

[0060] Furthermore, in the step S3, after encapsulating the compressed bit plane, symbol plane and other auxiliary information, use stream cipher encryption to embed secret data in the encrypted image. Specifically, the redundant space is reserved through LSB replacement, including:

[0061] Information encapsulation: Encapsulate the compressed bit plane data, auxiliary information and check information. Among them, the compressed bit plane data includes the coding streams of Type-I / II / III blocks. The auxiliary information includes the hierarchical block labels (recording the dynamic block path). The symbol matrix e sign (i,j), seed pixels, threshold T i and other information. Arrange them in the order of the MSB to LSB planes and encapsulate them in the format of a binary stream. Then the size of the vacated space is:

[0062] Embeddable space = Total size of the original bit plane - Size of the compressed data - Size of the auxiliary information

[0063] When encrypting the image, use the image encryption key K e to generate a key stream r c of the same length as I e . Perform a bitwise exclusive OR operation on the encapsulated data I c to obtain the encrypted image I e :

[0064]

[0065] Generate a random redundant bit stream r rand , whose length n r satisfies:

[0066] n r = total number of pixels × 8 - length of compressed data

[0067] Embed the binary representation of n r into the least significant bits of the last log e (M × N × 8) pixels of the encrypted image I. Append r 2 to the end of the encrypted image to ensure that the size of the final encrypted image is the same as the original rand . Figure 1

[0068] Hidden data encryption and embedding:

[0069] Data embedding process: First, obtain the encrypted image I e , the data hiding key K h , and the secret data S o . Then extract n e from the LSBs of the last log 2 (M × N × 8) pixels of I r . Truncate the redundant part and keep the first M × N × 8 - n r bits as the valid encrypted data

[0070] Secret data processing: Use K h to generate a key stream of the same length as the secret data S o , and then encrypt the secret data. The encryption formula is:

[0071]

[0072] Perform a random permutation of S h based on K h to enhance security, and then reverse the encrypted secret data S h bit by bit to obtain R(S h ).

[0073] Data embedding: Concatenate the marked encrypted image:

[0074]

[0075] where represents the valid encrypted data, R(S h ) represents the reversed encrypted secret data, and r rand represents the redundant random bit stream used to pad to the original image size.

[0076] ​Further, in step S4, the receiver extracts the embedded data according to the encryption key and the data hiding key, and losslessly restores the original image through the auxiliary information, specifically including:

[0077] Data extraction process: Use the data hiding key K h to extract the data. First, generate a key stream r using the data hiding key h (the same as the K used during encryption), process the marked encrypted image, and perform a random permutation operation opposite to that during embedding on the marked encrypted image I h to restore the original data order. XOR the processed data with the key stream r s to obtain the secret data before encryption h

[0078]

[0079] Extract the first log 2 (M×N×8) bits from the decrypted data as the capacity label n s to determine the length of the embedded secret data. According to n s intercept the secret data of the corresponding length The remaining part is the redundant random bit stream r rand h . Finally, use the random sequence generated by K o to perform an inverse permutation on the intercepted secret data to restore the original secret data S o :

[0080]

[0081] Image restoration process: Use the image encryption key K e to perform lossless restoration of the image. First, use the image encryption key K e to generate a key stream r e , and perform an XOR operation on the marked encrypted image I s to restore the encapsulated compressed image I c . Extract the following auxiliary information from I c : the number of compressed bit planes, the basic block size, the seed pixel, the sign plane, etc.

[0082] Hierarchical block variable length coding decompression, for each compressed bit plane (k = 1 to n p)Perform the following operations: Determine the decomposition level (level 1, level 2, level 3) of the block according to the hierarchical tags ("0", "10", "11"), read the type tag (e.g., "0" represents an all-0 block, "10" represents a block with a small number of 1s), decode the positions of the singular bits for Type-II blocks, restore the absolute positions through the recorded relative distances, reorganize the decoded blocks by level, and restore the complete bit plane.

[0083] Prediction error recovery: Concatenate the decompressed bit plane (k = 1 to n p ) with the uncompressed bit plane (k = n p +1 to 8) to obtain an 8-bit array e of the absolute values of the prediction errors x . Use the sign plane e sign to restore the positive and negative of the prediction error, obtaining the complete prediction error array e x (i, j).

[0084] Reconstruct the complete image: Fill the first row and the first column of the image with the extracted seed pixels. For each residual pixel, calculate the predicted value x p (i, j) based on the MED predictor, and restore the original pixel value through the prediction error e x (i, j):

[0085] x(i, j) = x p (i, j) + sign(es(i, j)) × ex(i, j).

Claims

1. A method for encrypting an image RDH based on layered block variable length coding with MSB plane prediction, characterized in that: The following steps are involved: S1, calculate the prediction error of the original image and generate an absolute value image and a symbol image of the prediction error; S2, the absolute value image of the prediction error is divided from the MSB plane, and then the plane is decomposed into blocks of different levels according to the local smoothness, and the hierarchical threshold T is used. i , determine whether to further divide the blocks, and compress the corresponding blocks to make room for data embedding; S3, after encapsulating the compressed bit plane, sign plane and other auxiliary information, it uses a stream cipher to encrypt, embed the secret data in the encrypted image, and retain the redundant space through LSB replacement to ensure reversibility; S4, the receiver extracts the embedded data based on the encryption key and the data hiding key, and losslessly restores the original image through the auxiliary information.

2. The encrypted image RDH method based on MSB plane prediction hierarchical block variable length coding according to claim 1 is characterized in that: The method for calculating the prediction error in step S1 and generating an absolute value image and a symbol map of the prediction error specifically includes: the original image I has a size of M×N, wherein the value range of each pixel value x(i,j) is [0,255]. For each pixel x(i,j) in the image, a median edge detector (MED) is used to calculate its prediction value x p (i,j). For each pixel x(i,j), calculate the prediction error e x (i, j), generate the prediction error graph E(i, j), prediction error e x The value range of (i,j) is [-255,255]. x The absolute value of (i, j) is stored in the absolute value image E of the prediction error. p (i,j) image, where e p (i,j) represents E p (i,j) is the pixel value of the i-th row and j-th column in the image, and its value range is [0,255]. In order to record the prediction error e x The sign (positive or negative) of (i,j) generates the sign graph e sign . Symbol diagram e sign It is a binary image used to restore the sign of the prediction error (1 for positive and 0 for negative) in the image restoration stage.

3. The encrypted image RDH method based on MSB plane prediction hierarchical block variable length coding according to claim 1 is characterized in that: The method for dividing the prediction error absolute value from the MSB into bit planes in step S2 specifically includes: dividing the prediction error absolute value E p The pixel value e of each pixel in the (i,j) image p (i, j), converted to an 8-bit binary number, each binary bit is extracted bit by bit to form an independent binary matrix B k (i, j), where k represents the value of the k-th bit plane (k = 1 is MSB, k = 8 is LSB). Finally, the absolute value of the prediction error E p (i,j) is decomposed into 8 independent binary bit planes.

4. The encrypted image RDH method based on MSB plane prediction hierarchical block variable length coding according to claim 1, characterized in that: The method for dividing the bit plane of the block in step S2 specifically includes: starting from the high bit plane, for a single bit plane, selecting a suitable basic block m×m, and dividing the block according to the number n1 of "1" in the block and the threshold T i The relationship determines whether to continue decomposition. If the number of "1" in the block n1 = 0, the block type is defined as Type-I block. <n1≤T i The block type is defined as a Type-II block. If the number of "1"s in the block n1>T i The sub-block is decomposed into smaller sub-blocks, each of which has its own threshold T i , and so on, recursively process each sub-block. After all sub-blocks are encoded, the auxiliary information such as labels and structural information of each layer are merged to form a complete compressed code stream.

5. The encrypted image RDH method based on MSB plane prediction hierarchical block variable length coding according to claim 1, characterized in that: In step S3, the encryption method of the auxiliary information and the compressed bit plane specifically includes: calculating the embeddable space, freeing up space S k , the number of bits reduced by compression, that is, S k = original bit plane size - compressed code length. Select available bit planes and keep only S k >0. Encapsulate the compression code and auxiliary information, where the auxiliary information includes the seed pixel value, block size, sign bit plane, and the number of compressed bit planes n. p . Encapsulation File I c The format is: I c =[np,W1,es,x seed ,C1,C2,...,C np , uncompressed bit planes] Use the image encryption key K e Generate a pseudo-random key stream r e , length and I c Same, for I c XOR encryption is performed bit by bit. To keep the image size consistent, random redundant bits r are generated rand , the total length is adjusted to M×N×8 bits. r Written into the LSB of the last log2(M×N×8) pixels of the encrypted image.

6. The encrypted image RDH method based on MSB plane prediction hierarchical block variable length coding according to claim 1, characterized in that: In step S3, the method for encrypting and embedding secret data specifically includes: c Remove redundant bits r rand , retain the valid data part I e , extract the embeddable space. Then the effective space is: Use data hiding key K h Generate key stream r h , for the secret data S O Encrypt. h It is divided into three parts: length tag, encrypted data, and random padding to construct an embedded stream. Replace it with I e In the reserved space, generate the marked encrypted image I s , to I s Bit reversal is performed to further enhance security.

7. The encrypted image RDH method based on MSB plane prediction hierarchical block variable length coding according to claim 1, characterized in that: In step S4, the method of extracting data and restoring the original image specifically includes: In the proposed method, data extraction and image restoration can be performed separately; therefore, three cases are considered; if the receiver only has the data hiding key K e , the receiver can losslessly extract additional data from the marked encrypted image; if the receiver only has the encryption key, the marked encrypted image can be directly decrypted; if the receiver also has K e and K h The key, the receiver can first extract the embedded data in a lossless way; next, the original image can be reconstructed.

Citation Information

Patent Citations

  • Reversible information hiding method for encrypted image based on bit plane compression and block rearrangement

    CN116582344A