Keywords

1 Introduction

With the increase of information exchange via internet, protection of the digital products has emerged as an urgent problem in aspects of information technology, such as authentication, security, copyright protection and so on [1]. Data hiding is a useful technique for solving this problem, in which a secret data is embedded within host object. Objects with and without the hidden data are called stego object and cover (original) object respectively [8, 10]. Most of works has been focused on digital images.

In most applications, it is usually tolerable that slight degradation is remained within the original image after extracting data. However, in the recent years, reversible data hiding (RDH) has been intensively investigated as a special kind of data hiding technique which requires the exact restoration of the cover images from the stego images after the hidden data have been extracted [2, 9, 14]. Hiding ratio and stego image quality are evaluated by bit per pixel(bpp) and Peak Signal to Noise Rate (PSNR) respectively, considering as two important metrics in evaluating the RDH performance [11].

Generally, there are three mechanisms which can be nominated as typical techniques of reversible data hiding: difference expansion (DE), histogram shifting (HS) and prediction error (PE). Although PE [7] and DE [11] methods keep the PSNR of stego images high, the improvement of visual quality is not obvious. Most HS methods [1, 3, 4, 6, 13] are performed by modifying the histogram of the cover image. HS algorithms are relatively simple and the location map for HS is small in size for low capacity case, which is an advantage of HS based RDH.

Recently, Wu et al. proposed a novel RDH algorithm with contrast enhancement (RDH-CE) based on the principle that image contrast enhancement can be achieved by histogram equalization [13]. Unlike previous works for improving the PSNR value of stego image, they noted fact that data hiding and contrast enhancement could be archived simultaneously. As a result, RDH-CE achieved a good effect in improving visual quality especially for poorly illustrated images while providing considerable embedding capacity. In Wu’s method, however, the PSNR of stego image is relatively low and the embedding performance is largely influenced by the histogram distribution of cover image. The PSNR is still considered as one of the most common and important metrics for evaluating the performance of almost all the data hiding methods and express difference between original image and stego image correlated with the security of stego system. Based on this perspective, we present a reliable RDH method based on the adaptive histogram shifting for digital images to improve the PSNR of stego image while maintaining the good effect of the contrast enhancement archived by Wu’s work. Experimental results show that our method has improved efficiently the PSNRs of stego images.

The rest of this paper is organized as follows. Section 2 introduces briefly about Wu’s algorithm and presents the details of our RDH method based on the adaptive histogram shifting. Our experiment results are presented in Sect. 3. Finally, a conclusion will be drawn in Sect. 4.

2 Adaptive Histogram Shifting Based RDH

In this section, RDH-CE algorithm proposed in [13] is explained briefly at first in Sect. 2.1. Then, the details of our adaptive histogram shifting based RDH method are presented in Sect. 2.2.

2.1 RDH-CE Method

Selecting two highest peaks to be split in histogram of the image and shifting histogram bins for peak split, which is the core technique of RDH-CE. Consider a gray scale-image C consisting of \(j (j\in [0, 255])\) different pixel values. Then the image histogram, denoting G, contains \(i (i \le j)\) nonempty bins, in which the two bins with the highest frequency values are chosen in each time for data embedding. We use \(G_{a}\) and \(G_{b}\) to denote the smaller and bigger bin values corresponding to the two highest peaks in the histogram, respectively. At this step, the embedding procedure is performed in the way that the binary bits are either added to or subtracted from the pixel values i according to Eq. 1,

$$\begin{aligned} i' = {\left\{ \begin{array}{ll} i-1 &{} \text {for } i<G_a\\ G_a-m_k &{} \text {for } i=G_a\\ i &{} \text {for } G_a<i<G_b\\ G_b+m_{k} &{} \text {for } i=G_b\\ i+1 &{} \text {for } i>G_b\\ \end{array}\right. } \end{aligned}$$
(1)

where \(i'\) and \(m_{k}\) are the modified pixel value and the k-th binary bit of the data to be embedded, respectively. The left bins of \(G_{a}\) and the right bins of \(G_{b}\) are shifted to the locations of the next adjacent bins toward the left and right ends (0 and 255) in G, respectively. A location map is generated to record the locations of the pre-shifted (pre-modified) pixels for preventing overflow or underflow. The location map is compressed by JBIG2 [13] to increase the embedding efficiency. A final data to be embedded consists of 3 parts: a location map, a secret data and two peak bin values. Let \(P_{CE}\) denotes the amount of peak pairs selected by embedding capacity. The above embedding procedure repeats \(P_{CE}\) - 1 times. At the \(P_{CE}\)-th embedding, the binary values of the last two peak bins are kept in LSBs of the first 16 pixels in the last row of the image C by LSB replacement, and the stego image \(C'\) is produced.

The procedure of data extracting and image recovery starts with extracting the \(P_{CE}\)-th peaks, and continues by inverting the procedure of embedding process.

Fig. 1.
figure 1

Block diagram of proposed RDH algorithm

2.2 Procedure of the Proposed Algorithm

The proposed method can be considered as a improved version of RDH-CE. Suppose that N (\(N=2P_{CE}\)) peaks are selected for a given 8-bit gray-level image C. To avoid the possible changes of the bounding pixels caused by overflow or underflow, as doing in RDH-CE, N/2 histogram bins at the right and left ends in G are pre-shifted simultaneously, and locations of pre-shifted pixels are recorded within a location map. The proposed embedding procedure is performed similar to RDH-CE in which peaks are split for data embedding. In our method, only one highest peak is chosen for data embedding in each time instead of utilizing the two highest peaks, and each of peaks can be split in any direction (right or left). Each time a peak is selected for embedding, its histogram shifting direction (HS-direction) is determined based on the PSNR value of the image to be modified prior to the histogram shifting. The PSNR expresses the visual quality of the modified image as well as the difference between the original image and the modified image. Therefore, each HS-direction is selected adaptively so that the modification of the image caused by data embedding is as minimal as possible in each step. Bin values and HS-directions of previous N-1 peaks are kept together with the location map as side information, meanwhile the value and HS-direction of the last N-th peak are saved in LSBs of the excluded 9 pixels using LSB replacement. The data extracting process and image recovery process are performed by reverse process of the data embedding.

The procedure of the proposed algorithm is illustrated in Fig. 1. The embedding process is performed as follows:

Step 1. Pixels which belong to histogram bins in the range of [0, N / 2-1] are added by N / 2 and pixels in the range of [256-N / 2, 255] are subtracted by N / 2 excluding the first 9 pixels in the bottom row. Positions of those pixels are recorded in the location map.

Step 2. The image histogram is calculated excluding the first 9 pixels in the bottom row.

Step 3. One highest peak is selected in the histogram, and its HS-direction is calculated as follows:

Step 3.1. Shift histogram bins in the right side of the selected peak toward the right end by one, and the peak is split with binary bits of data.

Step 3.2. Calculate the PSNR value (R-PSNR) of the right shifted image by Eq. 2.

$$\begin{aligned} PSNR(C, C_p') = 10log_{10} \frac{MAX_C^2}{(1/mn) \sum _{\begin{array}{c} s,t \end{array}} \Vert C(s, t)-C'(s, t) \Vert } \end{aligned}$$
(2)

Here, C is the original image; \(C_p'\) is the modified image using \(p(0<p<N)\) peaks; \(MAX_C\) is the maximum possible pixel value of the original image C.

Step 3.3. Return back the right shifted image into the previous state.

Step 3.4. Shift histogram bins in the left side of the selected peak toward the left end by one, and the peak is split with binary bits of data again.

Step 3.5. Calculate the PSNR value (L-PSNR) of the left shifted image.

Step 3.6. If the R-PSNR is higher than the L-PSNR, then the HS-direction will be set as 1 (right side). Otherwise, it will be set as 0 (left side).

Step 4. To embed data, Eq. 3 is applied to all pixels in the whole image in sequential order excluding those 9 pixels.

$$\begin{aligned} i' = {\left\{ \begin{array}{ll} i-1 &{} \text {if } direction=0(left)\\ G_s-m_k &{} \text {if } i=G_s \text { and }\ direction=0\\ G_s+m_k &{} \text {if } i=G_s \text { and }\ direction=1\\ i+1 &{} \text {if } direction=1(right) \end{array}\right. } \end{aligned}$$
(3)

Here, \(G_s\) indicates the bin value of the selected peak.

Step 5. The value of the peak and its HS-direction are kept as the side information.

Step 6. Then another one peak and its HS-direction in the histogram of the modified image are determined.

Step 7. Step 2 - Step 6 are repeated until all data are embedded.

Step 8. The location map (binary values) is embedded before message bits. The amount of peaks, the length of bitstream in the location map, LSBs of excluded 9 pixels, previous peak values and its HS-directions are embedded when the last peak is split.

Step 9. The last N-th peak value and its HS-direction are embedded into LSBs of excluded 9 pixels of the stego image by LSB replacement.

The extraction process and recovery process are performed as follows:

Step 1. The N-th peak value and its HS-direction are obtained from LSBs of excluded 9 pixels. The amount of peaks, the length of bitstream in the location map, LSBs of excluded 9 pixels are known by using the N-th peak and its HS-direction.

Step 2. The extraction is performed by using Eq. 4.

$$\begin{aligned} m'_{k} = {\left\{ \begin{array}{ll} 1 &{} \text {if } i'=G_s-1 \text { and }\ direction=0\\ 0 &{} \text {if } i'=G_s \\ 1 &{} \text {if } i'=G_s+1 \text { and }\ direction=1 \end{array}\right. } \end{aligned}$$
(4)

where, \(m'_{k}\) is the the k-th binary bit of the data extracted from the stego image.

Step 3. The recovery process is performed by applying Eq. 5 to all pixels excluding the first 9 pixels in the bottom row.

$$\begin{aligned} i = {\left\{ \begin{array}{ll} i'+1 &{} \text {for } i'<G_{s}-1 \text { and }\ direction=0\\ G_{s} &{} \text {for } i'=G_{s}-1 \text { or } i'=G_{s}\ (direction=0) \\ G_{s} &{} \text {for } i'=G_{s} \text { or } i'=G_{s}+1\ (direction=1) \\ i'-1 &{} \text {for } i'>G_{s}+1 \text { and }\ direction=1 \end{array}\right. } \end{aligned}$$
(5)

Step 4. Data are extracted by using the \((N-1)\)-th peak value and its HS-direction, and the previous peak value and its HS-direction are determined from the extracted data.

Step 5. Step 2 – Step 5 are repeated until N equals to 1.

Step 6: The location map is reconstructed from extracted data bits, and pre-shifted pixels are retrieved.

Step 7: LSBs of the first 9 pixels in the bottom row are written back, and the original image is fully recovered.

3 Experiments

Our experiments were performed on the USC-SIPI image database in which images were converted into grey-level images with the size of 512*512 [12]. Message bits are pseudo random binary bits generated by the Matlab function rand(). Figures 2 and 3 show 4 typical images and their histograms used in our experiments.

Fig. 2.
figure 2

4 typical test images used for experiment.

Fig. 3.
figure 3

Histograms of 4 test images in Fig. 2.

Fig. 4.
figure 4

PSNR comparision of the proposed method and RDH-CE using 4 test images in Fig. 2.

For comparision of our method and RDH-CE method at the maximum hiding ratio based on the number of selected peaks, the embedding performance (Fig. 4) is evaluated with PSNR values of stego images resulted by increasing the number of peaks from 1 to 30. Experiment results vary from image to image, but PSNR values of stego images by the proposed method are generally higher than those by RDH-CE method at the same number of peaks. Especially, as one can see from Fig. 3, the proposed method reveals noticeable results in images with the biased and irregularly distributed histogram, such as House, F-16, Tank, U-2, clock, Jelly beans and so on, rather than in those with the histogram distribution close to uniform or symmetric ones (such as Lena, Baboon, Elaine, Fishing boat and so on). For example, when 20 peaks are used in House (Fig. 2b) for embedding, PSNR values of the proposed method and RDH-CE method are 31.46 dB and 29.03 dB at the same amount of embedded data (84,579 bits) respectively. Furthermore, in Airplane (Fig. 2c), although the amount of data (87,764 bits) embedded by using 10 peaks in the proposed method is 2,235 bits more than 85,529 bits in the RDH-CE method, the PSNR value in the former is 5 dB higher than in the later. Our experiments are also evaluated in terms of the degree of contrast enhancement called the relative contrast error (RCE) [5]. Over all test images, the degree of the contrast enhancement in the proposed method is nearly similar to that in the RDH-CE method. Figure 5 shows visual comparison of the stego images resulted by RDH-CE and proposed method.

Fig. 5.
figure 5

Comparision of visual perception of the proposed method and RDH-CE using 20 peaks. (a), (d) Original images. (b), (e) Stego images by RDH-CE. (c), (f) Stego images by proposed method.

Table 1. Comparison of averaged PSNR, RCE and bpp.

Table 1 lists averaged values of PSNR, RCE and hiding ratio resulted by RDH-CE and proposed method over the 32 test images. From average values resulted by using 10, 20 and 30 peaks in the table, it is noted that our method has increased the hiding ratio as well as the PSNR per peak.

4 Conclusions

In this paper, we introduced an adaptive histogram shifting method to Wu’s RDH-CE method to improve the PSNR of stego image. One highest peak is selected in each step for data embedding and its histogram shifting direction is determined adaptively based on PSNR of image to be modified. The proposed method can improve efficiently the PSNR of stego image keeping the degree of the contrast enhancement provided by RDH-CE. From the experimental results, it is noted that determining adaptively HS-direction based on distance metrics between original image and the modified image in each step of the embedding process will result in improving PSNR of stego image efficiently.