Reversible data hiding method based on prediction error correction and adaptive optimization mapping

By adaptively selecting pixel block scanning order and optimal two-dimensional mapping to modify the prediction error pair, the problem of difficult balance between embedded capacity and image quality in the prior art is solved, and the high embedded capacity and low distortion reversible data hiding effect is achieved.

CN116389650BActive Publication Date: 2025-08-22XIAN UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310339538.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2025-08-22
Estimated Expiration
2043-03-31

AI Technical Summary

Technical Problem

Existing reversible data hiding technologies are difficult to improve image quality while ensuring embedded capacity. Especially in areas such as military, medical and aerospace where information security requirements are high, image quality loss is large.

Method used

Using a method based on prediction error correction and adaptive optimization mapping, the pixel block scanning order and optimal two-dimensional mapping are adaptively selected, the prediction error pair is modified, the degree of image loss is reduced, and the embedding capacity and image quality are improved.

Benefits of technology

While ensuring the embedded capacity, the image quality is significantly improved, the degree of image distortion is reduced, and a higher peak signal-to-noise ratio is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116389650B_ABST
    Figure CN116389650B_ABST
Patent Text Reader

Abstract

This reversible data hiding method, based on prediction error correction and adaptive optimization mapping, specifically involves the following steps: dividing the original image into equal-sized, non-overlapping blocks; dividing the pixel blocks into two interleaved sets, calculating the block complexity, and sorting them from smallest to largest; determining the scanning order of the current pixel block based on the surrounding pixel blocks, and calculating the four prediction errors within the pixel block using an improved pixel value sorting algorithm; traversing two sets of complexity thresholds, modifying the prediction errors in different intervals, pairing prediction errors with values ​​of 0 and 1, and selecting the two-dimensional mapping with minimal distortion from multiple sets of mappings; embedding the data according to the embedding rules, and calculating the peak signal-to-noise ratio; varying the block size, repeating the prediction optimization process, and selecting the block size, complexity threshold, and mapping with the highest peak signal-to-noise ratio. This method improves image quality while ensuring embedding capacity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of reversible data hiding, and in particular relates to a reversible data hiding method based on prediction error correction and adaptive optimization mapping. Background Art

[0002] The development of the internet and advancements in digital media technology have broadened the channels through which people access and disseminate information and data. With the advent of the big data era, information and data dissemination is characterized by large scale, diversity, rapid speed, and high value. The exchange and communication of large amounts of information and data inevitably requires the intervention of third-party organizations, which leads to data security issues. In fields with high security requirements, such as the military, medical, and aerospace sectors, if transmitted data attracts the attention and attack of unauthorized organizations or individuals during transmission, users may send incorrect information, leading to serious security incidents. Images, as the most common multimedia information carrier, are intuitive, easily understood, and have large storage capacity, making them widely used in visual processing. Therefore, how to protect the information and authenticate the identity of image authors during image dissemination has become a key concern for information security researchers. To address this issue, Barton first proposed the concept of RDH in his patented invention, embedding identity-verifying data into digital media. Legitimate users can verify the correctness and authenticity of their information by losslessly extracting the identity information from the digital media.

[0003] Pairwise Prediction-Error Expansion (PEE) is a technique that constructs a two-dimensional prediction error pair sequence by pairing the prediction errors using a pairwise strategy. This sequence is then expanded and embedded according to a specific two-dimensional mapping. Ou et al. divided the image into two intersecting sets in a checkerboard pattern and used a diamond prediction pattern to calculate the prediction error for the target pixel, making the prediction error more accurate and concentrated. This algorithm first paired adjacent prediction errors to construct a two-dimensional prediction error histogram. Furthermore, this scheme proposed a new method for expanding the pairwise prediction error histogram, replacing error mappings with large losses, namely, discarding the mapping from (0,0) to (1,1). This method reduces the degree of image quality loss. Wu et al. paired the maximum and minimum prediction errors in the same block and adaptively selected the two-dimensional histogram mapping for embedding, improving image quality but with low embedding capacity. Rajeev Kumar et al. combined diamond prediction with an improved PVO algorithm, performing multiple rounds of embedding according to a specified mapping, increasing the embedding capacity, but with suboptimal image quality.

[0004] There are two main measurement criteria for reversible data hiding technology: peak signal-to-noise ratio and embedding capacity. How to balance the relationship between embedding capacity and image is a problem that all researchers engaged in this research field should focus on. Summary of the Invention

[0005] The purpose of the present invention is to provide a reversible data hiding method based on prediction error correction and adaptive optimization mapping, which can improve image quality while ensuring embedding capacity.

[0006] The technical solution adopted by the present invention is a reversible data hiding method based on prediction error correction and adaptive optimization mapping, which is specifically implemented according to the following steps:

[0007] Step 1: perform overflow processing on the original image and divide the original image into several pixel blocks of the same size and without overlapping;

[0008] Step 2: Divide the pixel blocks obtained in step 1 into two sets in a cross-arranged manner, calculate the complexity of each pixel block in the two sets in turn, sort the pixel blocks in each set in ascending order according to their complexity, and sort each pixel block according to the gradient value G. h and G v Determine the scanning order within the pixel block, and sort the pixels in the pixel block in ascending order according to the size of the scanned pixel values;

[0009] Step 3: Use the third largest pixel to predict the largest and second largest pixels, and use the third smallest pixel to predict the smallest and second smallest pixels, generate four prediction errors, and modify the prediction errors based on the relationship between the sorted pixels and the subscripts;

[0010] Step 4: define two complexity thresholds, loop through the complexity thresholds, divide the complexity intervals, modify the prediction error according to the different complexity intervals, pair the prediction error values ​​0 and 1, and obtain a prediction error pair sequence;

[0011] Step 5: For a certain set of complexity thresholds T1 and T2, loop through the two-dimensional mappings of all prediction error pairs obtained in step 4, calculate the embedding capacity and the degree of image loss, and obtain the optimal complexity thresholds T1 and T2 and two-dimensional mapping of the pixel block under the current partitioning scheme based on the embedding capacity and the degree of image loss;

[0012] Step 6: Change the size of the pixel blocks divided in step 1 and repeat steps 2 to 5 to obtain the optimal complexity thresholds T1, T2 and two-dimensional mapping for all pixel blocks. Embed data in the set corresponding to the optimal complexity thresholds T1, T2 and two-dimensional mapping of each pixel block to obtain the encrypted image EI. The optimal encrypted image, final parameters, and final encrypted image are obtained through the peak signal-to-noise ratio.

[0013] The present invention is also characterized in that:

[0014] The specific process of step 1 is:

[0015] Step 1.1: Scan the original image OI of size M×N in a raster scan order, except for the first row, first column, last row, and last column. If the pixel value is 254 or 1, the position map records it as 0. If the pixel value is 255, the position map records it as 1, and the pixel value is modified to 254. If the pixel value is 0, the position map records it as 1, and the pixel value is modified to 1, to obtain a host image I. The host image I does not include the first row, first column, last row, and last column of pixels of the original image OI.

[0016] Step 1.2: Divide the host image I obtained in step 1.1 into a number of equal and non-overlapping pixel blocks of size P×Q, where P,Q∈{2,3,4,5}.

[0017] The specific process of step 2 is:

[0018] Step 2.1: Divide the pixel blocks obtained in step 1 into two sets in a cross-arranged manner, namely:

[0019]

[0020] In formula (1), i and j represent the row and column of the pixel block respectively;

[0021] Step 2.2: process one of the sets first, then process the other set. The processing process of the two sets is the same.

[0022] The processing process is:

[0023] The sum of the absolute values ​​of the differences between the pixels in the adjacent areas of the current pixel block is used as the complexity of the current pixel block, and the pixel blocks are sorted from small to large according to the size of the complexity;

[0024] The pixels in the adjacent area refer to the P×2 areas on the left and right sides and the 2×Q areas on the top and bottom sides of the current pixel block;

[0025] Step 2.3: For each pixel block, calculate the gradient value G of the current pixel block according to formula (2) and formula (3): h and G v , according to the gradient value G h and G v Select the scanning order to obtain the value of each pixel in each pixel block;

[0026]

[0027]

[0028] In equations (2) and (3), (i0, j0) is the coordinate of the upper left corner pixel of the current pixel block;

[0029] If |G h |<|G v |, G h ≥0, G v ≥0, the first row, the second row, ... the last row are scanned, and each row is scanned from left to right;

[0030] If |G h |<|G v |, G h ≥0, G v <0, the rows are scanned in the order of the last row, the second row, and the first row, and each row is scanned from left to right;

[0031] If |G h |<|G v |, G h <0, G v ≥0, the first row, the second row, ... the last row are scanned in order, and each row is scanned from right to left;

[0032] If |G h |<|G v |, G h <0, G v <0, the rows are scanned in the order of the last row, the second row, and the first row, and each row is scanned from right to left;

[0033] If |G h |≥|G v |, G h ≥0, G v ≥0, the columns are scanned in the order of the first column, the second column, ... the last column, and each column is scanned from top to bottom;

[0034] If |G h |≥|G v |, G h ≥0, G v <0, then the columns are scanned in the order of the first column, the second column, ... the last column, and each column is scanned from bottom to top;

[0035] If |G h |≥|G v |, G h <0, G v ≥0, the columns are scanned in the order of the last column, the second column, and the first column, and each column is scanned from top to bottom;

[0036] If |G h |≥|G v |, G h <0, G v <0, the columns are scanned in the order of the last column...the second column, the first column, and each column is scanned from bottom to top;

[0037] Step 2.4: According to the pixel values ​​in each pixel block obtained by scanning in step 2.3, the pixels in each pixel block are arranged in ascending order according to the pixel value size to obtain the ordered sequence X(x1, x2, ..., x n ), and the corresponding subscript sequence σ(σ(1),σ(2),...,σ(n)), and satisfy the conditions of formula (4), that is:

[0038] σ(p)<σ(q), if x p =x q And p

[0039] In formula (4), n represents the total number of pixel values ​​in each pixel block.

[0040] The specific process of step 3 is:

[0041] Use the third largest pixel to predict the maximum value pixel and the second largest pixel respectively, and according to formulas (5) and (6), the corresponding prediction errors are obtained. and Similarly, the third smallest pixel is used to predict the minimum pixel and the second smallest pixel respectively. According to formulas (7) and (8), the corresponding prediction errors are obtained: and

[0042]

[0043]

[0044]

[0045]

[0046] In formulas (5)-(8), u=min(σ(n),σ(n-1)), v=max(σ(n),σ(n-1)), s=min(σ(1),σ(2)), t=min(σ(1),σ(2));

[0047] When u<σ(n-2), according to formula (4) and formula (5), it means that in the ordered sequence X, the largest pixel or the second largest pixel has been swapped with the third largest pixel. At this time, x u -x​σ(n-2) ≥1; Similarly, when v<σ(n-2), x v -x σ(n-2) ≥1; when s,t>σ(3), x σ(3) -x s,t ≥1.

[0048] The specific process of step 4 is:

[0049] Step 4.1, for and In the pairwise prediction error, when When , modify the corresponding prediction error value, assuming The expression is:

[0050]

[0051] Step 4.2, define two complexity thresholds T1 and T2, assuming that the maximum complexity threshold is T max , the minimum complexity threshold is T min , let T max ≥T1≥T min , T max ≥T2≥T 1+1 , the step size is 100;

[0052] When the pixel block complexity T i ∈[0,T1), η=3, when the pixel block complexity T i ∈[T1,T2), η=255;

[0053] The values ​​of all groups of complexity thresholds T1 and T2 are traversed in a loop, and each group of complexity thresholds T1 and T2 needs to be processed so that all pixel blocks, for each group of complexity thresholds T1 and T2, the prediction error values ​​1 and 0 are paired, that is, (0,0), (1,0), (1,1), (0,1) four pairs, to obtain the prediction error pair sequence E (e1, e2, ..., e n ).

[0054] In step 5, the expressions of embedding capacity and image loss degree are:

[0055]

[0056]

[0057]

[0058] In formulas (10)-(12), H1(e i ) represents the number of embeddable prediction error pairs, H2(ea) represents the number of prediction errors of extended moves, g(e i) represents the prediction error of e i The ordered set of possible mappings, |g(e i )| represents the number of elements in the set, ||e i -e i '|| represents the l of the two prediction errors before and after the movement 2 norm, ED is the image loss degree, EC is the image embedding capacity, and payload is the given embedded data length.

[0059] The specific process of step 6 is:

[0060] Change the size of the pixel blocks divided in step 1 and repeat steps 2-5 to obtain the optimal complexity thresholds T1, T2 and two-dimensional mappings for all pixel blocks. Embed data in the set corresponding to the optimal complexity thresholds T1, T2 and two-dimensional mapping for each pixel block to obtain a encrypted image EI. Then calculate the peak signal-to-noise ratio of the encrypted image EI to the original image. The encrypted image corresponding to the maximum peak signal-to-noise ratio is the optimal encrypted image. The pixel block size, two sets of two-dimensional mappings, and two sets of complexity thresholds T1 and T2 corresponding to the optimal encrypted image are used as final parameters. The final parameters, the position map in step 1, and the positions where the embedded data stops in the two sets are used as auxiliary information. The auxiliary information is stored in the least significant bit plane of the first row, first column, last row, and last column of pixels in the original image using LSB substitution to obtain an auxiliary image. The auxiliary image is combined with the optimal encrypted image to obtain the final encrypted image.

[0061] In step 6, the peak signal-to-noise ratio of the encrypted image EI and the original image is calculated, and the expression is:

[0062]

[0063]

[0064] In equations (13) and (14), MSE represents the mean square error between the encrypted image EI and the host image I, M and N represent the number of rows and columns of the original image OI, D represents the number of bits per pixel, which is generally 8 for grayscale images, and PSNR is the peak signal-to-noise ratio, expressed in dB.

[0065] The beneficial effects of the present invention are:

[0066] (1) The method of the present invention adaptively selects the pixel block scanning order according to the complexity of the adjacent areas of the pixel block, so that the elements in the scanned sequence are arranged in order from small to large, making the prediction as accurate as possible, increasing the probability of embeddable prediction errors, and reducing the degree of image distortion;

[0067] (2) The method of the present invention does not adopt fixed block division, but adopts adaptive block division. According to the complexity of the image, the appropriate block division is selected to improve the image quality while ensuring the embedding capacity.

[0068] (3) The method of the present invention selects the optimal two-dimensional mapping based on the prediction error pair sequence, avoids modifying the prediction error pair with high loss, and maintains the image quality while embedding the data;

[0069] (4) The method of the present invention adopts a customized pairing strategy so that the generated two-dimensional prediction errors are mainly concentrated in the specified prediction error pairs, thereby improving the embedding capacity and reducing the image loss. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] Figure 1 Flowchart of the reversible data hiding method based on prediction error correction and adaptive optimization mapping of the present invention;

[0071] Figure 2 Schematic diagram of original image division in the reversible data hiding method based on prediction error correction and adaptive optimization mapping of the present invention;

[0072] Figure 3 Schematic diagram of complexity calculation in the reversible data hiding method based on prediction error correction and adaptive optimization mapping of the present invention;

[0073] Figure 4 Schematic diagram of pixel block scanning order of the reversible data hiding method based on prediction error correction and adaptive optimization mapping of the present invention;

[0074] Figure 5 1 is a diagram showing different mapping examples of the reversible data hiding method based on prediction error correction and adaptive optimization mapping according to the present invention;

[0075] Figure 6 These are four mapping direction diagrams of prediction error pairs in the reversible data hiding method based on prediction error correction and adaptive optimization mapping of the present invention. DETAILED DESCRIPTION

[0076] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0077] The present invention is based on a reversible data hiding method based on prediction error correction and adaptive optimization mapping, such as Figure 1 As shown, please follow the steps below:

[0078] Step 1: perform overflow processing on the original image and divide the original image into several pixel blocks of the same size and without overlapping;

[0079] The specific process is:

[0080] Step 1.1: Scan the original image OI of size M×N in a raster scan order, except for the first row, first column, last row, and last column. If the pixel value is 254 or 1, the position map records it as 0. If the pixel value is 255, the position map records it as 1, and the pixel value is modified to 254. If the pixel value is 0, the position map records it as 1, and the pixel value is modified to 1, to obtain a host image I. The host image I does not include the first row, first column, last row, and last column of pixels of the original image OI.

[0081] Step 1.2, as Figure 2 As shown, the host image I obtained in step 1.1 is divided into several equal and non-overlapping pixel blocks of size P×Q, where P,Q∈{2,3,4,5};

[0082] Step 2: Divide the pixel blocks obtained in step 1 into two sets in a cross-arranged manner, calculate the complexity of each pixel block in the two sets in turn, sort the pixel blocks in each set in ascending order according to their complexity, and sort each pixel block according to the gradient value G. h and G v Determine the scanning order within the pixel block, and sort the pixels in the pixel block in ascending order according to the size of the scanned pixel values;

[0083] The specific process is:

[0084] Step 2.1: Divide the pixel blocks obtained in step 1 into two sets in a cross-arranged manner, namely:

[0085]

[0086] In formula (1), i and j represent the row and column of the pixel block respectively;

[0087] Step 2.2: process one of the sets first, then process the other set. The processing process of the two sets is the same.

[0088] The processing process is:

[0089] like Figure 3 As shown, the sum of the absolute values ​​of the differences between the pixels in the adjacent areas of the current pixel block is used as the complexity of the current pixel block, and the pixel blocks are sorted from small to large according to the size of the complexity;

[0090] The pixels in the adjacent area refer to the P×2 areas on the left and right sides and the 2×Q areas on the top and bottom sides of the current pixel block; the difference between the pixels in the P×2 areas on the left and right sides of the current pixel block refers to the difference between the two adjacent pixels on the left and right sides, and the difference between the pixels in the 2×Q areas on the top and bottom sides of the previous pixel block refers to the difference between the two adjacent pixels on the top and bottom sides.

[0091] In the process of calculating the complexity of the current pixel block, the pixel values ​​of the pixels in the adjacent area do not change, which ensures the reversibility of the algorithm;

[0092] Step 2.3: For each pixel block, calculate the gradient value G of the current pixel block according to formula (2) and formula (3): h and G v ,like Figure 4 As shown, according to the parameter G h and G v Select the scanning order to obtain the value of each pixel in each pixel block;

[0093]

[0094]

[0095] In equations (2) and (3), (i0, j0) is the coordinate of the upper left corner pixel of the current pixel block;

[0096] If |G h |<|G v |, G h ≥0, G v ≥0, the first row, the second row, ... the last row are scanned, and each row is scanned from left to right;

[0097] If |G h |<|G v |, G h ≥0, G v <0, the rows are scanned in the order of the last row, the second row, and the first row, and each row is scanned from left to right;

[0098] If |G h |<|G v |, G h <0, G v ≥0, the first row, the second row, ... the last row are scanned in order, and each row is scanned from right to left;

[0099] If |G h |<|G v |, G h <0, G v <0, the rows are scanned in the order of the last row, the second row, and the first row, and each row is scanned from right to left;

[0100] If |G h |≥|G v |, G h ≥0, G v≥0, the columns are scanned in the order of the first column, the second column, ... the last column, and each column is scanned from top to bottom;

[0101] If |G h |≥|G v |, G h ≥0, G v <0, then the columns are scanned in the order of the first column, the second column, ... the last column, and each column is scanned from bottom to top;

[0102] If |G h |≥|G v |, G h <0, G v ≥0, the columns are scanned in the order of the last column, the second column, and the first column, and each column is scanned from top to bottom;

[0103] If |G h |≥|G v |, G h <0, G v <0, the columns are scanned in the order of the last column...the second column, the first column, and each column is scanned from bottom to top;

[0104] Step 2.4: According to the pixel values ​​in each pixel block obtained by scanning in step 2.3, the pixels in each pixel block are arranged in ascending order according to the pixel value size to obtain the ordered sequence X(x1, x2, ..., x n ), and the corresponding subscript sequence σ(σ(1),σ(2),...,σ(n)), and satisfy the conditions of formula (4), that is:

[0105] σ(p)<σ(q), if x p =x q And p

[0106] In formula (4), n represents the total number of pixel values ​​in each pixel block;

[0107] Step 3: Use the third largest pixel to predict the largest and second largest pixels, and use the third smallest pixel to predict the smallest and second smallest pixels, generating four prediction errors. Based on the relationship between the sorted pixels and the subscripts, modify the prediction errors so that the prediction error pairs are concentrated at (0,0);

[0108] The specific process is:

[0109] Use the third largest pixel to predict the maximum value pixel and the second largest pixel respectively, and according to formulas (5) and (6), the corresponding prediction errors are obtained. and ​Similarly, the third smallest pixel is used to predict the minimum pixel and the second smallest pixel respectively. According to formulas (7) and (8), the corresponding prediction errors are obtained: and

[0110]

[0111]

[0112]

[0113]

[0114] In formulas (5)-(8), u=min(σ(n),σ(n-1)), v=max(σ(n),σ(n-1)), s=min(σ(1),σ(2)), t=min(σ(1),σ(2));

[0115] When u<σ(n-2), according to formula (4) and formula (5), it means that in the ordered sequence X, the largest pixel or the second largest pixel has been swapped with the third largest pixel. At this time, x u -x σ(n-2) ≥1; Similarly, when v<σ(n-2), x v -x σ(n-2) ≥1; when s,t>σ(3), x σ(3) -x s,t ≥1;

[0116] In summary, the four prediction errors calculated for each pixel block are and are all greater than or equal to 0, the prediction error expansion can only be non-negative expansion; and x σ(n-2) and x σ(3) As the reference pixel remains unchanged, so the corresponding x σ(n-1) and x σ(n) Increase or remain unchanged, x σ(1) and x σ(2) Decrease or remain unchanged, which ensures the reversibility of the algorithm;

[0117] Step 4: define two complexity thresholds, loop through the complexity thresholds, divide the complexity intervals, modify the prediction error according to the different complexity intervals, pair the prediction error values ​​0 and 1, and obtain a prediction error pair sequence;

[0118] The specific process is:

[0119] Step 4.1, for and In the pairwise prediction error, only In the case of , there are two prediction errors that may be embedded in the data, and in the rest of the cases, at most one prediction error is embedded in the data. Therefore, when When , modify the corresponding prediction error value, assuming The expression is:

[0120]

[0121] Step 4.2, define two complexity thresholds T1 and T2, assuming that the maximum complexity threshold is T max , the minimum complexity threshold is T min , let T max ≥T1≥T min , T max ≥T2≥T 1+1 , the step size is 100;

[0122] When the pixel block complexity T i ∈[0,T1), η=3, when the pixel block complexity T i ∈[T1,T2), η=255, η is used for prediction error modification;

[0123] In the existing two-dimensional error histogram, only prediction error pairs containing 0 or 1 have data embedded. However, the prediction error modification of the present invention allows prediction errors with larger values ​​to also be embedded, thereby increasing the embedding capacity.

[0124] The values ​​of all groups of complexity thresholds T1 and T2 are traversed in a loop, and each group of complexity thresholds T1 and T2 needs to be processed so that all pixel blocks, for each group of complexity thresholds T1 and T2, the prediction error values ​​1 and 0 are paired, that is, (0,0), (1,0), (1,1), (0,1) four pairs, to obtain the prediction error pair sequence E (e1, e2, ..., e n );

[0125] for and same and Operation;

[0126] Step 5: For a set of complexity thresholds T1 and T2, loop through the two-dimensional mapping of all prediction error pairs obtained in step 4, such as Figure 5 The 20 mappings shown are used to calculate the embedding capacity and image loss degree, and the optimal complexity thresholds T1, T2 and two-dimensional mapping of the pixel block under the current partitioning scheme are obtained according to the embedding capacity and image loss degree;

[0127] The expression of embedding capacity and image loss degree is:

[0128]

[0129]

[0130]

[0131] In formulas (10)-(12), H1(e i ) represents the number of embeddable prediction error pairs, H2(ea) represents the number of prediction errors of extended moves, g(e i ) represents the prediction error of e i The ordered set of possible mappings, |g(e i )| represents the number of elements in the set, ||e i -e i '|| represents the l of the two prediction errors before and after the movement 2 norm, ED is the image loss degree, EC is the image embedding capacity, and payload is the given embedded data length;

[0132] like Figure 6 As shown in Figure 2, in the two-dimensional mapping embedding process, each mapping unit (a prediction error pair) has at most four possibilities, which are recorded as A, B, C, and D mapping directions respectively.

[0133] When there is only one mapping direction, no data is embedded, and the current pixel is moved according to the mapping or remains unchanged;

[0134] When there are two mapping directions, 1 bit of data is embedded;

[0135] When there are three mapping directions, first read 1 bit of data. If the bit value is 0, it is mapped to the first possibility and "0" is embedded. If the bit value is 1, scan the next bit. If the next bit value is 0, it is mapped to the third possibility and "10" is embedded. If the next bit value is 1, it is mapped to the second possibility and "1" is embedded. The specific embedding rules are shown in Table 1, where g(e) represents the ordered set of possible mappings of the prediction error pair e, b represents the embedded bit, and e' represents the prediction error pair embedded in the data.

[0136] Table 1 Embedding rules

[0137]

[0138] Step 6: Change the size of the pixel blocks divided in step 1 and repeat steps 2 to 5 to obtain the optimal complexity thresholds T1, T2 and two-dimensional mappings for all pixel blocks. Embed data in the set corresponding to the optimal complexity thresholds T1, T2 and two-dimensional mapping for each pixel block to obtain the encrypted image EI. The optimal encrypted image, final parameters, and the final encrypted image are obtained by using the peak signal-to-noise ratio.

[0139] The specific process is:

[0140] Changing the size of the pixel blocks divided in step 1, repeating steps 2 to 5, obtaining the optimal complexity thresholds T1, T2 and two-dimensional mappings for all pixel blocks, embedding data in the set corresponding to the optimal complexity thresholds T1, T2 and two-dimensional mapping for each pixel block to obtain a encrypted image EI, then calculating the peak signal-to-noise ratio of the encrypted image EI to the original image. The encrypted image corresponding to the maximum peak signal-to-noise ratio is the optimal encrypted image. The pixel block size, two sets of two-dimensional mappings, and two sets of complexity thresholds T1 and T2 corresponding to the optimal encrypted image are used as final parameters. The final parameters, the position map in step 1, and the positions where the embedded data stops in the two sets are used as auxiliary information. The auxiliary information is replaced with the least significant bit (LSB) and stored in the least significant bit plane of the first row, first column, last row, and last column of pixels in the original image to obtain an auxiliary image. The auxiliary image is combined with the optimal encrypted image to obtain the final encrypted image.

[0141] For a single pixel block, at least one reference pixel is required to calculate the prediction error. Therefore, ignoring the 2×2 pixel block, it only needs to be repeated 15 times.

[0142] Calculate the peak signal-to-noise ratio of the encrypted image EI and the original image. The expression is:

[0143]

[0144]

[0145] In equations (13) and (14), MSE represents the mean square error between the encrypted image EI and the host image I, M and N represent the number of rows and columns of the original image OI, D represents the number of bits per pixel, which is generally 8 for grayscale images, and PSNR is the peak signal-to-noise ratio, expressed in dB.

[0146] Decryption process:

[0147] The decryption process is actually the reverse process of the embedding process, which is implemented as follows:

[0148] Step 1: Separate the outermost circle (first row, first column, last row, and last column) of the encrypted image EI to obtain image I', and extract the auxiliary information added during the embedding process from the least significant bit plane of the outermost circle pixels;

[0149] Step 2: Scan the image I' and divide the image into equal-sized non-overlapping pixel blocks according to the optimal pixel block size in the auxiliary information;

[0150] Step 3: Divide the pixel block into two sets according to formula (1). The process is opposite to that of step 2.2. First, process the set of pixels (point set) processed later in the embedding process, and then process the set of pixels (cross set) processed earlier in the embedding process.

[0151] The specific processing process is as follows: calculate the complexity of the current pixel block. The calculation method is the same as the embedding process. Sort the pixel blocks in order of complexity from small to large, give priority to the pixel blocks with lower complexity, and calculate the gradient value G of the pixel block according to formula (2) (3) h and G v , determine the scanning order of pixels within a pixel block;

[0152] Step 4: Arrange the pixels in the pixel block in ascending order according to the pixel value, and calculate the four prediction errors in the pixel block according to formulas (5)-(8) and Extract the two complexity thresholds T1 and T2 of the set from the auxiliary information, divide the complexity interval according to the complexity threshold, modify the prediction error, record the larger value of the two prediction errors as Ea, and record the smaller value of the prediction error as Ei. The modification formula of Ei is as follows:

[0153]

[0154] Step 5: Pair the prediction error values ​​0, 1, and 2, i.e., (0,0), (0,1), (0,2), (1,0), (1,1), (1,2), (2,0), (2,1), and (2,2), to obtain the prediction error pair sequence EE (ee1, ee2, ..., ee n ), since the embedding process may require the determination of the next bit position, the extraction process requires reverse extraction of bits from the embedding stop position, extracting the optimal mapping corresponding to the set from the auxiliary information, determining which pair of prediction errors the prediction error pair is embedded from according to Table 2, and extracting the number of embedded bits. If the prediction error changes, the corresponding pixel value is incremented by 1 for the little-endian pixel and decremented by 1 for the big-endian pixel. Processing from the stop position to the first pixel block can obtain the extracted data P1;

[0155] Table 2 Extraction rules

[0156]

[0157] Step 6: The process of processing the cross set pixels (post-processing the set pixels) is the same as that of the point set (processing the set pixels first), and the data P2 can be obtained, thereby obtaining the restored image. Since the extraction at this time is reverse extraction, the final extracted bit P should be expressed as follows:

[0158]

[0159] In formula (16), T represents the reverse order of the sequence. The least significant bits of the outermost circle pixels obtained by LSB replacement in the front part of the sequence P are restored and combined with the restored image to obtain the extracted image EXI.

[0160] Example

[0161] There are two main performance metrics for reversible data hiding algorithms in the image spatial domain: embedding capacity and peak signal-to-noise ratio (PSNR). Embedding capacity refers to the maximum number of bits of secret data that can be embedded in the current image. Peak signal-to-noise ratio (PSNR) is a commonly used image evaluation metric used to measure the difference between the processed image and the original image. A larger PSNR indicates better image quality and lower distortion; a smaller PSNR indicates worse image quality and higher distortion. Using six images (Lena, Barbara, Lake, Boat, Elaine, and Peppers) as examples, all with a size of 512×512, the PSNR was calculated for each image at the same embedding capacity, as shown in Table 3. When embedding capacity is the same, the prediction error correction algorithm proposed in this paper achieves a higher PSNR value and better image quality. Comparative experiments with He's algorithm using fixed two-dimensional mapping embedding were conducted at embedding capacity ranges from 10,000 bits to 30,000 bits, as shown in Table 4. As can be seen from Table 4, as the amount of embedded data increases, the present invention maintains a high PSNR value, with average PSNR gains of 0.35dB, 0.22dB, and 0.19dB, respectively. This shows that the adaptive selection of two-dimensional mapping proposed in the present invention reduces image distortion.

[0162] Table 3 PSNR comparison between the proposed method and other algorithms at 10000-bit embedding capacity

[0163] Ou Li Wang Xiong Cai He The present invention Lena 59.70 60.04 60.75 60.91 61.01 61.24 61.63 Barbara 59.43 59.89 60.73 60.89 60.96 61.17 61.64 Lake 57.49 59.04 59.87 60.05 60.43 60.65 60.98 Boat 58.06 57.97 58.46 58.66 58.78 59.14 59.38 Elaine 58.62 58.47 58.2 58.5 58.75 58.9 59.15 Peppers 56.21 56.72 59.27 59.4 59.61 59.81 60.19 Average 58.25 58.69 59.55 59.74 59.92 60.15 60.50

[0164] Table 4 PSNR comparison between the present invention and He when the embedding capacity increases from 10000 bit to 3000 bit

[0165]

[0166] The method of the present invention adopts a complexity division mechanism to perform different modifications on prediction errors in different complexity intervals, thereby better balancing the relationship between capacity and distortion.

Claims

1. A reversible data hiding method based on prediction error correction and adaptive optimization mapping, characterized in that: Please follow the steps below to implement it: Step 1: perform overflow processing on the original image and divide the original image into several pixel blocks of the same size and without overlapping; Step 2: Divide the pixel blocks obtained in step 1 into two sets in a cross-arranged manner, calculate the complexity of each pixel block in the two sets in turn, sort the pixel blocks in each set from small to large according to their complexity, and sort each pixel block according to the gradient value. and Determine the scanning order within the pixel block, and sort the pixels in the pixel block in ascending order according to the size of the scanned pixel values; The specific process of step 2 is: Step 2.1: Divide the pixel blocks obtained in step 1 into two sets in a cross-arranged manner, namely: (1) In formula (1), , Represent the rows and columns of pixel blocks respectively; Step 2.2: process one of the sets first, then process the other set. The processing of the two sets is the same. The processing process is: The sum of the absolute values ​​of the differences between the pixels in the adjacent areas of the current pixel block is used as the complexity of the current pixel block, and the pixel blocks are sorted from small to large according to the size of the complexity; The pixels in the adjacent area refer to the P×2 areas on the left and right sides and the 2×Q areas on the top and bottom sides of the current pixel block; Step 2.3, for each pixel block, calculate the gradient value of the current pixel block according to formula (2) and formula (3) and , according to the gradient value and Select the scanning order to obtain the value of each pixel in each pixel block; (2) (3) In formulas (2) and (3), is the coordinate of the upper left corner pixel of the current pixel block; like , then follow the order of the first row, the second row...the last row, and each row is scanned from left to right; like , then the order of the lines is from the last line...the second line, the first line, and each line is scanned from left to right; like , then the first row, the second row, ... the last row are scanned in order, and each row is scanned from right to left; like , then the order of the lines is from the last line...the second line, the first line, and each line is scanned from right to left; like , then the columns are scanned in the order of the first column, the second column, ... the last column, and each column is scanned from top to bottom; like , then the columns are scanned in the order of the first column, the second column, ... the last column, and each column is scanned from bottom to top; like , then the columns are scanned in the order of the last column...the second column, the first column, and each column is scanned from top to bottom; like , then the columns are scanned in the order of the last column...the second column, the first column, and each column is scanned from bottom to top; Step 2.4: Arrange the pixels in each pixel block in ascending order according to the pixel value obtained by scanning in step 2.3 to obtain an ordered sequence. , and the corresponding subscript sequence , and satisfy the conditions of formula (4), that is: (4) In formula (4), n represents the total number of pixel values ​​in each pixel block; Step 3: Use the third largest pixel to predict the largest and second largest pixels, and use the third smallest pixel to predict the smallest and second smallest pixels, generate four prediction errors, and modify the prediction errors based on the relationship between the sorted pixels and the subscripts; Step 4: define two complexity thresholds, loop through the complexity thresholds, divide the complexity intervals, modify the prediction error according to the different complexity intervals, pair the prediction error values ​​0 and 1, and obtain a prediction error pair sequence; Step 5: For a certain set of complexity thresholds 、 , loop through all the two-dimensional mappings of the prediction error pairs obtained in step 4, calculate the embedding capacity and the degree of image loss, and obtain the optimal complexity threshold of the pixel block under the current partitioning scheme based on the embedding capacity and the degree of image loss 、 and two-dimensional mapping; Step 6: Change the size of the pixel blocks divided in step 1 and repeat steps 2 to 5 to obtain the optimal complexity threshold for all pixel blocks. 、 and two-dimensional mapping, the optimal complexity threshold at each pixel block 、 Embed data into the set corresponding to the two-dimensional mapping to obtain the encrypted image , the optimal encrypted image, final parameters, and final encrypted image are obtained through the peak signal-to-noise ratio.

2. The reversible data hiding method based on prediction error correction and adaptive optimization mapping according to claim 1 is characterized in that: The specific process of step 1 is: Step 1.1: convert the original image of size M×N , scan the pixels except the first row, first column, last row and last column in the order of raster scanning. If the pixel value is 254 or 1, the position map is recorded as 0. If the pixel value is 255, the position map is recorded as 1, and the pixel value is modified to 254. If the pixel value is 0, the position map is recorded as 1, and the pixel value is modified to 1 to obtain the host image I. The host image I does not include the original image the first row, first column, last row, and last column of pixels; Step 1.2: Divide the host image I obtained in step 1.1 into several and equal non-overlapping pixel blocks, .

3. The reversible data hiding method based on prediction error correction and adaptive optimization mapping according to claim 1 is characterized in that: The specific process of step 3 is: Use the third largest pixel to predict the maximum value pixel and the second largest pixel respectively, and according to formulas (5) and (6), the corresponding prediction errors are obtained. and Similarly, use the third smallest pixel to predict the minimum pixel and the second smallest pixel respectively. According to formulas (7) and (8), the corresponding prediction errors are obtained. and ; (5) (6) (7) (8) In formulas (5)-(8), , , , ; when When , according to formula (4) and formula (5), the ordered sequence In the case where the largest pixel or the second largest pixel is swapped with the third largest pixel, ; Similarly, when hour, ;when hour, .

4. The reversible data hiding method based on prediction error correction and adaptive optimization mapping according to claim 1, characterized in that: The specific process of step 4 is: Step 4.1, for and , in the pairwise prediction error, when When , modify the corresponding prediction error value, assuming , , the expression is: (9) Step 4.2, define two complexity thresholds 、 , assuming the maximum complexity threshold is , the minimum complexity threshold is ,make , , the step size is 100; When the pixel block complexity hour, , when the pixel block complexity hour, ; Loop through all group complexity thresholds 、 The value of each group complexity threshold 、 All pixel blocks need to be processed so that for each set of complexity thresholds 、 , pair the prediction error values ​​1 and 0, i.e., (0,0), (1,0), (1,1), (0,1), and obtain the prediction error pair sequence .

5. The reversible data hiding method based on prediction error correction and adaptive optimization mapping according to claim 1, characterized in that: In step 5, the expressions of embedding capacity and image loss degree are: (10) (11) (12) In formulas (10)-(12), represents the number of embeddable prediction error pairs, represents the amount of prediction error for the extended move, Represents the prediction error The ordered set of possible mappings of Indicates the number of elements in the collection. Represents the two prediction errors before and after the move norm, is the degree of image loss, is the image embedding capacity, The length of the given embedded data.

6. The reversible data hiding method based on prediction error correction and adaptive optimization mapping according to claim 1, characterized in that: The specific process of step 6 is: Change the size of the pixel blocks divided in step 1, repeat steps 2 to 5, and obtain the optimal complexity threshold under all pixel blocks 、 and two-dimensional mapping, the optimal complexity threshold at each pixel block 、 Embed data into the set corresponding to the two-dimensional mapping to obtain the encrypted image , and then calculate the encrypted image Compared with the peak signal-to-noise ratio of the original image, the encrypted image corresponding to the maximum peak signal-to-noise ratio is the optimal encrypted image. The pixel block size, two sets of two-dimensional mappings, and two sets of complexity thresholds corresponding to the optimal encrypted image are: 、 As the final parameters, the final parameters, the position map in step 1, and the positions where the embedded data stops in the two sets are used as auxiliary information. The auxiliary information is stored in the least significant bit plane of the first row, first column, last row, and last column of pixels in the original image using LSB replacement to obtain an auxiliary image. The auxiliary image is combined with the optimal encrypted image to obtain the final encrypted image.

7. The reversible data hiding method based on prediction error correction and adaptive optimization mapping according to claim 1, characterized in that: In step 6, calculate the encrypted image The peak signal-to-noise ratio of the original image is expressed as: (13) (14) In formulas (13) and (14), Indicates a secret image and host images The mean square error between and Represents the original image The number of rows and columns, Indicates the number of bits per pixel, 8 for grayscale images, is the peak signal-to-noise ratio, in units of .

Citation Information

Patent Citations

  • A reversible information hiding and extracting method based on modification of a plurality of two-dimensional histograms

    CN109671010A

  • Reversible information hiding method and system for sensing encrypted image

    CN114466113A