# A Self-Recovery Fragile Image Watermarking with Variable Watermark Capacity
## The Proposed Scheme
### Watermark Generation and Embedding
#### 3.1.2 Recovery Watermark  
To generate the variable capacity recovery watermark, the image blocks are firstly classified into smooth blocks and texture blocks using the classification method mentioned in Section 2. A mark symbol \(h\) is used to label the blocks. If the block belongs to the smooth block, then \(h=0\), else \(h=1\). For different blocks, alterable length recovery watermark is produced.  
For smooth block, the average value of its four pixels is served as the recovery watermark, which has a range from 0 to 31. This average value is turned into binary form, and then we get 5 bits recovery watermark for smooth block \((r_{1},r_{2},r_{3},r_{4},r_{5})\).  
Compared to smooth block, the texture block contains more image content. Once the texture block is tampered, more watermark information is needed to reconstruct the texture block. The DCT transform has good energy concentration characteristic. Most information of an image is concentrated upon just few low frequency DCT coefficients, while other coefficients are close to 0. In [PERSON].  
Figure 2: The block diagram of watermark generation and embedding.  
and [PERSON] proposed a DCT-based self-recovery fragile watermarking method. In their scheme, the host image is firstly divided into 2 \(\times\) 2 blocks, and the DCT transform is applied to each block. After analysis of the DCT coefficients in each block, the authors found that, for image block with size of 2 \(\times\) 2, the DC coefficient and the first AC coefficient accounts for a large component for a block, while the other two coefficients are either 0 or negligible values. Based on this property, they introduced a quantization method for DC and the first AC coefficient and produced 10 bits recovery watermark for each block. Though this method achieves good performance in image recovery, the watermark capacity for each block is constant. Inspired by [33], the generation process of the recovery watermark for texture blocks is developed below:  
* Step 1: To generate appropriate length recovery watermark, the image block \(\mathbf{C}=\left(c_{ij}\right)_{2\times 2}\) after preprocessing is further adjusted by Equation (5), and then we get the processed image block \(\mathbf{C}^{\prime}=\left(c^{\prime}_{ij}\right)_{2\times 2}\). \[c^{\prime}_{ij}=\left\lfloor\frac{c_{ij}}{2}-8\right\rfloor,\,i,j=1,2,\] (5) where \(\lfloor.\rfloor\) is the rounding-down operation.
* Step 2: For each block \(\mathbf{C}^{\prime}\), the DCT transform is applied, and then we get the DCT coefficient matrix \(\mathbf{D}=\left(d_{ij}\right)_{2\times 2}\): \[\mathbf{D}=\left[\begin{array}{cc}d_{11}&d_{12}\\ d_{21}&d_{22}\end{array}\right],\] (6)
* Step 3: To generate the recovery watermark, the DC coefficient \(d_{11}\) is rounded and coded into 5 bits watermark including 1 bit sign flag and 4 bits coefficient encoding result, and the AC coefficient \(d_{12}\) is coded into 4 bits watermark including 1 bit sign flag and 3 bits coefficient encoding result. It should be noted that if the coefficients are out of the coding range, they need to be modestly adjusted. For example, if the absolute value of \(d_{11}\) is larger than 15, then it should be adjusted and make it equal to 15.  
After the above watermark generation processes, we get different recovery watermarks for different blocks finally: 6 bits for smooth blocks and 10 bits for texture blocks, which can be expressed as:  
\[\mathbf{R}=\left(h,r_{1},r_{2},\cdots,r_{i}\right),\,i=\left\{\begin{array}{c}5,h=0,\\ 9,h=1.\end{array}\right. \tag{7}\]  
To ensure the security of recovery watermark, a same encryption method mentioned in Section 3.1.1 is adopted to encrypt the recovery watermark, which can be expressed as:  
\[\mathbf{R}_{\rm e}=\mathbf{R}\oplus\mathbf{S}_{2}, \tag{8}\]  
where \(\mathbf{S}_{2}\) is another binary pseudo-random sequence generated by secret key \(key2\), and \(\mathbf{R}_{\rm e}\) is the encrypted watermark.