High-Capacity Reversible Data Hiding in Encrypted Images with Flexible Restoration

In this paper, we propose a novel reversible data hiding in encrypted images (RDH-EI) method that achieves the highest hiding capacity in the RDH-EI research field and full flexibility in the processing order without restrictions. In the previous work in this field, there exist two representative methods; one provides flexible processing with a high hiding capacity of 2.17 bpp, and the other achieves the highest hiding capacity of 2.46 bpp by using the BOWS-2 dataset. The latter method has critical restrictions on the processing order. We focus on the advantage of the former method and introduce two efficient algorithms for maximizing the hiding capacity. With these algorithms, the proposed method can predict each pixel value with higher accuracy and refine the embedding algorithm. Consequently, the hiding capacity is effectively enhanced to 2.50 bpp using the BOWS-2 dataset, and a series of processes can be freely conducted without considering any restrictions on the order between data hiding and encryption. In the same way, there are no restrictions on the processing order in the restoration process. Thus, the proposed method provides flexibility in the privileges requested by users. Experimental results show the effectiveness of the proposed method in terms of hiding capacity and marked-image quality.


Introduction
In recent years, with the development of social networking services and cloud services, images are increasingly being uploaded to external servers or services for share and disclosure. However, this leads to leakage of personal information and copyright infringement due to unauthorized secondary use. In response to this situation, reversible data hiding (RDH), which is an image protection technique, has attracted attention. RDH allows an image owner to embed arbitrary data (hereafter a payload), e.g., copyright and authentication information, into an image without increasing the original file size. RDH methods can completely retrieve original images by extracting the payload from marked images [1][2][3][4][5]. This feature is practically effective not only for natural images but also for medical, military, and satellite images. RDH methods have been commonly applied to plane images, but, recently, RDH in encrypted images (RDH-EI) methods have also been actively studied [6][7][8][9][10][11][12][13][14][15][16]. With RDH-EI methods, we assume that an image owner first encrypts a target image and then sends it to a third party such as a service provider. The third party then embeds a payload, such as server information, access history, and annotation data. Therefore, a high hiding capacity is one of the requirements in the RDH-EI research field. Some RDH-EI methods have also been proposed for medical images with DICOM format and HDR images [17,18].
In an RDH-EI method proposed by Ma et al. [7], an image owner first divides an original image into two areas; one is used for data hiding, and the other is used for data storage for reversibility. The least significant bits (LSBs) of the former area are reversibly embedded into the latter area, so these LSBs are used for data hiding. The image owner can also use multiple bit-planes for data hiding depending on the area ratio. Then, the entire image is encrypted and sent to a third party. The third party embeds a payload into the LSB plane by bit substitution and derives a marked encrypted image. This method can obtain a high-quality marked image, which still contains a payload, through decryption without data extraction. However, the hiding capacity is at the most 0.5 bpp. The hiding capacity of any other methods using LSBs as data hiding area is limited to less than 1 bpp [8,9]. Another RDH-EI method proposed by Xu et al. [10] independently conducts data hiding and encryption processes without dividing an image into two areas, but the hiding capacity of this method is still less than 1 bpp. Wu et al. enhanced the hiding capacity of the Ma et al.'s method [7] by introducing the adaptive bit-plane partition [11]. Specifically, an original image is divided into two areas; one contains lower bit-planes, i.e., less significant bit-planes, and the other contains upper bit-planes, i.e., more significant bit-planes. The original bit values of the lower bit-planes are embedded into the upper bit-planes, and then the upper bit-planes are encrypted. The lower bit-planes are used for data hiding. This method achieves a high hiding capacity of more than 2 bpp. Additionally, since encryption for upper bit-planes and data hiding for lower bit-planes are conducted independently, decryption and data extraction can also be performed without restriction on their order. Hereafter, we call this method the RDH-BPP method. On another front, several unique approaches have been developed to compress a marked encrypted image [15,16]. These methods use one type of encryption and then compression systems [19][20][21] that can efficiently compress an encrypted image using an image coding standard.
Puteaux et al. proposed a high capacity RDH-EI method that introduces prediction and replacement using most significant bits (MSBs) instead of LSBs [12]. However, this method cannot fully retrieve the original image in many cases, so Hirasawa et al. extended Puteaux et al.'s method [12] and attained full reversibility by defining precise conditions for MSB substitution [13]. Later, Puteaux et al. proposed a more efficient RDH-EI method that guarantees full reversibility and considerably enhances the hiding capacity to 2.4 bpp on average [14] by using the BOWS-2 dataset. To the best of our knowledge, this capacity is the highest one in the RDH-EI research field. The recursive process using MSB prediction contributes such a high capacity. This method ensures full reversibility through a pixelvalue modification process based on an error detection algorithm. Hereafter, we call this method the RDH-MSB method. The RDH-MSB method, however, has restrictions on the processing order, and the order cannot be changed. In the restoration process, for instance, the order needs to be data extraction and then decryption, so we cannot decrypt a marked encrypted image without data extraction. This limits the range of practical applications.
In this paper, we propose a novel RDH-EI method that achieves both the highest hiding capacity and processing flexibility. We focus on the flexible processing sequence in the RDH-BPP method and develop prediction and embedding algorithms to enhance the hiding capacity. The proposed method, as with the RDH-BPP method, divides an original image into two areas by bit-plane partition, and thus the encryption and data hiding processes are totally independent from each other. Accordingly, there are no restrictions on the processing order, and the method can be applied to a wide range of applications. Through our experiments, we confirmed the effectiveness of the method in terms of hiding capacity and marked-image quality.

Related Works
As mentioned earlier, the proposed method uses an effective feature of the RDH-BPP method [11] and achieves a higher hiding capacity than the RDH-MSB method [14]. We explain the RDH-BPP and RDH-MSB methods as follows.

Bit-Plane-Partition-Based RDH-EI Method
The RDH-BPP method [11] is an RDH-EI method using bit-plane partition. An original image is divided into two areas on the basis of bit-planes: I 1 containing upper bit-planes and I 2 containing lower bit-planes. The encryption process is conducted on I 1 , while the data hiding process is conducted on I 2 . Such independent processes contribute to making the processing order flexible. In the restoration process, specifically, the decryption process can be conducted without data extraction, even when the encryption process has been performed before data hiding. In this case, we can obtain high quality images containing a payload. Figure 1 shows an outline of this method, where I 1 contains α bits of upper bit-planes, and I 2 contains 8 − α bits of lower bit-planes. I 2 is used as a data hiding area, so pixel values need to be stored into I 1 . We call this process the self-embedding process. The self-embedding algorithm is analogous to a part of another previous RDH method [2]. We calculate prediction values for each pixel in I 1 , and the pixel values of I 2 are embedded into I 1 on the basis of another embedding algorithm, for which a fundamental prediction error expansion with histogram shifting (PEE-HS) method [3] has been extended. The detailed steps of the self-embedding process are described below. Note that the image size is M × N. Step1-1: Prepare four modes for prediction as shown in Figure 2, and define the processing order of these modes. Step1-2: Derive prediction values for the target pixels in I 1 using the reference pixels as shown in Figure 3. For the target pixels p (i,j−1) and p (i−1,j) (1 ≤ i < M, 1 ≤ j < N), the prediction values pred (i,j−1) and pred (i−1,j) are obtained by In contrast, to derive the prediction value pred (i,j) , first calculate the interpolated values g 1 and g 2 using pairs of two diagonal reference pixels: Using g 1 , g 2 and the mean value µ of the four reference pixels, the variances δ 1 and δ 2 between two diagonal reference pixels are derived by Finally, the prediction value pred (i,j) is given by Step1-3: Derive the prediction errors e (i,j) as follows: Step1-4: Using the extended PEE-HS method [2], the original bit values in I 2 and additional information for reversibility are embedded into I 1 . Note that the embedding algorithm in [2] has been extended from the original PEE-HS method [3] in terms of the embedding efficiency. Step1-5: Repeat Steps 1-2 to 1-4 for the four modes until all the bits in I 2 are embedded. Step1-6: If a part of the bits in I 2 have not been embedded into I 1 , repeat Steps 1-2 to 1-5. Reference pixels Target pixels The self-embedding process guarantees reversibility. If the total amount of original bits in I 2 is larger than the hiding capacity of I 1 , a part of I 2 cannot serve as the data hiding area. In this case, the bits of I 2 that cannot be embedded into I 1 or are located in the same row with the first bit to be unembedded are not replaced with 0 and are omitted from the data hiding area. The row and bit-plane numbers of the last embedded bit are stored as additional information.
After the self-embedding process, we encrypt I 1 using a pixel-by-pixel encryption algorithm, and an encrypted image is derived. The encrypted image is sent to a third party such as a service provider. The third party embeds an arbitrary payload into I 2 of the encrypted image using bit substitution. Here, the embeddable bits of I 2 are defined by the self-embedding process and have a value of 0. The payload cannot be embedded into bits with a value of 1.

MSB-Prediction-Based RDH-EI Method
The RDH-MSB method [14] has a high hiding capacity and guarantees perfect reversibility. In this method, each bit-plane is processed recursively, in an order from MSB to LSB. Consequently, the hiding capacity is 2.46 bpp on average by using the BOWS-2 dataset, which is the highest among any related work. This method guarantees reversibility by using a pixel value modification process based on prediction errors.
An outline of the RDH-MSB method is shown in Figure 4. An original image I is composed of eight bit-planes B [1,8] , and B [1] represents the MSB plane. The k-th bit-plane where k ranges from 1 to 8, is a target plane to be processed, and the lower bit-planes B [k+1,8] are used for the reversibility of B [k] .
First, an image owner encrypts target images with the following procedure.

Enc3:
Calculate prediction errors e [k,8] (i,j) for each pixel and detect errors. Note that the errors prevent the algorithm from ensuring reversibility.

Enc4:
For each pixel, where an error has been detected, modify the pixel value so that the prediction error is translated into 2 7−k . Here, define the difference between the original and modified pixel values as the prediction-error width.

Enc5:
Compare the size of a series of the prediction-error widths W k and the hiding capacity of B [k] . If W k is smaller than the hiding capacity, the current bit-plane (1,0) with 1. Here, the flag bit p (1,0) denotes whether the next bit-plane will be marked or unmarked. Otherwise, B [k] is unembeddable, so restore the original pixel values, which are modified in Enc 4, and encrypt all bit-planes B [k,8] .

Enc6:
Generate pseudo-random number sequences, and encrypt both of the bit values (i,j) and W k using an exclusive-or operation. The encrypted onesp [k] (i,j) andŴ k can be obtained.

Enc7:
Following a top-left bit p (1,0) , embedŴ k and an end flag into B [k] by bit substitution.
On the other hand, the third party can embed an arbitrary payload depending on the hiding capacity.

Hid1:
Obtain the hiding capacity from the flag bit p (1,0) and end flags.

Hid2:
Embed the payload into the embeddable area in each bit-plane by bit substitution, and derive a marked encrypted image, where a single bit-plane is shown in Figure 5. This method guarantees perfect reversibility through error detection and achieves a high hiding capacity through recursive processing for multiple bit-planes. However, since the encryption and data hiding processes are not independent from each other, the decryption process has to always be conducted after data extraction.

Proposed Method
We propose a novel RDH-EI method that has the advantages of both the RDH-BPP and RDH-MSB methods [11,14]. The proposed method has unique algorithms for the self-embedding process. We focus on the MED method for prediction and improve the PEE-HS method [3] for data hiding. We describe the detailed procedures.

Encryption and Data Hiding Process
The proposed method uses the MED method to calculate prediction values in the selfembedding process. The MED method has a higher prediction accuracy than the prediction algorithm used in the RDH-BPP method [11]. Furthermore, the proposed method enhances the hiding capacity of I 1 by refining the self-embedding algorithm that stores the original bits of I 2 into I 1 . The outline of the proposed method is analogous to that of the RDH-BPP method [11] as shown in Figure 1. We explain the detailed steps of the self-embedding process as follows.
Step3-1: Split an original image into two areas I 1 and I 2 by bit-plane partition. I 1 contains α bits of upper bit-planes and is used for encryption, while I 2 contains 8 − α bits of lower bit-planes and is used for data hiding. Step3-2: Derive the prediction value pred (i,j) for each pixel p (i,j) in I 1 using the MED method: Step3-3: Derive the prediction error e (i,j) by Equation (6). Step3-4: Embed a part of the bit values b of I 2 into pixels in I 1 , where e (i,j) = 0: where e (i,j) denotes the prediction error after the embedding process in this step.
Step3-5: Explore two bins max n and max p (max n ≤ 0 and max p > 0) with the highest frequency from a prediction-error histogram. Step3-6: Embed the remaining bit values b of I 2 into pixels in I 1 , where e (i,j) = max n or max p : where e (i,j) denotes the prediction error after the embedding process in this step.
Step3-7: Repeat Steps 3-5 and 3-6 until all of b are embedded, and then replace b with 0.
If the total amount of the original bits in I 2 is larger than the hiding capacity of I 1 , a part of I 2 is excluded from the embeddable area. In this case, the same process as the RDH-BPP method [11] must be conducted for reversibility.

Decryption and Data Extraction Process
Here, we explain the decryption and data extraction processes. In the proposed method, encryption for I 1 and data hiding for I 2 are conducted independently, so we can conduct decryption and data extraction without any restriction on their order. Consequently, there exist three patterns for the restoration process as shown in Figure 6. In all patterns, a marked encrypted image I ME is first divided into I 1 and I 2 .   Figure 6a shows a pattern for retrieving the original image and payload. In this case, first, the payload is extracted from I 2 , and the decryption process is applied to I 1 . Here, these processes can be conducted in parallel. Subsequently, the original bits in I 2 are retrieved from I 1 by a self-extraction process, which is the reverse of the self-embedding process. Then, the pixel values of I 1 , which have been adjusted for reversibility, are replaced with the original ones. Finally, the original image I can be recovered by integrating I 1 and I 2 . Figure 6b shows another pattern, where a user has the privilege to decrypt I ME but cannot extract the payload. In this case, the user can directly decrypt I ME without data extraction and obtain a marked image I M still containing the payload.
In the third case, a user is allowed to extract the payload but cannot access the image content as shown in Figure 6c. The user can obtain the payload from I ME and an encrypted image I E .

Experimental Results
We confirmed the performance of the proposed method in terms of hiding capacity and marked-image quality. In the experiments, we used two datasets: BOWS-2 [22] and Kodak Lossless True Color Image Suite [23]. The former dataset consists of 10,000 grayscale images with 512 × 512 pixels, while the latter dataset consists of 24 color images with 512 × 768 or 768 × 512 pixels. For the latter dataset, we converted RGB to grayscale. Figure 7 shows examples of the test images. Using the proposed and RDH-BPP methods, the original images were divided into two areas using bit-plane partition: α bits of upper bit-planes and 8 − α bits of lower bit-planes. α controls the hiding capacity for payloads and is defined as α ∈ {7, 6, 5}. In the RDH-BPP method, there are 24 combinations of orders in which the four modes can be used for prediction. In our simulation, all test images were processed in the fixed order of a, b, c, and d shown in Figure 2. Note that we had confirmed that the processing sequence of the modes has little effect on the results. Figure 8 shows the marked encrypted images obtained by the proposed method.

Hiding Capacity
We first compared the hiding capacity among the proposed, RDH-BPP [11], and RDH-MSB [14] methods. Figure 9a,b illustrate the hiding capacity for the all test images of each dataset, and Table 1 shows the average hiding capacity for each method. The proposed method obviously outperformed the RDH-BPP method in both datasets. As can be seen in Figure 9a, the RDH-MSB method has achieved an enormously high hiding capacity for some images in the BOWS-2 dataset. However, images that can handle such a high hiding capacity are low in number. Furthermore, when using the Kodak dataset, the RDH-MSB method has the lowest capacity in these three methods as shown in Figure 9b. The RDH-MSB method attains the highest hiding capacity in several images, but the hiding capacity of this method strongly depends on image features and has a large variance. Comparing the average hiding capacity in Table 1, the proposed method has the highest hiding capacity in both datasets and provides stable high-performance.
Note that the proposed method has processing flexibility as mentioned in Section 3.2, while the RDH-MSB method [14] has a strict restriction on the processing order and prohibits decryption without data extraction. Through this experiment, it has been demonstrated that the proposed method is one of the best RDH-EI methods in terms of hiding capacity.

Marked-Image Quality
We then evaluated the marked-image quality using PSNR and SSIM. Figure 10 shows the marked images obtained by the proposed method under different α values. Using Figure 9c,d and Table 2, we compare the marked-image quality between the proposed and RDH-BPP methods. In this experiment, we controlled the payload amount for each image so that the proposed method had a comparable amount of payload with the RDH-BPP method. The average payload amounts were 2.17 bpp in the BOWS-2 dataset and 1.99 bpp in the Kodak dataset, respectively. Note that the RDH-MSB method [14] cannot perform decryption without data extraction, so marked images are not derived. It is evident that the proposed method enhanced the marked-image quality in terms of both PSNR and SSIM compared with the RDH-BPP method.
Relative contrast error (RCE) was applied in order to consider the variation in brightness contrast [24]: where std V and std V denote the standard deviations in brightness for the original and marked images, respectively. The RCE values ranges from 0 to 1, where 0.5 represents a reference value. Contrast distortion is prominently visible when the absolute difference between the computed RCE and reference values is large. As can be seen in Table 2, the proposed method alleviated the image distortion equally in terms of the contrast. In comparison, the contrast distortion with the RDH-BPP method was caused by the iterative process. A detailed discussion about the iterative process will be given in Section 4.3.

Discussion
We first discuss the advantages of our method in a comparison with the related work [11,14]. In Table 3, we summarize the features of the proposed, RDH-BPP, and RDH-MSB methods. The proposed method achieves all three features, while the related work sacrifices at least one of the features to satisfy the others. Table 3. Performance comparison among proposed method and related work [11,14].
Firstly, we focus on the hiding capacity. The proposed method is based on the RDH-BPP method, while the self-embedding process is widely different from this method. In our method, the MED algorithm is adopted for prediction, and the fundamental PEE-HS method [3] is extended for self-embedding. With the extension, the proposed method enhances the hiding capacity of the RDH-BPP method in both of the two datasets. In the BOWS-2 dataset, the hiding capacity of our method was comparable to that of the RDH-MSB method, which is highest in the RDH-EI research field to the best of our knowledge. In the Kodak dataset, however, the hiding capacity of the RDH-MSB method was lowest in the three methods. Consequently, the proposed method has the best performance among RDH-EI methods on the hiding capacity front.
Next, we consider the flexibility of the processing order. The proposed method has been extended from the RDH-BPP method without losing the advantages; thus, it has the flexibility without any restriction on the processing order. The encryption and data hiding processes are independent from each other, so the encryption/data hiding and decryption/data extraction orders are completely arbitrary. This feature makes it possible to expand the range of practical applications. Additionally, the lack of restrictions on the restoration process provides the following advantages in addition to retrieving the original image I. A user with the privilege to only decrypt marked encrypted images can decrypt a marked encrypted image I ME without data extraction and obtain the marked image I M as shown in Figure 6b. In the case where the user is later authorized to extract the payload, the user can conduct data extraction from I M . In the same way, another user with the privilege to only extract data can extract the payload from the marked encrypted image I ME without decryption and obtain the encrypted image I E as shown in Figure 6c. The content of I E is still concealed by encryption at this stage. Nevertheless, if the user is later authorized to access the image content, the user can decrypt I E and obtain I. As pointed out above, the proposed method provides flexible access control corresponding to each user's request. In contrast, the RDH-MSB method can embed a payload only after encryption and decrypt images only after data extraction. Such inflexible processing can reduce the possibility of practical applications.
Furthermore, we refer to the computational complexity. The RDH-EI methods with high hiding capacity commonly increase the computational complexity compared to the traditional RDH-EI methods with less hiding capacity. Although the proposed method has been extended based on the RDH-BPP method to enhance the hiding capacity, the entire process has been noticeably simplified by introducing a unique algorithm to the self-embedding process. In particular, the prediction values are first calculated by the MED method, and then the embedding process using the prediction error histogram is only iterated. In contrast, the RDH-BPP method has an issue with the self-embedding process. The four modes shown in Figure 2 are used to calculate the prediction values. The RDH-BPP method first predicts the target pixel values under one mode and embeds the original bit values of I 2 into the prediction values using an efficient algorithm. After finishing a series of processes in the current mode, the same processing is iterated under the next mode. The iterative process is continued until the entire payload is embedded. This algorithm, however, repeatedly uses marked pixels. When using a lot of repetition in this self-embedding process, the prediction accuracy gets worse, which could lead to a vicious circle. This method eventually increases the computational complexity. On another front, the RDH-MSB method embeds prediction error widths to ensure reversibility and does not require any preprocessing including the self-embedding process. This method consists of simple processes without computational complexity.
On another front, we also discuss the correlation between the hiding capacity and marked-image quality under different values of α, which specifies the number of bit-planes for data hiding. In general, an increase in the hiding capacity leads to a decrease in the marked-image quality. As mentioned, an original image is divided into I 1 and I 2 by bitplane partition; I 1 contains α bits of upper bit-planes and is used for encryption, while I 2 contains 8 − α bits of lower bit-planes and is used for data hiding. We can roughly control the hiding capacity with α. However, the minimum capacity is around 1 bpp, and it is difficult for the proposed and RDH-BPP methods to more finely control the capacity. Figure 11 depicts the hiding capacity and PSNR of the marked images when α = 7, 6, or 5, i.e., one, two, or three of the lower bit-planes are used for data hiding. This figure indicates that there exists a trade-off between the hiding capacity and marked-image quality. The proposed method has such a trade-off as with any other method while achieving a high hiding capacity with flexible processing.
Here, we further mention that the hiding capacity depends on α. In the case where one or two bit-planes are adopted for I 2 , almost all of the bits in I 2 are available for data hiding. However, when three lower bit-planes are used for data hiding, about half of the third lower bit-plane is excluded from the embeddable area. A number of the original bit values of the third bit-plane cannot be embedded into I 1 in the self-embedding process. This is because, as α gets smaller, I 1 , where the self-embedding process is conducted, it becomes narrow, while I 2 , where the original values are embedded into I 1 , becomes enlarged. Therefore, the embedding efficiency tends to get worse as α decreases.

Conclusions
We proposed a novel extension of an effective RDH-EI method that independently conducts encryption and data hiding by using area partitions. Our method has two main advantages. One is that it has the highest hiding capacity in this field. The other is that there are no restrictions on the processing order, and thus our method provides flexible processing, which satisfies user request and privilege needs. To this end, we focused on the processing flexibility of a previous RDH-EI method and extended the selfembedding process. This process consists of two processes: prediction and embedding. We introduced the MED method, which has a high prediction accuracy, and applied a refined embedding algorithm based on the original PEE-HS method. Experimental results show that the proposed method achieved the highest hiding capacity and alleviated image distortion in marked images. In addition, the processing flexibility offers image users four restoration options: data extraction only, data extraction then decryption, decryption only, and decryption then data extraction. Furthermore, even when a user is allowed to only decrypt images, the user can also extract the payload later from marked images by obtaining additional privilege. With this feature, the proposed method is expected to be applied to a wide range of applications. As seen in the results, it is clear that the proposed method is one of the best RDH-EI methods ever.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author.

Conflicts of Interest:
The authors declare no conflict of interest.