Method and system for hiding reversible data based on prediction errors
12058297 ยท 2024-08-06
Assignee
Inventors
- Hongtu LI (Jilin, CN)
- Shuai LI (Jilin, CN)
- Liang HU (Jilin, CN)
- Chengyu SUN (Jilin, CN)
- Ling CHI (Jilin, CN)
- Tuohang Li (Jilin, CN)
Cpc classification
H04N1/32347
ELECTRICITY
H04N1/32229
ELECTRICITY
International classification
H04N1/32
ELECTRICITY
Abstract
A method and system for hiding reversible data based on prediction errors are provided, where the method includes: partitioning an image, to obtain a shadow part and a blank part; performing a first-layer embedding process on the shadow part; performing a multi-layer embedding process on the blank part; extracting outermost layer information of the blank part after the multilayer embedding process; and extracting information of the shadow part after the first-layer embedding process. According to the method in the present disclosure, a problem of image distortion during high-capacity data embedding can be effectively solved.
Claims
1. A method for hiding reversible data based on prediction errors, comprising: partitioning an image, to obtain a shadow part and a blank part; performing a first-layer embedding process on the shadow part; performing a multi-layer embedding process on the blank part; extracting outermost layer information of the blank part after the multilayer embedding process; and extracting information of the shadow part after the first-layer embedding process.
2. The method for hiding reversible data based on prediction errors according to claim 1, wherein the partitioning an image comprises: scanning the image from left to right and from top to bottom, to obtain an original pixel sequence {c.sub.1, c.sub.2, . . . , c.sub.n} of the image; and partitioning the original pixel sequence, to obtain the blank part {a.sub.1, a.sub.2, . . . , a.sub.n} and the shadow part {x.sub.1, x.sub.2, . . . , x.sub.n}.
3. The method for hiding reversible data based on prediction errors according to claim 1, wherein the performing first-layer embedding process on the shadow part comprises: predicting center pixels by using peripheral pixels of the shadow part, to obtain first-layer encrypted predicted value, wherein a first row, a first column, a last row, and a last column of pixels of the shadow part are not predicted; and following equation is adopted:
ei=Xi?{circumflex over (x)}i(2), wherein Xi represents the original pixel value of the current pixel, and {circumflex over (x)}i represents the corresponding first-layer encrypted predicted value; calculating a frequency of each value in the first prediction error value sequence, to generate a first prediction error histogram; obtaining additional information, which comprises a length of secret information and a size of a compressed location map; embedding the additional information in a first row of original image pixels; embedding the secret information b?{0,1} in a predetermined prediction error value range, to obtain expanded and offset prediction error values; and determining a first-layer encrypted image based on the expanded and offset prediction error values, wherein following equation is adopted:
X.sub.i={circumflex over (x)}.sub.i+ei(4), wherein X.sub.i represents a pixel value of the first-layer encrypted image, {circumflex over (x)}.sub.i represents a predicted value of a pixel of the shadow part, and ei represents an expanded and offset prediction error.
4. The method for hiding reversible data based on prediction errors according to claim 3, wherein the embedding the additional information in a first row of original image pixels comprises: adjusting a boundary pixel value of the shadow part, wherein the boundary pixel value is [0, 255]; modifying location map marks corresponding to modified pixels to be 1, and location map marks corresponding to remaining unmodified pixel values to be 0, to obtain a location map matrix formed by 0 and 1; compressing the location map matrix to obtain a compressed location map; and embedding the compressed location map in the first row of the original image pixels.
5. The method for hiding reversible data based on prediction errors according to claim 3, wherein the embedding the secret information b?{0,1} in a preset prediction error value range, to obtain expanded and offset prediction error values adopts following equation:
6. The method for hiding reversible data based on prediction errors according to claim 1, wherein the performing multi-layer embedding process on the blank part comprises: predicting pixels of the blank part with neighbor pixels as centers by using first-layer encrypted pixels, to obtain second-layer encrypted predicted value; calculating a difference between an original pixel value of a current pixel and corresponding second-layer encrypted predicted value, to obtain a second prediction error value sequence; calculating a frequency of each value in the second prediction error value sequence, to generate a second prediction error histogram; and performing data embedding and translation according to the second prediction error histogram, to obtain a final encrypted image.
7. The method for hiding reversible data based on prediction errors according to claim 1, wherein the extracting outermost layer information of the blank part after the multilayer embedding process comprises: extracting additional information embedded in a first row; obtaining second-layer encrypted predicted value of pixels of an encrypted image; obtaining a second prediction error value sequence based on the second-layer encrypted predicted value, and generating a second prediction error histogram; extracting secret information according to the second prediction error value sequence; and restoring pixel values of an outermost encrypted image.
8. The method for hiding reversible data based on prediction errors according to claim 1, wherein the extracting information about the shadow part after the first-layer embedding process comprises: obtaining an encrypted image during first-layer encryption; obtaining first-layer encrypted predicted value of the encrypted image during the first-layer encryption; obtaining a first prediction error value sequence based on the first-layer encrypted predicted value, and generating a first prediction error histogram; extracting secret information based on the first prediction error value sequence; decompressing a losslessly compressed location map to obtain a decompressed location map; and obtaining, according to the decompressed location map, pixels corresponding to location map marks of 1, modifying and restoring the pixels, to restore original pixel values, and obtaining a non-destructive restored original image.
9. The method for hiding reversible data based on prediction errors according to claim 1, wherein the extracting secret information based on the second prediction error value sequence comprises: extracting the secret information within [?2, 1) according to T=1, dw(i, j); according to formulas: S=mod(dw(i, j)+1, 2) (5); and
Pr(i,j)=(Ps(i,j))+(dw(i,j)?S)/2(6), wherein S is an extracted secret information bit, Pr is a restored pixel value, Ps is a predicted value of an encrypted image, and dw is a prediction error value of the encrypted image; the remaining pixels are expanded and translated pixels in a range of [1, +?) and (??, ?2), and no information is embedded, and an extraction method is performed according to following formula:
10. A system for hiding reversible data based on prediction errors, comprising: an image partitioning module, configured to partition an image, to obtain a shadow part and a blank part; a first-layer embedding process module, configured to perform first-layer embedding process on the shadow part; a multi-layer embedding process module, configured to perform multi-layer embedding process on the blank part; a first extraction module, configured to extract outermost layer information of the blank part after the multilayer embedding process; and a second extraction module, configured to extract information of the shadow part after the first-layer embedding process.
Description
BRIEFT DESCRIPTION OF THE DRAWINGS
(1) In order to describe the technical solution of the invention more clearly, accompanying drawings required in the embodiments of the present disclosure will be illustrated briefly below. Apparently, the accompanying drawings in the following description merely illustrate some embodiments of the present disclosure, and those ordinarily skilled in the art may also derive other accompanying drawings from these accompanying drawings without creative efforts.
(2)
(3)
(4)
(5)
(6)
(7)
DETAILED DESCRIPTION OF THE EMBODIMENTS
(8) The technical solutions of the embodiments of the present disclosure are clearly and completely described below with reference to the accompanying drawings. Apparently, the described embodiments are merely a part rather than all of the embodiments of the present disclosure. All other examples obtained by a person of ordinary skills in the art based on the examples of the present disclosure without creative efforts shall fall within the protection scope of the present disclosure.
(9) An object of the present disclosure is to provide a method and system for hiding reversible data based on prediction errors, which can effectively solve a problem of image distortion during high-capacity data embedding.
(10) To make the above-mentioned objects, features, and advantages of the present disclosure clearer and more comprehensible, the present disclosure will be further described in detail below with reference to the accompanying drawings and specific implementations.
(11)
(12) In step 101, an image is partitioned, to obtain a shadow part and a blank part.
(13) A current image is partitioned into two regions, namely a shadow part and a blank part, and first-layer embedding process is first performed on pixels in the shadow part. Subsequently, multi-layer embedding process is performed on pixels in the blank part.
(14) The image partition specifically includes: scanning the image from left to right and from top to bottom, to obtain an original pixel sequence {c.sub.1, c.sub.2, . . . , c.sub.n} of the image; and partitioning the original pixel sequence, to obtain the blank part {a.sub.1, a.sub.2, . . . , a.sub.n} and the shadow part {x.sub.1, x.sub.2, . . . , x.sub.n}.
(15) In step 102, first-layer embedding process is performed on the shadow part.
(16) The performing first-layer embedding process on the shadow part specifically includes the following steps.
(17) In S1, center pixels are predicted by using peripheral pixels of the shadow part, to obtain first-layer encrypted predicted value. As shown in
(18) Specifically, the following equation is adopted:
(19)
where equation (1) represents that the center pixels are predicted by using the peripheral pixels, i, j respectively represent a row and a column where a current pixel is located, {a1, a2, . . . , an} are all original pixel values in the first-layer embedding, {{circumflex over (x)}1, {circumflex over (x)}2, {circumflex over (x)}3, . . . , {circumflex over (x)}n} is a one-dimensional predicted value sequence, and predicted values are integers.
(20) In S2, a difference between an original pixel value of the current pixel and a corresponding first-layer encrypted predicted value is calculated, to obtain a first prediction error value sequence (e1, . . . , en), where the following equation is specifically adopted:
ei=Xi?{circumflex over (x)}i(2),
where Xi represents the original pixel value of the current pixel, and {circumflex over (x)}i represents the first-layer encrypted predicted value.
(21) In S3, a frequency of each value in the first prediction error value sequence is calculated, to generate a first prediction error histogram. Embedded data is expanded and translated by modifying the first prediction error histogram, as shown in
(22) In S4, additional information is obtained, where the additional information includes a length of secret information and a size of a compressed location map.
(23) In S5, the additional information is embedded in a first row of original image pixels, as shown in
(24) In the method, the additional information is finally embedded in the first row by using a least significant bit replacement technology, and information in the first row is first extracted during extraction. Therefore, information of the compressed location map and the length of the secret information, as parts of an effective capacity, are embedded in the first row of the original image pixels.
(25) A process of embedding the additional information in a first row of original image pixels specifically includes the following steps.
(26) In S51, a boundary pixel value of the shadow part is adjusted, where the boundary pixel value is [0, 255].
(27) In S52, location map marks corresponding to modified pixels are modified to be 1, and location map marks corresponding to remaining unmodified pixel values are set to be 0, to obtain a location map matrix formed by 0 and 1.
(28) The location map is configured to mark pixels that may cause an overflow problem during embedding. To prevent overflow and underflow of a grayscale image in which information has been embedded, that is, to prevent the grayscale image from exceeding a range of [0, 255], pixel values are adjusted within a reliable range. Therefore, in the method, each pixel value is modified by at most 1, and only a boundary value pixel needs to be adjusted. For example, an xi (an original pixel) with a value of 255 is modified as 254, and an xi (an original pixel) with a value of 0 is modified as 1. In addition, location map marks corresponding to modified pixels are modified to be 1, and location map marks corresponding to the remaining unmodified pixel values are set to be 0. Herein, a matrix (that is, a location map matrix) formed by 0 and 1 and having the same size as a given image is obtained, and then, the obtained matrix is compressed by using a lossless compression technology. The lossless compression adopts a digital encoding manner, that is, step S53.
(29) In S53, the location map matrix is compressed to obtain a compressed location map.
(30) In S54, the compressed location map is embedded in the first row of the original image pixels. b?{0,1} is embedded in a prediction error [0, ?1], to obtain expanded and offset prediction error values ei.
(31) Specifically, the following equation is adopted:
(32)
where b represents the secret information, ei represents a prediction error, T represents an prediction error range by which the secret information is embedded, and ei represents the expanded and offset prediction error.
(33) In S7, a first layer encrypted image is determined based on the expanded and offset prediction error values.
(34) Specifically, following formula is adopted:
X.sub.i={circumflex over (x)}.sub.i+ei(4),
where X.sub.i represents a pixel value of the first layer encrypted image, that is, the pixel value of the first layer encrypted image, {circumflex over (x)}.sub.i represents a predicted value of a pixel of the shadow part, and ei represents an expanded and offset prediction error.
(35) Similarly, in the solution, multi-layer embedding may be performed, that is, as shown in
(36) In step 103, multi-layer embedding process is performed on the blank part.
(37) Different from the shadow part, pixel value prediction of the blank part is performed according to pixel values of a previous layer encrypted image. After the first-layer embedding is completed, through pixels after first-layer encryption, a prediction is performed by using the same prediction method and equation (1) with neighboring pixels as centers.
(38) During second-layer embedding, adjacent blank pixels of the shadow pixels, which are positioned on the right side of the shadow pixels in the same row, are selected for embedding, and during embedding, values used for predicting a second layer are values modified during the first-layer embedding.
(39) If two-layer embedding is performed, it is better to divide the secret information into two parts that have similar sizes, and then data embedding and offset are performed correspondingly, until information embedding is completed.
(40) The performing multi-layer embedding process on the blank part specifically includes the following steps.
(41) In A1, pixels of the blank part are predicted with neighbor pixels as centers by using first-layer encrypted pixels, to obtain second-layer encrypted predicted value.
(42) In A2, a difference between an original pixel value of a current pixel and corresponding second-layer encrypted predicted value is calculated, to obtain a second prediction error value sequence.
(43) In A3, a frequency of each value in the second prediction error value sequence is calculated, to generate a second prediction error histogram, as shown in
(44) In A4, data embedding and translation are performed according to the second prediction error histogram, to obtain a final encrypted image.
(45) In Step 104, outermost layer information of the blank part after the multi-layer embedding process is extracted.
(46) In processes of extracting the secret information and restoring the original image, the secret information embedded in the outermost layer is first extracted, subsequently, extraction is performed toward an inner layer in sequence, and finally the original image is restored in a lossless way and the embedded secret information is obtained.
(47) The extracting outermost layer information of the blank part after the multi-layer embedding process specifically includes the following steps.
(48) In B1, additional information embedded in a first row is extracted.
(49) Original pixel values in the first row are restored. An actual effective capacity in the image is obtained by reading a least significant bit in the first row of the encrypted image. The replaced least significant bit in the first row is restored back to original values of a first row of pixels.
(50) In B2, second-layer encrypted predicted value of pixels of an encrypted image are obtained.
(51) In B3, a second prediction error value sequence based on the second-layer encrypted predicted value is obtained, and a second prediction error histogram is generated.
(52) Specifically, pixel predicted values of an encrypted image are obtained by using the same scanning and prediction command, a marked prediction error sequence of the encrypted image is obtained subsequently, and a prediction error histogram of the encrypted image is generated. This process is the same as that in the embedding stage.
(53) In B4, secret information is extracted according to the second prediction error value sequence.
(54) The secret information is extracted within [?2, 1) according to T=1, dw(i, j), and according to equations:
S=mod(dw(i,j)+1,2)(5); and
Pr(i,j)=(Ps(i,j))+(dw(i,j)?S)/2(6),
where S is an extracted secret information bit, Pr is a restored pixel value, Ps is a predicted value of an encrypted image, and dw is a prediction error value of the encrypted image.
(55) The remaining pixels are expanded and translated pixels in a range of [1, +?) and (??, ?2), and no information is embedded, and an extraction method is performed according to following equation:
(56)
until all the secret information of the blank part is extracted completely.
(57) In B5, pixel values of an outermost encrypted image are restored.
(58) According to the process, an outermost image and encrypted information can be restored in a lossless way. A first row of pixels, a first column of pixels, a last row of pixels, and a last column of pixels of the original image and a first row of pixels, a first column of pixels, a last row of pixels, and a last column of pixels of the encrypted image are not changed in the embedding and extraction processes, and the predicted values of the encrypted image are the same as that during embedding.
(59) In step 105, information of the shadow part after the first-layer embedding process is extracted.
(60) In C1, an encrypted image is obtained during first-layer encryption.
(61) In C2, the first-layer encrypted predicted value of the encrypted image are obtained during the first-layer encryption.
(62) In C3, a first prediction error value sequence is obtained based on the first-layer encrypted predicted value, and a first prediction error histogram is generated.
(63) In C4, secret information is extracted based on the first prediction error value sequence.
(64) The extraction process is consistent with the extraction process in step 104.
(65) The secret information is extracted within [?2, 1) according to T=1, dw(i, j), and according to equations:
S=mod(dw(i,j)+1,2)(8); and
Pr(i,j)=(Ps(i,j))+(dw(i,j)?S)/2(9),
where S is an extracted secret information bit, Pr is a restored pixel value, Ps is a predicted value of an encrypted image, and dw is a prediction error value of the encrypted image.
(66) The remaining pixels are expanded and translated pixels in a range of [1, +?) and (??, ?2), and no information is embedded, and an extraction method is performed according to following equation:
(67)
until all of the secret information is extracted completely.
(68) In C5, a losslessly compressed location map is decompressed to obtain a decompressed location map.
(69) In C6, according to the decompressed location map, pixels corresponding to location map mark of 1 are obtained, the pixel is modified and restored, to restore an original pixel value, and obtain a non-destructive restored original image.
(70)
(71) Each example of the present specification is described in a progressive manner, each example focuses on the difference from other examples, and the same and similar parts between the examples may refer to each other.
(72) In this specification, several examples are used for illustration of the principles and implementations of the present disclosure. The description of the foregoing examples is used to help illustrate the method of the present disclosure and the core principles thereof. In addition, those of ordinary skills in the art can make various modifications in terms of specific implementations and scope of application in accordance with the teachings of the present disclosure. In conclusion, the content of the present specification shall not be construed as a limitation to the present disclosure.