High capacity reversible data hiding scheme based upon discrete cosine transformation

High capacity reversible data hiding scheme based upon discrete cosine transformation

The Journal of Systems and Software 85 (2012) 2395–2404 Contents lists available at SciVerse ScienceDirect The Journal of Systems and Software journ...

1MB Sizes 2 Downloads 106 Views

The Journal of Systems and Software 85 (2012) 2395–2404

Contents lists available at SciVerse ScienceDirect

The Journal of Systems and Software journal homepage: www.elsevier.com/locate/jss

High capacity reversible data hiding scheme based upon discrete cosine transformation Yih-Kai Lin ∗ Department of Computer Science, National Pingtung University of Education, No. 4-18 Minsheng Rd., Pingtung City 90003, Taiwan

a r t i c l e

i n f o

Article history: Received 2 November 2011 Received in revised form 7 January 2012 Accepted 8 May 2012 Available online 6 June 2012 Keywords: DCT Data hiding Histogram shifting

a b s t r a c t In this paper, we propose a reversible data hiding scheme based on the varieties of coefficients of discrete cosine transformation of an image. Cover images are decomposed into several different frequencies, and the high-frequency parts are embedded with secret data. We use integer mapping to implement our 2-dimensional discrete cosine transformation. Thus, the image recovered from the modified coefficients can be transformed back to the correct data-hidden coefficients. Since the distribution of 2-dimensional DCT coefficients looks close to Gaussian distribution centralized at zero, it is a natural candidate for embedding secret data using the histogram shifting approach. Thus, our approach shifts the positive coefficients around zero to the right and the negative coefficients around zero to the left in order to leave a space to hide the secret data. The experimental comparisons show that, compared to Chang et al. and Lin et al.’s method, the embedding capacity and quality of the stego-image of the proposed method is a great improvement. © 2012 Elsevier Inc. All rights reserved.

1. Introduction In reversible data hiding techniques (Yang et al., 2011; Chang et al., 2011), after the embedded secret data are extracted, the cover images can be completely recovered from the stegoimages. The reversible data embedding approach can be classified into three categories. They are the spatial-domain methods, frequency-domain, and other compression types, including vector quantization and JPEG. In the spatial-domain approach, the secret data are embedded into the pixels of a given cover image. In the frequency-domain approach, the cover image is transformed to frequency coefficients, and the secret data is embedded into these coefficients. In the compression types, e.g., vector quantization, the secret data is embedded into the unused code space. The simple spatial-domain approach involves hiding the secret data in the least-significant-bit (LSB) of the pixels of an image (Celik et al., 2002; Chan and Chen, 2004; Ker, 2007; Li et al., 2009). The LSB substitution method is simple to implement and easily obtains high hiding capacity, but it is also easily detected by human vision and programs. In 2002, Celik et al. (2002) proposed a generalized least significant bit method. In 2003, Tian (2003) proposed a difference expansion data hiding approach. In his method, the difference values of two neighboring pixels are calculated. The secret data is embedded in the difference values. In 2006, Ni et al.

∗ Tel.: +886 8 722 6141x33559; fax: +886 8 721 5034. E-mail address: [email protected] 0164-1212/$ – see front matter © 2012 Elsevier Inc. All rights reserved. http://dx.doi.org/10.1016/j.jss.2012.05.032

(2006) proposed a reversible hiding scheme to utilize the histogram of the pixels of the cover image. Their method shifts the part of the histogram between the peak point and the minimum point to the right side to create a space for hiding secret data. In these histogram-based data hiding schemes, the maximal hiding capacity is dependent on the number of pixels in the peak point of the histogram. To look for the proper pixels for hiding data without being noticed by humans, transform-based schemes are another choice. In these schemes, cover images are transformed by some kind of frequency-oriented mechanism, e.g., discrete cosine transform (DCT) and discrete wavelet transform (DWT). Then, the secret data are embedded into the frequency-form images by modifying the coefficients. In 2001, Fridrich et al. (2001) proposed an LSB-based reversible data hiding scheme. The secret data is embedded in the LSB of the quantized DCT coefficients. In 2002, Chang et al. (2002) presented a steganographic method based on the JPEG format. They modify the quantization table to get quantized DCT coefficients and to hide the secret data in the least-two-significant bits of the middle-frequency of the quantized DCT coefficients. To improve the embedding capacity, Tseng and Chang (2004) proposed a high capacity hiding method based on the adaptive least-significant bit substitution method. Later, Chang et al. (2007) presented a reversible hiding scheme for hiding secret data in quantized DCT coefficients. In 2010, Lin and Shiu (2010) extended Chang et al.’s idea (2002, 2007) and presented a high capacity data hiding strategy that also embeds data into the coefficients in the middle frequency of the quantized DCT coefficients. That is, Chang et al.

2396

Y.-K. Lin / The Journal of Systems and Software 85 (2012) 2395–2404

(2002, 2007), Tseng and Chang (2004), Lin and Shiu (2010) utilize the redundancy in the quantized DCT coefficients. In other words, their method modifies the quantization stage of JPEG compression and stores the stego-image in JPEG format. Since human vision is insensitive to the varieties of highfrequency components of an image, the secret data can be hidden in the high-frequency parts of an image. To improve the quality of the stego-image, we utilize the concept of decomposition of images. In the proposed method, images are decomposed into several different frequencies, of which the high-frequency parts contain hidden data. A similar idea has been used to compress images in JPEG. In JPEG compression, the information loss due to fixed-precision data storing and computing in the domain transformation stage and also in the quantization stage creates a huge compression rate. In this paper, we propose a method which directly embeds secret data into the DCT coefficients of the cover image. Since the distribution of 2-dimensional DCT coefficients looks close to Gaussian distribution centralized at zero, it is a natural candidate for embedding secret data using the histogram shifting approach. Thus, our approach shifts the positive coefficients around zero to the right and the negative coefficients around zero to the left in order to leave a space to hide secret data. Compared with Ni et al.’s (2006) method, our method does not need to restore the peak point and minimum point for retrieving the hidden data. The overhead of sending this information to the retrieving end is eliminated. The major problem of hiding data in the DCT coefficients is that when we transform the modified DCT coefficients back to the spatialdomain, because the pixels of the image are stored in integer form, rounding errors will be added into the spatial-domain image, and thus cannot be transformed back to the correct modified DCT coefficients when extracting the embedded data. We use one of the forms of integer mapping Hao and Shi (2001) to implement our DCT transformation which maps integer to integer for solving the problem of rounding errors. Thus, if the modified DCT coefficients remain as integers, the image recovered from the modified coefficient can be transformed again to the correct modified coefficient, and the embedded data can be extracted. Instead of hiding the secret data in the quantized coefficients, our method directly embeds the secret data into the pixels of the cover image. Compared with the methods (Chang et al., 2002, 2007; Tseng and Chang, 2004; Lin and Shiu, 2010) mentioned above which embed secret data into quantized spatial-domain coefficients, our stego-image stays in its raw image form instead of some special form of quantized coefficients e.g., JPEG-formatted.

2. Preliminaries An M × N digital image is defined by function f : (N, N) → N where N denotes the set of nature numbers. For convenience, a traditional matrix is used to denote a digital image: X = [xi,j ] where xi,j = f(i, j) for 1 ≤ i ≤ M and 1 ≤ j ≤ N. A real number b can be rounded (denoted by angled brackets  · ) to an integer b by rounding-down, rounding-up, or by using some other methods. Given an N × N matrix A, the kth order leading principal of A is a sub-matrix formed by deleting the last N − k columns, say column k + 1, k + 2, . . ., N and the last N − k rows, row k + 1, k + 2, . . ., N. The kth order leading principal minor of A is the determinant of a k × k principal sub-matrix. The data needing to be hidden are called the secret data and are a sequence of bits denoted by M. The cover image is the image for carrying the hidden secret data. The stego-image is the image containing the hidden secret data. The image quality refers to the similarity of the cover image and the stego-image. The capacity refers to the total bits of hidden secret data.

3. The proposed scheme The proposed reversible data hiding scheme based on discrete cosine transformation is described in this section. A given cover image X is first transformed into a sequence of DCT coefficients Y . Then we present a hiding algorithm to embed the secret data into Y , benefiting from the centralization of the frequency coefficients of images. The secret data M is directly embedded in the high-frequency coefficients part of Y to produce the modified frequency-domain image Y  . Then the modified frequency-domain image Y  is transformed back to the spatialdomain to get the stego-image X  . Because the general DCT coefficients are in the real domain, one major problem is to ensure that the secret data can be extracted when the stegoimages are stored in a small range of integers, e.g., 0 to 255. That is, with the unavoidable error in floating-point number calculation with fixed-precision computing architecture, the image X  in the spatial domain needs to be transformed exactly back to Y  . Therefore, the secret data M and original cover image Y can be extracted from Y  . Our proposed scheme is shown in Fig. 1.

3.1. Reversible decomposition As mentioned above, cover image X is transformed into coefficient matrix Y = AX by transform matrix A. Based on the theorems from Hao and Shi (2001), matrix A has a factorization PS N S N−1 · · · S 0 if and only if the minors of the leading principal sub-matrices of A are all 1s, where P is a permutation matrix, S m = I + em sTm for m = 1, 2, 3, . . ., N, S 0 = I + eN sT0 , em is the mth column vector of the identity matrix, and I is the identity matrix. Consider an integer column vector x of X; the linear transformation Ax = y can be computed by PS N S N−1 · · · S 1 S 0 x = y where y is a column vector of Y . Consider the linear transformation  S m x = y for m = 0, 1, 2, 3, . . ., N,



1

⎢ .. ⎢ . ⎢ ⎢ S m x = ⎢ sm,1  ⎢ ⎢ . ⎣ .. ⎡

0

···

0

···

0

..

.

.. .

.. .

.. .

···

1

.. .

.. .

···

0

···

1





x1



⎢ ⎥ ⎥ ⎢ .. ⎥ ⎥⎢ . ⎥ ⎥⎢ ⎥ ⎢ ⎥ · · · sm,N  ⎥ ⎥ ⎢ xm ⎥ ⎥⎢ ⎥ .. ⎥ ⎢ .. ⎥ .. ⎥ . . ⎦⎢ ⎣ . ⎦ xN



⎡ ⎤ y1 ⎢ ⎥ .. ⎢ ⎥ ⎢ ⎥ . ⎢ ⎥ ⎢ .. ⎥ ⎢ m−1 ⎥ ⎢ . ⎥ N ⎢  ⎥ ⎢ ⎥  ⎢ s x +x + ⎥ ⎢ ⎥ sm,i xi  ⎥ = ⎢ ym ⎥ = y = ⎢ m m,i i ⎢ i=1 ⎥ ⎢ ⎥ i=m+1 ⎢ ⎥ ⎢ .. ⎥ ⎢ ⎥ ⎢ . ⎥ .. ⎢ ⎥ ⎣ ⎦ . ⎣ ⎦ yN x1

xN

where  denotes integer conversion. The reverse transformation is

Y.-K. Lin / The Journal of Systems and Software 85 (2012) 2395–2404

2397

numbers x1 , x2 , . . . xN are maps to the N real numbers y1 , y2 , . . . yN according to the formula yk =

N 

xn cos

 N

n−1+

1 2





(k − 1)

for k = 1, . . . , N.

n=1

The discrete cosine transformation is rearranged to a matrix form C such that y = Cx. The row vectors of transformation matrix C are the basis for synthesizing y. For example, the 1-dimensional 8 × 8 discrete cosine transformation matrix is

⎡ 1.000

Fig. 1. Scheme for embedding secret data and extracting cover image and secret data.



1

⎢ .. ⎢ . ⎢ ⎢  − sm,1  −1 S m y = ⎢ ⎢ ⎢ .. ⎣ . ⎡

0

···

0

···

..

.

.. .

.. .

···

1

···

.. .

.. .

..

···

0

···

.

⎡ ⎤ ⎤ y1 ⎢ ⎥ ⎥⎢ .. ⎥ .. ⎥⎢ . ⎥ . ⎥⎢ ⎥ ⎢ ⎥  − sm,N  ⎥ ⎥⎢ ym ⎥ ⎥⎢ ⎥ ⎥⎢ .. ⎥ .. ⎦⎢ . ⎥ . ⎣ ⎦

⎡ −0.354

⎢ −0.832 ⎢ −0.000 ⎢ ⎢ 0.368 ⎢ A = ⎢ −0.007 ⎢ 0.192 ⎢ ⎢ −0.049 ⎣

yN



y1



0.195

0.831 0.383

1.000

1.000

1.000

1.000

0.556

0.195

−0.195

−0.556

−0.383 −0.924 −0.924 −0.383

−0.195

−0.981 −0.556

1.000

0.195

0.707

−0.707

−0.707

−0.707

0.707

0.195

0.831

−0.924

0.924

−0.383 −0.383

−0.556

0.831

−0.981

−0.831 −0.195 0.981

⎥ ⎥ ⎥ 0.707 ⎥ ⎥ −0.556 ⎥ 0.383 ⎥ ⎦

0.383

0.981

−0.707

x1



⎢ ⎥ .. ⎢ ⎥ ⎢ ⎥ . ⎢ ⎥ ⎢ .. ⎥ ⎢ m−1 ⎥ ⎢ . ⎥ N ⎢  ⎥ ⎢ ⎥ ⎢ − s x  + y + −  s x  ⎥ ⎢ xm ⎥ = ⎢ m m,i i m,i i ⎥ = ⎢ ⎥ = x. ⎢ i=1 ⎥ ⎢ ⎥ i=m+1 ⎢ ⎥ ⎢ .. ⎥ ⎢ ⎥ ⎢ . ⎥ .. ⎢ ⎥ ⎣ ⎦ . ⎣ ⎦ xN yN

0.924

−0.831 ⎥

0.981

0.924

−0.924

−0.831

0.556

−0.195

−0.087

−0.354

−0.354 −0.354 −0.354 −0.354 −0.354 −0.354

−0.002

0.464

0.692

0.344

−0.298

0.435

0.296

0.070

0.004

−0.017

−0.419 −0.437

−0.101

0.457

0.487

−0.291

0.356

0.375

−0.131

0.471

−0.302

0.426

0.146

−0.230

0.133

−0.414

0.310

−0.551

0.269

−0.012

−0.166

0.078

−0.277

0.229

−0.516

−0.000 ⎥

⎥ ⎥ −0.035 ⎥ ⎥ −0.168 ⎥ 0.532 ⎥ ⎦ −0.005 ⎥

−0.534 −0.351 −0.634

0.750

Then, matrix A is decomposed into PS N S N−1 · · · S 1 S 0 such that

s0 =

s1 =

s2 =

Because yi = xi for i = / m, the fact



i=1

sm,i yi  + 

N 

sm,i yi  = 

i=m+1

m−1  i=1

sm,i xi  + 

N 

sm,i xi 

s3 =



i=m+1

deduces Eq. (1) – a reversible integer linear transformation. Notice that yi and xi must keep precision in store and computation. With a fixed-precision computer, keeping yi and xi in integer form is a way to preserve reversible linear transformation. In summary, the input signals are rearranged into vector x and yield y 0 = S 0 x. Then each element of y 0 is rounded to an integer and used to get y 1 as y 1 = S 1  y 0  and so on. Finally, y =  P S N  · · ·  S 1  S 0  x · · ·  and −1 −1 −1 x = S −1 y· · ·. 0 · · ·S N−1 S N P

s4 =

s5 =

s6 =

s7 =

−1.448

−1.620 2.041 −0.184 1.351 1.518 0.914 0.000

,

0.000 1.204 −1.697 0.216 −1.291 −0.910 −1.202 0.750

,

−0.832 0.000 −0.949 0.476 −1.004 −0.753 −1.001 0.624

0.575 0.692 0.000 −0.757 0.248 0.377 0.675 −0.432

−0.459 −0.986

0.356 0.000 −0.778 −0.792 −0.644

0.129 −0.687 0.522 0.688 1.438 0.000 0.720 0.310

,

,

0.340

0.380 0.632 0.070 0.242 0.000 −0.024 0.163 −0.319



,

,



0.489 −1.395 0.764 0.466 1.682 −1.154 0.000 0.634

,

,

3.2. A 2-dimensional discrete cosine transformation

RN

The 1-dimensional cosine transformation is the function g : → RN where R denotes the set of real numbers. The N real



−0.000 ⎥

−0.000

−0.428 −0.446 −0.144

(1)

m−1 



−0.831 −0.981 ⎥

0.556

−0.981

1.000

For reducing the error of decomposition, we transform the row vectors of C to be orthonormal. The modified matrix, denoted A, is used as the discrete cosine transformation matrix in the remaining part of this paper. For example, the above 8 × 8 matrix C is converted into orthonormal row vectors of

0

1

⎢ 0.981 ⎢ 0.924 ⎢ ⎢ 0.831 ⎢ C = ⎢ 0.707 ⎢ 0.556 ⎢ ⎢ 0.383 ⎣

1.000

s8 =

−0.044

−2.200 1.177 0.575 2.099 −1.263 −1.152 −2.000



2398

and

Y.-K. Lin / The Journal of Systems and Software 85 (2012) 2395–2404



0

0

0

0

0

1

0

0

⎢0 ⎢ ⎢0 ⎢ ⎢0 ⎢ P=⎢ ⎢0 ⎢0 ⎢ ⎢0 ⎢ ⎣1

1

0

0

0

0

0

0⎥

0

1

0

0

0

0

0

0

1

0

0

0

0

0

0

1

0

0

0

0

0

0

0

0

0

0

0

0

0

1

0

0

0

0

0

0

35000



4×4 8×8 16 × 16

30000

⎥ ⎥ 0⎥ ⎥ 0⎥ ⎥ 1⎥ ⎥ 0⎥ ⎥ 0⎦ 0⎥

25000 20000 15000 10000 5000

such that A = PS 8 · · · S 1 S 0 . The 2-dimensional DCT is given by the formula yk1 ,k2 =

N N  

xn1 ,n2 cos

n1 =1n2 =1

× cos

 N

 N 1 2

n2 − 1 +

1 2

n1 − 1 +





0 -20



(k1 − 1)



(k2 − 1)

for k1 , k2 = 1, . . . , N.

Technically, we compute an 2-dimensional DCT of an image X by applying 1-dimensional DCT along the rows and then along the columns. That is, the frequency-domain coefficients yi,j for i, j = 1, . . ., N are computed by Y = A( AX)T =  P S N  · · ·  S 1  S 0 ( P S N  · · ·  S 1  S 0  X · · · )T . 3.3. Embedding and extracting phase The input cover image is divided into 8 × 8 sub-images, each of which is denoted X. Matrix X is transformed into the frequencydomain coefficients Y = A( AX)T . The frequency-domain Y is computed step by step from Y =  P S N  · · ·  S 1  S 0 ( P S N  · · ·  S 1  S 0  X · · · )T and reverse transformation is computed by X = −1 −1 −1 −1 −1 −1 (S −1 Y · · ·)T . For examS −1 0 · · ·S N−1 S N P 0 · · ·S N−1 S N P ple, take an 8 × 8 sub-image X L of image ‘Lena’ shown as follows



148

⎢ 150 ⎢ ⎢ 145 ⎢ ⎢ 144 XL = ⎢ ⎢ 141 ⎢ ⎢ 143 ⎢ ⎣ 141

144

145

143 146 144 139 139

143

148 147

146 142 135

143

141 147

146 143 137

145

142

148

143

140

143

146

145 146

136

140

139

141

138 141

139 138 135

139

140

137 139 139

138 139

142

142 136



136 ⎥ ⎥ 130 ⎥ ⎥ 139 ⎥ ⎥, 133 ⎥ ⎥ 138 ⎥ ⎥ 141 ⎦

134 137 136 137

the correspondence frequency-domain sub-image is



YL

⎢ ⎢ ⎢ ⎢ ⎢ = ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ =

1129 −4

5

6

9

3

−7

−9

4

0



⎥ ⎥ 1 −1 −4 −4 3 0 4 2 ⎥ ⎥ 9 0 1 −3 3 0 0 −1 ⎥ ⎥ 7 2 1 1 1 2 −3 −2 ⎥ ⎥ 7 −4 8 0 1 5 −2 2 ⎥ ⎥ 2 ⎦ −13 −3 −1 0 −3 −7 0 −2

2

−3

0

3

0

−6 −2 −1 −4 −4 −4 0 1 PS N · · ·S 1 S 0 (PS N · · ·S 1 S 0 X L · · ·)T

Observe that the values of the elements in the high-frequency parts of Y L centralize on a small range. See Fig. 2 to observe this trend. Inspired from this observation, we shift the positive values slightly to larger values and the negative values slightly to smaller values in order to hide the secret data. Also, the variants in the elements of the right-bottom part of the 2-dimension matrix Y ,

-15

-10

-5

0

5

10

15

20

Fig. 2. Histograms of DCT coefficients for the experiment of a cover image ‘Lena’ with block sizes of 4 × 4, 8 × 8 and 16 × 16. The vertical axis is the values of the DCT coefficients. The horizontal axis is the histogram of the specific value.

which are the higher frequency components of the sub-image X, are hard to detect with human vision. We scan the elements on the diagonals starting from the top left corner of the matrix. The first diagonal contains the single element, while the second contains the two elements. For example, the matrix Y L mentioned previously has 15 diagonals. The first diagonal contains the single element 1129, and the second diagonal contains the two elements −2 and −4. In general, an N × N matrix has 2N − 1 diagonals. Our algorithm skips the first p diagonals and embeds data into the elements from the (p + 1)th diagonal to the least diagonal. Given an element yi,j located in diagonal p + 1 to diagonal 2N − 1 of Y , yi,j is modified to

 = yi,j

⎧ 2yi,j if − q < yi,j < q and secret data is 0 ⎪ ⎪ ⎪ ⎪ ⎨ 2yi,j + 1 if − q < yi,j < q and secret data is 1 ⎪ yi,j + q ⎪ ⎪ ⎪ ⎩

if q ≤ yi,j

yi,j − q

(2)

if yi,j ≤ −q

to hide the secret data. The 2q − 1 values centralized in 0 are shifted to a new value corresponding to the secret data. For example, Fig. 3 illustrates the shifting when q = 4. For example, the modified coefficients for embedding secret data into Y L with p = 1 and q = 4 are shown in



⎢ ⎢ ⎢ ⎢ ⎢ Y L = ⎢ ⎢ ⎢ ⎢ ⎢ ⎣

1129 −3 2

−8

9

5

−6

−1 −8

10

13

7

−11

−13

0

7

0

8

0

−8

7

0

8

4

13

0

2

−6

6

0

1

−1

11

5

3

2

2

5

−6

−3

11

−8

12

1

2

9

−4

5

−17

−6 −2

1

−6

−11

1

4

−10

−4 −2

−8

−8

−8

1

3

⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦

Since our scheme adopts histogram shifting to embed the secret data, it is possible to get overflow and underflow on the pixel value of the stego-image by adding q or −q to the DCT coefficient. To solve this problem, our method tests whether overflow and underflow occurs, and only embeds data into those images which do not cause overflow and underflow. The formal embedding algorithm is shown in algorithm Reversible-DCT-Hiding and the formal extracting algorithm is shown in algorithm Reversible-DCT-Extraction. Reversible-DCT-Hiding( PS 8 · · · S 0 , I, p, q, M) Input: PS 8 · · · S 0 : a factorization of A

Y.-K. Lin / The Journal of Systems and Software 85 (2012) 2395–2404

2399

−9

−8

−7

−6

−5

−4

−3

−2

−1

0

1

2

3

4

5

6

7

8

9

−9

−8

−7

−6

−5

−4

−3

−2

−1

0

1

2

3

4

5

6

7

8

9

no hidden data hidden data 0 hidden data 1 Fig. 3. The shifting situation when q = 4.

I: input cover image p: the parameter for adjusting the number of diagonals for embedding data q: the parameter for adjusting the value of shifting of embedded data M[]: the secret data stream Output: the stego-image corresponding to the input image begin 1for each N × N sub-image X of I /* divide input cover image in N × N blocks */ 2 for i = 1 to 2 /* 2-dimensional DCT */ T ← S 0 X /* save result in temporary storage */ 3 T ← T  /* round temporary result to integer */ 4 5 for i = 1 to N 6 T ← Si T 7 T ← T  T 8 X ← (PT ) 9 Y ← XT 10 for each element yi,j of Y 11 if ((i + j) > p) /* skip first p diagonals */ 12 if (q ≤ yi,j ) 13 yi,j ← yi,j + q 14 else if (yi,j ≤ −q) 15 yi,j ← yi,j − q 16 else if (next bit of M[] = 0) yi,j ← 2 × yi,j /* embed 0 into yi,j */ 17 else (next bit of M[] = 1) 18 yi,j ← 2 × yi,j + 1 /* embed 1 into yi,j */ 19 20 for i = 1 to 2 21 T ← P −1 Y /* start to transform coefficient back to image */ 22 for i = N downto 0 23 T ← S −1 T i T ← T  24 T 25 Y ← (T ) 26 X ← Y T /* replace original block X with modified one Y T */ 27 return I /* I is now stego-image */ end

Reversible-DCT-Extraction( PS 8 · · · S 0 , I, p, q) Input: PS 8 · · · S 0 : a factorization of A I: input stego-image p: the parameter for adjusting the number of diagonals of embedded data q: the parameter for adjusting numbers of least significant bits of embedded data Output: recovered cover image R M[]: the secret data stream

begin 1 for each N × N sub-image X of I /* divide input cover image in N × N blocks */ 2 for i = 1 to 2 3 T ← S 0 X /* save result in temporary storage */ 4 T ← T  /* round temporary result to integer */ 5 for i = 1 to N T ← Si T 6 T ← T  7 T 8 X ← (PT ) 9 Y ← XT 10 for each element yi,j of Y 11 if ((i + j) > p) /* skip first p diagonals */ 12 if (2q ≤ yi,j ) 13 yi,j ← yi,j − q else if (yi,j ≤ −2q) 14 yi,j ← yi,j + q 15 else if (yi,j is even) 16 insert 0 into M[] /* extract 0 from yi,j */ 17 18 19 20

y

yi,j ← 2i,j /* recover yi,j */ else /* yi,j is odd */ insert 1 into M[] /* extract 1 from yi,j */ (y

−1)

yi,j ← i,j2 /* recover yi,j */ 21 22 for i = 1 to 2 23 T ← P −1 Y /* start to transform coefficient back to image */ 24 for i = N downto 0 25 T ← S −1 T i T ← T  26 T 27 Y ← (T ) 28 R ← Y T 29 return M, R end

In Reversible-DCT-Hiding, the input cover image I is first divided into N × N blocks. Then, lines 2–9 implement the 2-dimensional DCT transformation. Lines 10–19 embed secret data obeying Eq. (2). Afterwards, lines 20–26 transform the modified coefficients back to the image i.e., the stego-image. In Reversible-DCT-Extraction, the input stego-image I is first divided into N × N blocks. Then, lines 2–9 transform it into DCT coefficients. Lines 10–21 extract the secret data and the coefficients of the cover image. Afterwards, lines 22–28 transform the coefficients of the cover image into the spatial domain. 4. Experiment and comparison The proposed reversible data hiding scheme is used to embed secret data into six test images of size 512 × 512, namely ‘Lena’, ‘Baboon’, ‘Peppers’, ‘Boat’, ‘Airplane’, and ‘Tiffany’ – a selection of images from the USC-SIPI Image Database. All experiments are performed on a personal computer with an Intel 3.2 GHz Pentium 4 CPU with cache size 2048 KB for evaluating the practical performance of the proposed reversible data hiding scheme. The proposed scheme is implemented to embed the random bit streams into the cover images ‘Lena’, ‘Baboon’, ‘Peppers’, ‘Boat’,

2400

Y.-K. Lin / The Journal of Systems and Software 85 (2012) 2395–2404

Fig. 4. Six test images: (a) Lena. (b) Baboon. (c) Peppers. (d) Boat. (e) Airplane and (f) Tiffany.

‘Airplane’, and ‘Tiffany’, respectively. The six cover images ‘Lena’, ‘Baboon’, ‘Peppers’, ‘Boat’, ‘Airplane’, and ‘Tiffany’ are size 512 × 512 gray-scale images with the gray values ranging from 0 through 255, as shown in Fig. 4. Table 1 compares the capacities, structural similarity (SSIM) Wang et al. (2004), and peak signal-to-noise ratios (PSNRs) of embedding the secret data into the test set with different values of q and a specified p = 1 and block size 2 × 2. Column 1 shows the names of the test files, and column 2 shows the items of comparison. Column 3, entitled “2 × 2 block and p = 1” refers to the proposed method with a block size of 2 × 2. The first sub-column of column 3, entitled “q = 2”, shows the capacities and PSNRs of embedding

random bit streams into the test images with embedding parameter q = 2. The 100 different random bit streams are used to get the average SSIMs and PSNRs shown here. The SSIM is developed based on the assumption that the human visual system is highly adjusted to extracting structural information. The SSIM index S between two M × N gray-scale images U and V is define as S(U, V ) =



2U V 2 +2 U

ˇ

V

2U V  2 + 2 U

V

˛ 

UV U V



(%) where 

and  stand for mean and standard deviation, respectively, and  UV corresponds to covariance. The PSNRs shown here measure the differences between the cover images and the stego-images. For the two M × N gray-

Table 1 The capacities, SSIMs, and PSNRs for embedding random bit streams using our approach at various q and a specified p = 1 with a 2 × 2 block. 2 × 2 block and p = 1

File name

Lena

Baboon

Peppers

Boat

Airplane

Tiffany

Capacity SSIM PSNR Capacity SSIM PSNR Capacity SSIM PSNR Capacity SSIM PSNR Capacity SSIM PSNR Capacity SSIM PSNR

q=2

q=3

q=4

q=5

q=6

q=7

q=8

q=9

61,888 98.01 43.495 24,895 99.29 43.007 59,622 98.00 43.451 49,629 98.48 43.335 94,505 98.02 44.017 71,523 97.85 43.644

95,050 96.88 41.141 40,334 98.76 40.132 92,330 96.83 41.075 77,914 97.51 40.791 127,132 97.34 42.074 107,534 96.74 41.438

120,268 95.91 39.585 54,309 98.19 38.053 11,7694 95.80 39.496 100,495 96.60 39.045 144,836 96.85 40.731 132,765 95.85 40.018

139,264 95.19 38.512 66,871 97.64 36.487 137,431 95.02 38.416 118,889 95.81 37.796 156,224 96.51 39.741 149,948 95.21 39.047

152,158 94.64 37.694 77,927 97.09 35.198 151,470 94.40 37.603 132,849 95.12 36.824 163,253 96.25 38.930 160,695 94.71 38.302

161,206 94.21 37.054 87,743 96.57 34.149 161,676 93.95 36.985 143,855 94.54 36.055 168,305 96.03 38.251 168,222 94.33 37.716

167,706 93.87 36.515 96,436 96.06 33.241 168,949 93.59 36.479 152,760 94.04 35.419 172,277 95.84 37.662 173,677 94.01 37.218

172,335 93.60 36.058 104,216 95.59 32.468 174,115 93.31 36.063 159,577 93.62 34.886 175,214 95.68 37.143 177,471 93.75 36.804

Y.-K. Lin / The Journal of Systems and Software 85 (2012) 2395–2404

2401

Table 2 The capacities, SSIMs, and PSNRs for embedding random bit streams using our approach at various q and a specified p = 1 with a 4 × 4 block. 4 × 4 block and p = 1

File name

Lena

Baboon

Peppers

Boat

Airplane

Tiffany

Capacity SSIM PSNR Capacity SSIM PSNR Capacity SSIM PSNR Capacity SSIM PSNR Capacity SSIM PSNR Capacity SSIM PSNR

q=2

q=3

q=4

q=5

q=6

q=7

q=8

q=9

68,700 96.96 41.455 26,173 98.97 41.208 67,515 96.97 41.469 55,031 97.72 41.374 99,178 96.64 41.668 78,043 96.66 41.538

106,702 95.55 39.362 42,679 98.34 38.638 105,126 95.53 39.368 86,853 96.55 39.130 138,757 95.59 39.873 118,964 95.19 39.557

136,471 94.31 37.882 57,764 97.64 36.681 135,230 94.23 37.870 113,647 95.42 37.485 162,721 94.82 38.580 149,408 93.96 38.173

158,951 93.28 36.761 71,615 96.93 35.117 158,259 93.14 36.752 135,346 94.41 36.221 178,194 94.21 37.547 170,676 92.95 37.135

175,267 92.45 35.895 84,243 96.23 33.837 175,344 92.25 35.894 152,946 93.53 35.229 188,698 93.73 36.708 185,546 92.13 36.329

187,002 91.77 35.208 95,474 95.56 32.795 188,278 91.53 35.230 166,899 92.77 34.447 196,185 93.33 36.033 196,180 91.46 35.687

195,794 91.21 34.648 105,645 94.90 31.938 197,978 90.94 34.699 178,081 92.12 33.818 201,971 92.98 35.470 204,128 90.88 35.161

202,435 90.73 34.189 114,891 94.28 31.245 205,020 90.44 34.273 186,868 91.56 33.303 206,489 92.67 34.997 210,302 90.40 34.726

Table 3 The capacities, SSIMs, and PSNRs for embedding random bit streams using our approach at various q and specified p = 1 with an 8 × 8 block size. 8 × 8 block and p = 1

File name

Lena

Baboon

Peppers

Boat

Airplane

Tiffany

Capacity SSIM PSNR Capacity SSIM PSNR Capacity SSIM PSNR Capacity SSIM PSNR Capacity SSIM PSNR Capacity SSIM PSNR

q=2

q=3

q=4

q=5

q=6

q=7

q=8

q=9

64,345 97.36 41.787 23,904 99.11 41.505 62,881 97.36 41.795 50,848 98.02 41.697 93,951 97.14 42.039 72,901 97.09 41.875

100,749 95.95 39.394 39,035 98.48 38.663 97,955 95.90 39.386 80,419 96.86 39.142 131,566 96.10 39.909 112,395 95.63 39.587

129,791 94.67 37.707 53,392 97.78 36.556 127,248 94.54 37.692 105,690 95.71 37.302 155,198 95.26 38.362 142,749 94.34 37.998

152,389 93.58 36.447 66,437 97.06 34.909 149,921 93.35 36.433 126,863 94.65 35.909 170,992 94.57 37.153 164,625 93.24 36.809

169,137 92.66 35.471 78,527 96.35 33.594 167,317 92.32 35.476 144,324 93.71 34.829 182,138 93.98 36.185 180,401 92.31 35.890

181,775 91.88 34.700 89,677 95.65 32.529 180,607 91.43 34.723 158,632 92.87 33.976 190,488 93.48 35.402 192,126 91.50 35.154

191,285 91.21 34.077 99,792 94.97 31.669 190,952 90.66 34.127 170,540 92.14 33.296 197,094 93.02 34.763 201,127 90.80 34.557

199,088 90.62 33.568 109,180 94.32 30.966 198,958 89.98 33.641 180,423 91.49 32.745 202,621 92.62 34.237 208,264 90.17 34.065

2

scale images U and V, the PSNR is computed as 10 × log10 255 MSE 1 MN

M N

2

(Ui,j − Vi,j ) (dB) is the mean squared where MSE = i=1 j=1 error. The second sub-column, entitled “q = 3”, of column 4, shows the capacities and PSNRs of embedding random bit streams into the test images with embedding parameter q = 3. The meanings of the other sub-columns in column 3 are similar to the first sub-column. Table 2 compares the capacities, SSIMs, and PSNRs of embedding the secret data into the test set with different values of q and a specified p = 1 and block size of 4 × 4. Column 1 shows the names of the Table 4 Comparisons of the results for embedding random bit streams into cover images using the method in Chang et al. (2007), the method in Lin and Shiu (2010), and our approach with an 8 × 8 block size and q = 5, p = 1. File name Image size Chang et al.’s method (2007) Capacity PSNR Lena Baboon Peppers Boat Airplane

512 × 512 512 × 512 512 × 512 512 × 512 512 × 512

36,850 35,402 36,804 36,710 36,817

30.24 26.44 30.65 29.75 29.88

Lin et al.’s method Our approach (2010b) Capacity PSNR 57,717 66,075 56,981 58,426 57,966

30.30 23.20 34.30 32.23 33.44

Capacity

PSNR

152,389 66,437 149,921 12,6863 170,992

36.44 34.90 36.43 35.90 36.80

test files, and column 2 shows the items of comparison. Column 3, entitled “4 × 4 block and p = 1” refers to the proposed method with a block size of 4 × 4. The meanings of the sub-columns in Table 2 are similar to those in Table 1. Table 3 compares the capacities, SSIMs,

airplane baboon boat lena peppers tiffany

44 42 40 38 36 34 32 30 1

2

3

4

5

6

7

8

9

10

Fig. 5. Comparison of the PSNRs of six images for the experiment using our method versus different q with p = 1 and a block size of 2 × 2. The vertical axis is image quality in terms of PSNR (dB). The horizontal axis is value q.

2402

Y.-K. Lin / The Journal of Systems and Software 85 (2012) 2395–2404

airplane baboon boat lena peppers tiffany

44 42 40

airplane baboon boat lena peppers tiffany

44 42 40

38

38

36

36

34

34

32

32 30

30 1

2

3

4

5

6

7

8

9

10

1

2

3

4

5

6

7

8

9

10

Fig. 6. Comparison of the PSNRs of six images for the experiment using our method versus different q with p = 1 and a block size of 4 × 4. The vertical axis is image quality in terms of PSNR (dB). The horizontal axis is value q.

Fig. 8. Comparison of the PSNRs of six images for the experiment using our method versus different q with p = 1 and a block size of 16 × 16. The vertical axis is image quality in terms of PSNR (dB). The horizontal axis is value q.

and PSNRs of embedding the secret data into the test set with different values of q and a specified p = 1 and block size of 8 × 8. Column 1 shows the names of the test files, and column 2 shows the items of comparison. Column 3, entitled “8 × 8 block and p = 1” refers to the proposed method with a block size of 8 × 8. The meanings of the sub-columns in Table 3 are similar to those in Table 1. The comparisons of Tables 1–3 show that with the fixed p = 1, the hiding capacity of our method increases when parameter q increases. As the trend shows in Tables 1–3, among block sizes 2 × 2, 4 × 4, and 8 × 8, hiding capacity is at its maximum when the block size is 4 × 4 with the same p and q. In Table 4, we compare the capacities and PSNRs of our scheme with the methods proposed in Chang et al. (2007) and Lin and Shiu (2010). The results of embedding random bit streams into the test set are presented in Table 4. The 100 different random bit streams are used to get the average PSNRs shown here. Column 1 shows the names of the test files, and column 2 shows the size of the original test files. Column 3, entitled “Chang et al.’s method” refers to the method proposed in Chang et al. (2007); column 4, entitled “Lin et al.’s method” refers to the method proposed in Lin and Shiu (2010); and column 5, entitled “Our approach”, refers to the proposed scheme with p = 1, q = 5, and an 8 × 8 block. The first sub-column of column 3, denoted ‘Capacity’, shows the capacities of the test images by the algorithm proposed in Chang et al. (2007), while the second sub-column, denoted ‘PSNR’, of column 3, shows the PSNRs of the test images, and the first sub-column of column 4 shows the capacities of the test images by the algorithm proposed in Lin and Shiu (2010), while the second sub-column of column

4, shows the PSNRs of the test images. The observation values of the proposed scheme are shown in column 5. Column 5 is also divided into two sub-columns. The first shows the capacities of the test images of the scheme, where the unit is bits, while the second shows the PSNRs of the test images. Fig. 5 shows the quality of the stego-images at various q up to 9 with p = 1 and a block size of 2 × 2. As shown in Fig. 5, a high quality stego-image can be achieved with a small q. Figs. 6–8 are similar to Fig. 5 but with different block sizes. As the trend shows in Fig. 5-8, image quality becomes higher when the block size is small. Fig. 9 shows the hiding capacities of the stego-images at various q up to 9 with p = 1 and a block size of 2 × 2. As shown in Fig. 9, a higher embedding capacity of the stego-image can be achieved by a larger q. Figs. 10–12 are similar to Fig. 9 but with different block sizes. As the trend shows in Figs. 9-12, image capacities are at their maximum when the block size is 4 × 4. In Fig. 13, we compare the quality of the stego-image versus different p with q = 4 and a block size of 8 × 8. As shown in Fig. 13, when the p increases, the quality of the stego-image measured by PSNRs increases. On the other hand, the hiding capacity decreases when p increases. See Fig. 14 for an illustration. Note that the cover images used in our experimental are stored in lossless format e.g., BMP or lossless TIFF. If the cover images are compressed by some frequency domain approach e.g., JPEG compression, the hiding capacities are larger than the values in Figs. 9–12. The reason is that due to the quantization stage of JPEG compression, the coefficients are more centralized 220000

airplane baboon boat lena peppers tiffany

44 42 40

airplane baboon boat lena peppers tiffany

200000 180000 160000 140000

38

120000 100000

36

80000

34

60000 32

40000 20000

30 1

2

3

4

5

6

7

8

9

10

Fig. 7. Comparison of the PSNRs of six images for the experiment using our method versus different q with p = 1 and a block size of 8 × 8. The vertical axis is image quality in terms of PSNR (dB). The horizontal axis is value q.

1

2

3

4

5

6

7

8

9

10

Fig. 9. Comparison of the data hiding capacities of six images for the experiment using our method versus different q with p = 1 and a block size of 2 × 2. The vertical axis is embedding capacity (bits). The horizontal axis is value q.

Y.-K. Lin / The Journal of Systems and Software 85 (2012) 2395–2404

220000

54

airplane baboon boat lena peppers tiffany

200000 180000 160000

2403

airplane baboon boat lena peppers tiffany

52 50 48

140000

46

120000

44

100000 42

80000

40

60000

38

40000

36

20000 1

2

3

4

5

6

7

8

9

2

10

Fig. 10. Comparison of the data hiding capacities of six images for the experiment using our method versus different q with p = 1 and a block size of 4 × 4. The vertical axis is embedding capacity (bits). The horizontal axis is value q.

4

6

8

10

airplane baboon boat lena peppers tiffany

200000 180000 160000

14

Fig. 13. Comparison of the PSNRs of stego-images for the experiment using our method versus different p with q = 4 and a block size of 8 × 8. The vertical axis is image quality in terms of PSNR (dB). The horizontal axis is value p.

160000

220000

12

airplane baboon boat lena peppers tiffany

140000 120000 100000

140000

80000

120000 60000

100000 80000

40000

60000

20000

40000

0 2

20000 1

2

3

4

5

6

7

8

9

4

6

8

10

Fig. 11. Comparison of the data hiding capacities of six images for the experiment using our method versus different q with p = 1 and a block size of 8 × 8. The vertical axis is embedding capacity (bits). The horizontal axis is value q.

around zero. See Fig. 15 for an illustration of this situation. Thus, there are more coefficients that can be used to embed secret data. Fig. 16 shows the original image and the data hided image at various embedding capacities for ‘Lena’ image. Even though the PSNR is 31.118 dB and SSIM is 86.12 %, the perceptual quality of the data hided image is good.

airplane baboon boat lena peppers tiffany

200000 180000 160000

14

Fig. 14. Comparison of the data hiding capacities of six images for the experiment using our method versus different p with q = 4 a and block size of 8 × 8. The vertical axis is embedding capacity (bits). The horizontal axis is value p.

The random noise is chosen to evaluate the robustness of the proposed method. Since our processing unit is N × N block, we randomly adjust the LSB of one pixel for each block of stegoimage. Then only 7.4% blocks of cover image can be recovered from stego-image with 4 × 4 block size. This evidence shows that our method are fragile in sense that cover image cannot be recovered after incidental modification has been applied to stego-image. 35000

220000

12

10

JPEG BMP

30000 25000 20000

140000 120000

15000

100000 10000

80000

5000

60000 40000

0 -20

20000 1

2

3

4

5

6

7

8

9

-15

-10

-5

0

5

10

15

20

10

Fig. 12. Comparison of the data hiding capacities of six images for the experiment using our method versus different q with p = 1 and a block size of 16 × 16. The vertical axis is embedding capacity (bits). The horizontal axis is value q.

Fig. 15. Comparison of the histograms of DCT coefficients for the experiment of a JPEG-compressed and a BMP formatted cover image ‘Lena’ with a block size of 4 × 4. The vertical axis is the values of the DCT coefficients. The horizontal axis is the histogram of the specific value.

2404

Y.-K. Lin / The Journal of Systems and Software 85 (2012) 2395–2404

Fig. 16. Original and stego ‘Lena’ images: (a) original (b) an image produced by 4 × 4 block p = 1, q = 2 with SSIM 96.96%, PSNR 41.450 and capacity 68,700 bits. (c) An image produced by 4 × 4 block p = 1, q = 9 with SSIM 90.71%, PSNR 34.182 and capacity 202,435 bits. (d) An image produced by 4 × 4 block p = 1, q = 39 with SSIM 86.12%, PSNR 31.118 and capacity 240,929 bits.

5. Conclusions The proposed reversible data hiding scheme improves the quality of the stego-images and their hiding capacity. We conclude that the histogram shifting method based on DCT coefficients has high potential in competition with the method of hiding in quantized DCT coefficients. Our future work will focus on conquering the underflow and overflow problem without any additional overhead. References Celik, M.U., Sharma, G., Tekalp, A.M., Saber, E., 2002. Reversible data hiding. In: Proceedings of IEEE International Conference on Image Processing, Rochester, NY, pp. 157–160. Chan, C.K., Chen, L.M., 2004. Hiding data in images by simple LSB substitution. Pattern Recognition 37, 313–316. Chang, C.C., Chen, T.S., Chung, L.Z., 2002. A steganographic method based upon JPEG and quantization table modification. Information Sciences 141, 123–138. Chang, C.C., Lin, C.C., Tseng, C.S., Tai, W.L., 2007. Reversible hiding in DCT-based compressed images. Information Sciences 177, 2768–2786. Chang, C.C., Thai, S.N., Lin, C.C., 2011. A reversible data hiding scheme for VQ indices using locally adaptive coding. Journal of Visual Communication and Image Representation 22, 664–672. Fridrich, J., Goljan, M., Du, R., 2001. Invertible authentication watermark for JPEG images. In: Proceedings of IEEE International Conference on Information Technology: Coding and Computing, NV, USA, pp. 223–227.

Hao, P., Shi, Q., 2001. Matrix factorizations for reversible integer mapping. IEEE Transactions on Signal Processing 49 (10), 2314–2324. Ker, A.D., 2007. Steganalysis of embedding in two least-significant bits. IEEE Transactions on Information Forensics and Security 2 (1), 46–54. Li, X., Yang, B., Cheng, D.F., Zeng, T.Y., 2009. A generalization of LSB matching. IEEE Signal Processing Letter 16 (2), 69–72. Lin, C.C., Shiu, P.F., 2010. High capacity data hiding scheme for DCT-based images. Journal of Information Hiding and Multimedia Signal Processing 1 (3), 220–240. Lin, C.C., Shiu, P.F., 2010. DCT-based reversible data hiding scheme. Journal of Software 5 (2), 214–224. Ni, Z., Shi, Y.Q., Ansari, N., Su, W., 2006. Reversible data hiding. IEEE Transactions on Circuits Systems for Video Technology 16 (3), 354–361. Tian, J., 2003. Reversible data embedding using a difference expansion. IEEE Transactions on Circuits and Systems for Video Technology 13 (8), 890–896. Tseng, H.W., Chang, C.C., 2004. High capacity data hiding in JPEG-compressed images. Informatica 15 (1), 127–142. Wang, Z., Bovik, A.C., Sheikh, H.R., Simoncelli, E.P., 2004. Image quality assessment: from error visibility to structural similarity. IEEE Transactions on Image Processing 13 (4), 600–612. Yang, C.H., Wu, S.C., Huang, S.C., Lin, Y.K., 2011. Huffman-code strategies to improve MFCVQ-based reversible data hiding for VQ indexes. Journal of Systems and Software 84 (3), 388–396. Yih-Kai Lin received the PhD degree in the Electrical Engineering from National Taiwan University, Taiwan, in 2003. He is presently an assistant professor of Computer Science at National Pingtung University of Education. His current research interests include data compression, pattern recognition, computer graphics and image processing.