Keywords

1 Introduction

Digital steganography is the set of techniques designed to conceal digital data (the payload) within a digital medium or carrier. Unlike related areas, such as cryptography or watermarking, steganography techniques aim to keep the existence of a message undetected and to continuously increase the amount of input data to be embedded [3].

In digital image steganography, the pixel intensities are used to hide the payload data. A common approach, and perhaps the simplest, is to use some form of Least Significant Bit (LSB) insertion method [1]. LSB methods replace b least significant bits of the carrier pixels with the same number of payload data bits. The less bits being replaced, the less altered the carrier image will be, but also the payload will be smaller. Some LSB substitution techniques have implemented an optimal pixel adjustment for data embedding to reduce the disruption of the carrier image [10]. Other steganographic methods include an assortment of transformation as well as masking and filtering techniques. Surveys and reviews of current methods are readily available in the literature [3, 7].

With the objective of increasing the amount of data that an image can carry, a set of techniques have been proposed that use the difference between two neighbour pixels to hide input data. This difference can be computed in any neighbouring direction. Wu and Tsai [11] proposed a Pixel Value Differencing (PVD) method that produces a stego-image with considerable payload data and a substancial image quality. Thereafter various approaches based on PVD have been produced [2, 4, 12].

Ideally, the payload must be recovered using only the resulting pixel values, and all pixels of the original image should be used to embed data in order to achieve a higher payload. However, many PVD methods yield overflow or underflow pixels (i.e., out of the valid range interval) and decide either to ignore or to somehow adjust the resulting pixel values. This, however, may lead to a lower payload or to include additional strategies to retrieve the embedded data [11] that may reveal the existence of a hidden message.

In this paper, we adopt the Tri-way Pixel-Value Differencing method and find an optimal pixel value for each computed pixel block such that their difference holds the maximum input data. Our method reduces the size of the search space and computes a much more smaller set of feasible solutions. In addition, two more strategies are discussed to further increase the size of the embedded payload. The method is designed in such a way that the resulting pixel intensities are never out of the valid interval and it uses all pixel blocks to carry payload data. A series of experimental results show the feasibility of the method.

We begin in Sect. 2 by covering the basics of the Pixel-Value Differencing method. Section 3 presents a detailed description of our two optimisation algorithm approaches. Section 4 presents several experimental results, and Sect. 5 concludes the paper.

2 Pixel-Value Differencing

The PVD method [11] assumes that the payload is a continuos stream of input bits that represent any type of digital data. The PVD embeds data using the intensity difference of two contiguous pixels. The idea is to modify these pixels by adding a decimal conversion of some input data bits in such a way that their value difference is kept to preserve the image quality. Regions in the image with larger differences in pixel intensities can carry more pieces of payload than others. This usually happens in the areas with evident edges and less frequently in smoother regions. The method provides a good embedding capacity but is prone to be detected using statistical based stego-analysis methods [5].

Chang et al. [2] proposed a modified version of the PVD named Tri-way Pixel-Value Differencing (TWPVD). Whereas the PVD inserts data in only one pixel pair, the TWPVD uses horizontal, vertical and diagonal diferences (hence its name) in \(2\times 2\) pixel blocks to hide input data, thus achieving a higher payload than the PVD in the carrier image. One problem arising in PVD based methods is that they frequently yield overflow/underflow pixel values. These pixels are either adjusted or ignored by the method, thus reducing the number of pixels available to carry data payload [2, 6].

2.1 Tri-Way Pixel-Value Differencing

The Tri-way Pixel-Value Differencing (TWPVD) method was designed to get more pixels involved in the data embedding process [2]. The TWPVD divides the carrier image into non-overlapping blocks of \(2\times 2\) consecutive pixels. Three difference values are computed in each block from the values of two neighbour pixels in three distinctive directions. The first difference is computed between the pixel in the upper left corner, namely the pivot, and the pixel on its right. The second difference is between the pivot and the pixel in the opposite corner, and the third one is also between the pivot and the pixel below it. Each difference belongs to one of a predefined set of range intervals which, in turn, determines the number of bits to be inserted in every pixel pair. Each range interval \(R_k\) has a lower \(l_k\) and an upper \(u_k\) value listed in the form of a range table. The range table has been designed simply by computing each interval width using a power of two, either to provide large capacity or to provide high imperceptibility [11, 12]. Other approaches have designed the range table based on the perfect square number [9], or have opted for entirely replacing the range table with a well crafted function based on the floor and ceiling functions [4].

Regardless of how these range intervals are produced, the TWPVD algorithm follows these steps:

  1. 1.

    Compute the differences \({d}_{i}={p}_{i}-{p}_{1}\) within the pixel block \(i\in \{1,2,3,4\}\), where

  2. 2.

    Locate for each \({d}_{i}\) the range k such that \(l_k\le |{d}_{i}|\le u_k\)

  3. 3.

    Compute the amount of input data bits \({t}_{i}\) to be inserted in the difference i of the block \({p}_{i}\) as follows:

    $$\begin{aligned} {t}_{i}= \left\{ \begin{array}{ll} 0 &{} \text {if } i=1\\ \lfloor \log _2(u_k-l_k+1) \rfloor &{} \text {otherwise} \\ \end{array} \right. \end{aligned}$$
    (1)
  4. 4.

    Compute the decimal representation \({b}_{i}\) of the \({t}_{i}\) bits

  5. 5.

    A new \({d'}_{i}\) is computed for each \({d}_{i}\)

    $$\begin{aligned} {d'}_{i}=l_{k_{i}}+{b}_{i} \end{aligned}$$
    (2)
  6. 6.

    Later the TWPVD uses each \({d'}_{i}\) to compute the values of the resulting pixels \({p}'_{i}\) using a well crafted set of rules [2]. We have adopted the TWPVD by replacing these rules with an optimisation strategy to determine the best pixel values that hold the maximum payload.

A closer look to this algorithm, reveals that it also produces overflow/underflow pixel values that are simply skipped as data payload carriers. Worse still, TWPVD authors [2] do not seem to discuss how the extraction algorithm knows which pixels are being ignored [4]. This is fundamental to guarantee the integrity of the secret message.

3 An Optimisation Approach to Modify the TWPVD

Any PVD method can be seen as an optimisation problem as follows: Given \({d'}_{i}\) and \({p}_{i}\), search for a solution \({p'}_{i}\) subject to the following set of conditions:

  1. 1.

    Overflow/underflow must be prevented subject to \(0\le {p'}_{i} \le 255\)

  2. 2.

    Retrieving the payload data is subject to \({d'}_{i}=|{p'}_{i}-{p'}_{1}|\), where \(p'_i\) and \(p'_1\) are now variables to be searched as an optimization problem which will define the stego-image.

  3. 3.

    Distortion of the resulting image must be subject to minimize the objective function

    $$\begin{aligned} f({p}_{i},{p'}_{i})=\sum _{i=1}^{4}({p}_{i}-{p'}_{i})^2 \end{aligned}$$
    (3)

We know that \({p'}_{i}=|{d'}_{i}|\) is a solution, i.e. \(p_1 = 0\), that fulfills conditions 1 y 2, but does not fulfill condition 3 because it causes a major distortion to the resulting stego-image. Nonetheless, the solution shows that there exist at least one solution for any given input.

Since there are 4 pixels per block in the range [0..255], we can easily estimate the size of the search space to be \(2^{32}\) possible pixel value combinations times the carrier image dimensions divided by 4. These solutions take far too long to be explored efficiently, as shown in Table 1.

Table 1. Comparison between Optimal-TWPVD and a simply Brute Force strategy added to the TWPVD. The time performance advantage is clear.

One alternative is to reduce the size of the search space so that it can be explored in useful times.

Using equation from condition 2 it follows that

$$\begin{aligned} {p'}_{i}=\pm {d'}_{i}+{p'}_{1} \end{aligned}$$
(4)

This evidently means that we can compute \({p'}_{i}\) using the two following variables:

  1. 1.

    \(\pm {d'}_{i}\) takes the different sign combinations for \({d'}_{i}\). These combinations are 8 because \({d'}_{1}\) is always 0 and \({d'}_{2},{d'}_{3},{d'}_{4}\) only can take 2 different values: one positive and one negative of equal magnitude.

  2. 2.

    \({p'}_{1}\) must be subject to \(0\le {p'}_{1} \le 255\). This means that \({p'}_{1}\) only can take 256 distinct values.

This further reduces the size of the search space to \(2^{11}\). A search space of this size can be readily explored in its entirety. That is, all possible values for \({p'}_{1}\) must be combined with all possible values for \(\pm {d'}_{i}\).

3.1 An Additional Optimisation Strategy

We now describe an additional optimisation strategy to further increase the payload inserted by the method from Sect. 3. Such strategy is based on the first derivative of the objective function with respect of \({p'}_{1}\) and discards the overflow/underflow solutions.

Using Eqs. 3 and 4, a quadratic function can be produced in terms of \({p'}_{1}\), namely:

$$\begin{aligned} f({p'}_{1})=\sum _{i=1}^{4}(\pm {d}_i+{p'}_{1}-{p}_{i})^2 \end{aligned}$$
(5)

Eight different quadratic curves can be plotted from the eight different combinations of signs in \(\pm d_i\). When computing the first derivative of these functions, a point for each curve can be found for which f is minimum:

$$\begin{aligned} {p'}_{1}=\frac{1}{4}\sum _{i=1}^{4}{p}_{i}-\frac{1}{4}\sum _{i=1}^{4}\pm {d}_{i} \end{aligned}$$
(6)

The resulting 8 candidate values for \({p'}_{1}\) can become 16 because Eq.  (6) can yield real numbers that need to be converted into integers using both the ceil and floor functions.

In some cases the optimal point can be off the valid range or can even cause some of the other 3 pixels to be off. It is necessary then to move that point within the proper range as that value is potentially a solution.

Figure 1 shows 2 curves plotted using the objective function. These curves are bounded between a pair of dotted lines representing the upper and lower bounds valid for \({p'}_{1}\). It also shows that the points of minimum value are not always within the valid interval and is necessary to move that point to a valid area.

Fig. 1.
figure 1

Two different objective function graphs

Equation (4) can yield valid intervals for each curve as \(\max (\pm {d}_{i})\le {p'}_{1} \le \min (\pm {d}_{i}+255)\). From this equation, we can define the adjustment function:

$$\begin{aligned} A(p,M,m)=\left\{ \begin{array}{lll} 0 &{}if&{} M\le p\le m\\ M-p &{}if&{} p< M \\ -(p-m) &{}if&{} p> m\\ \end{array} \right. \end{aligned}$$
(7)

Therefore the optimal point in the valid range would be defined as:

$$\begin{aligned} {p'}_{1}={p'}_{1}+A({p'}_{1},\max (\pm {d}_{i}),\min (\pm {d}_{i})+255) \end{aligned}$$
(8)

As mentioned before, this point needs to be adjusted using the ceil or floor functions. Both functions yield an identical or extremely close value. Because there are 8 curves each with 2 solutions, we end up with a new search space of only 16 potential solutions.

The algorithm follows these steps:

  1. 1.

    Go through steps 1–5 of the algorithm from Sect. 2.1

  2. 2.

    Compute \(s_i=\pm {d}_{i}+{p'}_{1}\) using the ceil or floor functions. Overflow/underflow solutions are discarded

  3. 3.

    The optimal solution is given by \({p'}_{i}=\min (f({p}_i,s_i))\)

  4. 4.

    Replace the original \(2\times 2\) pixel block with the optimal solution found

  5. 5.

    Repeat for each \(2\times 2\) pixel block of the carrier image

To recover the secret message, the inverse process is applied as follows:

  1. 1.

    Divide the carrier image into non-overlapping blocks of \(2\times 2\) consecutive pixels

  2. 2.

    Compute the differences \({d}_{i}={p}_{i}-{p}_{1}\) within the pixel block \(i\in \{1,2,3,4\}\)

  3. 3.

    For each \(d_i\) locate the table range \(r_i=k\) such that \(l_k \le |d_i| \le u_k\)

  4. 4.

    Compute the number of inserted bits in each difference

    \({t}_{i}= \left\{ \begin{array}{ll} 0 &{} \text {if } i=1\\ \lfloor \log _2(u_{r_i}-l_{r_i}+1) \rfloor &{} \text {otherwise} \\ \end{array} \right. \)

  5. 5.

    The entire data payload is recovered by concatenating the binary representation of \(b_i=d_i-l_{r_i}\)

3.2 Inserting an Extra Bit

The method can insert an additional bit to further increase the secret message inserted in each \(2\times 2\) block with a minimal deterioration to the carrier image.

The floor and ceil functions yield two consecutive integer numbers that produce very close or even identical Objective Function results. This type of function curves constantly appear and are used as indication for inserting an additional bit of the secret message. This additional bit is called \(\beta \). If \(\beta =0\), \({p'}_{1}\) must be even, if \(\beta =1\), \({p'}_{1}\) must be odd.

To find the optimal we say that \(2c={p'}_{1}-\beta \) and modify Eq. 4 as follows:

$$\begin{aligned} {p'}_{i}=\pm {d}_{i}+2c+\beta \end{aligned}$$
(9)
$$\begin{aligned} f(c)=\sum _{i=1}^{4}(\pm {d}_i+2c+\beta -{p}_{i})^2 \end{aligned}$$
(10)

Therefore, the valid interval for the optimisation problem is given by:

$$\begin{aligned} c=\frac{1}{8}\sum _{i=1}^{4}{p}_{i}-\frac{1}{8}\sum _{i=1}^{4}\pm {d}_i-\frac{1}{2}\beta \end{aligned}$$
(11)
$$\begin{aligned} c=c+A(c,\max (-\frac{\beta }{2}-\frac{1}{2}(\pm {d}_{i})),\min (-\frac{\beta }{2}-\frac{1}{2}\pm ({d}_{i})+255)) \end{aligned}$$
(12)

The algorithm is also modified as follows:

  1. 1.

    Go through steps 1–5 of the algorithm from Sect. 2.1

  2. 2.

    Compute \(s_i=\pm {d}_i+c\) using the ceil or floor functions. Overflow/underflow solutions are discarded

  3. 3.

    The optimal solution is given by \({p'}_{i}=\min (f(p_i,s_i))\)

  4. 4.

    Replace the original \(2\times 2\) pixel block with the optimal solution found

  5. 5.

    Repeat for each pixel block of the carrier image

To recover the message payload, the same steps from Sect. 3.1 are used, and an extra bit 0 is added to the message if \(p_1\) is even or a 1 otherwise.

4 Experimental Results

A set of images were used to test the performance of our algorithms and to compare our results to those previously published in the literature. All carrier images, shown in Fig. 2, are 8-bit grayscale images of size \(512\times 512\). These images belong to a larger set that have become a de facto standard in Image Processing and Computer Vision experiments for testing new developments. We also have chosen these images to compare our results with previous work by Peng et al. [8] and Hernandez-Servin et al. [4]. Both authors compared their own results with work previously published. In addition, we also compare the performance of our algorithm with the results of the TWPVD [2].

Fig. 2.
figure 2

Original images (first row). Resulting stego images using the Optimal-TWPVD (second row). Resulting stego images using the OTWPVD and Extra Bit Insertion (third row)

The peak signal-to-noise ratio (PSNR) is used to measure the difference between the original carrier image and the image with the message payload. The higher the PSNR, the better the quality of the stego image. The number of bits per pixel (bpp) for each test image, is computed simply by dividing the number of bits inserted by the number of pixels in the carrier image.

Table 2 shows a comparison between the Optimal-TWPVD and the Extra Bit Insertion algorithms. While the former shows a better performance than previous work (as shown in Table 4), the latter further increases the overall results in terms of both the amount of data payload (the bpp) inserted, and the image distortion measured with the PSNR in all images tested. This might seem expected as both the Optimal TWPVD and the Extra Bit Insertion strategies use every \(2\times 2\) block to carry data payload. No pixel block is ignored and no pixel overflow/underflow occurred.

Table 2. Comparison between the Optimal-TWPVD and the Optimal-TWPVD with Extra Bit Insertion

We also compare our results with those from the TWPVD [2] in Table 3. Since our algorithms search for the optimal pixel values for each block, the results are superior in terms of both bpp and PSNR. The general notion is that less data embedded should result in less distortion of the carrier image, which is not observed by comparing the PSNR values of our experiments.

Table 3. Comparison between the TWPVD and a our Optimal-TWPVD

A similar comparison with recent results by Peng et al. [8] and Hernandez-Servin et al. [4] is shown in Table 4. This table also shows favorable results in terms of both data payload carried and stego image quality.

Table 4. Comparison between our proposals Optimal-TWPVD & Extra Bit OTWPVD, and Hernadez-Servin et al. [4] and Peng et al. [8]

5 Conclusions

This work designs an optimisation algorithm that modifies and improves the TWPVD [2] steganographic method. It is favourably compared against the TWPVD and also against recent results by Peng et al. [8] and Hernandez-Servin et al. [4].

Our results show improvements in several important aspects, namely, (1) Number of Bits per pixel inserted, (2) Better stego image quality measured with the PSNR, (3) No overflow/underflow pixels are produced, and (4) No blocks of pixels are skipped or ignored as data carriers.

The major merit of our algorithms is to reduce the feasible set of possible pixel values for each block such that the search for the best solution in terms of both data payload and stego image quality can be efficiently conducted.

There are a couple directions in which this work may proceed. The first logical next step is to use the method to hide data payload into color images. The obvious result would be to achieve a very large payload insertion, but the effects in color and general image distortion may either require to adapt or entirely change the algorithm.