Disclosure of Invention
In order to solve the above problems, an object of the present invention is to provide a DWT domain-based digital watermarking method and system, so as to implement embedding and extraction of a blind watermark image with gray scale, and ensure the concealment and security of the watermark.
In order to achieve the purpose, the technical scheme of the invention is as follows:
a digital watermarking method based on DWT domain includes embedding watermark and extracting watermark, wherein, the embedding of watermark includes the following steps:
s10: acquiring an original color image to be embedded with a watermark and a gray watermark image to be embedded;
s12: YUV color space conversion is carried out on the original color image, and secondary wavelet transformation is carried out on the Y component of the original color image after conversion;
s13: carrying out reverse color preprocessing on the gray watermark image, carrying out wavelet transformation on the gray watermark image subjected to the reverse color preprocessing, and discarding a high-frequency diagonal sub-band part;
s14: performing difference value storage on the wavelet coefficient low-frequency sub-band after wavelet transformation of the gray watermark image;
s15: multiplying the low-frequency coefficient stored by the difference value and other wavelet transform coefficients by respective coefficients, then sequencing the low-frequency coefficient and other wavelet transform coefficients together with watermark color reversal preprocessing variables, and taking the sequencing sequence as a key;
s16: determining the number of times of repeated embedding of the coefficient sequence by calculating the sizes of the original color image and the gray watermark image;
s17: embedding the sequence in the step S15 into the diagonal sub-band of the secondary wavelet transform coefficient of the original image according to the repetition times calculated in the step S16;
s18: performing secondary wavelet inverse transformation on the color image with the embedded coefficient to obtain a Y component, and performing color space transformation together with Cr and Cb components of the original image to obtain an image with the embedded watermark;
the extraction of the watermark comprises the following steps:
s20: carrying out YUV color space conversion on the image embedded with the watermark, and carrying out secondary wavelet transformation on a Y component in the image;
s21: the diagonal high-frequency subband portion of the secondary wavelet transform is subjected to the key extraction in step S15 to extract subbands of the grayscale watermark image and an inverse preprocessing decision variable epsilon'.
S22: and completing all zeros of the diagonal sub-bands of the wavelet coefficients of the gray watermark image, and performing wavelet inverse transformation on the obtained average value of the sub-band coefficients and the completely zeroed diagonal sub-bands to obtain the extracted gray watermark image.
A DWT domain-based digital watermarking system includes a watermark embedding section and a watermark extraction section, wherein the watermark embedding section includes: an image obtaining unit for obtaining an original color image to be embedded with a watermark and a gray watermark image to be embedded, a color space conversion and secondary wavelet conversion unit connected with the image obtaining unit and used for YUV color space conversion of the obtained original color image and carrying out secondary wavelet conversion on the Y component of the converted original color image, and a difference storage unit connected with the difference storage unit and used for storing the difference of a wavelet coefficient low-frequency sub-band after the gray watermark image is subjected to wavelet conversion, wherein the inverse wavelet conversion and primary wavelet conversion unit is used for carrying out inverse color pretreatment on the gray watermark image after the inverse color pretreatment and omitting the high-frequency diagonal sub-band part of the inverse color pretreatment and primary wavelet conversion unit, and the difference storage unit is connected with the inverse color pretreatment and primary wavelet conversion unit and used for storing the difference of the wavelet coefficient low-frequency sub-band after the gray watermark image is subjected to wavelet conversion, Other wavelet transform coefficients are multiplied by respective coefficients and then are subjected to sequence ordering together with watermark color reversal preprocessing variables, a sequence ordering unit taking the arrangement sequence as a key, a repeated embedding times calculating unit connected with the sequence ordering unit to calculate the size of the original color image and the gray watermark image, a sequence embedding unit connected with the repeated embedding times calculating unit to embed the sequence in the sequence ordering unit into the diagonal sub-band of the secondary wavelet transform coefficient of the original image according to the repeated times calculated by the repeated embedding times calculating unit, a sequence embedding unit connected with the sequence embedding unit to perform secondary wavelet inverse transform on the color image after embedding the coefficient to obtain Y component, and carry on the inverse transformation and color space conversion unit of the color space conversion together with Cr and Cb weight of the original image;
the watermark extraction part comprises a transformation unit, an extraction unit connected with the transformation unit, and a diagonal sub-band full-zero completion and wavelet inverse transformation unit connected with the extraction unit, wherein the transformation unit performs YUV color space transformation on the image embedded with the watermark, and performs secondary wavelet transformation on a Y component in the image; the extraction unit extracts each sub-band of the gray watermark image and the inverse color preprocessing judgment variable epsilon' from the diagonal high-frequency sub-band part of the secondary wavelet transform according to the key in the sequence ordering unit of the embedded watermark part, then the diagonal sub-band full-zero completion and wavelet inverse transform unit completes the full-zero completion of the wavelet coefficient diagonal sub-band of the gray watermark image, and the obtained sub-band coefficients and the full-zero diagonal sub-band are subjected to wavelet inverse transform once to obtain the extracted gray watermark image.
The digital watermarking method based on the DWT domain replaces the secondary wavelet transform diagonal component sub-band coefficient of the carrier image with the watermark image wavelet coefficient, embeds the watermark information into the diagonal component of the secondary wavelet transform, and uses the replacement watermark wavelet coefficient instead of the common quantization method, thereby realizing blind watermark extraction, improving the stability of the system and ensuring the concealment and safety of the watermark.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1 and fig. 2, the DWT domain-based digital watermarking method of the present invention includes embedding of a watermark and extracting of the watermark. The watermark embedding process comprises the following steps: the method comprises the steps of converting an original color image in a YUV color space, performing secondary wavelet transformation on a Y component, performing inverse color preprocessing on a gray watermark image, storing wavelet transformation coefficients of the gray watermark image by difference values, replacing diagonal sub-band coefficients of the secondary wavelet transformation of the Y component by encryption arrangement, and performing secondary wavelet inverse transformation on the replaced Y component to obtain the color image embedded with the watermark. The extraction process of the watermark comprises the following steps: and performing YUV color space conversion on the image embedded with the watermark, performing secondary wavelet transformation on the Y component, obtaining each wavelet component of the gray watermark according to the encryption arrangement sequence in the embedding process, and performing wavelet inverse transformation to obtain the extracted gray watermark image.
As shown in fig. 1, which shows a flowchart of embedding a watermark, the embedding of the watermark includes the following steps:
s10: acquiring an original color image to be embedded with a watermark and a gray watermark image to be embedded;
s12: YUV color space conversion is carried out on the original color image, and secondary wavelet transformation is carried out on the Y component of the original color image after conversion;
s13: carrying out reverse color preprocessing on the gray watermark image, carrying out wavelet transformation on the gray watermark image subjected to the reverse color preprocessing, and discarding a high-frequency diagonal sub-band part;
s14: performing difference value storage on the wavelet coefficient low-frequency sub-band after wavelet transformation of the gray watermark image;
s15: multiplying the low-frequency coefficient stored by the difference value and other wavelet transform coefficients by respective coefficients, then sequencing the low-frequency coefficient and other wavelet transform coefficients together with watermark color reversal preprocessing variables, and taking the sequencing sequence as a key;
s16: determining the number of times of repeated embedding of the coefficient sequence by calculating the sizes of the original color image and the gray watermark image;
s17: embedding the sequence in the step S15 into the diagonal sub-band of the secondary wavelet transform coefficient of the original image according to the repetition times calculated in the step S16;
s18: and performing secondary wavelet inverse transformation on the color image with the embedded coefficient to obtain a Y component, and performing color space transformation together with Cr and Cb components of the original image to obtain an image with the embedded watermark.
Wherein,
in step S12, converting the color space of the original image of size M × N to convert the RGB color space to the YUV color space; the Y component is subjected to a secondary wavelet transform, and the resulting secondary wavelet transform subbands are denoted as LL2, HL2, LH2, and HH2, respectively, as shown in fig. 3.
In step S13, the grayscale watermark image of size m × n to be embedded is subjected to an inversion preprocessing, and whether or not the watermark image has been subjected to the inversion processing is recorded by positive and negative values of an inversion variable ∈. Then, the image after the reverse color processing is subjected to wavelet transform once, and the obtained wavelet-transformed low-frequency coefficient matrix is represented as wLL, and the high-frequency coefficient matrices are represented as wLH, wHL, and wHH, as shown in fig. 4. The gray watermark image is subjected to gray average calculation, and whether to perform the reverse color processing is determined according to whether the average is larger than 127. And the reverse color variable epsilon is a positive integer, if the watermark image is reversed, epsilon is set to be-epsilon, otherwise, the original value is kept. In practical application, the epsilon is 13, so that better effect can be achieved.
In steps S14 and S15, the differences between wLL are stored, and then each component is multiplied by the corresponding coefficient to obtain α · wLL, β · wLH, and γ · wHL. Then, the coefficients and epsilon in alpha wLL, beta wLH and gamma wHL are arranged together to form an mn × 1 sequence, wherein the arrangement order can be used as an encryption means to protect watermark information when extracting the watermark. The difference value storage is a method for storing the difference value of two coefficients before and after replacing the original coefficient value, and obtaining the original value again every delta coefficient values. In practical application, δ is taken to be 4. The permutation order encryption means refers to the permutation order of the coefficients and epsilon in alpha-wLL, beta-wLH and gamma-wHL, and different mn x 1 sequences can be generated through different permutation orders. When the extraction is performed, if the correct order is not known, the correct α · wLL, β · wLH, and γ · wHL cannot be obtained.
In steps S16, S17
The number of times the embedding should be repeated is calculated, and the mn × 1 sequence in step S15 is repeated N' times to replace the HH2 diagonal high-frequency subband of the secondary wavelet transform coefficient of the Y component obtained in step S12.
In step S18, the replaced image is subjected to inverse wavelet transform to obtain a Y component, and then the Y component is combined with the Cr and Cb components to perform color space conversion, so as to obtain an RGB watermark-embedded image.
As shown in fig. 2, which shows a schematic representation of a watermark extraction flow, the watermark extraction includes the following steps:
s20: carrying out YUV color space conversion on the image embedded with the watermark, and carrying out secondary wavelet transformation on a Y component in the image;
s21: the diagonal high-frequency subband portion of the secondary wavelet transform is subjected to the key extraction in step S15 to extract subbands of the grayscale watermark image and an inverse preprocessing decision variable epsilon'.
S22: and completing all zeros of the diagonal sub-bands of the wavelet coefficients of the gray watermark image, and performing wavelet inverse transformation on the obtained average value of the sub-band coefficients and the completely zeroed diagonal sub-bands to obtain the extracted gray watermark image.
Wherein,
in steps S20 and S21, the image embedded with the watermark is subjected to YUV color space conversion, the Y component is subjected to secondary wavelet transform, the HH2 diagonal subband component is extracted, and wavelet coefficients α · wLL ', β · wLH', γ · wHL 'and an inverse color processing parameter ∈' are extracted according to the key in step S15.
In step S22, an average value of all repeated embedding coefficients is obtained according to the number of repeated embedding, the average value corresponding to α · wLL ', β · wLH ', γ · wHL ' is multiplied by coefficients 1/α, 1/β, 1/γ to obtain corresponding watermark wavelet transforms wLL ', wLH ' and wHL ' subband portions, wLL ', wLH ', wHL ' are combined into corresponding watermark wavelet subbands, the non-embedded wHH portions are replaced by all-zero coefficient subbands, and these coefficients are subjected to a wavelet inverse transform to obtain a watermark image. And judging whether the watermark is inversed or not according to whether the average value of the obtained inversed color variable epsilon' is larger than zero or not, and determining whether the watermark image needs to be inversed or not according to the judgment result so as to obtain the gray watermark image needing to be extracted. The coefficients α, β, γ are used to multiply with the sub-band matrix coefficients wl, wLH, and wHL, and in practical applications, α is 0.08, and β is 0.12.
Referring to fig. 5 and fig. 6, the present invention will be described by taking a 512 × 512 Lena color image as an original image and a 32 × 32 grayscale image as a watermark image.
Firstly, embedding a watermark, and converting an original Lena image with the size of M multiplied by N (512 multiplied by 512) into a color space to convert the RGB color space into a YUV color space. The Y component in YUV color space is subjected to secondary wavelet transform to obtain four secondary wavelet transform sub-bands LL2, HL2, LH2 and HH2 with the size of 128 multiplied by 128, and the specific sub-band division is shown in FIG. 3. Calculating the average gray value of the m × n (64 × 64) gray watermark image, wherein the calculation formula is as follows:
<math>
<mrow>
<msub>
<mover>
<mi>Y</mi>
<mo>‾</mo>
</mover>
<mi>w</mi>
</msub>
<mo>=</mo>
<mfrac>
<mrow>
<msubsup>
<mi>Σ</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>m</mi>
</msubsup>
<msubsup>
<mi>Σ</mi>
<mrow>
<mi>j</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>n</mi>
</msubsup>
<msub>
<mi>Y</mi>
<mi>w</mi>
</msub>
<mrow>
<mo>(</mo>
<mi>i</mi>
<mo>,</mo>
<mi>j</mi>
<mo>)</mo>
</mrow>
</mrow>
<mrow>
<mi>m</mi>
<mo>×</mo>
<mi>n</mi>
</mrow>
</mfrac>
<mo>,</mo>
</mrow>
</math>
wherein, Y
wAnd (i, j) represents the pixel gray scale value of the gray scale watermark image at the (i, j) position. If it is not
Greater than 127, then Y
w(i,j)=|255-Y
w(i, j) |, and assigning the inverse variable as ∈ -13; if it is not
127 or less, Y is maintained
wThe value of (i, j) is unchanged and the inverse variable is assigned ε 13.
And performing wavelet transformation on the image after the reverse color processing, and recording the obtained low-frequency coefficient matrix after the wavelet transformation as wLL and the high-frequency coefficient matrix as wLH, wHL and wHH. The specific sub-band division is shown in fig. 4. The resulting low frequency coefficient matrix wLL is difference-preserved, where a variable δ is defined to represent the interval of the number of coefficients at which the non-difference watermark wavelet coefficients are again obtained. The specific method comprises the following steps: let the original coefficient sequence be Wi(i represents the i-th coefficient value in the sequence), δ is 4, and the difference-preserving coefficient sequence is Wi', then W1′=W1,W2′=W1-W2,W3′=W2-W3,W4′=W3-W4,W5′=W5....... The watermark wavelet transform coefficient values are multiplied by corresponding coefficients alpha and gamma of 0.08 and beta and gamma of 0.12 to obtain beta 1 and wLL, beta 2 and wLH and gamma and wHL. Then, the coefficients in α · wLL, β · wLH, γ · wHL and the inverse color variable β 0 are arranged together as a sequence mn × 1. The arrangement sequence can be used as an encryption means, and watermark information can be protected when the watermark is extracted. In this example, α · wLL (1, 1), β · wLH (1, 1), γ · wHL (1, 1), ε, α · wLL (1, 2), β · wLH (1, 2) … … are taken <math>
<mrow>
<mi>α</mi>
<mo>·</mo>
</mrow>
</math> <math>
<mrow>
<mi>β</mi>
<mo>·</mo>
<mi>wLH</mi>
<mrow>
<mo>(</mo>
<mfrac>
<mi>m</mi>
<mn>4</mn>
</mfrac>
<mo>,</mo>
<mfrac>
<mi>n</mi>
<mn>4</mn>
</mfrac>
<mo>)</mo>
</mrow>
<mo>,</mo>
</mrow>
</math> <math>
<mrow>
<mi>γ</mi>
<mo>·</mo>
<mi>wHL</mi>
<mrow>
<mo>(</mo>
<mfrac>
<mi>m</mi>
<mn>4</mn>
</mfrac>
<mo>,</mo>
<mfrac>
<mi>n</mi>
<mn>4</mn>
</mfrac>
<mo>)</mo>
</mrow>
<mo>,</mo>
</mrow>
</math> ε is arranged (wLL (i, j) indicates the coefficient values wLH (i, j) in row i and column j in the coefficient matrix wLL, wHL (i, j) is the same). The resulting mn × 1 sequence is based on <math>
<mrow>
<mo>(</mo>
<msup>
<mi>N</mi>
<mo>′</mo>
</msup>
<mo>=</mo>
<mfrac>
<mi>M</mi>
<mrow>
<mn>4</mn>
<mi>m</mi>
</mrow>
</mfrac>
<mo>×</mo>
<mfrac>
<mi>N</mi>
<mrow>
<mn>4</mn>
<mi>n</mi>
</mrow>
</mfrac>
<mo>=</mo>
<mrow>
<mo>(</mo>
<mfrac>
<mn>512</mn>
<mrow>
<mn>4</mn>
<mo>×</mo>
<mn>64</mn>
</mrow>
</mfrac>
<mo>)</mo>
</mrow>
<mo>×</mo>
<mrow>
<mo>(</mo>
<mfrac>
<mn>512</mn>
<mrow>
<mn>4</mn>
<mo>×</mo>
<mn>64</mn>
</mrow>
</mfrac>
<mo>)</mo>
</mrow>
<mo>=</mo>
<mn>4</mn>
<mo>)</mo>
</mrow>
</math> The resulting number of repeated embeddings is calculated, and the sequence is repeated 4 times replacing the HH2 diagonal subband coefficient value of the Y component of the original image. And performing secondary wavelet inverse transformation on the replaced wavelet coefficient image to obtain a Y component, and performing color space transformation by combining the Y component with the previous Cr and Cb components to obtain a watermark embedded image in an RGB (red, green and blue) form.
Secondly, extracting the watermark image, wherein the extraction process of the watermark image comprises the following steps: the water-containing print image is converted from RGB color space to YUV color space, and then the Y color component is subjected to secondary wavelet transformation. The corresponding LL2 ', HL 2', LH2 ', HH 2' were obtained. Wavelet coefficients are extracted according to the encryption arrangement sequence in the watermark embedding process. Since the embedding was repeated 4 times during the execution, α · wLL ', β · wLH ', γ · wHL ' were obtained, and the coefficients were averaged 4 times, whereas ∈ ' was embedded 4096 times instead of wHH in the embedding coefficient position, and similarly, an average of ∈ ' was obtained. The coefficients of wLL ', wLH', wHL 'wavelet transform sub-bands of the extracted watermark image are obtained by multiplying alpha-wLL', beta-wLH ', gamma-wHL' by 1/alpha, 1/beta, 1/gamma, and the part wHH which is not embedded is replaced by the sub-band of all-zero coefficients of equal size. And performing wavelet inverse transformation on the wavelet transformation sub-subband coefficient image to obtain a gray watermark image. According to epsilonAnd whether the average value is larger than zero or not is judged, so that whether the gray watermark image is inversed or not is judged. If reversed, Yw′(i,j)=|255-Yw' (i, j) |, otherwise the original value is kept unchanged. Thus, the gray watermark image to be extracted is obtained. Wherein Y isw' (i, j) denotes a pixel gradation value of the extracted gradation watermark image at the (i, j) position. The extraction effect of the watermark image is shown in fig. 6 (b).
The results of this example were experimentally tested to evaluate the difference between the embedded watermark picture and the original image using peak signal-to-noise ratio (PSNR). PSNR is defined as:
<math>
<mrow>
<mi>PSNR</mi>
<mo>=</mo>
<mn>10</mn>
<msub>
<mi>log</mi>
<mn>10</mn>
</msub>
<mfrac>
<mrow>
<mi>MN</mi>
<mo>[</mo>
<mi>max</mi>
<mrow>
<mo>(</mo>
<msup>
<mi>I</mi>
<mn>2</mn>
</msup>
<mo>)</mo>
</mrow>
<mo>]</mo>
</mrow>
<mrow>
<msubsup>
<mi>Σ</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>M</mi>
</msubsup>
<msubsup>
<mi>Σ</mi>
<mrow>
<mi>j</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>N</mi>
</msubsup>
<msup>
<mrow>
<mo>[</mo>
<mi>I</mi>
<mrow>
<mo>(</mo>
<mi>i</mi>
<mo>,</mo>
<mi>j</mi>
<mo>)</mo>
</mrow>
<mo>-</mo>
<msup>
<mi>I</mi>
<mo>′</mo>
</msup>
<mrow>
<mo>(</mo>
<mi>i</mi>
<mo>,</mo>
<mi>j</mi>
<mo>)</mo>
</mrow>
<mo>]</mo>
</mrow>
<mn>2</mn>
</msup>
</mrow>
</mfrac>
<mo>,</mo>
</mrow>
</math>
wherein, I is an original image, I' is an image embedded with a watermark, and M and N are the number of pixels of the length and the width of the image respectively.
In the aspect of evaluating the watermark extraction effect, the similarity evaluation of the extracted watermark and the original watermark is carried out by using the normalized correlation coefficient NC in the test. The corresponding formula is defined as follows:
<math>
<mrow>
<mi>NC</mi>
<mo>=</mo>
<mfrac>
<mrow>
<msubsup>
<mi>Σ</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>n</mi>
</msubsup>
<msubsup>
<mi>Σ</mi>
<mrow>
<mi>j</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>m</mi>
</msubsup>
<mi>W</mi>
<mrow>
<mo>(</mo>
<mi>i</mi>
<mo>,</mo>
<mi>j</mi>
<mo>)</mo>
</mrow>
<mo>×</mo>
<msup>
<mi>W</mi>
<mo>′</mo>
</msup>
<mrow>
<mo>(</mo>
<mi>i</mi>
<mo>,</mo>
<mi>j</mi>
<mo>)</mo>
</mrow>
</mrow>
<msqrt>
<msubsup>
<mi>Σ</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>n</mi>
</msubsup>
<msubsup>
<mi>Σ</mi>
<mrow>
<mi>j</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>m</mi>
</msubsup>
<msup>
<mrow>
<mo>(</mo>
<mi>W</mi>
<mrow>
<mo>(</mo>
<mi>i</mi>
<mo>,</mo>
<mi>j</mi>
<mo>)</mo>
</mrow>
<mo>)</mo>
</mrow>
<mn>2</mn>
</msup>
<msubsup>
<mi>Σ</mi>
<mrow>
<mi>i</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>n</mi>
</msubsup>
<msubsup>
<mi>Σ</mi>
<mrow>
<mi>j</mi>
<mo>=</mo>
<mn>1</mn>
</mrow>
<mi>m</mi>
</msubsup>
<msup>
<mrow>
<mo>(</mo>
<msup>
<mi>W</mi>
<mo>′</mo>
</msup>
<mrow>
<mo>(</mo>
<mi>i</mi>
<mo>,</mo>
<mi>j</mi>
<mo>)</mo>
</mrow>
<mo>)</mo>
</mrow>
<mn>2</mn>
</msup>
</msqrt>
</mfrac>
<mo>,</mo>
</mrow>
</math>
wherein, W represents the original watermark, W' represents the extracted watermark, and n and m are the number of pixels of the length and width of the watermark image, respectively.
The BMP images are subjected to embedding and extracting tests according to parameter values in the implementation process, the PSNR of the image after embedding the watermark is 37.03, and the NC of the extracted watermark is 0.998, so that the effect is shown in fig. 6 (b). As shown in tables 1, 2 and 3 below, the watermark image extraction effect of the digital watermarking system under JPEG compression, filtering, noise adding and 1/4 clipping attacks is shown. Where table 1 is the JPEG lossy compression test, table 2 is the noise attack test, and table 3 is the median filter and 1/4 clipping test.
TABLE 1
From the results in tables 1, 2 and 3, it can be seen that the digital watermarking method of the present invention has a good attack resistance effect on JPEG attack and noise attack, has good attack resistance capability on median filtering when the filter size is 3 × 3, and has good robustness on cropping attack.
Referring to fig. 7, as another embodiment of the present invention, there is provided a DWT domain-based digital watermarking system including a watermark embedding section and a watermark extracting section. The watermark embedding part comprises an image acquisition unit, a color space conversion and secondary wavelet transformation unit connected with the image acquisition unit, an inverse color preprocessing and primary wavelet transformation unit connected with the color space conversion and secondary wavelet transformation unit, a difference value storage unit connected with the inverse color preprocessing and primary wavelet transformation unit, a sequence sorting unit connected with the difference value storage unit, a repeated embedding time calculation unit connected with the sequence sorting unit, a sequence embedding unit connected with the repeated embedding time calculation unit, and an inverse conversion and color space conversion unit connected with the sequence embedding unit. The image acquisition unit is used for acquiring an original color image to be embedded with a watermark and a gray watermark image to be embedded, and the color space conversion and secondary wavelet transformation unit is used for performing YUV color space conversion on the acquired original color image and performing secondary wavelet transformation on a Y component of the converted original color image; meanwhile, the reverse color preprocessing and the primary wavelet transformation unit reversely preprocesses the gray watermark image, performs primary wavelet transformation on the gray watermark image after the reverse color preprocessing, and omits a high-frequency diagonal sub-band part therein, and then the difference value storage unit performs difference value storage on a wavelet coefficient low-frequency sub-band after the gray watermark image is wavelet transformed; the sequence ordering unit multiplies the low-frequency coefficient stored by the difference value and other wavelet transformation coefficients by respective coefficients, then carries out sequence ordering together with watermark color reversal preprocessing variables, and takes the ordering sequence as a key; the repeated embedding frequency calculation unit determines the times of repeated embedding of the coefficient sequence by calculating the sizes of the original color image and the gray watermark image; the sequence embedding unit embeds the sequence in the sequence ordering unit into an original image secondary wavelet transform coefficient diagonal sub-band according to the repetition times calculated by the repetition embedding time calculating unit, finally, the inverse transform and color space converting unit carries out secondary wavelet inverse transform on the color image embedded with the coefficient to obtain a Y component, and carries out color space conversion together with Cr and Cb components of the original image to obtain an image embedded with the watermark.
The watermark extraction part comprises a transformation unit, an extraction unit connected with the transformation unit, and a diagonal sub-band full-zero completion and wavelet inverse transformation unit connected with the extraction unit. The transformation unit carries out YUV color space transformation on the image embedded with the watermark and carries out secondary wavelet transformation on a Y component in the image; the extraction unit extracts each sub-band of the gray watermark image and an inverse color preprocessing judgment variable epsilon' from the diagonal high-frequency sub-band part of the secondary wavelet transform according to the key in the sequence ordering unit of the embedded watermark part, then the diagonal sub-band full-zero completion and wavelet inverse transform unit completes the full-zero completion of the diagonal sub-band of the wavelet coefficient of the gray watermark image, and the obtained sub-band coefficient and the full-zero diagonal sub-band are subjected to wavelet inverse transform once to obtain the extracted gray watermark image.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.