A novel secured Euclidean space points algorithm for blind spatial image watermarking

Digital raw images obtained from the data set of various organizations require authentication, copyright protection, and security with simple processing. New Euclidean space point’s algorithm is proposed to authenticate the images by embedding binary logos in the digital images in the spatial domain. Diffie–Hellman key exchange protocol is implemented along with the Euclidean space axioms to maintain security for the proposed work. The proposed watermarking methodology is tested on the standard set of raw grayscale and RGB color images. The watermarked images are sent in the email, WhatsApp, and Facebook and analyzed. Standard watermarking attacks are also applied to the watermarked images and analyzed. The finding shows that there are no image distortions in the communication medium of email and WhatsApp. But in the Facebook platform, raw images experience compression and observed exponential noise on the digital images. The authentication and copyright protection are tested from the processed Facebook images. It is found that the embedded logo could be recovered and seen with added noise distortions. So the proposed method offers authentication and security with compression attacks. Similarly, it is found that the proposed methodology is robust to JPEG compression, image tampering attacks like collage attack, image cropping, rotation, salt-and-pepper noise, sharpening filter, semi-robust to Gaussian filtering, and image resizing, and fragile to other geometrical attacks. The receiver operating characteristics (ROC) curve is drawn and found that the area under the curve is approximately equal to unity and restoration accuracy of [67 to 100]% for various attacks.

image integrity. George Voyatzis and Ionnis Pitas in [7] proposed the concepts of robust watermarking with various attacks and stated that geometrical attacks are still a problem to solve. Huynh-The et al. [11] work on the binary watermark bits; they are embedded in the DWT blocks HL4 and LH4 to provide imperceptibility and robustness in the color images. Liu in [16] work on YCbCr color model images, they were tamper-proofed. Using dualoption parity check and morphological operations it was recovered. Sajjad et al. [23] proposed image tampering and restoration using SVD. Lei-Doa and Bao-Long in [15] resist the geometric attacks in the spatial domain, the watermark is embedded in the circular regions of the even-odd quantization. Qingtang Su et al. in [21] proposed color image watermarking in YCbCr color space and performed watermark embedding in the Y component using the DC component of each 8 × 8 sub-block in the spatial domain similar to DCT transform, this work was robust against signal processing attacks and geometric attacks, it does not specify the pitfalls of the method for the future scope. It does not add the security parameter to the proposed algorithm.
Dipti Prasad Mukherjee et al. [5] work on a new algorithm in the spatial domain, which provides buyer authentication with the multimedia objects, it provides robust against the standard Stirmark attack.
Image authentication scheme is proposed by Zhaxoia et al. in [35] using random values authentication codes are generated and induced in the user-defined seed using Hilbert curve mapping. Authors thought authentication of digital images in the natural way using the concept of moles on the human body. Moles on the human body are considered as one of the basic identification marks (authentication) for a person. In the same analogy, authors thought of establishing moles like watermarks all over the image to provide authentication where these watermark points are invisible and the moles are visible. Mathematical investigation behind moles on the human body is still under research, so author's proposed the points of watermarks (as like moles) on the digital image mathematically using geometric and arithmetic series. The authors thought of generating geometric sequences instead of any predefined curves. So, in the proposed work the geometric sequences were derived to retain the image authentication with added security concept.
The knowledge behind the Euclidean Space points and their axioms are obtained from [28] the idea behind discrete mathematics in the form of Geometric and Arithmetic Sequence came into play in the author's mind using from [6]. In the same way, the implementation idea of the Diffie-Hellman key exchange protocol was initiated in [27] explains the similarities and differences between watermark security and cryptography security.
Using the above knowledge, Euclidean Space point's (ESP) algorithm is designed in the second section. In the third section, the digital watermark embedding scheme in the raw host image is described along with the Diffie-Hellman key exchange protocol algorithm. The blind watermark recovery is described in the fourth section. Testing the proposed work and comparing with the existing methods on the standard raw digital grayscale, and RGB color images are carried out in the fifth section. The results and discussion is carried out with different perspective in the spatial domain with the conclusion of the proposed work.

Aim
The proposed work objective is: a) To design and develop a New Euclidean Space Points (ESP) Algorithm using discrete mathematics and algebra. b) To implement blind spatial domain image watermarking system for image authentication and copyright protection using the developed ESP algorithm and Diffie-Hellman key exchange protocol algorithm for security purpose. c) To test the authentication and copyright protection of the proposed watermarking system by sending the watermarked images in the Email, WhatsApp, and Facebook platform. d) To test the proposed watermarking system with various attacks. e) To restore the watermark logo after the attacks. f ) To analyze and evaluate the proposed watermarking system using quality metrics and statistical methods.

Euclidean space point's (ESP) algorithm basics
The Euclidean space point's (ESP) algorithm is designed first by choosing the size of the host image in which the watermarking is desired. Using discrete mathematics, in (discrete mathematics), geometric sequence (GS), and arithmetic sequence (AS) are generated and arranged along the x and y-spatial Cartesian coordinate system using the axioms of the Euclidean plane (UChicago REU, 2013). The generation of GS and AS is described in the ESP algorithm with example values. The points of intercept (POI), of the GS (along with the x-axis), and AS (along the y-axis) in the host image define the ESP to embed the watermark in the spatial domain.

Proposed Euclidean space point's (ESP) algorithm
Step 1 : Let the set x = x 11 , x 21 , x 31, . . . x n1 and y = y 11 , y 21 , y 31 , . . . ., y n1 are the possible sets of all ordered n-tuples in x-coordinates and y-coordinates. Let X = R n x R n y = R n and the elements of R n x and R n y are the points in the spatial coordinates. The axioms of the Euclidean spaces are defined in [28]. a) Vectors additions x 11 + y 11 , x 21 + y 21 , . . . ., x n1 + y n1 . b) Multiplication by a real number 'a' .
Step 5 If these coordinate points exceed the size of the host image, the location point processing is described below: This set of sequences can further be expanded, but the designed algorithm takes only the axioms from the sequences (3) and (4) so that the processing time and the complexity can be reduced. An example of the ESP algorithm with (Tables 1, 2, and 3) is explained in the Supplementary material. In this algorithm, to initialize the security to the Euclidean Space points, the secret key is shared between the end-users using Diffie-Hellman key exchange protocol, which is explained in the next upcoming section.

Proposed watermark embedding scheme using ESP algorithm
In the proposed work, the host image is selected, and based on the size of the host image (different image sizes are chosen), the Euclidean Space points are designed using the ESP Algorithm. The main objective of the proposed work is to attain a blind and simple watermarking algorithm, imperceptibility of the watermark in the spatial domain, robust watermark for any attack, increased payload, and also to provide security to the watermark to preserve the owner copyrights or authentication. To achieve the mentioned parameters a block diagram is proposed which is shown in Fig. 1, the block diagram performs Euclidean space point's based spatial domain watermarking and it is analyzed with both the grayscale image and RGB color model image. The proposed block diagram and algorithm are analyzed with the grayscale images and also with the RGB color model images.

Proposed block diagram
In the proposed block diagram Fig. 1, the grayscale host image is first chosen in which the watermark is to be embedded. Next according to the size of the host image Euclidean space points are generated using the ESP algorithm. After obtaining the Euclidean space points, the grayscale intensity values of the host image at the POI are obtained and these grayscale intensity values of the host image are converted into its eight binary equivalent digits. The watermark image or Logo is converted into a binary logical image using Otsu's adaptive threshold method [26]. The binary digits of the logical logo are embedded in one of the bit planes or positions of POI obtained from the Euclidean space points and the watermarked image is obtained. The analysis was done on the host image by embedding the logo binary digits in every bit position of the POI. The watermarked image performance was obtained and it is described in the results and discussion.
In the second stage of the work, the RGB color image model is chosen as the host image. In this second proposed methodology, the RGB host image is processed by separating the red, green, and blue frames. The ESP algorithm is obtained according to the size of the Blue frame to obtain POI to embed the watermark logo. Intensity values of the blue frame at POI are obtained and converted to 8-bit binary digits. The binary digits of the logical logo are embedded in every bit position of POI and analyzed by merging the two frames. Similarly, the green color frame and red color frames are processed separately and analyzed. The results are described in the "Results and discussion" section. After individual frame processing, red, green, and blue frames are embedded with Logo2 at the same time and combined to get the RGB watermarked image. According to the concept of cryptography algorithm, public keys are shared in the public domain and private keys are shared securely. In the ESP algorithm, the initial x-coordinate value (x 0 ) , the initial y-coordinate value y 0 , the common ratio value (r) , the common difference value (d) and secret key value (a) could be defined by the sender to obtain security of the Euclidean space points. This provides security to the Euclidean Space points where the watermark logo is going to reside. The concept of sharing private keys using Diffie-Hellman key exchange protocol is explained in the next section.

Diffie-Hellman key exchange protocol algorithm
The security of the secret key Diffie-Hellman key exchange protocol (DHKEP) [24] is one of the best algorithms to share the secret key securely in an unsecured channel [30]. The procedure of key exchange protocol is as follows: i. Let the two users be transmitter 'T' and receiver 'R' in a treaty to share the secret key.

ii. In the treaty both 'T' and 'R' users agree on two prime numbers 'P' and 'G' and these
are in the public domain. Choose P as a large number. iii. G is the primitive root modulo P. iv. Let 'T' and 'R' users choose privately 'a' and 'b'-a large random number or secret key or private key. v. 'T' computes A = G a modP and sends to 'R' and 'R' computes B = G b modP and sends to 'T' . Both 'T' and 'R' computes the shared key K = G ab modP, and 'R' share the shared key 'K' to exchange the secret key securely. This algorithm is the discrete logarithmic problem and it is equally as hard as RSA. In this proposed work P = 7919, G = 3041, a = 19 and b = 17, A = 2753, B = 4886. Figure 2 shows the proposed blind watermark extraction block diagram at the receiver end. In the transmission section, the host image could be either the grayscale image or the RGB color image. In the receiver section, after obtaining the watermarked image, the watermark logo can be removed and checked based on the required strategies. To prove the authentication of the sender at the transmission end the watermark logo could be recovered from the watermarked image without using the original logo or partial logo or original image, so the recovery of the watermark logo is very blind, so it is called blind watermarking. The logo is recovered by generating the secret key value 'a' from the shared keys between the two parties 'T' and 'R' using the Diffie-Hellman key exchange protocol.

Proposed blind watermark extraction methodology
Then the Euclidean space points are generated at the receiver end. The key value provides security to the location points of Euclidean space points where the logo was embedded. After obtaining the Euclidean space points from the secret key value, POI is obtained on the watermarked image, the intensity values of the POI from the watermarked image are obtained from all the specific locations of POI, and it is converted into its binary equivalent digits. As per the end-end user treaty, the bit where the digital bit of logo is embedded is obtained and all the digital bits are processed to form the logical digital binary logo, and hence the logical digital binary logo is recovered blindly without the use of any host image information or original watermark logo information and it proves the authentication or ownership of the user. Similarly, the logo is recovered from the RGB color image, and analysis was done and it is described in the "Result and discussion" section.

Results and discussion
The Euclidean space points (point of intercept of GS and AS) are obtained and shown in Fig. 3. The complete proposed work is implemented using custom MATLAB R2018a coding. In the proposed work, the host image is selected and the Euclidean space points are generated using the ESP algorithm according to the size of the host image. Depending upon the initial values and secret key value the Euclidean space points are obtained, these points spread over the entire region of the host image, and it is an advantage that, when the watermark spreads over the entire region of the host image, authentication of the digital image could be obtained from every corner of the image.

Measure of imperceptibility
The proposed watermarking scheme is applied on the data set (ImageProcessing-Place.com), in [12] which there are 166 raw images they are Gray Scale Data Set: Tiff_ Sequence_Images: 64 images, Tiff_Texture_Image: 64 images, Tiff_Misc_Images: 25 images, and Standard_PNG_Images: 13 images, and JPG_Football_images: 44 images. ImageProcessingPlace.com data sets are the Image databases and it is selected because: a) These are the standard test images found frequently in literature. b) Almost all the images are uncompressed with higher resolution. c) Image databases are used for digital image processing using MATLAB, and they are in the DIP4E and DIPUM3E Faculty and Students Support Packages. d) In one place faculty and students can select different image data base according to their work. e) These databases are used in more than 50 countries worldwide. f ) More than 1K research institution, industries, and educational institutes use DIP and DIPUM image databases.  where WI(i, j) is the watermarked image and I(i, j) is the host image. SSIM metric consists of luminance, contrast, and structural information of the digital image. The human visual system (HVS) perception is good at observing structures that are used in SSIM, so the metric SSIM is more related to the subjective quality score of human beings. Structural Similarity Index [26] is given in Eq. 11:  SSIM is based on the computation of three terms; they are luminance, contrast, and structural. They are computed using Eqs. (12), (13), and (14):

Most of the books, journals and publishers used these image databases
where µ I , µ WI , σ I , σ WI, andσ IWI are the local means, standard derivations, and crosscovariance for images I (host image) and WI (Watermarked image).

Watermarked image analysis via Email, WhatApp, and Facebook
All the raw watermarked images (WIs) are zipped, attached in a folder, and sent to the personal email. The WIs from email (E_WI) are downloaded and extracted through the compressed folder. Performance metric analysis on the images WI and E_WI is done and it is found that the PSNR is infinite dB, SSIM is unity, BER is zero, and NC is unity. All the embedded logos are perfectly recovered from all the sets of images. Similarly, all the WIs are sent individually in WhatsApp and downloaded from WhatsApp the metric analysis between WI and W_WI is done the result values are as same as email.
In the same way, the WIs are uploaded to the authors' Facebook (FB) book account and downloaded individually. It is shown in Fig. 6. The observations made in the analysis are the following: So for this proposed algorithm, 5th-bit logo embedding is advisable for the Facebook image authentication, because the 6th-bit offers very low PSNR (less than 40dB) between I and F_WI from Table 2.
It is analyzed by comparing the histograms of WI and F_WI. The histogram difference between the WI and F_WI is similar to exponential noise. It is submitted in Annexure (Table 5) since the numbers of tables are more in this work: f ) All the Logos from WI are recovered blindly. So the proposed work falls in the category of blind image watermarking.

Attacks and tests for image authentication
To test the proposed scheme for image authentication, the WI tampers with various attacks. The watermark logo is obtained from the tampered watermarked image without the reference of the host image (Blind Watermarking) and compared with the original logo as shown in Fig. 7. The tampered watermarked image obtained at the receiver section is processed with the ESP algorithm and the watermark logo is extracted. The tampered image can be recovered using the steps followed in Fig. 7. The tampered image is recovered using the host image as a reference, at first the tampered image and the host image are subtracted to get the residual tampered region. Next, the residual tampered image region coordinates are collected and mapped with the coordinates of the host image. The intensity values of the coordinates from the host image are collected and the intensity values are replaced in the residual region to recover the tampered region. The PSNR between the recovered watermarked image and the watermarked image is infinity. In the proposed watermarking scheme even if the watermarked image tampers more than 90%, detection of the watermark is done as shown in Fig. 8h. Figure 8a-o shows the extraction of the watermark logo from the tampered

The restoration process of RGB color images
In the practical view, when the digital images are transmitted in the channel, images may lead to different attacks by the intruders it may be an intentional or unintentional attack. The proposed work needs to offer good robustness and security to the intruders. So to  check the performance of the proposed algorithm 10 standard sets of raw images from (ImageProcessingPlace.com) are taken. Different types of attacks are performed on the watermarked image and the performance of the proposed ESP algorithm and the watermarking scheme was tested using the performance metrics SSIM, cross-correlation function (CC), mean square error (MSE), and bit error rate (BER). Figures 9, 10, 11, 12,  13 show the visual quality metrics on the recovered watermark before and after restoration. The Logo2 is embedded in all three color frames Red, Green, and Blue. The average SSIM of Logo2 before restoration that is after all attacks on the RGB color watermarked image is 0.979294 and after restoration is 0.995141. The restoration process enhances the correlation coefficient value to a greater extent. The restoration process was done as follows: Input Host image: RGB Color Model image.
Step 1: Store all the three color frames separately as 'R' , 'G' , and 'B' of the host image.
Step 2: After watermarking and transmitting from the transmitter section in Fig. 1, store the watermarked image in the receiver section.
Step 5: Using the restored frames Logo2 can be obtained with acceptable visual quality.
Using the above restoration process, the average correlation coefficient on all the attacks was increased by 0.450106 times.
The average mean square error and average bit error rate on all the attacks were decreased by 0.232843 and 953.7059.
The accuracy is calculated by using the formula from [18] after the restoration process, it is given in Eq. where TP: true positive, TN: true negative, FP: false positive, and FN: false negative. Figure 12 shows that after the restoration process, the watermark Logo2 can be obtained with an accuracy of more than 67%. So the proposed ESP algorithm, watermarking scheme, and restoration scheme work more accurately.

Watermark restoration
The watermark Logo2 was better restored after the restoration process.
In Fig. 14, watermark Logo2 after the attack and restored watermark Logo2 from the watermarked image is shown with all different kinds of attacks. The proposed watermarking scheme and the algorithm are immune to salt-and-pepper noise and sharpening filter that is before restoration.

Comparison with the existing methods
Comparison of average PSNR values of 10 standard grayscale images with the other existing methods is presented in Table 4. The proposed ESP algorithm and watermarking methodology were analyzed by embedding a logical binary logo individually in every bit position of the host image. In Fig. 2 of Chuan Qin et al. in [3] at page 236, the watermark bits are used to recover MSB layers of the tampered image but watermark bits can authenticate the tampered images without recovering them since the purpose of watermarking is to provide image authentication.
In [3] tampering of Lena 512 × 512-the grayscale image at 6.84% leads to a PSNR of 44.16 dB and the recovered image has the PSNR of 46.37 dB which at the embedding mode (6,2). In Table 4 the proposed method is compared with the particular references [3,22,31], and [32] because all these existing methods are purely based  on spatial domain image watermarking technique as the proposed work, in which the PSNR metric is calculated depending upon the different significant bits i.e. from ISB to LSB. In a similar manner, the existing techniques calculated PSNR metric after restoration technique from tampering attack.

Comparison of statistical performance with the existing methods
In [33], the confusion matrix and its analysis were carried out to find the TPR (true positive rate) and FPR (false positive rate) to check the quality of the proposed work. Similarly, for the proposed work statistical performance was carried out. The confusion matrix was constructed and is shown in Table 5. The formula for TPR and FPR is calculated from [18] and it is given in Eqs. (19) and (20): Using the above confusion matrix, Eqs. (19) and (20), Table 6 values are calculated for the proposed work and compared with the existing works.
In Table 6 the statistical parameters TP, TN, FP FN, TPR and FPR are calculated for the proposed work to check the performance of the proposed watermark embedding and blind recovery using ESP algorithm with the other existing methods in [4], [33], [34] and [35]. In the existing methodologies similar statistical parameters were used to analyze the watermarking system, so these reference were chosen for comparison. From Table 6 it is evident that TPR is higher and FPR is lower for the proposed methodology

Conclusion
Blind and semi-fragile spatial domain watermarking is proposed for image authentication. The ESP algorithm is developed with fixed initial values and a secret key. The points of intercept, of GS and AS make the algorithm to be more secured where the confusion probability will be more. It is difficult for the intruder to identify the watermark presence in the host image since the logo is embedded appending the Diffie-Hellman key exchange protocol with the ESP algorithm. According to the proposed methodology embedding the logo is better in the 4th bit plane for the raw images and the 5th-bit plane for compressed images, where the authentication could be done perfectly. The proposed ESP spreads over the entire region of the host image, so the image authentication could be done from any corner of the image. The image authentication is tested by sending the WI in the E-mail, WhatsApp, and Facebook. It is observed that using this proposed method, image authentication in E-mail and WhatsApp can be done perfectly with 100% accuracy the SSIM of the original Logo and recovered Logo is unity. In FB, to obtain better image authentication, the embedding is done in the 5th-bit plane of the host image, because after downloading the WI from the FB the WI is in the compressed format. So the image authentication is done with more accuracy. Image tampering attacks are done on the WI with the tampering attack ranging from 0.59 to 95%, the proposed work provides the PSNR of the watermark logo in the range [81.2441 to 52.9996] dB. The proposed work is robust to JPEG compression from it can withstand up to 7:1 compression ratio as given in Table 2. Similarly, the work is robust to tampering, image cropping, saltand-pepper noise, sharpening filter, semi-robust to Gaussian filtering, rotation (1°), and image resizing, and fragile to other geometrical attacks. Logo detection is 100% after averaging filter attack, tampering WI with 32 × 32 grayscale image attack, and sharpening filter attack. The average accuracy of logo detection is more than 65% for all the attacks. The proposed ESP algorithm and the watermark embedding scheme provide higher imperceptibility, security, and robustness to the raw and compressed grayscale images. Similar to the RGB images, it offers higher imperceptibility with a higher payload and the logo recovery rate is very high. Overall, the proposed methods provide the best image authentication compared with the other existing methods.

Future scope
The proposed work is handcrafted over different image data set of various sizes and it is working well for the grayscale images and also with the color images, but the downloaded colored watermarked images from the FB give poor authentication. After embedding the watermark logo in all three color frames separately, the PSNR between the host image and FB_WI is 45 dB which is acceptable. But the authentication is not satisfactory for the author, where the SSIM is very low. The downloaded watermarked image from FB is checked with the original WI image, it is observed that about 48.19% of pixels are affected in FB color image. So another spatial watermarking method is to be developed for color images to maintain authentication in FB. Deep Neural Networks (DNN)-based spatial domain watermarking with the handcrafted ESP algorithm is the future scope of this proposed work.