Abstract:
A watermark and extracting method and a watermark hardware structure used in an image compression system. A series of data is generated by random variables, such that duplication is avoided. According to characteristics of the human vision system, weighted value of each block is analyzed by classification in the frequency domain. According to the specific weighted value for each block, a watermark intensity is embedded, such that the embedded watermark is not easily observed, while the robustness is retained. Therefore, the original figure is not required for extraction. In addition, the watermark embedding hardware structure can be incorporated in a joint photographic experts group (JPEG) system, so that the image itself contains the watermark data while being intercepted.

Description:
CROSS-REFERENCE TO RELATED APPLICATION 
   This application is a divisional application of, and claims the priority benefit of, U.S. application Ser. No. 10/104,281 filed on Mar. 20, 2002, now U.S. Pat. No. 6,993,151, which claims the priority benefit of Taiwan application serial no. 91101230, filed Jan. 25, 2002. 

   SCENARIO OF THE INVENTION 
   1. Field of the Invention 
   The present invention relates in general to a watermark, and more particularly, to a watermark embedding and extracting method and a watermark embedding hardware structure used in an image compression system. 
   2. Description of the Related Art 
   In recent years, many corporations and enterprises have applied the Internet to commercial activities for business promotion. The activities include, for example, electronic shopping, on-line broadcast, on-line filming, and electronic document. A great convenience has been obtained for both the enterprises and the customers. However, problems regarding information security such as allonym transaction, embezzlement, abstraction and interpolation occur. Many of these problems can be resolved by encryption technique. However, copyright approval and inspection problems for the network transmission of valuable medium (such as image, film and music) have to be overcome. Lately, as digital cameras and scanners have become popular, the digitized photograph has become widely distributed over the network. Such a broad distribution results in interpolation and appropriation problems for the photographs, and copyright problems thus occur. The watermark is one of the methods to resolve such problems. 
   The hidden watermark is applied based on the distortability characteristic of the digital medium, that is, minor modification of digital data does not result in significant effect for sensory perception of human beings. The watermark technique is categorized into a spatial domain and a frequency domain. In the spatial domain, digital data value is directly changed to embed the watermark. Such a method has the advantage of fast operation speed, but it is difficult to resist damage caused by various type of signal process. In the frequency domain, the digital data is transformed into a frequency domain, using Fourier transformation, discrete cosine transformation (DCT), or wavelet transformation, for example. After transformation, the obtained coefficient is used to embed the watermark, which is then converted to the previous spatial domain. The method requires a huge operation, but has a better capability to resist noise processing damage. 
   The above conventional watermark embedding technique is achieved by software processing. As the watermark embedment requires a huge operation, a complex program is required. Thus, the load on the system is increased, and the performance thereof is affected. 
   SUMMARY OF THE INVENTION 
   The invention provides a watermark embedding and extracting method and a watermark embedding hardware structure used in an image compression system. By executing watermark embedment via the watermark embedding hardware structure, the image itself contains the watermark data after image compression, therefore, the performance of the whole system is enhanced. 
   The watermark embedding method used in the image compression system comprises partitioning an original image into several sub-image blocks. Each of the sub-image blocks B k  (k=1, 2, 3, . . . , n, and n is a positive integer) has an 8×8dimension. A discrete cosine transformation is performed on each of the sub-image blocks B k . A texture analysis and a luminance analysis are performed on each sub-image block by classification to generate analysis data. According to the analysis data, each sub-image block is divided into three levels. 
   When number{intF k  (u,v)/Q k (u,v))≠0}&lt;T 2 and F k  (0,0)&lt;T 1 , the sub-image block B k  is defined as level 1 that indicates darker luminance and insignificant texture characteristics. 
   When number{intF k (u,v)/Q k (u,v))≠0}&gt;T 2  and F k (0,0)&gt;T 1 , B k  is defined as class 3 that indicates brighter luminance and significant texture characteristics. 
   When B k  is neither class 1 nor class 3, it is defined as class 2 that indicates luminance and texture characteristics between levels 1 and 3. 
   In the above relationships, F k (0,0) indicates the low frequency value (DC) obtained by performing a discrete cosine transformation on each sub-image block B k , and F k (u,v) indicates the high frequency value (AC) obtained by performing discrete cosine transformation on each sub-image block B k , where u, v≠0. Q(u,v) is the quantized value, T 1  is the low frequency value, and T 2  is the non-zero number in high frequency. According to the analysis value, the image characteristic for each sub-image block is determined, and a corresponding weighted value α k  is given. A multiplication for the weighted value and a watermark value is obtained. The data F k * of the watermark embedded into each sub-image block corresponding to a fixed position of the sub-image block is derived from the following equation (1). 
                   F   k   *     =     {                 F   k     ⁡     (     u   ,   v     )       +     (       α   k     ×     x   i       )       ,       3   ⁢   k     &lt;   i   &lt;     (       3   ⁢   k     +   1     )       ,             (     u   ,   v     )     ∈     {       (     0   ,   1     )     ,     (     1   ,   0     )     ,     (     1   ,   1     )       }                     F   k     ⁡     (     u   ,   v     )       ,         others                   (   1   )               
where x i  is the embedded watermark value. The embedded watermark value is then quantized and encoded to generate a standard JPEG file.
 
   The invention further provides a watermark extracting method used in an image compression system. The image to be tested X* is partitioned into several sub-image blocks with a dimension of 8×8. The discrete cosine transformation is performed on each sub-image block to obtain several data. A zigzag encoding process is performed to sort the data from low frequency to high frequency. A watermark signal energy W* is extracted at the position where the embedded watermark is. The relationship of Z=W×W*/M is applied to obtain the correlated value Z of the watermark contained in the image to be tested X*. Z is the correlated value of the watermark contained in the image to be tested X*, W is the value of the embedded watermark, and M is the quantity of the embedded watermark. When the correlated value Z is larger than a critical value S z , whether the image to be tested X* contains watermark is determined. The critical value S z  can be expressed by 
               S   z     =         α   _       3   ⁢   M       ⁢       ∑     i   =   1     M     ⁢     W   i   *           ,         
where {overscore (α)} is an average weighted value.
 
   The invention further provides a watermark embedding hardware structure, having a discrete cosine transformation register, a quantization table ROM, a first and a second comparator, a first and a second register, a multiplier and an adder. The discrete cosine transformation register is used to store the data obtained by discrete cosine transformation. The quantization table ROM is used to store the quantized values. The first comparator coupled to the quantization table ROM receives and compares the data and the quantized values, and outputs the quantized values. The first register is used to store a first configuration value. The second register is used to store a second configuration value. The second comparator is coupled to the first comparator and the first and second registers to receive and compare the quantized data, the first and second configuration values, so as to output a weight value corresponding to each quantized value. The multiplier is coupled to the second comparator to receive the weighted values and the watermark values. The weighted values are multiplied by the watermark values to output the embedded watermark value. The adder is coupled to the discrete cosine transformation register and the multiplier to receive the embedded watermark values and the data to be embedded with the embedded watermark values. The data is added to the embedded watermark data to output the embedded watermark data. In addition, the embedded watermark data is stored in the discrete cosine transformation and output thereby. 
   The invention further comprises another watermark embedding hardware structure, comprising a discrete cosine transformation register, a classification detection system, and a watermark embedding apparatus. The discrete cosine transformation register is used to store the data obtained by discrete cosine transformation. The classification detection system is coupled to the discrete cosine transformation register to receive the data, and to output a weighted value, which is generated by a weighted value generator corresponding to each of the data. The watermark embedding apparatus is coupled to the classification detection system and the weighted value generator to receive the weighted values and the watermark values. The weighted values are then multiplied with the watermark values to obtain an embedded watermark value, which is then added with the data to obtain the embedded watermark data, output by the classification detection system. In addition, the embedded watermark data is stored in the discrete cosine transformation register and output thereby. 
   According to the above, the embedment of watermark executed by the watermark embedding hardware structure provided by the invention allows the image to contain the watermark data therein after image compression, so that the system performance is enhanced. In addition, the watermark embedding hardware structure can be combined with the joint photographic experts group (JPEG) system, and is applicable to image compression systems for digital cameras or scanners. 
   Both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed. 

   
     BRIEF DESCRIPTION OF THE DRAWINGS 
       FIG. 1  shows an embodiment of a watermark embedding hardware structure used in an image compression system in the invention; 
       FIG. 2  shows a watermark control process flow of an watermark embedding hardware structure used in an image compression system according to a preferred embodiment of the invention; 
       FIG. 3  shows an embodiment of a watermark embedding process flow applied to an image compression system; 
       FIG. 4  shows an embodiment of a watermark extracting process flow applied to an image compression system; and 
       FIG. 5  shows the correlation and peak signal noise ratio under different compression ratio for a watermark embedding hardware structure used in an image compression system in one embodiment of the invention. 
       FIG. 6  shows combining a JPEG file with a watermark embedding hardware structure used in an image compression system in one embodiment of the invention. 
   

   DESCRIPTION OF THE PREFERRED EMBODIMENTS 
   Referring to  FIG. 1 , a preferred embodiment of a watermark embedding hardware structure used in an image compression system according to the invention is shown. The embedding hardware structure comprises a discrete cosine transformation (DCT) register  102 , a classification detection system  104 , and a watermark embedding apparatus  106 . The functions for each of the above elements are described as follows. 
   The DCT register  102  is used to store several data obtained after the discrete cosine transformation. In this embodiment, the DCT register  102  has 64×12bits. 
   The classification detection system  104  comprises a quantization table ROM  108 , a first comparator  110 , a first register  112 , a second register  114 , and a second comparator  116 . The quantization table ROM  108  is used to store several quantization values. The first comparator  110  is used to receive the data and the quantization values. The first register  112  is used to store a first configuration value. The second register  114  is used to store a second configuration value. The second comparator is used to receive and compare the quantization values, the first and second configuration values, and to output the weighted value α k  corresponding to each of the quantization values. In addition, the weighted value α k  is generated by a weighted value generator (not shown). 
   The watermark embedding apparatus  106  comprises a multiplier  118  and an adder  120 . The multiplier  118  receives the weighted values α k  and a watermark value, so as to output an embedded watermark value obtained by multiplying the weighted values α k  and the watermark value. The adder  120  receives the embedded watermark value and adds the data with the embedded watermark data to output embedded watermark data, which is then stored in and output by the DCT register  102 . 
   The whole control process for embedding watermark is completed using an internal control unit  122  as shown in  FIG. 2 . The whole control process is divided into four states, that is, an idle state  202 , an S0 state  204 , an S1 state  206  and an S2 state  208 . The idle state  202  lasts until receiving a DCT complete signal. While receiving the DCT complete signal that indicates the completion of the discrete cosine transformation in the DCT module, the S0 state is entered. In S0 state, the data obtained by transformation is input and stored to the DCT register  102 , and the weighted values α k  are obtained. The S1 state is then entered to execute the embedding function of the watermark. The S2 state is then entered to output the embedded watermark data obtained by the watermark embedding function. The system then enters the idle state  202  again and standby for the next DCT complete signal. 
   According the process flow for watermark embedment used in an image compression system in one embodiment of the invention as shown in  FIG. 3 , an original image is partitioned into several sub-image blocks. Each sub-image block B k (k=1, 2, 3, . . . , n, where n is a positive integer) has an 8×8 dimension. A forward discrete cosine transformation (FDCT) is performed on each sub-image in step s 302 . Texture and luminance analysis is performed on each sub-image block to obtain an analysis value. According to the analysis value, each sub-image block can be divided into three levels. 
   When number{intF k (u,v)/Q k (u,v))≠0}&lt;T 2  and F k (0,0)&lt;T 1 , the sub-image block B k  is defined as class 1 that indicates darker luminance and insignificant texture characteristics. 
   When number{intF k (u,v)/Q k (u,v))≠0}&gt;T 2  and F k (0,0)&gt;T 1 , B k  is defined as class 3 that indicates brighter luminance and significant texture characteristics. 
   When B k  is neither class 1 nor class 3, B k  is defined as class 2 that indicates luminance and texture characteristics between class 1 and class 3. 
   In the above relationships, F k (0,0) indicates the low frequency value (DC) obtained by performing a discrete cosine transformation on each sub-image block B k , and F k (u,v) indicates the high frequency value (AC) obtained by performing a discrete cosine transformation on each sub-image block B k , where u, v≠0. Q(u,v) is the quantized value, T 1  is a value in low frequency, and T 2  is the non-zero number in high frequency (step s 304 ). According to the analysis value, the image characteristic for each sub-image block is determined, and a corresponding weighted value α k  is given. Multiplication of the weighted value and a watermark value is performed. The data F k * of the watermark embedded into each sub-image block corresponding to a fixed position of the sub-image block is derived from the following equation (1). 
                   F   k   *     =     {                 F   k     ⁡     (     u   ,   v     )       +     (       α   k     ×     x   i       )       ,       3   ⁢   k     &lt;   i   &lt;     (       3   ⁢   k     +   1     )       ,             (     u   ,   v     )     ∈     {       (     0   ,   1     )     ,     (     1   ,   0     )     ,     (     1   ,   1     )       }                     F   k     ⁡     (     u   ,   v     )       ,         others                   (   1   )               
where x i  is the embedded watermark value, which is a set of random variables ranged between +1 and −1 (as step s 306 ). An inverse DCT (IDCT) is performed on the resultant watermark data F k *, and the standard JPEG file generated by quantization and encoding is obtained (step s 308 ).
 
   In addition, if each sub-image block belongs to class 1, the best image quality is obtained when the weighted value is 2 according to an empirical result. If each sub-image block belongs to class 2, the best image quality is obtained when the weighted value is 6 according to an empirical result. If each sub-image block belongs to class 3, the best image quality is obtained when the weighted value is 9 according to an empirical result. Further, the embedding method comprises a module added with a watermark and a module not added with a watermark, which results in the JPEG file with and without hidden watermark, respectively. 
     FIG. 4  shows a watermark extracting process flow used in an image compression system according to one embodiment of the invention. An image to be tested X* is partitioned into several sub-image blocks with a dimension of 8×8. The discrete cosine transformation is performed on each sub-image block to obtain several data. A zigzag encoding process is performed to sort the data from low frequency to high frequency (step s 402 ). A watermark signal energy W* is extracted at the position where the embedded watermark is (step s 404 ). The relationship of Z=W×W*/M is applied to obtain the correlated value Z of the watermark contained in the image to be tested X*. Z is the correlated value of the watermark contained in the image to be tested X*, W is the value of the embedded watermark, and M is the quantity of the embedded watermark (step s 406 ). When the correlated value Z is larger than a critical value S z , whether the image to be tested X* contains a watermark is determined. The critical value S z  can be expressed by 
               S   z     =         α   _       3   ⁢   M       ⁢       ∑     i   =   1     M     ⁢     W   i   *           ,         
where {overscore (α)} is an average weighted value.
 
   When the correlated value Z is not larger than the critical value S z , the image to be tested X* does not contain the watermark (step s 408 ). 
   In addition, 
               W   *     =       ∑     k   =   1     n     ⁢     W   k   *         ,       W   k   *     =       F   *     ⁡     (     u   ,   v     )         ,       (     u   ,   v     )     ∈     {       (     0   ,   1     )     ,     (     1   ,   0     )     ,     (     1   ,   1     )       }             
where F k *(u,v) is the embedded watermark data.
 
             W   =       ∑     i   =   1       3   ⁢   n       ⁢     x   i         ,         
where x i  is the embedded watermark value, and M=3n. In addition, the extracting method does not require the storage of the original figure, so that it can be applied to detection of watermark.
 
     FIG. 5  shows a graph of correlation versus peak signal to noise ratio (PSNR) for an embedding hardware structure used in an image compression system under different compression ratios according to one embodiment of the invention. As shown in  FIG. 5 , when the percentage of compression quality is low, the correlation and PSNR are low. In contrast, the correlation and PSNR are high when the compression quality percentage is high. 
   Another embodiment of the invention provides a watermark embedding hardware structure that can be incorporated in a JPEG system. The combination of the watermark embedding hardware structure and the JEPG system is shown as  FIG. 6 . The watermark embedding structure  602  is a watermark embedding hardware structure used in an image compression system. The watermark value is stored in an watermark ROM. The JPEG system  606  comprises a low frequency table apparatus (DC_table)  608 , a low frequency variable length coding apparatus (DC_VLC)  610 , a difference program coding module (DPCM)  612 , a quantization apparatus  614 , a quantization table apparatus  616 , a zigzag code sequence apparatus  618 , an execution length converter (RLC)  620 , a high frequency table apparatus (AC_table)  622 , and a high frequency variable length coding apparatus (AC_VLC)  624 . The operation of the system structure is described as follows. 
   Through a color image domain converter (RGB2YUV)  626 , an image is sampled by a sampling apparatus  628 . The sampled image is partitioned into 8×8 image blocks by an image partitioning apparatus. Each image block is processed with FDCT by a DCT module  632 . The transformed image can select the watermark data provided by the watermark embedding apparatus  602  via a multiplexor  634 . The output data of the multiplexor are then quantized and coded by the JPEG system  606 . Through the transformation control apparatus  636  and the header  638 , the JPEG file with watermark data is generated. Therefore, the invention incorporates a combination of the watermark embedding hardware structure into a JPEG system, which is applicable to an image compression system such as a digital camera and a scanner. Thereby, while an image is intercepted by the digital camera or the scanner, the image itself contains the watermark data, and the system performance is enhanced. 
   According to the above, the invention has the following advantages. 
   1. A hardware structure is used for embedding the watermark, so that the performance of the whole system is enhanced. 
   2. After image compression, the image itself contains watermark data. 
   3. The watermark hardware structure can be combined with the JPEG system. 
   Other embodiments of the invention will appear to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. It is intended that the specification and examples to be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.