#### Abstract

This paper proposes an image watermarking method based on the fast discrete cosine transform (DCT) algorithm for implementation in digital signal processor. A digital watermark can be effectively embedded and efficiently extracted without the host image. The keys in watermarking process include four frequency coefficients in DCT, two random permutation vectors, and a quantization matrix for normalizing the watermark and the host image. The fast DCT algorithm has been shown to reduce the complexity of two-dimensional image transformation so that embedding/decoding an image watermark can be completed in real time within 0.33 seconds. The quality of both watermarked image and extracted (retrieved) watermark remains excellent. It is shown that the watermarking method is efficient in and robust to data cropping, transmission loss, and compression/decompression.

#### 1. Introduction

Conventional technique of embedding watermark signals or patterns into digital image is to insert a secret bit string in spatial, frequency, or wavelet domain. In spatial domain watermarking, the human visual system (HVS) is applied to assure that modifications of an original image by embedded watermark are imperceptible. Koz and Alatan [1] applied the temporal contrast threshold of HVS to prevent image distortion after watermarking, but the watermarked image is vulnerable to data transmission. Kaur et al. [2] proposed a technique to substitute the blue component of image pixels with character bits, but it is also vulnerable to signal processing attack. Agarwal [3] embedded a watermark with data encryption which required substantial data capacity thus leading to low image quality. Tyagi et al. [4] also applied the least significant bit (LSB) to achieve high security at the price of lower image quality. Nath et al. [5] proposed a method for hiding encrypted secret message inside a cover file, which again is vulnerable to data compression and attack. Sara et al. [6] selected the pixels with higher intensity to embed watermark bits by LSB. A major constraint of the above studies is that they all require the original image data to decode the watermark.

In “blind” watermarking, Chadha et al. [7] proposed a method based on LSB and discrete cosine transform (DCT) for decoding watermark without the original image, but the method is sensitive to common image compression. Surrah and Mohamed [8] presented a binary data hiding algorithm by changing the position of every image block to increase security. Wang et al. [9] proposed watermarking by quaternion Fourier transform, but the image quality was reduced significantly by the embedded watermark. With Joint Photographic Experts Group (JPEG) adopting DCT to its compression process, many watermarking methods based on DCT have been developed. Benoraira et al. [10] proposed embedding the watermark bits sequence in both DCT and discrete wavelet transform (DWT) to guard against attack, but the procedure is computational intensive. A watermarking technique based on the so-called wavelet-tree [11] and another based on DWT [12] were also proposed achieving better robustness; however, both required substantial computation with large data capacity.

Singular value decomposition (SVD) is desirable for implementation together with DCT or DWT because it requires extensive computations if applied separately onto images. Rawat and Raman [13] proposed an SVD-based watermarking scheme to increase security in copyright protection. Makbol and Khoo [14] and Lagzian et al. [15] also developed image watermarking schemes based on DWT and SVD to achieve robustness against image processing, but the computational load was substantial. Hu and Hsu [16] proposed image watermarking with DWT-SVD-DCT features to guard against compression. Mishra et al. [17] applied a firefly algorithm based on DWT and SVD for watermarking, but the encryption is time consuming. The above SVD-based watermarking may have good robustness against JPEG compression; however, the embedded watermark becomes vulnerable because all pixels would be changed when one singular value is modified. This paper presents an efficient digital image watermarking method based on the fast DCT algorithm for real-time application. It is shown that the watermarked image quality, robustness, and computation loading can all be improved.

#### 2. Embedding Watermark by the Fast DCT Algorithm

Consider an 8-bit gray-level original image** S** and an image watermark** W**,where and are integers, . The original image** S** is divided into nonoverlapping pixel blocks of size and then transformed into frequency domain. Each block is processed independently by two-dimensional (2D) DCT into matrix** F**. The fast DCT algorithm [18] is applied to decompose the 2D DCT into a pair of 1D DCTs for computation efficiency. For a digital image** S**, the 2D DCT matrix** F** in frequency domain and its inverse transform back to spatial domain can be written in matrix form by where matrix with being the elements in the th row and th columnThe 2D spatial data matrix in (2b) is the linear combination of the base images, which are obtained by the outer product of the column and row vectors of** M**. By exploiting the redundancy in DCT coefficients, it can be shown that the fast DCT algorithm can reduce the complexity of a 2D DCT of 8 × 8 block from** S** to** F** in (2a) in only 24 multiplications, and the inverse transform from** F** to spatial domain in (2b) is simply the transpose of the DCT matrix** M** [18].

Watermarking is performed first by decomposing a true color image into RGB components, and the watermark should be embedded in the main composition of the original image to maintain image quality after watermarking. For example, an image rich in blue shall be watermarked with gray-level blue watermarks. Due to the lower sensitivity of human eyes to blue light, it is recommended to embed watermark in blue component if one cannot determine the main composition of the image. The image embedding process of the watermarking method as shown in Figure 1 includes computation optimization by the fast DCT algorithm and its inverse transform, selection of the middle frequency coefficients, permutation of the watermark, and quantization (normalization) of the watermark and the host image. A spatial domain image** S** is processed by the fast DCT algorithm into spectral domain** F**. Intuitively a watermark should be embedded into the higher frequency coefficients in DCT for better perceptual invisibility. However, the image “energy” is concentrated in the low frequency coefficients (e.g., the 0th~5th coefficients in Figure 2) so that the information embedded (hidden) in the high frequency coefficients (the 28th~63th coefficients) may be vulnerable to data processing. To maintain the quality of a host image after watermarking and to improve the robustness of a watermarked image against data processing, it is recommended to embed the watermark in some of the middle frequency coefficients (the 6th~27th coefficients) as shown in the light color region of Figure 2. Because the host image of size and the watermark are divided into nonoverlapping pixel blocks of size 8 × 8, the number of the middle frequency coefficients selected for embedding the watermark is ()^{2} such that the sizes of the host image and the watermark are compatible. For an 8-bit original image of size 256 × 256 () and 8-bit digital watermark of size 64 × 64 (), 4 middle frequency coefficients in each of the 8 × 8 blocks from the host image are needed to embed the watermark. The image block composed of these middle frequency coefficients is denoted as in frequency domain.

A random number generator is applied to simultaneously generate two vectors to permute the watermark** W** into in spatial domain. These vectors with elements in representing the new coordinates serve as a key to watermark decoding. The permuted watermark is divided into nonoverlapping 4 × 4 blocks and processed by the fast DCT algorithm into in spectral domain. Quantization is required to normalize the image intensity of the host image and watermark thereby increasing the quality of watermarked image and reducing the watermark memory size. The process is to scale the watermark into by the host image property, represented by the average of the middle frequency coefficients, denoted as . The element of quantization matrix is definedsuch that is scaled element by element or block by block into . Note that the watermark now contains the host image information so the impact on image quality after watermarking will be minimized. When embedding the watermark image, the four coefficients selected in will be substituted by the corresponding element in into . The final step is inverse transform of by the fast DCT algorithm in (2b) into watermarked image in spectral domain. In summary, the parameters in the embedding process are the four middle frequency coefficients, two random vectors, and one quantization matrix for normalization. All are to be stored as keys for later decoding process.

A quantitative measurement for evaluating the fidelity of the watermarked image is the peak to signal noise ratiowhere MSE is the mean-square error. For an image of block size 8 × 8, its MSE is where and represent the pixel value in the original image** S** and watermarked image , respectively. The higher the PSNR, the better the image quality. In general, human visual system cannot differentiate a watermarked image from the host image when PSNR ≥ 30 dB.

#### 3. Decoding Watermark

The step of decoding process as shown in Figure 3 is reverse to the embedding process. A watermarked image is first divided into nonoverlapped blocks of size 8 × 8, and each block is processed by the fast DCT algorithm. The middle frequency coefficients in each block are extracted by using the key in the embedding process. Inverse quantization of the extracted watermark is by matrix from the key in embedding process. Inverse DCT can then be applied to obtain the watermark image in spatial domain. Reverse permutation by using the key of the two random vectors is to extract the watermark embedded in the image, denoted as . Note that no original image is required in decoding a watermarked image.

The normalized correlation (NC) is defined to evaluate the fidelity of the extracted watermarkThis is to represent the cross-correlation of the reference and extracted watermarks. If the extracted watermark is the same as the reference (registered) watermark image , then NC = 1.0. Note that NC is a quantitative measurement; it is not necessarily related to image quality. NC = 1.0 indicates that the watermarking method can extract the embedded watermark faithfully. In summary, the steps of decoding process are selection of the RGB component of the watermarked image, computation by the fast DCT algorithm, extraction of the middle frequency coefficients, and inverse quantization, inverse DCT, and reverse permutation.

#### 4. Watermarking Implementation

##### 4.1. PC-Based Watermarking

In order to validate the proposed watermarking method, experiments are conducted on computer (CPU: AMD AM3 Athlon II X4-640, RAM: DDR3 4G-1333, and VGA: MSI R5770 HAWK 1 G GDDR5) in Windows® 8 with Matlab® 2012. The digital image can be stored in Windows Bitmap (BMP), Graphics Interchange Format (GIF), Joint Photographic Experts Group (JPEG), or Tagged Image File Format (TIFF). The use of color image processing is motivated by two factors: color is a powerful descriptor that often simplifies object identification and extraction from a scene and human can distinguish thousands of color shades and intensities, compared to about only two dozen shades of gray. From the absorption characteristics of human eyes, colors are seen as variable combinations of the primary colors: red (R), green (G), and blue (B). In practice, a color model is a specification of coordinate system within which the color is represented by a single point.

By the image watermarking method illustrated in Figure 1, the three components of an image are stored in data array that defines RGB components for each individual pixel. Embedding a watermark is dependent on the main composition of the color image. An original image of size 256 × 256 and a digital watermark of 8-bit gray-level of size 64 × 64 as shown in Table 2 are to demonstrate the watermarking method. The original image divided into nonoverlap blocks of size 8 × 8 shall select 4 coefficients in the middle frequency range after DCT. The middle range coefficients in coordinates (1, 4), (4, 2), (3, 3), and (1, 5), corresponding to block numbers 6, 11, 12, and 14, are selected to embed the image watermark. Table 1 also lists the two random permutation vectors and the quantization matrix of (4). The experiment result is shown in Table 2, where PSNR = 31.256 dB and NC = 1.0, and the watermark embedding/decoding can be completed within 1.6 seconds. The result indicates that the proposed watermarking method can maintain the image quality and the embedding/decoding process is efficient.

Experiments are also conducted to validate the robustness of the watermarking method against image cropping and data compression. Table 3 shows that, after 5% cropping of watermarked image, NC = 0.931. For 15% and 25% cropping, the watermarked image yields NC = 0.777 and 0.707, respectively, and the quality of the retrieved watermark remains satisfactory. These results show that selection of the four middle frequency coefficients for embedding watermark is robust to data compression. Although some distinct features in the retrieved watermark are lost after 25% cropping or 1/4 data compression, the method can still correctly extract and identify the watermark.

Experiments of color image embedding in different components are also conducted. For the color image in Table 4, the watermark can be embedded into R, G, or B component in the middle frequency coefficients. The watermarked in any of the components can be completed within 2 seconds, with PSNR higher than 41 dB.

##### 4.2. DSP-Based Watermarking

With rapid development of digital signal processor (DSP), implementation of real-time processing is feasible. The watermarking method is most effective when implemented in digital signal processor (TMS320C6701), which includes eight functional units CPU, instruction packing to reduce code size, 40-bit arithmetic options for precision, hardware support for floating point operations, and large on-chip RAM. The C/C++ compiler is able to perform optimization (, 1, 2, and 3) in different level of clock cycles and code size. : the lowest level optimization provides the operations of performing loop rotation, allocating variables to registers and simplifying expressions and statements. : the first level performs the optimization on constant propagation and unused assignments. : the second level performs the optimization on software pipelining, unused global assignments, loop unrolling, and incremented pointer. : the highest level performs the optimization by simplifying functions with return values never used, removing all functions never called. and 1 level can efficiently reduce the code size, while and 3 enhance the execution speed with larger code size. Higher levels generally result in the smallest code size.

The code of the proposed watermarking method is written in C language. After compiler, assembler, and linker, the development software generates a machine file and stores it in DSP. The original image, the watermark, and the decoding key are loaded and stored in SDRAM. As a safety protection in communication, the decoding key as listed in Table 1 is the protocol between the deliverer and the receiver. The computation time and code size in DSP at different levels of optimization are listed in Table 5. The code size and computation time are 26 KB and 0.89 seconds in the lowest level (). The computation time in first level () reduces to 0.61 seconds with code size 29 KB. In the second and third ( and 3), the computation time reduces to 0.35 and 0.33 seconds, but the code size increases to 43 and 44 KB, respectively. Implementation on DSP is much faster than PC-based operation. The higher the level of optimization, the less the time required. By comparison, implementation using Matlab on PC requires 1.6 seconds’ computation time. The experiment starts with the highest optimization (), and the watermarked image and extracted watermark are shown in Table 5 with PSNR = 31.531 dB and NC = 0.951. The calculation uses 57,149,130 clocks, corresponding to 0.33 seconds in 44 KB code size. In conclusion, the watermarking method on DSP is efficient and effective for real-time implementation.

#### 5. Conclusions

(1)A digital image watermarking method based on the fast DCT algorithm is developed to maintain the image quality and improve image robustness against signal processing. The decoding keys include (i) the four middle frequency coefficients, (ii) two random permutation vectors, and (iii) a quantization matrix for normalizing the watermark and the original image. A watermark with ownership information is embedded into the host image in an unnoticeable way. An index of peak signal to noise ratio (PSNR) is employed to measure the quality of the watermarked image, and another, the normalized correlation (NC), is also applied to evaluate the similarity and articulation of the extracted watermark with the reference (registered) watermark. The “blind” watermarking method is shown to be robust to image data cropping, transmission loss, and compression/decompression.(2)The watermarking method is first by decomposing a true color image into RGB components such that a watermark can be embedded in the main composition for better image quality. Due to lower sensitivity of human eyes to blue light, it is recommended to embed watermark in blue component if one cannot determine the main composition. The image watermarking method is applicable to images in Windows Bitmap (BMP), Graphics Interchange Format (GIF), Joint Photographic Experts Group (JPEG), or Tagged Image File (TIF) format. To maintain image quality after watermarking and to improve the robustness of a watermarked image, it is recommended to embed the watermark in some of the middle frequency coefficients (the 6th~27th coefficients) in DCT as shown in the light color region of Figure 2. Selection of the frequency coefficients should be based on the desired watermarked image quality and robustness. For an 8-bit original image of size 256 × 256 () and 8-bit digital watermark of size 64 × 64 (), 4 middle frequency coefficients of the host image after DCT are needed to embed the watermark.(3)Experiments show that PC-based watermarking can be completed within 1.6 seconds and the quality of image remains pristine with PSNR = 31.256 dB and the retrieved watermark NC = 1.0. The method is shown to be robust to image data cropping and compression/decompression. The method is also optimal for real-time applications in DSP, where implementation shows that the embedding and extraction can be completed within 0.33 seconds. The watermarking method is efficient and effective against illegal pirating, destruction, and copy.

#### Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.