Document not found! Please try again

Watermarking Algorithm - CiteSeerX

2 downloads 503 Views 119KB Size Report
Feature Watermarking in Digital Documents For. Retrieval and ..... zero as an element. As mentioned before, zero is the sign of termination of one round of.
Feature Watermarking in Digital Documents For Retrieval and Authentication Negar Sadat Mirsattari, Parisa Haghani, and Mansour Jamzad Department of Computer Engineering Sharif University of Technology Tehran, Iran [email protected], [email protected], [email protected]

Abstract The wide proliferation of digital media, such as digital images has aroused great interest for copyright protection, annotation and authentication. In this paper, we have used invisible watermarking as a means for authentication of two-color text documents. After detecting important features of the document for example the name in an ID card, they are compressed and embedded in the document image as a watermark. Two variations have been made to the CPT watermarking algorithm [8, 9, 10] and the improved scheme has been used as our watermarking method. This scheme uses a secret matrix key and therefore is completely secure. It also has a high capacity and does not degrade the quality of the host image. As we use a lose less method to compact each important feature and embed the coded feature many times in the document image, the implemented system is able to detect image altercations in these features and can completely retrieve them, even if a hacker has changed them in that document. Therefore, we can provide a valid authentication for the retrieved document.

1. Introduction The wide proliferation of digital media, such as digital images, video and text has aroused great interest for copyright protection, annotation and authentication. In this paper, we have used invisible watermarking as a means for authentication of two-color text documents. After detecting important features of the document, such as the name or birth date in a birth certificate or the patent number in a patent, they are compressed and embedded in the document image as a watermark. As an example, we have used the name of a person in his ID card as the document’s feature and embedded it in the document image. This algorithm is applicable on any feature of two-color text images. The implemented system is able to detect image altercations and can completely retrieve the features watermarked in the image, even if these features are changed by a hacker. In recent years, there has been a lot of interest for digital watermarking of digital images [1, 2]. However, hiding data in black and white images, such as faxes, barcodes or text documents, have been seldom approached and have specific complications. The difficulty of watermarking in such images, come from the fact that changing a single pixel in them, can be easily detected by eye. In a number of methods used specifically in black and white text documents statistical information of the distances between words, lines and paragraphs are used to store data [3, 4, 5]. These methods are applicable only on text

images which have been typed. Extracting the needed statistical information is one of the reasons that makes these methods complicated. The other method proposed in this regard uses the relation between odd and even run lengths to hide data [6]. In this technique, if the watermarking method is known to the attacker, the watermarked information can be extracted without needing any more information. The image can be changed in a way that the stored information aren’t altered, causing the changes to go undetectable. An investigation of watermarking for binary images on frequency domain, in particular DC components of DCT is presented in [7]. In this work, the quality of watermarked images is not good enough since a post embedding binarization process is involved. However, this method may provide certain degrees of robustness. We have used and improved to some extend the watermarking method introduced in [8, 9, 10]. In this method the image is divided into m × n blocks. By changing at most two pixels in a block, log2( m × n +1) -1 bits can be hidden in that block. This technique is based on a key matrix, so that even if an attacker knows the watermarking scheme, he can not extract the embedded information. In section 2 we introduce our watermarking algorithm. It consisted of two main parts, the watermark embedding and retrieval subsystems, which are described in sections 3 and 4. An example of a tampered image is illustrated in section 5.

2. Watermarking Algorithm In general, data hiding can be defined as follows: Given a host image H and a guest message G, a data hiding scheme provides a data hiding function Sh and a data retrieving function Sr such that H’ = Sh (H, G, K) Sr (H’, K) = Sr (Sh (H, G, K), K) = G Where, H’ is the modified version of H containing the guest message G, K is a secret key. Sr must be able to retrieve message G from H’ by applying Sh on it. In addition it must be hardly detectable that H’ has been hidden with information. In other words, H’ must look almost like H.

2.1 CPT Watermarking Algorithm CPT Watermarking Algorithm is introduced in reference [8] and is revised in [9] and [10]. This scheme changes the value of a pixel only if it has a neighbor having the same color as its new value, so the quality of resulting image is very good. In this algorithm, it is assumed that we are given a host binary image F. F will be partitioned into m × n fixed size blocks. To perform this partitioning we may need to pad F or do not consider some parts of it. This scheme is able to hide up to r ≤ [log 2 (mn + 1)] − 1 bits in each block by modifying at most two bits of that block. The secret key in this scheme has two components:

• •

K: The first component of secret key is a random selected binary matrix of size m × n . W: The second component of secret key is a weight matrix which is an integer matrix of size m × n .

W satisfies the condition that {[w]i , j | i = 1,...m , j = 1,...n} = {1,2,...,2 r +1 − 1} and each 2×2 subblock of it contains at least one odd element. The number of possible W matrices is large enough to prevent a brute-force attack. Now we describe how to hide a bit stream b1 b2 …br into an m × n host block, say, Fi. 1. First we calculate the distance matrix dist(F), which is an integer matrix of the same size such that [dist ( F )]i , j = ∀x, y min{ | i − x | 2 + | j − y | 2 | [ F ]i , j ≠ [ F ] x , y }

That is, [dist(F)]i,j is the distance from [F]i,j to the closest element [F]x,y such that the complement of [F]i,j is equal to [F]x,y. 2. Compute Fi ⊕ k , Where ⊕ means the bitwise exclusive-OR of two equal-size binary matrices. 3. Compute SUM (( Fi ⊕ k ) ⊗ W ) , Where ⊗ means the pair wise multiplication of two equal-size binary matrices and SUM means the sum of all elements in a matrix. 4. From the matrix Fi ⊕ k , compute for each w = 1… (2r+1-1) the following set: S w = {( j , k ) | ([W ] j , k = w ∧ [ Fi ⊕ K ] j ,k = 0 ∧ [dist ( F )] j , k ≤ 2 ) ∨ ([W ] j , k = 2 r +1 − w ∧ [ Fi ⊕ K ] j ,k = 1 ∧ [dist ( F )] j ,k ≤ 2 ))}

Intuitively, Sw is the set containing every matrix index (j, k) such that a pixel with its complement value exists in its 8-connected neighbors and if we complement the [Fi]j,k , we can increase the sum in step 3 by w. In addition, we define s w = sw' for any w ≡ w′ (mod 2r+1). 5. Define the weight difference d d ≡ (b1b2 ...br 0) − SUM (( Fi ⊕ K ) ⊗ W )(mod 2 r +1 ) If d=0, there is no need to change Fi. Otherwise, we run the following program to transform Fi to Fi’. If possible randomly pick an h from {1,2,..., 2 r +1 − 1} such that s hd ≠ φ and s − ( h −1 ) d ≠ φ . a) Randomly pick a point ( j, k ) ∈ s hd and complement the bit [Fi]j,k.

b) Randomly pick a point ( j , k ) ∈ s −( h −1) d and complement the bit [Fi]j,k. By changing these two points hd and –(h-i)d will be added to SUM (( Fi ⊕ k ) ⊗ W ) . So in total the sum will be increased by d, as it was required. If it is not possible to find such an h, no data will be hidden. We compute SUM (( Fi ⊕ k ) ⊗ w ) mod 2. If it is equal to 1 then Fi will be kept intact. Otherwise, we select a point ( j, k ) ∈ s w where w is an odd number and complement the bit [Fi]j,k. Therefore, an odd sum determines that no data is hidden. However, note that if the resultant block is completely black or blank, we will regard the data hiding as invalid. That is, we will hide the same bit stream again in the next host block. 6. Upon receiving the block Fi’, the receiver computes SUM (( Fi ′ ⊕ k ) ⊗ w ) / 2 . This is the hidden data if the block is not completely black or white and ′ SUM (( F i ⊕ k ) ⊗ w ) is even.

2.2 The Variations Made To CPT We have changed the former algorithm in two ways and applied it on texts written in Persian. The first change has improved the quality of image after data embedding, while the second makes it possible to embed more data without degrading the quality. To improve the quality we have defined priorities for changing the pixel values as described in the following. As Persian is written from right to left, top to bottom, the upper-right and lower-left neighbors of a pixel are assigned the highest weights. The 4-neighbores have the second highest weights and the other two posses the lowest weights. The sum of the weights of the 8-neighbores of a pixel having the opposite color is used as a priority for changing that pixel. In the second variation made to the algorithm, in order to increase the capacity we take in to account the pixels around a block to assess the values of a pixel’s neighbors. This technique selects the border pixels of a block with higher probability compared to the original scheme. This helps detecting more and better changeable pixels, therefore improving the capacity and the quality of watermarking. The around block pixels are only used for assessing the values of their neighbors, which are border pixels, and are not selected to be changed.

3. The Watermarking Subsystem of our Scheme The implemented system consists of two main subsystems, in addition to the subsystems generating the key and weight matrices of CPT method. Our proposed two main subsystems are the watermark embedding and retrieval subsystems. In this section we describe the watermarking subsystem, which is responsible for extracting the main

feature of the document and hiding it in the document image. The retrieval subsystem is described in the next section.

3.1. Formatting the Document Image We assume that the document image is placed in a black background. First, we eliminate all rows and columns of the background which consist of mostly black pixels. Then the document is rotated until it is aligned vertically and horizontally. Again the borders of the rotated image are eliminated and the image is resized to a predefined size. After these pre-processing, the features of the image can be extracted. A formatted image is shown in figure 1. The image is resized to 400 × 600 pixels. It is clear that the larger the image is the more information can be hidden in it.

Figure 1: A formatted image

3.2 Feature Extraction Now we vaguely know the location of the feature. Each feature is located in a window of a predefined size. To extract the feature, we perform the following on a copy of the window containing it. First, we use a number of dilation, erosion using small probs (i.e. structuring elements) to remove noise, and then the solely white marginal columns of the window are eliminated. Using a method similar to Run-Length encoding introduced in [11] we compress the feature’s data into an array: the first element is the number of white pixels from the upper

right corner of the feature window moving in the corresponding column down, the second is the number of black pixels following the white ones. The rest of the elements are similarly equal to the number of white and then the black pixels following the white ones in a column by column traversal of the feature window. The last element of this array is set to zero as a sign of termination. The feature extraction phase is shown in figures 2.

Figure 2: Feature extraction. Left: Feature window. Right: Feature window after noise removal

The user can select from the automatic mode described above and a manual mode. In the manual mode, the user sets the feature array equal to the ASCII codes of the characters of the word corresponding to the feature. In this case, the number of bits of the feature array is less than the automatic mode and therefore the number of times it can be repeated as a watermark is about ten times the automatic version. As a result, the probability of extracting these codes is much higher and the feature is extractable even when the image is clipped or noise has been added to a lot of its block. Using a Persian hand-writing detection systems, the ASCII codes can be extracted from the feature window automatically, therefore enabling an automatic system that requires the least number of bits for storing the feature. This is to be studied and implemented in our future works.

3.3 Invisible Watermarking Elements // what do you mean by elements of the feature of the feature array are embedded in image starting from the first block to the last element of the array which is zero. // Is the first block an element of the array ?? Please clarify the sentence. Then they are repeated again from the beginning until the last block of image. As defined in CPT algorithm each block can hide at most r bits, (i.e. the number 2r-1), // isn’t it 2r-1 ,(2 to the power of r) minus one. Please correct all related terms in this // paragraph. so for example to embed the number 2r+1-2 we hide the numbers 2r-1 in two consecutive blocks and the number 0 in the third block following the two mentioned blocks. If we wanted to store 2r+1-1 we would store 1 in the third block. Note that we have assumed that if block A and B are consecutive blocks and A contains 2r-1 as its embedded date, the value in B should be added to 2r-1 to generate the corresponding array element and this should continue until the data embedded in a block is less than 2r-1. In Figure 3, the watermarked image is shown. Figure 4 presents the difference between the original and watermarked images.

4. The Watermark Retrieval Subsystem of our Scheme

This subsystem receives the watermarked image as its input and verifies its authentication. Image modifications are detected, and if the image has not been widely changed, the important feature that was embedded in the image is retrieved.

Figure 3: The watermarked image

Figure 4: The difference between the original and watermarked images

4.1 Watermark Extraction The watermark is extracted as explained in the watermark retrieval section of the CPT scheme. If the number extracted from one block is 2r-1, as described in section 3.3 we know that it is not just complete. The rest of the element’s value is extracted from the following block or blocks. The elements are stored in a row of a matrix until extracting a zero as an element. As mentioned before, zero is the sign of termination of one round of embedding the watermark. Staring from the next extracted element, they are stored in the next row of the matrix. In this matrix, each row corresponds to one watermark extraction, while each column corresponds to the extracted elements. After all elements hided in the blocks have been retrieved, the voting method is used between the elements of each column to determine the corresponding element. Putting all these next to each other in a row, we have extracted the watermark, i.e. embedded features of document 4.2 Constructing The Feature From The Feature Array After constructing the feature array, by considering its length we can determine which of the methods, automatic or manual has been used for watermark embedding. If the manual method has been used, we just decode the feature array elements from their ASCII code to strings. In the other case, where automatic method has been used to embed data, knowing the window’s size and the array’s elements which determine the distance of the feature’s pixel’s from the previous pixels, we rebuild the window. Figure 5 Left shows the window built from the extracted watermark of figure 2.

4.3 Extracting The Feature From The Watermarked Image The method described for extracting the feature of original image is used here again. Figure 5 Middle shows the extracted feature of the image shown in Figure 3.

4.4 Comparing Two Features If the feature is extracted manually, the task of comparing the two features is reduced to checking the equality of the two ASCII code strings. Otherwise, comparing the features is done in two ways. In the first method, which is more appropriate for visual monitoring of an operator, the extracted watermark is decoded to an image and the two images, the watermark and the feature extracted from the image, are compared together. If they differ on only a few pixels the feature has not been changed. Figure 5 shows these three images.

Figure 5: Retrieval subsystem. Left: Decoded window, Middle: Extracted window. Right: Difference.

To perform a more precise comparison, the similarity between two arrays is assessed. In this method, the maximum match between two arrays is detected. The maximum match is the length of the largest common sub-arrays of the two arrays, with respect to the order of elements, but not their position. Figure 6 illustrates an example of maximum match between two arrays of length 5.

Figure 6: An example of maximum match.

The similarity measure between two arrays extracted from figure 2 and figure 3 is 0.9720. This is because two pixels in the feature have been changed for watermark embedding and therefore some elements of the feature array have been changed. As the watermarked image has a few different pixels compared to original image, the similarity measure is less than 1. However, the thinning and noise removal processes, usually lessen these differences.

5. Another Example Figure 7 shows a tampered version of figure 3. In figure 8 the retrieval steps have been illustrated. The system is able to retrieve the initial feature from the watermark and as the difference between the watermark extracted, meaning the initial feature, and the feature extracted from the watermarked image is too high, their similarity is only 0.4259, tamper is detected and the image is modified.

Figure 7: Tampered watermarked image

Figure 8: Retrieval subsystem. Left: Decoded window, Middle: Extracted window. Right: Difference.

6. Conclusion In this paper two variations have been made to the CPT scheme in order to improve the quality of the resultant image and increase the capacity of it for holding watermarked information. This scheme is then used to watermark digital documents for their authentication and feature retrieval. Using this scheme, all important features of a digital document can be extracted and watermarked in the document image. For Authentication, the main features of the image are extracted and are then compared to the retrieved watermarked information, which contains the original image’s main features. If they are similar enough, the document is considered valid, otherwise the document has been tampered by a hacker. But as we use a lose less method to compact each important feature and embed the coded feature many times in the document image, the watermarked features can reveal the true values of the main features embedded in the document. This watermarking scheme does not degrade the image quality and it is also robust to noise which has affected a number of blocks in the image but not all of them.

7. References [1] N. F. Johnson, and S. Jajodia (1998),”Exploring Steganography: Seeing The Unseen,” IEEE Computer, vol.31, no.2 ,pp.26-34. [2] D. C. Wu, and W. H. Tsai (2000), “Spatial-domain Image Hiding Using Image Differencing,” IEE Proceeding-Vision, Image and Signal Processing, vol. 147, no. 1, pp 29-37. [3] J. T. Brassil, S. Low, N.F. Maxemchuk, and L. o’Gorman (1995), “Electronic Marking and Identification Techniques to Discourage Document Coping, ”IEEE Journal on Selected Areas in Communications, Vol. 13, no. 8, pp. 1495-1504. [4] J. T. Brassil, S. Low, and N.F. Maxemchuk, (1999), “Copyright Protection for the Electronic Distribution of Text Documents,” Proceeding of the IEEE, Vol. 87, no. 7, pp. 1181-96. [5] D. Huang, and H. Yan, (2001), “Interword Distance Changes represented by Sine Waves for Watermarking Text Images,” IEEE Trans. On Circuits and Systems for Video Technology, vol. 11, no. 12, pp. 1237-45. [6] D. C. Wu, M. K. Hsu, and J. H. Jheng (2003), “Data Hiding and Authentication Techniques for 2-Color Digital Documents Based on Adjusting Lengths of Runs,” 16th IPPR Conference on Computer Vision, Graphics and Image Processing. [7] H. Lu, X. Shi, Y. Q. Shi, A. C. Kot, and L. Chen(2002), ”Watermark embedding in DC Components of DCT for Binary images”, 2002 IEEE Workshop on Multimedia Signal Processing, pp.300-303, Dec. 2002.

[8] H. K. Pan, Y. Y. Chen, and Y. C. Tseng (2000), “A secure data hiding scheme for 2-color images,” IEEE ISCC 2000, pp. 750-755 [9] Y.-C. Tseng, and H.-K. Pan (2001) “Secure and invisible data hiding in 2-color images” IEEE INFOCOM 2001 The Conference on Computer Communications, no .1 ,pp 887-896 [10] Y.-C. , Tseng , Y.Y.Chen , and H.-K. Pan (2002), “A Secure Data Hiding Scheme for Binary Images” IEEE Trans On communication, Vol. 50, No. 8, Aug. 2002, pp.1227-31. [11] Kh. Sayoon (2000), “Introduction to Data Compression,” Morgan Kaufmann Publishers Book Company.