Skip to main content

A Novel Image Data Hiding Scheme with Diamond Encoding


A novel data hiding scheme in digital images with the diamond encoding by pixel value adjustment is proposed. The proposed method is the extension of the exploiting modification direction (EMD) embedding scheme. First, the process of embedding partitions the cover image into nonoverlapping blocks of two consecutive pixels and transforms the secret messages to a series of -ary digits. For each block, the diamond encoding technique is applied to calculate the diamond characteristic value, and one secret -ary digit is concealed into the diamond characteristic value. The diamond characteristic value is modified to secret digit and it can be obtained by adjusting pixel values in a block. This scheme is designed in such a way that the distortion of each block after diamond encoding is never out of the embedding parameter , and the block capacity is equal to . The diamond encoding provides an easy way to produce a more perceptible result than those yielded by simple least-significant-bit substitution methods. The embedded secret data can be extracted without the original cover image. Experimental results have demonstrated that the proposed method is capable of hiding more secret data while keeping the stego-image quality degradation imperceptible.

1. Introduction

In recent years, communication security over the Internet is becoming more and more important because the multimedia and network are widely developed. Two fields of research have been proposed to enhance the communication security: cryptography and information hiding. Although they are both applied to the protection of secret message, the major difference is the appearance of the transmitted data. The cryptography methods, such as DES and RSA, referred almost exclusively to encryption which is the process of converting ordinary information (plaintext) into unintelligible gibberish (cipher-text). After data encryption, the secret data appears to be a total chaos of seemingly meaningless bits. However, the existence of the transmitted secret message can be detected. Because it does not conceal the fact that there is an important message, the encrypted message could motivate an unauthorized user to decrypt or destroy it. However, information/data hiding [13], referred to as a process to hiding secret data of various types (message, image, information, etc.) into another digital media (text, image, audio or video streams), can solve the intercepts problem. The concealing media is called "cover" or "host" media. If this cover media is a digital image, it is called a cover image, and the altered cover image containing the secret information is called a stego-image (or stego-media). The embedding capacity and invisibility are the major concerns in a data hiding scheme analysis. The capacity of a data hiding scheme refers to the quantity of the secret data that can be embedded into the cover image, and the term invisibility indicates how imperceptible the fact is to illegal users when the cover image has been manipulated and turned to be a stego-image. In order to keep the imperceptibility, the data hinging techniques only alter the most insignificant parts of the cover image. It attempts to establish covert communication between trusting parties and prevent malicious interceptors or attackers from discovering the existence of the hidden message in the stego-image.

Many approaches of information hiding have been proposed for different applications, such as copyright protection [4], secret transmission [5], tampering detection [6], and image authentication [7]. The most well-known data hiding scheme is the least significant bits (LSBs) substitution method. This method embeds fixed-length secret bits into the least significant bits of pixels by directly replacing the LSBs of cover image with the secret message bits. The LSBs approach assumes that the base of the hidden numerical data is a whole power of 2 (e.g., 1-bit LSB means the hidden number is treated as a binary number because , 2-bit LSB means the hidden number is treated as a number of base , etc.). Although this method is simple, it generally effects noticeable distortion when the number of embedded bits for each pixel exceeds three. Several methods have been proposed to reduce the distortion induced by LSBs substitution. OPAP [8] scheme searches the minimal distortion value which LSBs equal the embedded bits and replaces stego-pixel value with it. Another way of improving LSBs scheme is to reduce the amount of alterations necessary to be introduced into the cover image for data hiding when the number of secret bits is significantly less than that of available cover pixels. The method proposed by Tseng et al. [9] can conceal as many as  bits of data in a binary image block sized by changing, at most, two bits in the block. Matrix encoding [10], on the other hand, uses less than one change of the least significant bit in average to embed w bits into cover pixels. Recently, Wu and Tsai [11] proposed a "pixel value differencing" (PVD) method that computes the difference value between two neighboring pixels to determine how many secret bits should be embedded into a cover pixel. All difference values are classified into some ranges that contain different levels of the value. In order to embed secret bits, the difference value is changed but it cannot outside the range of original difference, and the pair of original cover pixels is modified according with the new difference value. In addition, Wang et al. [12] presented an improvement of pixel value differencing scheme where the secret data is hidden in pixel difference with a modulus function. So the alteration caused by the hiding of the secret data is greatly reduced. The proposed method is the extension of the exploiting modification direction (EMD) embedding scheme [13]. The EMD embedding scheme hides each -ary notational secret digit into cover pixels, and only one pixel value increases or decreases by 1 at most.

In this paper, an efficient data hiding method is proposed for gray-scale images by utilizing the diamond encoding concept. We first transform the secret data into a sequence of digits, and the cover image is partitioned into nonoverlapping blocks of two consecutive pixels. The diamond encoding method produces a diamond characteristic value (DCV) of the pixel-pair block, and the DCV is revised as the embedded secret digit after data embedding procedure. For each block, the diamond encoding technique addresses the minimal changes of two pixel values under the embedding parameter . In other words, the difference between the cover-block and the stego-block is never more than , and the embedding capacity of a block equals . The diamond encoding technique minimizes the distortion after the DCV alteration to perform better visual quality. Experimental results have demonstrated that the proposed method is capable of hiding more secret data while maintaining imperceptible stego-image quality degradation.

The remainder of this paper is organized as in the following sections. We will describe the exploiting modification direction scheme first in Section 2. Section 3 will present the concept of diamond encoding method. In Section 4, the framework of the proposed scheme will be shown in detail. In Section 5, we will analyze the new scheme and compare it with some well-celebrated schemes in terms of payload and stego-image quality, respectively. Finally, a brief conclusion will be given in Section 6.

2. Review of the Exploiting Modification Direction Embedding Scheme

The proposed method is the extension of the exploiting modification direction (EMD) embedding scheme [13]. The main idea of the EMD embedding scheme is that each -ary notational secret digit is carried by cover pixels, and only one pixel value increases or decreases by 1 at most. For each block of cover pixels, there are possible states of only one pixel value plus 1 or minus 1. The states of alteration plus the case in which no pixel is modified form different cases. Therefore, the -ary notational secret digit is embedded into the cover pixels by changing the state. Before the data embedding procedure, the preprocess can convert the secret data into sequences of digits with -ary notational representation. For the simplest case of , the secret data stream can be expressed as where denotes the -ary notational system representation of secret data stream . Thus, the 5-ary digits can conceal into blocks of two cover pixels by modifying at most one pixel value. Denote the gray values of a block of two cover pixels as and , and the extraction function is defined as a weighted sum modulo 5:


Suppose that the transformed 5-ary secret digit s desired to be embedded into the cover pixels and . According to the secret digit, the embedding process can be classified into 5 conditions.

Condition 1

If :

No modification is needed because the extraction function can decrypt the correct secret data.

Condition 2

If :

Increase the pixel value by 1.

Condition 3

If :

Increase the pixel value by 1.

Condition 4

If :

Decrease the pixel value by 1.

Condition 5

If :

Decrease the pixel value by 1.

By the above operations, the stego-pixel value of the block is obtained. The extraction function is equal to the secret digit . For example, the secret data stream can be expressed as . Consider an original pixel group , and the extraction functions and are calculated by (1). We compute, above equation . Then, the first pixel pair located into Condition 4, and the pixel value 57 must decrease by 1. Similarly, the second pixel pair located into Condition 3 by the equation . The fourth pixel value must increase by 1. Finally, we can get the stego-group by modifying at most one value of two pixel values. In the extraction phase, the extraction function and can be extracted directly, and data stream is decrypted by transforming the secret digit .

3. The Diamond Encoding

In this section, we shall introduce the general operation of the diamond encoding technique. The EMD scheme embeds -ary digit into cover pixels, but the diamond encoding scheme can conceal -ary digit into a cover pixel pair where is the embedding parameter. The detail of this scheme is described as follows.

Assume that , , , and are pixel values, and is a positive integer. The neighborhood set represents the set that contains all the vectors () with the distance to vector () smaller than , and is defined as the following form:


Let the absolute value denote the number of elements of the set , and each member in is called neighboring vector of (). We calculate the value of to obtain the embedding base and embedded base with a parameter . The examples of are illustrated in Figure 1, and we can obtain , , , and so on. Moreover, we compute the value by the following equation, and the embedding base equals to the value of ,

Figure 1
figure 1

(a) Diamond encoding patterns with k = 1 and (b) diamond encoding patterns with k = 2. (a) (b)


The proposed diamond encoding method uses a diamond function to compute the diamond characteristic value (DCV) in embedding and extraction procedures. The DCV of two pixel values and can be defined as follows:


where is the absolute value of . The DCV have two important properties: (1) the DCV of the vector is the member of belongs to and (2) any two DCVs of vectors in are distinct. Assume that represents the embedded digit and belongs to . For secret data embedding, we replace the DCV of the vector with the embedded secret digit. Therefore, the modulus distance between and is . For each , we can design a distance pattern to search which neighboring pixel owns the modulus distance , and different are shown in Figure 2. Then, the vector is replaced with the neighboring vector by . The vector is the member of and the DCV of equals to the embedded secret digit . The vector can extract the correct secret digit by (5):

Figure 2
figure 2

Diamond encoding patterns with k = 1, k = 2, and k = 3. (a) (b) (c)


The diamond encoding scheme promises that the distortion of vector is no more than k after embedding a secret digit . Therefore, this minimal distortion scheme can be employed to embed large amount of data.

4. The Proposed Method

In this section, we shall present the proposed technique, whose embedding and extraction procedures are illustrated by the block diagrams shown in Figures 3 and 4, respectively. In our method, the embedding parameter k is determined firstly, and the diamond encoding with parameter k can conceal secret data into the cover image. The detailed steps of the proposed scheme are discussed in the following subsections.

Figure 3
figure 3

Data embedding process.

Figure 4
figure 4

Data extraction process.

4.1. Embedding Procedure

Step 1.

To begin with, according to the secret data size, a parameter k is selected, and we transform secret data into diamond encoding digits. Assume that the secret data size is s, and then the embedding parameter k is determined by finding the minimal positive integer that satisfies the following inequality:


Set the embedding base . Then, the secret message is regarded as a sequence of digits in l-ary notational system.

Step 2.

In the data embedding procedure, the original image is segmented into a number of nonoverlapping two-pixel blocks. Then, we can select each block from top-down and left-right in turn for data embedding process. The block vector is defined as and where I is the cover image sized , and t is the block index. The block construction of the proposed scheme is illustrated by Figure 5. The embedded secret data bit stream is transformed into l-ary digit sequence. Moreover, the embedded secret digit is obtained from the th index of the sequence of l-ary digits.

Figure 5
figure 5

Sequence of nonoverlapping consecutive two-pixel blocks is constructed in a cover image.

Step 3.

Compute the DCV of two pixel values x and y by (4)


Step 4.

The new stego-image pixel pair can be calculated by replacing with The used equation is shown as follows:


The symbol shows the modulus distance between the and . By applying the distance , the stego-pixel values and can be found in such that the DCV is replaced with . However, in this step, the overflow or underflow problems might be occurred; that is, the stego-pixel value or might go beyond 255 or below 0. If it happens, the next step, namely Step 5, has to be processed; otherwise, Step 5 has to be skipped, and the data embedding procedure is finished.

Step 5.

When one stego-pixel value has the overflow or underflow problem, the critical vector has to be adjusted to the appropriate value. The adjustment rules are defined as follows:

(1)if , ;

(2)if , ;

(3)if , ;

(4)if ,

From the above rules, it can be observed that the overflow/underflow problem is solved and the DCV also has the same value. After all, we take the next pixel pair from the cover image and repeat Steps 2–5. Repeat until all the secret data have been concealed. Then we collect all stego-pixel values to form the stego-image . The embedding parameter k has to transmit to the receiver in order to extract data.

4.2. Extraction Procedure

Here are the steps to extract the secret data from the stego-image and the detailed secret data extraction is described as follows.

Step 1.

To begin with, in the data extraction procedure, the original image is segmented into a number of nonoverlapping two-pixel blocks. Then, we can select each block from top-down and left-right in turn for data extraction process. The block vector is defined as and . The block construction of the proposed scheme is illustrated by Figure 2.

Step 2.

According to the parameter k, set the embedding base . For each stego-pixel pair and , the DCV of is obtained from (5):


Therefore, the secret digit is obtained by the DCV of .

Step 3.

Take the next pixel pair from the stego-image and repeat Steps 1 and 2. The same thing goes on and on until all secret digits have been extracted for each block with index t.

Step 4.

Finally, the secret data can be obtained by transforming the secret symbols to binary bits with base 2.

Here is an example to describe how the proposed algorithm actually works. Assume that the embedding parameter and . Suppose we have pixel pairs and and we use (4) to calculate DCV by computing . Now let us take as the embedded secret digit, and we can obtain the modulus distance by computing (8). Then, we search which is shown in Figure 2 and obtain the neighboring vector () locating in set and . Therefore, the values of pixel pair () are replaced with (). In the secret data extraction phase, the stego-pixel pairs and can be used to compute the DCV by . Finally, the secret digit is obtained.

5. Experimental Results and Analysis

This section presents and analyzes the experimental results by using the proposed method. To evaluate the performance of our new scheme, in our experiments, we have used about 1000 images with size . Our evaluation starts with the eight well-known images Lenna, Airplane, Boat, Baboon, Barbara, Pepper, Tiffany, and Zelda which are shown in Figures 6(a)6(d) and 7(a)7(d). Our experiments conclude visual quality, RS attack, PVD histogram, large-scale experiment, and ROC curves. The secret messages in our experiments were generated by a pseudorandom number generator with identical probabilities for bits "1" and "0." Figures 6(e)6(g) and 7(e)7(g) are the stego-images produced by the proposed scheme where the embedding parameter k was set to be 6. The generated stego-images show that they contain no artifacts that can be identified by human eyes.

Figure 6
figure 6

Test images (a)–(d) and stego-images (e)–(h).

Figure 7
figure 7

Test images (a)–(d) and stego-images (e)–(h).

In the proposed algorithm, the length of hidden messages decides the embedding parameter k. However, the parameter k plays a dominant role in deciding the payload and the stego-image quality for each image. We have also designed experiments, where the "Lenna" test image was used to investigate how the proposed scheme would perform at different parameter k and the results are shown in Table 1. The embedding capacity or payload size is measured by the number of embedded bits per pixel (bpp). In the proposed method, an embedded secret digit is an l-ary data which represents  bits and the payload P can be computed by the following equation:

Table 1 Results of the proposed scheme with different parameter k.

In our experiments, the quality of the stego-image is measured by the peak signal-to-noise ratio (PSNR). The PSNR is the most popular criterion to measure the distortion between the cover image and stego-image. It is defined as follows:


where MSE is the mean square error between the cover image and stego-image:


Here, the symbols and represent the pixel values of the cover image and stego-image in the position , respectively, and m and n are the width and height of the original image.

From Table 1, smaller k means low capacity and less distortion whereas larger k means high capacity and increased distortion. As expected, Table 1 shows that the growth of payload did depend on the value k. The third column of Table 1 indicates that the numbers of pixels with overflow or underflow conditions. The payload and PSNR value are listed in fourth and fifth columns of Table 1 by (10)–(12). Therefore, human eyes cannot discover the difference between cover image and stego-image.

We compare our scheme with other existing well-known data hiding methods. The results of embedding 30 000 bits (1.14 bpp) and 60 000 bits (2.28 bpp) secret data into the test cover images are listed in Tables 2 and 3. Referring to Tables 2 and 3, the sixth column is our proposed scheme with the diamond encoding; the column labeled LSB is the simple LSB substitution method; the column labeled OPAP is the optimal pixel adjustment LSB method [8]; the column labeled PVD is the pixel value differencing method [11]; the column labeled M-PVD is the modulus PVD method [12] (the range table of PVD and M-PVD in Tables 2 and 3 are and [, resp.). For these methods, the PSNR value is employed to compare the quality of stego-images under the same embedding payload. We can see that the proposed scheme with the diamond encoding has the least distortion of all the methods tested.

Table 2 Comparison results of PSNR among LSB, OPAP, PVD, M-PVD and our scheme on various test images with embedding payload = 300 000 bits (1.14 bpp).
Table 3 Comparison results of PSNR of LSB, OPAP, PVD, M-PVD and our scheme on various test images with embedding payload = 600 000 bits (2.28 bpp).

In addition, the proposed scheme is secure against the well-known steganalysis like RS detection attack [14] or PVD histogram analysis [15]. The RS detection method which is proposed by Fridrich et al. can directly detect the existence of hidden data in a stego-image without perceptual analysis. By a flipping function and the mask M, they use the statistical method to classify each pixel into three groups: the regular group , the singular group , and the unusable group . Similarly, the statistical method also can classify each pixel into three groups with the inverse mask –M: , and . The stego-image will pass the RS detection method when and . On the contrary, the stego-image will be considered as a suspicious image which contains secret data. The RS detection results of our scheme are shown in Figure 8, where the x-axis represents the embedding rate and the y-axis represents the percentage of the , , and with masks and . Moreover, we have also tested the other stego-images proposed by our scheme and the results are the same as Figure 8. As expected, the RS attack, which is targeting LSB steganography, fails to detect the proposed scheme. In Figure 9, we can see the PVD histogram results of original image and stego-image. If the histogram does not display a smooth curve, the image will be judged as a suspicious image. According to the analysis, we can make a conclusion that the proposed scheme is secure against the RS detection attack and PVD histogram analysis.

Figure 8
figure 8

The RS -diagram for stego-image Lenna produced by the proposed scheme. (a) k = 1 (b) k = 2. (a) k = 1 (b) k = 2

Figure 9
figure 9

The PVD histogram for (a) original image Lenna and (b) its stego-image produced by the proposed scheme. Original imageStego-image

In addition, the blind attack of steganography [16, 17] is presented in 2006 to detect hidden messages in images and uses a wavelet decomposition to build higher-order statistical model of natural images by support vector machine (SVM). We have collected 1000 gray-scale natural images (all natural images were downloaded from These images include decades of digital and traditional photography and consist of a range of indoor and outdoor scenes with pixels in size. The wavelet transform decomposes the image into subbands. The j th order horizontal, vertical, and diagonal subbands are denoted as , , and , respectively. In this experiment, we use , , , , , , , , and as the decomposition subbands. Given this image decomposition, the statistical model is composed of the mean, variance, skewness, and kurtosis of the subband coefficients, to yield 36-dimensional statistical features.

Next, 1000 stego-images were generated by embedding messages of varying parameter into 1000 cover images. We implemented the classification procedure into an LIBSVM [18] for linear and nonlinear (radial basis) kernel types. Next, 800 clean and stego-images were used to train an SVM model and the remaining 200 images were used in testing. All SVM parameters were optimized by a grid search that optimized the SVM training and testing accuracy. The classification accuracy means the correctness of classifying results. If the stego-image is judged to be a clean image, it is classified into False set; otherwise, it belongs to True set. Similarly, if the clean image can be detected by SVM as a stego-image, it is also in False set. For each test set, the accuracy formula is shown as follows:


Then, the classification accuracy for varying parameter k in testing results is shown in Table 4. According to the steganalysis result, our scheme is hardly detected for k ≤ 4. Finally, we select the estimated embedding rate as the decision threshold and generate the receiver operating characteristic (ROC) curves shown in Figure 10.

Table 4 Classification accuracy (percentage) for varying parameter k with linear SVM and nonlinear SVM as classification kernel.
Figure 10
figure 10

The ROC curves with linear SVM and nonlinear SVM as classification kernel. Linear SVMNon-linear SVM

6. Conclusions

In this paper, we have presented a novel data hiding scheme based on the diamond encoding technique. The diamond encoding method has been used to alleviate distortions after hiding a secret digit into two cover pixels. It not only keeps high stego-image quality but also conceals large amount of data into cover images for secret communication. The performance of the proposed scheme proves to be better than the simple LSB method and other existing schemes in terms of payload and stego-image quality.


  1. Hartung F, Kutter M: Multimedia watermarking techniques. Proceedings of the IEEE 1999, 87(7):1079-1107. 10.1109/5.771066

    Article  Google Scholar 

  2. Marvel LM, Boncelet CG Jr., Retter CT: Spread spectrum image steganography. IEEE Transactions on Image Processing 1999, 8(8):1075-1083. 10.1109/83.777088

    Article  Google Scholar 

  3. Zhang X, Wang S: Steganography using multiple-base notational system and human vision sensitivity. IEEE Signal Processing Letters 2005, 12(1):67-70. 10.1109/LSP.2004.838214

    Article  Google Scholar 

  4. Wang S-H, Lin Y-P: Wavelet tree quantization for copyright protection watermarking. IEEE Transactions on Image Processing 2004, 13(2):154-165. 10.1109/TIP.2004.823822

    Article  Google Scholar 

  5. Lou D-C, Liu J-L: Steganographic method for secure communications. Computers and Security 2002, 21(5):449-460. 10.1016/S0167-4048(02)00515-1

    Article  Google Scholar 

  6. Lin PL, Hsieh C-K, Huang P-W: A hierarchical digital watermarking method for image tamper detection and recovery. Pattern Recognition 2005, 38(12):2519-2529. 10.1016/j.patcog.2005.02.007

    Article  Google Scholar 

  7. Wong PW, Memon N: Secret and public key image watermarking schemes for image authentication and ownership verification. IEEE Transactions on Image Processing 2001, 10(10):1593-1601. 10.1109/83.951543

    Article  MATH  Google Scholar 

  8. Chan C-K, Cheng LM: Hiding data in images by simple LSB substitution. Pattern Recognition 2004, 37(3):469-474. 10.1016/j.patcog.2003.08.007

    Article  MATH  Google Scholar 

  9. Tseng Y-C, Chen Y-Y, Pan H-K: A secure data hiding scheme for binary images. IEEE Transactions on Communications 2002, 50(8):1227-1231. 10.1109/TCOMM.2002.801488

    Article  Google Scholar 

  10. Westfeld A: F5—a steganographic algorithm. Proceedings of the 4th International Workshop on Information Hiding (IH '01), April 2001, Pittsburgh, Pa, USA, Lecture Notes in Computer Science 2137: 289-302.

    Article  MATH  Google Scholar 

  11. Wu D-C, Tsai W-H: A steganographic method for images by pixel-value differencing. Pattern Recognition Letters 2003, 24(9-10):1613-1626. 10.1016/S0167-8655(02)00402-6

    Article  MATH  Google Scholar 

  12. Wang C-M, Wu N-I, Tsai C-S, Hwang M-S: A high quality steganographic method with pixel-value differencing and modulus function. The Journal of Systems and Software 2008, 81(1):150-158. 10.1016/j.jss.2007.01.049

    Article  Google Scholar 

  13. Zhang X, Wang S: Efficient steganographic embedding by exploiting modification direction. IEEE Communications Letters 2006, 10(11):781-783. 10.1109/LCOMM.2006.060863

    Article  Google Scholar 

  14. Fridrich J, Goljan M, Du R: Reliable detection of LSB steganography in color and grayscale images. Proceedings of the International Workshop on Multimedia and Security, October 2001, Ottawa, Canada 27-30.

    Google Scholar 

  15. Zhang X, Wang S: Vulnerability of pixel-value differencing steganography to histogram analysis and modification for enhanced security. Pattern Recognition Letters 2004, 25(3):331-339. 10.1016/j.patrec.2003.10.014

    Article  Google Scholar 

  16. Lyu S, Farid H: Steganalysis using higher-order image statistics. IEEE Transactions on Information Forensics and Security 2006, 1(1):111-119. 10.1109/TIFS.2005.863485

    Article  Google Scholar 

  17. Lyu S, Farid H: Detecting hidden messages using higher-order statistics and support vector machines. Proceedings of the 5th International Workshop on Information Hiding (IH '02), October 2002, Noordwijkerhout, The Netherlands, Lecture Notes in Computer Science 2578: 340-354.

    Article  MATH  Google Scholar 

  18. Chang C, Lin C: LIBSVM: a library for support vector machines. 2001,

    Google Scholar 

Download references

Author information

Authors and Affiliations


Corresponding author

Correspondence to Hsien-Chu Wu.

Rights and permissions

Open Access This article is distributed under the terms of the Creative Commons Attribution 2.0 International License ( ), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Reprints and Permissions

About this article

Cite this article

Chao, RM., Wu, HC., Lee, CC. et al. A Novel Image Data Hiding Scheme with Diamond Encoding. EURASIP J. on Info. Security 2009, 658047 (2009).

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • DOI:


  • Cover Image
  • Secret Message
  • Secret Data
  • Pixel Pair
  • Data Hiding Scheme