1 Introduction

Multimedia data circulation has become more widespread with the advances in mobile and internet technologies. Multimedia products are things like digital photographs, audio and video recordings, and text that are easy to copy and change. Consequently, copyright protection for these data is crucial. A digital watermark is one of the most prevalent copyright safeguarding methods. Digital watermarking is the process of embedding or concealing digital data, known as a watermark, within other digital data and then extracting the concealed information [1]. Digital watermarking is used in a variety of contexts, including content identification and management, forensic investigation, content authentication, fingerprinting, security controls, broadcast tracking, and media content archiving [2]. In addition, the high security requirements of images in several scenarios, such as military and trading scenarios, motivate the development of digital image encryption [3, 4] and forensic algorithms.

Invisibility and robustness are two of the most important parameters for evaluating the efficacy of watermarking schemes [5]. Based on these two parameters, watermarking techniques are classified into three types: robust, fragile, and semi-fragile watermarking [6]. Robust watermarking is essential for protecting image information since it does not change the reliability of the watermarked image much and can withstand various kinds of attacks. It is therefore frequently used to protect copyright and establish ownership. Fragile watermarking is just applied to make sure the image is complete, not to prove who is the legitimate owner. Although it can help detect any unauthorized alterations to the watermarked images, it also destroys the watermark's completeness if any changes occur. The advantages of both fragile and robust watermarking are combined in semi-fragile watermarking, which allows for the detection of illegal alterations while maintaining robustness against modifications [7].

Watermarking using digital images can be divided into two groups: visible and invisible. Visible watermarks are recognizable visual patterns like logos or labels. These watermarks are added to an image to indicate who owns the material. Visible watermarks are simple to spot, but they are also simple for adversaries to attack and erase [8]. On the other hand, invisible watermarks are used more often because it is hard for the human visual system (HVS) to see them. The idea behind invisible watermarks is to implant watermark data into unknown regions of a host image [9]. Depending on the needs of the application, techniques for invisible image watermarking provide different trade-offs between performance metrics like imperceptibility, resilience or robustness to attacks, security, and computational cost. Imperceptibility or invisibility refers to the fact that the watermark information is not discernible to the human visual system. The capacity to withstand all attacks, including cropping, scaling, noise, filtering, and others, without compromising the watermark data is referred to as robustness [10]. To protect the watermarking method against attacks, secret keys should be employed [8, 11]. The watermarking method should be hard to figure out to ensure the protection of the intellectual property.

From another perspective, watermarking algorithms can be classified into: spatial domain algorithms and transform domain algorithms, depending on where the watermark is buried [12]. In spatial domain techniques, the watermark is added by directly modifying the pixels intensities without applying any transformation [13]. Since no prior transformation is necessary, these techniques are straightforward and computationally efficient [14]. Such spatial domain techniques are common in fragile watermarking for authenticating images [15]. However, they are less resistant to various attacks. In the field of spatial domain image watermarking, numerous studies exist in literature [16,17,18,19]. Transformation-based watermarking techniques, on the other hand, transfer the signal from a spatial domain to another domain [e.g., frequency domain in discrete cosine transform (DCT)]. The watermark is then embedded into specific coefficients in this domain. Finally, to return to the spatial domain, the inverse transformation is used [20]. Frequency-based embedding produces better imperceptibility and offers superior resistance to numerous attacks [21]. As a result, transform domain watermarking has received much more attention with the majority of recent studies concentrating on semi-fragile watermarking for image authentication and robust watermarking for copyright protection. Commonly used transforms for image watermarking purposes include the discrete cosine transform [22], the discrete wavelet transform (DWT) [23], the discrete Fourier transform (DFT) [24], the Hadamard transform [25], and the Contourlet transform [26]. Additionally, image watermarking schemes based on the singular value decomposition (SVD) [27] and vector quantization [28] have been developed. New watermarking methods use hybrid transforms.

Hurrah et al. [29] propose two watermarking schemes. The first scheme produces a robust watermark, while the second yields a fragile one. In their robust watermarking scheme, they use DWT and block-based DCT. The embedding process of the encrypted watermark employs an inter-block DCT coefficients differencing algorithm. Liu et al. [30] use the hybrid decomposition based on DWT and SVD applied to the host image and they apply two encryption algorithms to the watermark image, namely the Rivest–Shamir–Adleman (RSA) algorithm and a logistic map-based image scrambling algorithm, to increase their algorithm security. The scrambled watermark is hidden within the low-frequency sub-band of the one-level DWT transformed host image. This scheme's resistance to Filtering attacks is moderate. As for medical image watermarking, a three-level DWT, DCT, and SVD were utilized by Zear et al. to produce a robust watermark [31]. Three different watermarks are embedded within the transformed host image. A neural network is used to eliminate noise and interference from retrieved watermarks. This method is only slightly resistant to a salt and pepper attack. Naffouti et al. also combined DWT and SVD in their image watermarking scheme [32]. A one-level DWT is applied to both the host grayscale image and the watermark image. The singular values of the watermark image are embedded in the high-frequency (HH) sub-band of the host image. In order to achieve a good balance between robustness and invisibility, a scaling factor is used in the embedding process to control the strength of the singular values of the watermark. However, this scaling factor is not optimized, but obtained using a trial-and-error procedure. Zhang et al. presented another watermarking algorithm of this family of DWT-SVD-based schemes in [33]. In this algorithm, the DCT is additionally applied. The optimal scaling factor used in the embedding process is obtained using particle swarm optimization (PSO) to ensure both robustness to attacks as well as imperceptibility. This approach is only moderately resistant to a sharpening attack. However, it is noteworthy that PSO is a population-based algorithm that consumes memory and processing time. Thus, it would be more suitable to use a trajectory-based optimization technique, especially that the range of the values of the scaling factor is small. The DWT is also used by Naffouti et al.[34]. In this scheme, after applying a three-level DWT, all coefficients are chosen from the “LH3” sub-band of the watermark image and embedded in the same sub-band of the original image. Moreover, PSO is combined with an approach to prevent watermarking from losing its robustness and imperceptibility and to extract the watermark with optimal performance.

To protect copyrights, Ernawan et al. [35] presented a Tchebyshev moment-based watermarking technique. This approach splits the host image into non-overlapping blocks and calculates the Tchebychev moments for each block. The watermark image is encrypted using the Arnold transform before embedding into blocks with lower visual entropy. The security of the watermarking algorithm proposed by Zaniol et al. [36] is enhanced by using a chaotic map-based embedding procedure. A secret key is extracted from the host image and the watermark image, which is used to construct a chaotic matrix and chaotic multiple scaling factors (CMSF). This technique is only slightly resilient to speckle noise attacks. Deeba et al. [37] transform the cover image to a sparse domain and they hide the secret information of the watermark logo into the significant sparse portions of the original image. Orthogonal matching pursuit (OMP) is used in the extraction process. This scheme's resistance to sharpening, Gaussian noise, and salt and pepper attacks is moderate. Ahmadi et al. [35] propose a watermarking scheme for grayscale images, where the embedding regions are determined based on the human visual system (HSV). Ahmadi et al. [38] describe another watermarking scheme but for RGB color images. Two watermarks are embedded within the host image; one is robust and another is fragile. The robust watermark is hidden in the blue color channel after applying the DWT and obtaining SVD of selected sub-bands. Particle swarm optimization (PSO) is used to optimize the balance between imperceptibility and robustness. Instead of using the DWT, the discrete Fourier transform (DFT) in conjunction with a decomposition methodology is employed in [39]. The host image is first subjected to a 2-D Fast Fourier Transform (FFT), and then, its singular value decomposition (SVD) is obtained. These two steps are also applied to the watermark image after encrypting it using a chaotic map, to prevent unauthorized access. This approach is only moderately resistant to some cropping attacks. Wang et al. in [40] present a copyright protection scheme based on blockchains. It is a zero-watermark algorithm, which does not depend on a trusted third party as the smart contract in the system implemented plays its role. Gaussian noise and gamma correction in this approach need improvement. Ahmadi et al. [41] describe an intelligent image watermarking technique that increases the embedding capacity. Two watermark bits are indirectly embedded into the eigenvectors components of the SVD decomposition of the chosen regions. The embedding regions are selected based on obtaining the highest possible visual quality by the human visual system (HVS) after applying a one-level DWT to the host image and choosing the “LL” sub-band. In order to make the system more robust, particle swarm optimization (PSO) is used to determine the best scaling factors automatically.

Invisibility and robustness are two essential performance metrics for image watermarking and balancing between their values is not an easy task. The watermarking methods discussed above have been introduced to address this issue. Most of the existing algorithms do not consider enough attacks in their analysis, where these attacks can prevent them from extracting useful watermarks. To ensure copyright protection, common attacks from earlier works, including rotation, some cropping, motion blur, sharpening, salt and pepper, speckle noise and Gaussian noise, need to be considered simultaneously and more robust techniques need to be developed. Work on watermarking methods for various sizes of watermarks and host images is still necessary as new attacks come up and there is always room for improvement. To address the issue of trade-off between invisibility and robustness, this paper suggests a novel watermarking scheme that effectively succeeds to increase both robustness to most attacks and invisibility, simultaneously. The proposed scheme is a modified SVD-based watermarking technique that employs the Schur decomposition and a dynamic weighting factors matrix in the embedding procedure. The pattern search algorithm is used to rapidly find the optimal scaling factors included in the embedding formula that achieve the best trade-off between imperceptibility and robustness to various attacks.

The primary contributions of this paper are as follows:

  1. (1)

    Efficiently overcomes the idea of a trade-off between robustness and invisibility, thereby increasing both under most attacks that has been accomplished by:

    1. Introducing a weighting factors matrix, which gives greater weights to singular values whose absolute values are small, causing improved robustness by boosting the normalized correlation values in most attacks.

    2. Proposing a modified embedding formula involving an extra scaling factor to be optimized as a multiplier of the singular values of the host image that increases the invisibility of the algorithm when used with different kinds of images, even medical ones.

  2. (2)

    Employing trajectory-based optimization instead of commonly population-based PSO algorithm, which in turn decreases the time of finding the optimal scaling factors dramatically.

  3. (3)

    Statistical analysis is performed using the Friedman test, one of the useful nonparametric alternatives to ANOVA, and the results reveal considerable improvement in performance of our proposed algorithm over the existing techniques.

The remainder of this paper is structured as follows: A brief description of the theoretical background needed to understand the proposed algorithm is provided in Sect. 2. Section 3 provides the details of the suggested watermarking algorithm as well as the optimization of the scaling factors matrix. Section 4 discusses the experimental findings and analyzes the performance, together with a comparison to other algorithms based on statistical analysis. The paper conclusion is summarized in Sect. 5.

2 Theoretical background

2.1 Schur decomposition

The Schur decomposition of a real matrix \({A}_{M\mathrm{x}M}\) can be determined as follows:

$$A=QU{Q}^{T}$$

where \(Q\) is a unitary matrix, \({Q}^{T}\) denotes the transpose of the matrix \(Q\), such that \({Q}^{T}Q={I}_{M} (\mathrm{identity matrix})\), and \(U\) is an upper triangular matrix which is called a Schur form of A that has the real eigenvalues on the diagonal and the complex eigenvalues in 2 × 2 blocks on the diagonal.

The Schur decomposition is one of the most important tools in numerical linear algebra. It involves approximately \(\frac{8}{3}{N}^{3}\) flops, which is fewer operations than other known decompositions and thus reduces processing time [42].

2.2 Pattern search algorithm

The pattern search (PS) trajectory-based metaheuristic is one of the derivative-free, direct search methods. Compared to other heuristic algorithms like genetic algorithms (GA) and particle swarm optimization (PSO), the pattern search algorithm is simple in concept, requires less time to compute, and is easy to implement [43]. PS works effectively in a short amount of time, particularly in a compact workspace. The flowchart in Fig. 1 shows the PS steps to solve a minimization problem, which can be summarized as follows [44]:

  1. 1.

    Define the PS parameters, which include mesh size, mesh expansion factor, mesh contraction factor, and maximum number of iterations.

  2. 2.

    Choose an initial or starting point.

  3. 3.

    Construct the pattern vector and mesh points based on mesh size.

  4. 4.

    Calculate the objective function for each point of the mesh.

  5. 5.

    Test the termination conditions, including:

    • The algorithm maximum number of iterations has been reached.

    • The mesh cell size is less than the mesh tolerance.

    • The algorithm maximum number of function evaluations has been reached.

    • The distance between two points established by a successful poll and the next successful poll is smaller than a predetermined tolerance.

      If any of them is satisfied, then stop. Else, go to step 6.

  6. 6.

    The algorithm polls the mesh points by comparing the objective function values that have been calculated.

    • If it gets to a point where the objective function is lower than the current point, the poll is successful, and the algorithm makes this point to be the current point. Then, increase the mesh size by a multiplier (expansion factor) and go to step 3.

    • If the poll does not work and none of the mesh points have a smaller objective function than the current point, the algorithm does not change the current point during the next iteration. Instead, it multiplies the mesh size by the contraction factor and goes back to step 3.

Fig. 1
figure 1

The pattern search algorithm flowchart

3 Proposed method

This section presents the proposed algorithm. The algorithm embedding steps are fully explained in Sect. 3.1. The extraction process is explained in depth in Sect. 3.2, while Sect. 3.3 describes how to optimize the embedding formula scaling factors.

3.1 Proposed watermark embedding process

The inputs to this step are an \(\mathrm{NxN}\) greyscale watermark image which is to be embedded into an \(\mathrm{MxM}\) greyscale host image, and the output is a watermarked image of size \(\mathrm{MxM}\). The block diagram of the suggested watermark embedding method is provided in Fig. 2. The following are the basic steps of the watermark embedding procedure.

Fig. 2
figure 2

Watermark embedding process

Step 1. Based on an R-level DWT, the host image \({I}^{O}\) is decomposed into the parts of \({\mathrm{LL}}_{R}\), \({\mathrm{LH}}_{R}\), \({\mathrm{HL}}_{R}\) and \({\mathrm{HH}}_{R}\), where \(R={\mathrm{log}}_{2}(\frac{M}{N})+1 .\)

Step 2. Schur decomposition is applied to the selected sub-bands \({\mathrm{LL}}_{R}\) and \({\mathrm{HH}}_{R}\):

$$ P_{1} H_{1} P_{1}^{T} \leftarrow {\text{Schur}}\left( {{\text{LL}}_{R} } \right). $$
(1)
$$ P_{2} H_{2} P_{2}^{T} \leftarrow {\text{Schur }}\left( {{\text{HH}}_{R} } \right). $$
(2)

Step 3. Apply SVD to both \({H}_{1}\) and \({H}_{2}\):

$$ U_{1} S_{1} V_{1}^{T} \leftarrow {\text{SVD}}\left( {H_{1} } \right). $$
(3)
$$ U_{2} S_{2} V_{2}^{T} \leftarrow {\text{SVD}}\left( {H_{2} } \right). $$
(4)

Step 4. Use the generalized Arnold transform (GAT) to scramble the greyscale watermark image \({I}^{W}\) with a random key K, then apply a one-level DWT to obtain \({LL}_{W}\), \({LH}_{W}\), \({HL}_{W}\) and \({HH}_{W}\) after obtaining the DCT of the encrypted watermark image \({I}^{S}\).

Step 5. Apply SVD to \({LL}_{W}\):

$$ U_{W} S_{W} V_{W}^{T} \leftarrow {\text{SVD}}\left( {{\text{LL}}_{W} } \right). $$
(5)

Step 6. Calculate the weighting factors matrix \({W}_{F}\) based on the size of the host image \(\mathrm{MxM}\) and the \(\mathrm{R}\) value such that this matrix is a diagonal matrix with the values of the diagonal entries being sorted in an ascending order. Its diagonal elements sum equals one \((\mathrm{SUM}\left({W}_{F}\right)=1)\). This matrix is constructed by using the following formula:

$$ W_{F} = \left( {\frac{2}{{\begin{array}{*{20}c} \\ {\frac{M}{{2^{R} }}\left( {\frac{M}{{2^{R} }} + 1} \right)} \\ \end{array} }}} \right){\text{diag}}\left( {1,2, \ldots ,\frac{M}{{2^{R} }}} \right). $$
(6)

The main purpose of this matrix is to retain all the data in the singular values matrix of the watermark image and avoid their vanishing, where the singular values are sorted in decreasing order. It does this by giving the smallest-valued entries more weight than the entries whose values are larger.

Step 7. Compute the modified singular values matrices \({S}_{1}^{\mathrm{new}}\) and \({S}_{2}^{\mathrm{new}}\) by embedding the singular values of the watermark image \({S}_{W}\) into the singular values of the host image \({S}_{1}\) and \({S}_{2}\), respectively, and using the scaling factors \({\alpha }_{i1}\) and \({\alpha }_{i2}\) which are optimized by the pattern search algorithm for each communication, as follows:

$$ S_{i}^{{{\text{new}}}} = S_{i} + \left( {\alpha_{i1} W_{F} S_{W} } \right) - \left( {S_{i} \alpha_{i2} } \right){ },{ }i = 1,2. $$
(7)

Step 8. The inverse SVD is applied to \(S_{{1}}^{{{\text{new}}}}\) and \(S_{{2}}^{{{\text{new}}}}\) to generate the watermarked sub-bands \(H_{{1}}^{{{\text{new}}}}\) and \(H_{{2}}^{{{\text{new}}}}\), respectively:

$$ H_{{1}}^{{{\text{new}}}} = U_{1} S_{{1}}^{{{\text{new}}}} V_{1}^{T} . $$
(8)
$$ H_{{2}}^{{{\text{new}}}} = U_{2} S_{{2}}^{{{\text{new}}}} V_{2}^{T} . $$
(9)

Step 9. Through using the inverse Schur decomposition, new frequency approximation sub-bands \({\text{LL}}_{R}^{{{\text{new}}}}\) and \({\text{HH}}_{R}^{{{\text{new}}}}\) are built.

$$ {\text{LL}}_{R}^{{{\text{new}}}} = P_{1} H_{1}^{{{\text{new}}}} P_{1}^{T} . $$
(10)
$$ HH_{R}^{{{\text{new}}}} = P_{1} H_{2}^{{{\text{new}}}} P_{1}^{T} . $$
(11)

Step 10. Finally, integrated with the additional wavelet sub-bands of the \(R\)-level, the inverse DWT is performed to get the watermarked image.

The size of the watermark image is shared through a private channel to calculate the number of DWT levels applied to the host image \((R)\) and the weighting factors matrix \({(W}_{F})\). The scaling factors \({\alpha }_{i1},{\alpha }_{i2}\) used in the embedding formula, the singular values matrices \({S}_{1}\) and \({S}_{2}\) of the host image and the parameter K of the generalized Arnold transform are all shared privately for watermark extraction.

3.2 Watermark extraction process

The steps of the embedding process in reverse order are used for extraction. The input of the extraction method is the watermarked image, and the output is the extracted watermark. The procedure for the watermarking extraction process is shown in Fig. 3, and the steps are explained as follows:

Fig. 3
figure 3

Watermark extraction process

Step 1. The R-level DWT is applied to the watermarked host image \({I}^{M}\) to obtain\({ \mathrm{LL}}_{R}^{M}\), \({\mathrm{LH}}_{R}^{M}\), \({\mathrm{HL}}_{R}^{M}\) and \({\mathrm{HH}}_{R}^{M}\).

Step 2. Schur decomposition is performed on the sub-bands \({\mathrm{LL}}_{R}^{M}\) and \({\mathrm{HH}}_{R}^{M}\):

$$ P_{1}^{M} H_{1}^{M} P_{1}^{{M^{T} }} \leftarrow {\text{Schur}}\left( {{\text{LL}}_{R}^{M} } \right). $$
(12)
$$ P_{2}^{M} H_{2}^{M} P_{2}^{{M^{T} }} \leftarrow {\text{Schur}}\left( {{\text{HH}}_{R}^{M} } \right). $$
(13)

Step 3. Apply SVD to each of \(H_{1}^{M}\) and \(H_{2}^{M}\):

$$ U_{1}^{M} S_{1}^{M} V_{1}^{{M^{T} }} \leftarrow {\text{SVD}}\left( {H_{1}^{M} } \right). $$
(14)
$$ U_{2}^{M} S_{2}^{M} V_{2}^{{M^{T} }} \leftarrow {\text{SVD}}\left( {H_{2}^{M} } \right). $$
(15)

Step 4: Using the shared keys, the two singular values matrices \(S_{W1}^{{{\text{ext}}}}\) and \(S_{W2}^{{{\text{ext}}}}\) of the two retrieved watermark images are derived from \(S_{1}^{M}\) and \(S_{2}^{M}\), respectively, just by using the extraction formula as follows:

$$ S_{Wi}^{{{\text{ext}}}} = \left( {\alpha_{i1} W_{F} } \right)/(S_{i}^{M} - S_{i} + \left( {S_{i} \alpha_{i2} )} \right){ },{ }i = 1,2. $$
(16)

Step 5: Two encrypted watermark images \({I}_{1}^{\mathrm{ext},\mathrm{S}}\) and \({I}_{2}^{\mathrm{ext},\mathrm{S}}\) are obtained when the inverse SVD, DWT, and DCT operations are performed on each of the \({S}_{W1}^{\mathrm{ext}}\) and \({S}_{W2}^{\mathrm{ext}}\) matrices.

Step 6: The generalized Arnold transform is used to decrypt the watermark images \({I}_{1}^{\mathrm{ext},\mathrm{S}}\) and \({I}_{2}^{\mathrm{ext},\mathrm{S}}\) to yield two watermark images \({I}_{1}^{\mathrm{ext}}\) and \({I}_{2}^{\mathrm{ext}}\), respectively.

Step 7: Finally, the extracted watermark normalized correlation coefficient (NC) to the original watermark is determined for each of the above generated watermarks. The watermark chosen is the one with the higher NC value.

3.3 Embedding scaling factors determination

One of the strategies for trajectory-based optimization, pattern search, is used to handle the trade-off issue between invisibility and robustness in this paper.

Invisibility is commonly quantified using performance measures such as peak signal-to-noise ratio (PSNR) between the watermarked image and the original host image, which is defined as:

$$ {\text{PSNR}} = 10\log_{10} \left( {\frac{{255^{2} }}{{{\text{MSE}}}}} \right) . $$
(17)

where MSE represents the mean squared error between the watermarked host image \(\left( {I_{w} } \right) \) and the host image \(\left( I \right)\).

$$ {\text{MSE}} = \frac{1}{M \times N}\mathop \sum \limits_{i = 0}^{M - 1} \mathop \sum \limits_{j = 0}^{N - 1} \left( {I\left( {i,j} \right) - I_{w} \left( {i,j} \right)} \right)^{2} . $$
(18)

The robustness of the original watermark (\(W\)) and extracted watermark (\(W_{r}\)) is frequently assessed using normalized correlation (NC), which is defined by:

$$ {\text{NC}} = \frac{{\mathop \sum \nolimits_{i = 0}^{M - 1} \mathop \sum \nolimits_{j = 0}^{N - 1} W\left( {i,j} \right)W_{r} \left( {i,j} \right) }}{{\sqrt {\mathop \sum \nolimits_{i = 0}^{M - 1} \mathop \sum \nolimits_{j = 0}^{N - 1} W^{2} \left( {i,j} \right) } \sqrt {\mathop \sum \nolimits_{i = 0}^{M - 1} \mathop \sum \nolimits_{j = 0}^{N - 1} W_{r}^{2} \left( {i,j} \right) } }} $$
(19)

In this study, the fitness function (to be maximized) used to rank a pattern vector is defined as:

$$ {\text{fitness }}\,{\text{function}} = \left( {\frac{{{\text{PSNR}} + \mathop \sum \nolimits_{i = 1}^{n} {\text{NC}}_{i} }}{n + 1}} \right) . $$
(20)

where n is the total number of distinct attacks considered in our experiments on the watermarked host image during the pattern search optimization of the scaling factors and PSNR is per unit. The PSNR value is computed when the watermark is inserted in the original image, and the NC values when the resilience of the watermarked image is checked against common attacks.

PS algorithm is performed to find the optimal scaling factors values. The parameters of the PS algorithm used are shown in Table 1. The initial points are the initial guesses for the scaling factors. Our experiments confirmed that no matter where the search starts almost the same optimal fitness function value is obtained.

Table 1 The pattern search algorithm parameters settings

4 Experimental results and analysis

To demonstrate the effectiveness of the proposed method, this paper uses two different \(512\mathrm{ x }512\) greyscale host image types. Normal images of Lena, Barbara, Mandril, Peppers, Boat, and HouseFootnote 1Footnote 2; medical imagesFootnote 3 of skull (MRI), lung (CT). Normal images, medical images, and logos are used as \(128\mathrm{x}128\) watermark images. Images employed in our tests are provided in Fig. 4.

Fig. 4
figure 4

Original host images: a Lena, b Barbara, c Mandril, d Peppers, e Boat, f House, g skull, and h lung Watermark images: (W1) Cameraman, (W2) Brain, (W3) Logo, and (W4) Copyright

All experiments are run on an Intel dual core 3.7 GHz computer with 16.0 GB RAM and running MATLAB R2020a. For watermarking system evaluation, peak signal-to-noise ratio (PSNR) in Eq. (17) is used to measure the watermarked host image quality as well as imperceptibility. The normalized correlation (NC) in Eq. (19) is used to assess the quality of the extracted watermark image for system robustness. This section primarily analyzes the suggested algorithm performance and rates it on these two most important criteria of imperceptibility and robustness. It then makes comparisons with other algorithms in the field. Section 4.1 validates the proposed method using various host and watermark images. Using the above criteria, our proposal is compared to existing algorithms and the results are shown in Sect. 4.2.

4.1 Algorithm performance analysis

4.1.1 Imperceptibility analysis

The imperceptibility of the suggested algorithm is evaluated using the PSNR measure. Identical images have an infinite value of PSNR. Although the watermarked image differs a little from the original host image, the difference in PSNR between the two is not infinite. However, it must be sufficiently large so that the difference is not perceptible to the human visual system. Since the benchmark threshold value is typically 30 dB, image degradation becomes more noticeable when PSNR falls below 30 dB, so if PSNR is higher than 30 dB, the watermark image existence is not recognizable, and the image changes cannot be observed by the human eye. Figure 5 shows the results of applying the embedding method described in Sect. 3.1 to eight host images and calculating the PSNR for each with different watermark types. It appears that in each case, the PSNR between the watermarked host image and the original host image is above 50 dB, demonstrating the algorithm superior invisibility. The conclusion is generic because we use various types of test images and watermark images. This means that the proposed method can meet the watermarking algorithm requirement of invisibility.

Fig. 5
figure 5

The PSNR values of the proposed method for various images

4.1.2 Robustness analysis

When invisibility is acceptable, robustness should be evaluated. Robustness is a measure of system ability to resist changes without affecting its stable performance. Robustness in image watermarking is the ability to extract watermarks under various attacks. For this reason, evaluating the reliability of an image watermarking technique is crucial. To test the robustness of the proposed method, various attacks are applied to the watermarked host image. In the analysis of the proposed method, different attacks have been applied to the watermarked host images with various embedded watermarks. Then, the watermarks are extracted from them. Table 2 displays the NC values between the extracted and original watermarks. The greater NC values denote high resistance of the embedded watermark to attacks. If the NC value is near to 1, the algorithm can resist attacks better. Otherwise, it is weak. Table 2 demonstrates that the algorithm is resilient to most attacks by evaluating it using different images. In noise attacks such as speckle noise, sharpening noise, salt and pepper noise, and histogram equalization, most NC values are close to 1. Geometrical attacks including various cropping and rescaling and using different filters like Gaussian low-pass filter, median filter, average filtering, and Gamma correction produced a high value for NC. The extracted watermark can still be recognized even when the image is rotated or blurred. Different images have different levels of robustness, but our algorithm shows strong resilience to attacks on the overall.

Table 2 NC values of the watermark extracted from watermarked image under various attacks

Moreover, Fig. 6 displays the compromised Lena watermarked image and the two different kinds of watermarks used. It shows that a clear watermark can be captured from an image that has been significantly destroyed. As shown above, our algorithm fulfills the watermarking robustness requirement, and a clear and recognizable watermark can be extracted under most attacks.

Fig. 6
figure 6

Compromised Lena watermarked image and the extracted two different kinds of watermarks

It is important to consider the effect of varying the parameters of the attacks to fully reflect the robustness of the proposed technique, as they are held static in the above tests. In addition, the NC value for the same watermarked host image can be different depending on the watermark size and the attack parameters. The experiments with varying parameters and different watermark sizes, i.e., \(256\mathrm{x256,128x128,64x}64\) are executed and the results are depicted in Fig. 7. The tests under JPEG2000 compression attack are shown in Fig. 7a, with compression ratios (CRs) chosen at steps of size 4 in the range from 4 to 36. Even with a CR of 36, the worst NC is over 0.9933 which is a good result. In Fig. 7b and c, the robustness is checked under Gaussian low-pass and median filters, with the window size set from 1 × 1 to 9 × 9 with a 1 × 1 step. According to the test results for all three watermarks, Gaussian low-pass filter NCs are larger than 0.9928. For 64 × 64 watermark size, NCs are greater than 0.994. As the window size increases, all three median filter NCs are greater than 0.9723. The minimum NC of the median attack is 0.992 for the 64 × 64 watermark. The cases of Gaussian noise, sharpening and Wiener filter are tested with different variances, thresholds, and neighborhood sizes. The results are shown in Fig. 7d–f. Their ranges setting are [0.001,0.009] with a step of 0.001, [0.1,0.9] with a step of 0.1, and [1, 9] with a step of 1, respectively. All Gaussian noise, sharpening Wiener filter NCs are larger than 0.9791, 0.9942 and 0.9373, respectively. For the 64 × 64 watermark size, all NCs for them are greater than 0.9952, 0.9993 and 0.9913, respectively. The case of upper left cropping is tested with a different crop ratio of \({\left(\frac{1}{2}\right)}^{n}\) where n is chosen from 2 to 8 with step one. The results are shown in Fig. 7g. All values for NCs are greater than 0.9923. We can see that the NCs values for the largest watermark size, 256 × 256 are higher than those for the smaller watermark size as the cropping ratio goes down. Figure 7h shows motion blur testing, with varying lengths of motion and angles of motion in degrees in a counterclockwise direction. With step of 4, both length and angle are selected from 5 to 45. The worst NC is above 0.95 even with a length and angle of 45. Figure 7i depicts the results of the tests conducted under salt and pepper attack. The noise density values utilized are [0.01,0.05] with a step of 0.01 followed by [0.05,0.25] with a step of 0.5. More noise is indicated by a higher density. The lowest NC is over 0.9452 even with a density of 0.25, which is a good outcome.

Fig. 7
figure 7

NC values for different parameters under various attacks. a JPEG2000 compression, b Gaussian low-pass filter, c Median filter, d Gaussian noise, e sharpening, f Wiener filter, g Cropping, h Motion blur, and i Salt and pepper noise

By looking at the above results for the three watermarks, one can see that the smaller the watermark size, the higher the NC value is, except for the cropping attack which is a localized attack. Additionally, a decrease in the NC value occurs for each of the three different watermark sizes when the parameter value is increased.

Since lossy compression, cropping, and other image processing-based attacks can be effectively stopped by adding watermark information based on weighting factors, the proposed method is a good way to protect images. Moreover, the technique is resistant to attacks like blurring, resizing, and JPEG compression if the watermark is put in the high-frequency part of the DWT domain instead of the low-frequency part.

In our proposed method, the low-frequency and high-frequency zones are used to embed the watermark, which makes the algorithm more reliable. Additionally, the weighting factors matrix is used to adjust the embedding factors, and the pattern search algorithm is used to make the scaling factors as good as possible, rendering our proposed algorithm much more robust.

To further demonstrate the strength of the suggested technique, it is crucial to address the case of a hybrid attack, which involves applying more than one attack to the watermarked host image simultaneously. Table 3 shows the NC values of the Lena host image and cameraman as a watermark image under a variety of hybrid attacks. By observing these NC values, we notice that our algorithm is also highly resistant against combinations of attacks. The NC value for a hybrid attack is lower than the NC value for each one, individually. In the case of combining the rotation attack with the Gaussian low-pass filter, the NC value is 0.9915, which is less than the individual NC after the rotation attack (0.9916) and Gaussian low-pass filter attack (0.9961). When JPEG compression is used with circular cropping and histogram equalization, the NC value is 0.9991, which is lower than the individual NC following JPEG compression (0.9998), circular cropping (0.9968), and histogram equalization (1.000). Moreover, the gamma correction attack combined with salt and pepper noise is ineffective against our scheme with NC = 0.9999 (NC is close to 1). The sharpening attack and Gaussian noise attack can be combined where an NC value of 0.9963 is obtained that is less than the separate NC values after the sharpening attack (0.9986) and Gaussian noise attack (0.9974). As a result, the proposed algorithm can successfully extract the watermark image with a high NC value from the watermarked host image after using multiple attacks. This demonstrates the high resistance of the proposed algorithm to hybrid attacks.

Table 3 The NC values against hybrid attacks

4.1.3 Computational cost analysis

This section discusses the computational cost of the proposed approach by estimating the processing time. The pattern search algorithm (PS), which is a trajectory-based optimization technique, is used in the proposed algorithm to find the optimal scaling factors for the embedding formula, rather than the more common population-based heuristic algorithms like genetic algorithms (GA) and particle swarm optimization (PSO). Figure 8 displays the average time required by each of these optimization techniques to find the appropriate scaling factors for the proposed algorithm. The time is an average of roughly twenty executions of each optimization method. Observing the results in Fig. 8 reveals that the time needed by the pattern search algorithm is about nine times less than the time required for the particle swarm optimization. Also, the pattern search algorithm is approximately a dozen times faster than the genetic algorithm. This demonstrates that applying the pattern search algorithm speeds up the proposed algorithm ability to determine the best scaling factors.

Fig. 8
figure 8

The computational cost for various optimization techniques

4.2 Comparative study

In the analysis below, we compare our proposed method with the existing techniques in [5, 33, 36, 37, 39, 40] based on the imperceptibility and robustness measures.

4.2.1 Imperceptibility analysis

The watermarked image is constructed by using the non-blind algorithms in [5, 33, 36, 37, 39, 40] and our suggested method to add the watermark W1 of size \(128\mathrm{x}128\) to the host images of a size \(512\mathrm{x}512\) (Lena, Barbara, Peppers and Skull). Figure 9 shows the resulting PSNR values between the watermarked image and the original host image.

Fig. 9
figure 9

Invisibility comparison of the algorithms based on the PSNR value

Figure 9 demonstrates that the PSNR of our proposed method is better compared to all other algorithms for all test images, especially those by Zhang et al. [33], Liu et al. [5] and Deeba et al. [37]. This suggests that our method has merits over others in terms of how transparent it is.

4.2.2 Robustness analysis

In this section, the proposed algorithm is evaluated in terms of its robustness through comparison to other algorithms in literature. According to the non-blind methods in [5, 33, 36, 37, 39, 40] and our algorithm, the watermark W1 is embedded in the Lena image. The Lena watermarked images are then subjected to various degradation processes. Finally, the watermarks are extracted from them, and the corresponding NC values are shown in Fig. 10. As apparent in Fig. 10, under all 21 attacks, particularly in Gaussian noise, scaling, sharpening, and cropping in the upper left, the robustness of the algorithm in [33] is not very good. Under the attack of rotation, the algorithm in [5] is more vulnerable. With motion blur and scaling down, its performance is also quite unacceptable. The extracted watermark NC values using the algorithm in [36] are superior to others, but its performance degrades under motion blur attack. When cropping the lower right, the watermark obtained by [39] has a low NC value of less than 0.87. Additionally, the gamma correlation and histogram equalization attacks render this algorithm copyright protection capability inadequate. The performance of the algorithm in [37] under attacks of histogram equalization, salt and pepper noise, and speckle noise is unsatisfactory. When the watermarked image is sharpened, and Gaussian noise is applied, this produces a low NC, which is less than 0.91. The algorithm in [40] fails under Gaussian noise, gamma correction, motion blur, and upper left corner cropping attacks. In terms of JPEG compression, all varieties of cropping, scaling up or down, Gaussian noise, motion blur, sharpening, median, average, and Wiener filtering attacks, the proposed technique clearly outperforms the existing ones.

Fig. 10
figure 10

Robustness comparison of the algorithms based on NC values

On the other hand, it is interesting to compare the suggested approach to a blind image watermarking scheme such as the scheme in [41]. Depending on the NC values of certain attacks, the comparison shown in Fig. 11 implies that our approach is superior to the scheme in [41] in terms of resilience to attacks, especially under the rotation attack.

Fig. 11
figure 11

Comparison of the proposed algorithm to the blind scheme in [41] based on NC values

4.2.3 Statistical analysis

In this subsection, we use the Friedman test, which is one of the useful nonparametric alternatives to ANOVA. It is employed to determine whether there is a statistically significant difference between the mean performance metrics of the existing algorithms and our new algorithm or not. The test is based on the null hypothesis, which claims that the mean across all algorithms is equal based on the NC values under the same attacks. Table 4 displays the results of the hypothesis test. The test statistical P value is 0.00034. Since this value is less than 0.05, which is the significance level, we can reject the null hypothesis. This means that there is a difference between the algorithms based on the NC values. Additionally, the rank of each algorithm as determined by the Friedman's analysis of means is displayed in Table 5. This table shows that our algorithm has a better rank than others, indicating that it has the best overall NC values.

Table 4 The hypothesis test result
Table 5 The ranks of different algorithm by Friedman’s two-way analysis

Each algorithm and its rank are represented by a point in Fig. 12. The blue line between two algorithms says that the significance value is far less than 0.05. The red line suggests that the significance values are close to 0.05. Closer to 0.05 are thicker lines. According to statistical analysis, this indicates that our method is superior to others.

Fig. 12
figure 12

Summary of Friedman’s two-way analysis results

5 Conclusions

This paper presented a novel approach for watermarking images that is capable of increasing both invisibility and robustness, simultaneously. The inclusion of the Schur decomposition in the embedding process enhanced the algorithm robustness against most attacks. Using an embedding formula with two scaling parameters, instead of a single one, assisted in improving robustness without compromising imperceptibility. In this paper, the concept of trajectory-based optimization is used by applying the pattern search algorithm to get the optimal scaling factors for the embedding function efficiently. The statistical analysis results demonstrate that the suggested technique offers advantages in terms of both invisibility and robustness when compared to similar existing watermarking techniques.

The limitations of this paper and suggestions for future research are stated below. Since that watermark embedding is implemented in the (LL and HH) sub-bands, the robustness of the proposed scheme against some types of cropping attacks is moderate. Also, the proposed algorithm is designed for grayscale host images and watermarks. As a future improvement, the algorithm could be extended to include copyright protection for color images, audio, and video streams. Moreover, the watermarking algorithm security can be enhanced by using more secure encryption algorithms to encipher the watermark image. Furthermore, the proposed algorithm can be used to hide multiple watermarks in the host image.