2.2.1. Watermark Template and Corresponding Spatial Mask
In the process of designing the template, there are three issues to consider. The first one is the shape of the watermark template. Choosing a circular template can resist the rotation attack. According to the rotation property of 2D-DFT, the circular template keeps the same position after rotation, which makes watermark extraction faster and more accurate. As shown in
Figure 1c, the zero-template, which denotes watermark bit zero, is presented. The corresponding binary sequence is 10101010101010101010, where 1 forms a peak and 0 becomes a gap. To achieve this goal, a constant
C can be added to the DFT coefficient at the position corresponding to the bit “1” in the sequence. In order to ensure that the video frames are still guaranteed to be real after IDFT transformation, we should ensure that the watermark templates are centrally symmetric. Therefore, we embedded the same template sequence 2 times in the embedding process.
The second issue is the location of the watermark template. Low-frequency DFT coefficients occupy the majority energy of the video frame, and modifying them would greatly reduce the visual quality. On the contrary, high-frequency DFT coefficients hold the minority energy of the image, but they are easily removed under various video-processing operations. Therefore, it is most appropriate to embed the watermark template in the mid-frequency part. Since small radius size denotes low-frequency DFT coefficients, we set the embedding radius size to 1.2 × L/2, where L is the width of the video frame. The last issue is spatial mask generation process. The specific construction process is shown as follows.
Step 1: A grayscale image with size
L ×
L is constructed, and then all its pixel values are set to 128. This ensures that all the DFT magnitude is 0 except the center of DFT, as shown in
Figure 1a,b.
Step 2: The watermark template is added to the 2D-DFT of the grayscale image. Then, the IDFT transformation was performed to form a grayscale image with watermark information, as shown in
Figure 1c–e.
Step 3: The Spatial mask corresponding to the watermark template is generated by subtracting
Figure 1a from
Figure 1e. From the linear property of 2D-DFT, when embedding watermark information, we only need to add the corresponding spatial mask to the video frame.
2.2.2. Template Sequence
According to [
21], in order to ensure good robustness in the watermark extraction process, two bits sequences, as shown in Equations (6) and (7), were selected as templates for watermark bit 0 and watermark bit 1 for watermark embedding, where
S represents the bit sequence for watermark bit 0 and
S represents the bit sequence for watermark bit 1. The advantage is that the normalized correlation (NC) value of the two templates remains at 0.5 regardless of the rotation strength they undergo.
However, two watermark templates mean only 1 bit can be embedded in one GOP, and this leads to a low embedding capacity. To solve the problem, a new approach is proposed to extend the embedding capacity from 1 bit to a theoretical n bits by designing a number of watermark template sequences.
When constructing the watermark template, the divisor, such as 2 and 4 in Equations (6) and (7), is a key parameter. First of all, the divisors in different template sequence should be distinct with each other; thus, the watermark template can be different and can be easy to distinguish in the watermark extraction process. Second, the divisor affects the bit error ratio (BER) between any two watermark template sequences, especially with the consideration of rotation attack. Here, the BER is used to calculate the similarity between the template sequences in order to facilitate the following analysis. Therefore, to ensure n bits can be embedded in one video frame, 2 watermark template sequences and 2 different and robust divisors should be built. To solve the problem, the operation of factorization is brought in to calculate the template sequences, which can ensure the accuracy of the algorithm.
Equation (
8) shows the prime factorization of a positive integer
cn,
where
are prime numbers that are not equal to 1 and not the same as each other, and
are the prime index of
, respectively, and all are greater than or equal to 1. The factor of
cn can be used as divisors to construct watermark template sequences, and 2
different divisors are required. The factor number of
cn can be obtained according to Equation (
9).
To ensure that the number of templates embedded in the cover video is exactly 2
, i.e., the factor number of
cn is 2
, we used the inverse method of integer factorization to calculate the number of factors. The inverse operation of factorization is defined in Equations (10) and (11).
cn1 must have 2
mutually different factors, where each factor is the combination
. After we obtain the divisors, we can construct the watermark template sequence by using Equation (
12), where
q represents the divisor,
denotes ceiling function, and
S represents the
kth watermark template sequence.
Next, we elaborate the BER of any two watermark template sequences. Suppose
q and
q are two different divisors for two watermark templates; there are two kinds of relation between them. One is that
q or
q is a multiple of the other. The other one is
q or
q cannot be evenly divided by the other.
Figure 2 shows the case of the first relation. In
Figure 2a,
q,
q are equal to 6, 12, respectively, so
q is an even multiple of
q. The first row is the watermark template sequence
S(i) constructed by using divisor
q = 6, and the second row is the watermark template sequence
S(i) constructed by using divisor
q = 12. In
Figure 2b,
q,
q are equal to 6, 18, respectively, so
q is an odd multiple of
q.
From
Figure 2a, the watermark template sequence with divisor
q always consists of two parts: the all-one sequence and all-zero sequence. In the all-one sequence, the different bit number between
S(i) and
S(i) is
, and the different bit number between
S(i) and
S(i) is
in the all-zero sequence, where
denotes floor function. Therefore the BER between
S(i), and
S(i) can be described as Equation (
13), which can represent the BER for the case of
q, or
q is an even multiple of the other. By adopting the same analysis, we can obtain the BER for the case of
q, or
q is an odd multiple of the other. The example is shown in
Figure 2b, and BER is described in Equation (
14).
Then, we should consider the BER of
S(i) and
S(i) when they are rotated since it is better if the watermark template can resist rotation attack. From Equation (
12), we can see that the structure of
S(i) is the all-one sequence first and then the all-zero sequence. As illustrated in
Figure 3a, the first row is the watermark sequence
S(i) with divisor
q = 4, and the second row is the watermark sequence
S(i) with divisor
q = 20. When no rotation appears,
S(i) and
S(i) are most aligned, which means the BER is lowest at this time. When
S(i) is rotated to a sequence which is the opposite of the original one, as shown in
Figure 3b, the BER value is the largest. Therefore, we can obtain the BER range, which is displayed in Equation (
15).
From the above analysis, we can see in the case that q or q is an even multiple of the other, the BER value always remains at 0.5. In the case that q or q is an odd multiple of the other, the BER value gradually approaches to 0.5 as the multiple increases. Especially, when q is three times q, the BER reaches the minimum value, which is 0.33.
Equation (
15) satisfies the case that
q or
q is a multiple of the other. For the other case that
q or
q cannot be evenly divided by the other, the BER between
S(i) and
S(i) also satisfies Equation (
15) after extensive testing.
Next, we will take
n = 3 as an example. Three bits means 2
templates are needed for embedding. We chose
n1 = 2,
equal to 2 and 3, respectively. By using Equations (10) and (11), we can obtain
cn1 = 24, which consists of 8 factors, including factor 1. Eight factors are used as the divisors according to Equation (
12), and the watermark template sequences can be obtained as Equation (
15). Please note that, for divisor 1, i.e., the eighth watermark template
S(i), it is impossible to construct it as Equation (
12), so we found the sequence whose BER with
S(i), ⋯,
S(i) is nearest to 0.5 with the help of programming.
According to Equation (
15), we calculated the BER between each two sequences, and the results are shown in
Table 1. It can be seen that the BER between any two template sequences is always higher than 0.33 and as high as 0.67 in some cases, most of them remaining at 0.5.