1 Introduction

Because of the rapid growth of computer and internet technology, multimedia such as images, audio, and video are distributed through the Internet. How to protect digital content security is a very important issue. The two most common methodologies are cryptography and steganography which can maintain data security. Steganography can embed a secret message in a meaningful cover image and form a stego-image which is not apparent to other people. The most important characteristic is the imperceptibility. Another important characteristic is the capacity. If steganographic technology can embed more secret data in a cover image, the user transfers less stego-images and avoids the suspicions of unprivy people.

The most well known steganographic technology is the least significant bit(LSB) replacement method. This scheme is very simple, fast and has good stego-image quality. Unfortunately, it is not secure. There are many detection technologies which can detect LSB replacement methods. One famous of detection technology is RS detection [1]. In 2006, Zhang and Wang proposed a data hiding scheme based on Exploiting Modification Direction(EMD) [12]. The EMD scheme used n pixels for a group and only modified one pixel value + 1 or − 1 at most in a group. The most important contribution of EMD is that the image quality is very good and better than most data hiding schemes such as LSB replacement methods. But, there are two shortcomings. One is that it must transform the binary secret data to (2n + 1)-ary to get full capacity before embedding by the using EMD method. The other is that the embedding capacity decreases fast when n increases. EMD maintains embedding capacity of slightly more than 1 bpp when n = 2. Afterwards, many similar EMD-type methods [211] were proposed. In 2007, Lee et al. proposed the LWC scheme [11] to improve the embedding capacity from 1.16 to 1.5 bpp when n = 2. However, it does not have the flexibility of changing pixel group size. In order to improve this shortcoming, the generalized EMD(GEMD) scheme [3] was proposed by Kuo et al. in 2013. The major contribution of GEMD scheme is that it used n pixels for a pixel group to embed (n+1) bits secret data. In other words, the embedding capacity of the GEMD scheme always maintains over 1 bpp. Specifically, the LWC scheme is the special case of GEMD scheme.

Besides the above benefits, the GEMD scheme can also prevent RS detection. In fact, the best embedding capacity of the GEMD scheme is 1.5 bpp when n = 2. Intuitively, the embedding capacity still decreases as n increases. In order to improve this shortcoming, a data hiding scheme based on re-adjusted GEMD method is proposed in this paper. We demonstrate that our scheme maintains embedding capacity at 2 bpp even when n increases and also maintains good image quality.

The rest of this paper is organized as follows: In Section 2, we will review the EMD [12], the LWC [11] and the GEMD schemes [3] briefly. Then, we introduce our proposed data hiding scheme and provide experimental results in Sections 3 and 4, respectively. Finally, some conclusions are given in Section 5.

2 Review data hiding schemes

The EMD type data hiding scheme maintains good stego-image quality and also prevents RS detection. In this section, we will introduce the EMD [12], LWC [11] and GEMD schemes [3] in detail.

2.1 EMD data hiding scheme [12]

In 2006, Zhang and Wang proposed a data hiding scheme based on Exploiting Modification Direction. They used n pixels for a group and define the extraction function as (1). They adjust one pixel value + 1 or − 1 at most to embed (2n + 1)-ary secret data.

$$\begin{array}{@{}rcl@{}} f_{EMD}(g_{1}, g_{2}, \ldots, g_{n}) = \left[\sum\limits_{i=1}^{n} (g_{i} \times i)\right] \mod {(2n+1)}, \end{array} $$
(1)

where g i is the i-th pixel value for adjusting, and n is the number of values required for implementing the selected pixels.

figure e

Example 1

Given three cover image pixels (g 1,g 2,g 3) = (62,63,60) and secret data s = (11)2, we can obtain output stego-image pixels \((g_{1}^{\prime }, g_{2}^{\prime }, g_{3}^{\prime }) = (61, 63, 60)\) using the EMD embedding procedure as the following:

Step 1.:

Transform s = (11)2 = (3)7.

Step 2.:

Compute f E M D = (62 × 1 + 63 × 2 + 60 × 3) mod 7 = 4.

Step 3.:

Compute d = (3 − 4) mod 7 = 6.

Step 4.:

Compute \(g_{7-6}^{\prime } = 62-1=61\) because d > n = 3.

The stego-pixel value is \((g_{1}^{\prime }, g_{2}^{\prime }, g_{3}^{\prime }) = (61, 63, 60)\). When the receiver gets the stego-pixel value, the secret data s is recovered by computing s = f E M D = (61 × 1 + 63 × 2 + 60 × 3) mod 7 = 3 and transform (3)7 to binary (11)2.

The most important contribution of EMD is that the image quality is very good and embedding method by using the modulus function. However, there are two shortcomings. One is that it must transform the binary secret data to (2n + 1)-ary to get full capacity before embedding by the using (1). The other is that the embedding capacity decreases fast when n increases.

2.2 LWC data hiding scheme [11]

For the EMD scheme, the embedding capacity decreases fast when n increases. It maintains slighty more than 1 bpp when n = 2 for [12]. In order to improve the embedding capacity from 1.16 to 1.5 bpp, Lee et al. proposed the improved LWC scheme [11] in 2007. In the LWC scheme, they fixed two pixels for each pixel group and gave the the modified extraction function as (2).

$$\begin{array}{@{}rcl@{}} f_{LWC}(g_{1}, g_{2}) = (g_{1} \times 1 + g_{2} \times 3) \mod {8}, \end{array} $$
(2)

where g 1 and g 2 are the two pixel values for adjusting.

figure f

Example 2

Given two pixels (g 1,g 2) = (62,63) and secret data s = (110)2. We obtain the stego-image pixels \((g_{1}^{\prime }, g_{2}^{\prime }) = (62, 64)\) using the LWC scheme as the following:

Step 1.:

Compute f L W C (62,63) = (62 × 1 + 63 × 3) mod 8 = 3

Step 2.:

Using s = (110)2, find s i = f L W C (g 1,g 2 + 1) = (62 × 1 + 64 × 3) mod 8 = 6

When the receiver gets the two stego pixels, the secret data (110)2 is recovered by using (2) (s = f L W C (62,64) = (62 × 1 + 64 × 3) mod 8 = 6).

2.3 GEMD data hiding scheme [3]

Although the embedding capacity of the LWC scheme can achieved 1.5 bpp, the pixel group size is always fixed. In other words, there are only two pixels in a group and it cannot be extended or changed. That is to say, the LWC scheme is inflexible. In 2013, Kuo et al. proposed a new data hiding scheme based on general EMD. The major property of the GEMD scheme is having n pixels for each pixel group and maintaining embedding capacity of more than 1 bpp. Moreover, the LWC scheme is a special case of the GEMD scheme when n = 2. In the GEMD scheme, the new extraction function is shown as (3).

$$\begin{array}{@{}rcl@{}} f_{GEMD}(g_{1}, g_{2}, \ldots, g_{n}) = \left[\sum\limits_{i=1}^{n} (g_{i} \times (2^{i}-1))\right] \mod {2^{n+1}}, \end{array} $$
(3)

where g i is the i-th pixel value for adjusting, and n is the number of values required for implementing the selected pixels.

figure g

Example 3

Given three cover image pixels (g 1,g 2,g 3) = (62,63,60) and secret data s = (1100)2, we obtain output stego-image pixels \((g_{1}^{\prime }, g_{2}^{\prime }, g_{3}^{\prime }) = (62, 62, 60)\) using the GEMD embedding procedure.

Step 1:

Compute f G E M D = (62 × 1 + 63 × 3 + 60 × 7) mod 16 = 15.

Step 2:

Using 4 bits secret data (1100)2, transform it to decimal (12)10.

Step 3:

Compute d = (12 − 15) mod 16 = 13.

Step 4:

Obtain k = 4 since d = 13 > 23.

Step 5:

Execute case 4, compute d = 24 − 13 = 3 = (0011)2 = (b 3 b 2 b 1 b 0)2 to get \(\left (g_{1}^{\prime }, g_{2}^{\prime }, g_{3}^{\prime }\right ) = (62, 62, 60)\).

Therefore, the receiver can recover the secret data s = f G E M D = (62 × 1 + 62 × 3 + 60 × 7) mod 16 = 12 = (1100)2 when receiving the stego-pixel values (62,62,60).

3 The proposed scheme

Kuo et al. proposed the GEMD scheme which has benefits of both EMD and LWC schemes. GEMD can maintain more than 1 bpp capacity and good image quality. However, we still think the capacity is not enough. Therefore, we will re-adjust stego-pixel value of GEMD to embed extra secret data and keeps the extraction function value changeless. Our embedding structure is shown as Fig. 1 and the detail algorithm is described in Algorithm 4.

Fig. 1
figure 1

The structure of embedding phase

figure h

When the receiver gets the stego-image, he can extract (n + 1) secret data bits by using GEMD extraction function. Then the receiver extracts (n − 1) secret data bits for the LSB of n to 2 pixels in group. The extracting structure is shown as Fig. 2 and the detail algorithm is described in Algorithm 5.

Fig. 2
figure 2

The structure of extracting phase

figure i

The following two examples show use of the embedding and extracting procedure.

Example 4

Given three cover image pixels (g 1,g 2,g 3) = (62,63,60) and secret data s = (110011)2, we obtain output stego-image pixels \((g_{1}^{\prime }, g_{2}^{\prime }, g_{3}^{\prime }) = (60, 65, 59)\) using the RGEMD embedding procedure as following:

Step 1.:

Compute f G E M D = (62 × 1 + 63 × 3 + 60 × 7) mod 16 = 15.

Step 2.:

Access 4 bits secret data (1100)2 and then transform it to decimal (12)10.

Step 3.:

Compute d = (12 − 15) mod 16 = 13.

Step 4.:

Get k = 4 because d = 13 > 23.

Step 5.:

Execute case 4, compute d = 24 − 13 = 3 = (0011)2 = (b 3 b 2 b 1 b 0)2 and get \(\left (g_{1}^{\prime }, g_{2}^{\prime }, g_{3}^{\prime }\right ) = (62, 62, 60)\).

Step 6.:

Using the next 2 bits \((b_{1}^{\prime } b_{0}^{\prime })_{2} = (11)_{2}\), \(b_{1}^{\prime } =1 \neq LSB(g_{3}^{\prime })=LSB(60)\) \(g_{3}^{\prime }=60 \geq g_{3} =60 \& g_{2}^{\prime }=62 \leq g_{2} =63\), \(g_{3}^{\prime }=60-1=59\); \(g_{2}^{\prime }=62+2=64\); \(g_{1}^{\prime }=62+1=63\); \(b_{0}^{\prime } =1 \neq LSB(g_{2}^{\prime })=LSB(64)\) \(g_{2}^{\prime }=64 \geq g_{2} =63 \& g_{1}^{\prime }=63 > g_{1} =62\), \(g_{2}^{\prime }=64+1=65\); \(g_{1}^{\prime }=63-2=61\); \(g_{1}^{\prime }=61-1=60\).

Finally the stego-image pixels are \((g_{1}^{\prime }, g_{2}^{\prime }, g_{3}^{\prime }) = (60, 65, 59)\).

Example 5

Given three stego-image pixels (60,65,59). We obtain the secret data s = (110011)2 using the RGEMD extraction procedure as following:

Step 1.:

Compute f G E M D = (60 × 1 + 65 × 3 + 59 × 7) mod 16 = 12 = (1100)2.

Step 2.:

\(LSB(g_{3}^{\prime })=1\) and \(LSB(g_{2}^{\prime }) =1\), concatenate so s 2 = (11)2.

Step 3.:

Concatenate s 1 and s 2 to get s = (110011)2.

4 Experimental results

In this section, simulations and results of our proposed scheme are shown. For our experiment, the hardware environment is a personal computer with an Intel Core Duo 2 E4600 2.4 (GHz) CPU with 2G RAM. The operating system is Windows 7 running MATLAB. We use eight 512 × 512 grayscale images (Lena, Baboon, F16, Barbara, Boat, Goldhill, Tiffany and Pepper) and four 512512 color images (Lena, Baboon, Tiffany, Pepper) as shown in Figs. 3 and 4

Fig. 3
figure 3

Eight grayscale test images

Fig. 4
figure 4

Four color test images

4.1 Performance analysis

The major concerns for data hiding scheme analysis are capacity and image quality. Peak signal to noise ratio (PSNR) measures stego image quality. The higher the PSNR, the more similar the stego image is to the cover image. In general, if PSNR is lower than 30 dB, the stego image can be visually distinguished from the cover image as different. The PSNR and the mean square error (MSE) is calculated as follows:

$$\begin{array}{@{}rcl@{}} PSNR & = & 10 \times \log_{10} \frac{255^{2}}{MSE}, \end{array} $$
(4)
$$\begin{array}{@{}rcl@{}} MSE & = & \frac{1}{M\times N} \sum\limits_{x=1}^{M} \sum\limits_{y=1}^{N} (I(x,y) - I^{\prime}(x,y))^{2}, \end{array} $$
(5)

where M and N represent the length and width of the image, respectively. The stego images were produced in raster-scan order.

The comparison between EMD, LWC, GEMD and our scheme are shown as Table 1. From this table, the image quality of all schemes are more than 44 dB, so the stego-image quality is good enough to avoid human eye detection. The embedding capacity of our proposed scheme maintains 2 bpp which is independent of n. However, other schemes suffer as n increases.

Table 1 Embedding capacity and PSNR comparison table for the gray stego image

In Table 2, we show the color images capacity and PSNR comparison table for EMD, LWC, GEMD and our scheme. We can find that the capacity becomes triple because there are three channels (RGB) in color images to embed secret bits. According to Table 2, the color stego image’s quality(PSNR) is similar to the gray stego image’s quality.

Table 2 Embedding capacity and PSNR comparison table for the color stego image

The performance comparison for gray images and color images are shown in Figs. 5 and 6, respectively. Since it is used the fixed points (i.e. n = 2) in the LWC scheme, there is only one point in the graph. According to Figs. 5 and 6, all points of proposed scheme are similar in our proposed scheme. In other words, the performance of our scheme is not concerned with the size of pixel group.

Fig. 5
figure 5

The performance comparison for gray images

Fig. 6
figure 6

The performance comparison for color images

4.2 Steganalysis

Most EMD type data hiding scheme avoid RS detection. We confirm our scheme thwarts RS detection. In RS steganalysis, n adjacent pixels (g 1,g 2,⋯ ,g n ) are selected as a pixel group. Then the discrimination function \(DF(g_{1}, g_{2}, \cdots , g_{n})={\sum }_{i=1}^{n}|g_{i+1} - g_{i}|\) is used to quantify the smoothness or regularity of each pixel group.

The discrimination function is used to define three types of pixel groups: Regular (R), Singular (S), and Unusable (U). The R means \(DF\left (g_{1}^{\prime }, g_{2}, g_{3}, g_{4}^{\prime }\right ) >DF(g_{1}, g_{2}, g_{3}, g_{4})\) and S means \(DF\left (g_{1}^{\prime }, g_{2}, g_{3}, g_{4}^{\prime }\right ) <DF(g_{1}, g_{2}, g_{3}, g_{4})\). We use masks M = [1001] and − M = [−100 − 1] to flip pixels (g 1,g 2,g 3,g 4) to \(\left (g_{1}^{\prime }, g_{2}, g_{3}, g_{4}^{\prime }\right )\). It measures that R M , R M , S M , and S M and then transform to percentages. The more detail RS detection method is described in [1]. The simulation results for 2-LSB and our proposed scheme are shown in Fig. 7. The statistical hypotheses of the RS-diagram are R M R M and S M S M . The 2-LSB scheme is detected by RS steganalysis while our scheme avoids detection.

Fig. 7
figure 7

RS detection

5 Conclusion

In this paper, we improve the GEMD data hiding scheme. After using GEMD to embed (n + 1) bits in each group, we re-adjust the stego-pixel values to embed (n − 1) bits and keep the extraction function the same. The most significant contribution of our approach is that the capacity maintains 2 bpp when n increases. Addition contributions in this paper include: the proposed scheme is more flexible, the stego-image quality is over 44 dB, and it is not detected by RS detection.