Automatic Rotation Recovery Algorithm for Accurate Digital Image and Video Watermarks Extraction

Research in digital watermarking has evolved rapidly in the current decade. This evolution brought various different methods and algorithms for watermarking digital images and videos. Introduced methods in the field varies from weak to robust according to how tolerant the method is implemented to keep the existence of the watermark in the presence of attacks. Rotation attacks applied to the watermarked media is one of the serious attacks which many, if not most, algorithms cannot survive. In this paper, a new automatic rotation recovery algorithm is proposed. This algorithm can be plugged to any image or video watermarking algorithm extraction component. The main job for this method is to detect the geometrical distortion happens to the watermarked image/images sequence; recover the distorted scene to its original state in a blind and automatic way and then send it to be used by the extraction procedure. The work is limited to have a recovery process to zero padded rotations for now, cropped images after rotation is left as future work. The proposed algorithm is tested on top of extraction component. Both recovery accuracy and the extracted watermarks accuracy showed high performance level. Keywords—Rotation recovery; image watermarking; video watermarking; watermark extraction; robustness

Although, there are different algorithms in digital watermarking for images and videos, and many of them claim high performance in term of robustness, it is still difficult for developers to come up with a perfect algorithm that survives all attacks at once and with high extraction accuracy results.This is due to the tries to achieve a performance tradeoff between various metrics such as imperceptibility and robustness [3].One of the problems while designing a digital watermarking algorithm is losing the robustness for some attacks, such noising and compression once you concentrate to increase the robustness for geometrical attacks like rotation, scaling, and translation.
The focus here will be on rotation attack by proposing a different solution that adds a new facility to watermarking systems.By plugging the proposed solution to any watermarking system, there will be no need to focus on the design phase whether the developed watermarking algorithm has to be invariant to the rotation attack or not.The proposed algorithm is implemented to be used on top of extraction function.Hence, the algorithm will recover the attacked rotated image or a sequence of images from a video then send the restored images to be used in the extraction phase.
The proposed algorithm scope can be further extended to be integrated to various practical applications other than digital watermarking, such as 3D modeling, image visual enhancement, scene recovery in cameras, and more.
The rest of the paper is organized as follows: the second section reviews the recent and related works.The third section presents the proposed algorithm.The fourth section illustrates the experiments.The fifth section presents the results of evaluating the proposed rotation recovery algorithm.Finally, the sixth section concludes the paper.

II. RELATED WORKS
In digital watermarking systems, algorithms to watermark images and videos need to address various performance metrics such as imperceptibility, robustness and capacity.Most researchers try in their algorithms to achieve some tradeoff between imperceptibility and robustness.This tradeoff makes developers to sacrifice some robustness values.For example, increasing the tolerance to some noising attacks with decreasing the visual effects in the watermarked image might lead to losing the resistance to geometrical attacks such as scaling, rotation and translation.Focusing on resisting geometrical attacks might force the developer to sacrifice the visual image quality.For these reasons, there were algorithms that focused to achieve specific tolerance to determined attacks; some examples of these algorithms that intended to be invariant to geometrical attacks are in [4,5,6,7].www.ijacsa.thesai.org In addition, current researches in image watermarking as well as in video watermarking have shown low robustness in the case of rotation attacks.Some examples of low resistance to rotation attacks are obviously reported in [8,9,10,11,12,13,14].In these works the watermark after rotation attack was difficult to be accurately extracted and the data was mostly lost.The reported normalized correlation (NC) values were very low.Table 1 summarizes some of the reported result in the case of rotation attacks.[8] 0.73 -L.Agilandeeswari et al [9] 0.80 9.33 Ta Minh Thanh et al [10] -Nasrin M. Makbol [11] -0.50 Zhao et al [12] 0.86 -Jiansheng et al [13] 0.50 -Lusson et al [14] 0.65 -Some approaches were proposed to recover images into their original states after rotation attacks occur.In [15] they proposed a rotation estimation and recovery algorithm using image alignment, Radial Tchebichef moments or Fourier descriptors.In their algorithm, for all used methods, they need the original non-rotated image to be used as a reference image for the recovery and estimation purposes.Although the algorithm works with presence of the reference non-rotated image, it was still estimating the rotation angle with degree error reached to 4 degrees.

Another algorithm previously was proposed by Morgan
McGuire [16].In this algorithm, image registration using Fourier-Mellin transform was used for the purpose of estimating geometrical attacks parameters such as scaling, rotation and translation parameters.The algorithm showed good performance in rotation recovery.However, it reported an error reached up to 1 degree.Moreover, experiments were reported for rotated scenes and not with zero padded images.It also needs a reference image to estimate the parameters.
Previously, a symmetric reversible method was proposed by Laurent Condat and Dimitri Van De Ville [17].In this method, a 1-D filter is designed to convolve the rotated image with appropriate fractional delay filters.Pixels interpolation was utilized to recover the rotated scene.However, their results showed blurred images after recovery.This indicates the weakness in the algorithm to perfectly recover the rotations.Such algorithm cannot work accurately while used with digital watermarking systems.
In 3D images field, some algorithms have been released to deal with rotated scene estimation.In [18] authors developed a method to automatically recover image rotations from 3D urban scene.This was achieved by estimating various parameters from the taken images by multiple cameras.The parameters such as, intrinsic camera parameters and extrinsic pose are used with edge detection algorithm and vanishing points to estimate the rotation of the scene.This algorithm seems impractical to work with single 2D image rotation attacks, for example, in digital watermarking applications.
Another work in [19] introduced a recovery algorithm for rotations on 3D cameras.The algorithm was developed as a part of creating view panoramic mosaics scene.The algorithm works by registering a sequence of images after recovery rotation and using the registered images to estimate the focal length.However, this algorithm cannot serve some applications such as digital watermarking while it needs to multi mages to recover rotation parameters.
As noticed from Table 1, numerous algorithms have been published claiming high robustness.That is true when considering the common attacks and ignoring geometrical attacks.However, investigating these algorithms proved that rotation attacks still uncovered when algorithms can tolerate other attacks such as noising, filtering, cropping and compression.Low NC and high BER values, under rotation attacks for the investigated algorithms open the way for researchers to find an alternative solution that does not affect the other results while considering different attacks to achieve high performance.
For the purpose of solving the issue of the low performance related to rotation attacks, an alternative solution that adapts the rotation recovery scenario to watermarking systems is proposed instead of designing the watermarking algorithms to be invariant to rotation attacks but affecting other performance metrics.

III. PROPOSED ALGORITHM
As discussed in the previous sections, the main problem was found in the weakness of the most available algorithms for image and video watermarking to resist rotation attack.In consequence, the detection process of the embedded watermarks will be inaccurate if not impossible.
To solve this problem a new recovery rotation algorithm is proposed here to prepare the attacked image before performing extraction process.The algorithm is implemented to be pluggable to the extraction component in any image or watermarking system.This algorithm is developed to automatically detect, estimate and recover rotations for acute angles rotated scenes without need to a reference image.This is due to the difficulty to estimate the acute rotations in images accurately.In addition to the large distortion happens to watermark data once the scene is rotated with acute angles.
To fully recover the rotated image into its original state, the algorithm is implemented to take the attacked image as input, detect the edges in the image, estimate and compute the rotation angle, estimate the original image size then according to the estimated angle and size the rotation recovery is performed.Fig 1 .describes the proposed algorithm process.

A. Recovery algorithm
The proposed rotation recovery algorithm is implemented in the following steps.Figure 2 shows the states of the image during executing the recovery algorithm.www.ijacsa.thesai.orgStep 1: Input the rotated image I.
Step 2: if I is in RGB, Convert I to gray scale image.
Step 3: Apply Canny Edge Detector to detect edges in image I.
Step 4: Apply image dilation on the output from Step 3 using desk structuring element of radius = 3. Save the result as EdgeImage.
Step 5: Measure the rotation angle as follow:  Set one flag carrying first pixel value from the image coroner such that: (  Measure the opposite side of the angle: Loop in image rows and count the pixel values such that: Where Opposite is set to "0" the beginning.
 Measure the adjacent side of the angle: Loop in image columns and count the pixel values such that: Where Adjacent is set to "0" the beginning.
Step 6: Rotate the image I by Angle and save the rotated image as RImage where: (5) Step 7: Estimate the original image size using RImage as follow:  Set two flags from RImage such that: Where L is the length of RImage, and H is the height of RImage.
 Loop to calculate the distances BL (Black Length) and BH (Black Height) between the edge of the image and the original scene such that: Where BH and BL are set to "0" in the beginning.
 Find the original image size such that Where L and H are the length and Height of RImage.
Step 8: Crop RImage from Point (BL, BH) and by size of OriginalL and OriginalH.
Step 9: Return the Recovered Image.

B. Edge detection and angle estimation
After converting the colored attacked image to gray scale as explained in section 3.1, and to simplify the estimation of the angle with more accurate value, the edges of the rotated scene are detected using canny operator.The output from canny edge detector will be a binary image (black and white).Although canny operator works perfectly for edges, the resulted image still sometimes can cause inaccurate angle estimation.That is due to the black holes spotted in some places of the edge.These black holes can lead to wrong angle sides" measurements.To solve this matter, an image dilation using desk structuring element of radius = 3 is considered.This will fill the holes in the edge and the angle sides" measurements will be perfectly accurate.
In the dilated image, to estimate the rotation angle, a flag that carries the value of the pixel chosen from the opposite side or the adjacent side can be used to count the similar pixels that have the same value.In current case the pixel value will be "0".The counting continues until it finds a different pixel value.The stop pixel value is "1".The count of pixels either for adjacent or opposite side is registered as the length.The length of opposite and the length of the adjacent are used to estimate the rotation angle according to equations 1 to 5. Fig. 3. describes the required measurements for the proposed recovery algorithm.www.ijacsa.thesai.org

C. Image size estimation
Once the rotation angle is estimated and the scene is rerotated, a black or unwanted area will be resulted with a larger image size than it was in the original one.Two steps must be performed, estimating the original image size form the rotated scene and eliminating the unwanted area.Otherwise, the detection of the watermark data will not be possible.
In the proposed algorithm, the estimation of the size is implemented in a blind manner assuming that the original image size is unknown.To perform this, the distances between the scene and the image edge BH and BL, the original image length (width), (L), the original image height (H) must be measured according to equations 6 to 11.These measurements are then used to crop the recovered scene and eliminate the unwanted area as explored in Fig. 2 and Fig. 3.In this point, the image is ready to be used by the extraction function of the watermarking algorithm which makes the extraction function retrieves the embedded data accurately.

IV. EXPERIMENTS
For the purpose of evaluating the proposed rotation recovery algorithm under digital watermarking environment, the algorithm must be implemented on top of extraction function for any available image watermarking.This is to ensure that the algorithm has attained its main objective, which is to enable digital watermarking systems to resist rotation attacks and increase the accuracy of the extracted watermarks.
To validate the performance of the proposed algorithm, implementing an image digital watermarking algorithm according to [14] is considered.This algorithm was chosen due to its weakness to withstand rotation attacks.This issue made it possible to implement the proposed rotation recovery algorithm on top of the implemented image watermarking algorithm to verify the performance and see how it is possible to survive rotation attack after using the proposed recovery algorithm.The utilized image watermarking algorithm, is implemented based on Discrete Wavelet Transform (DWT), and was developed according to the framework as shown in Fig. 4.
After implementing the image watermarking algorithm based on Fig. 4., and adapting the recovery algorithm to the extraction component, the testing is performed by comparing the extracted watermarks from the image watermarking algorithm before and after using the recovery algorithm.Fig. 5. explains the testing scenario used to evaluate the proposed recovery algorithm.
To emphasis the results, three different standard images Baboon, Lena and Peppers of size 512x512 are used.Each image was watermarked using the implemented image watermarking algorithm, with a watermark of size 64x64 pixels.The watermarked images are then attacked by rotating the images using various acute angles.The watermarks are extracted using both implemented watermarking algorithms with and without recovery.www.ijacsa.thesai.orgThe testing of the recovery algorithm was conducted using the experiments illustrated in the previous section.Two measures were used to evaluate the accuracy of the extracted watermarks before and after using the proposed rotation recovery algorithm, Normalized Correlation (NC) and Bit Error Rate (BER) according to the following formulas: Where, O is the original watermark, E is the extracted watermark.
Where, O is the original watermark, E is the extracted watermark, and mxn is the total number of watermark bits.
After implementing the image watermarking algorithm and testing the detection of the watermarks in the normal case where no rotation attack has applied to the watermarked images, the watermarks were extracted accurately as in Fig. 6.In the current case, the extracted watermarks in the situation where no rotation is applied as the original watermarks to be used for calculating NC and BER values for the extracted watermarks after recovery is considered.The comparison is done later with the extracted watermarks after rotation attack.
To evaluate the accuracy of the rotation recovery algorithm, the normalized correlation was measured for both original image after watermarking and the recovered image from rotation attacks.This is to indicate how accurate the recovery is.Results from the used images conducted based on various angles have shown NC of "1" for Lena and Peppers and 0.98 for Baboon image.Baboon image has not reached to NC of "1" www.ijacsa.thesai.orgbecause the error expected on size estimation on some images which is around 1 pixel height or width.However, in recovered images having value of 0.98 of NC, it was enough to retrieve the watermark accurately.Fig. 7. shows the NC values for the various angles rotation recovery in the three images.
After ensuring the high performance of the rotation recovery algorithm, the experiments under the implemented watermarking algorithm was conducted.The mentioned three tested images, Baboon, Lena and Peppers were tested.The extracted watermarks from attacked images with different rotation angles and from recovered images were utilized to measure both NC and BER.As seen in the results above, the NC value was extremely improved in the extracted watermarks from around 0.80 in the attacked images to 1 in the recovered images in most cases.At the same time BER value improvements from around 0.30 to almost 0.000 was achieved in most cases.These results prove that the proposed rotation recovery algorithm was developed to perfectly suits image watermarking systems and increases the resistance against rotation attacks.
As shown in Fig. 14. a sample of the extracted watermarks from attacked and recovered images is presented.The extracted watermarks are almost lost with attacks applied to the watermarked images.In contrast, the watermarks were accurately extracted after performing the recovery using the proposed algorithm.

VI. CONCLUSION
In this paper, the current digital image and video watermarking algorithms were investigated in term of robustness.Consequently, the weakness of the most algorithms was noticed to be resides on surviving the rotation attacks.This article has proposed a new automatic and blind algorithm to recover acute angles rotations in images.The proposed algorithm estimates the angle of rotation mathematically then estimates the original watermarked image size in a blind way.
Based on the angle and estimated size, the original image is recovered.The proposed algorithm has been made pluggable to the extraction function in any watermarking algorithm to benefit from extracting accurate watermarks.Using such algorithm will save developers from considering rotation attacks during the design of the watermarking algorithms.This work has been designated for zero padded rotated images while investigating images by applying cropping attack after rotation attack is left as an improvement for the current work on the future.Testing the proposed algorithm showed NC of "1" for the recovery process which indicates accurate angles estimations.Evaluating the adaption under digital watermarking algorithms showed very high accuracy for the extracted watermarks as well.Regardless of specifically using the proposed rotation recovery algorithm for digital watermarking, it can be proudly integrated to other image processing applications.