1 Introduction

1.1 Overview

In recent years, exchanging digital data via the Internet has become more and more popular. The rapid development of digital technology techniques and devices has brought a lot of convenience for users. However, it is also a fertile land for attacks who want to steal or fake information. Therefore, inspecting the integrity and the authentication of data is an extremely important issue to tackle risks. For images, besides general rules of the law, there are some applied methods such as encryption, information hiding, and watermarking to help owners protect their digital copyright. Among these techniques, the image watermarking technique has been known as the best one until now. Watermarking is a process of embedding digital information called watermark into an image by some constraints.

Depending on the watermark embedding domain, digital watermarking methods can be divided into two main categories: spatial domain and transform domain. In spatial domain techniques, the watermark is inserted by directly altering the pixel intensities of the cover image (Su and Chen 2018). Altering the least significant bits (LSB) of the cover image is one of the common spatial domain-based watermarking techniques. Spatial domain methods have low computational complexity, but they are not usually robust against almost image processing or other attacks. On the other hand, in transform domain methods, the original image is first transformed into the frequency domain by several transformation methods such as discrete cosine transform (DCT), discrete wavelet transform (DWT), or matrix decomposition such as singular value decomposition (SVD), QR decomposition, LU decomposition, and Schur decomposition. Then, according to certain criteria, the transform domain coefficients are altered for embedding the watermark information. Finally, the inverse transform is applied to obtain the watermarked digital image. Although watermarking methods in the frequency domain have high computational complexity, they are always more robust than spatial domain-based watermarking schemes.

Image watermarking schemes based on DCT transformation often embed watermark on the median frequency to harmonize between the quality of the watermarked image and the robustness of the extracted information (Su et al. 2015; Hsu and Hu 2017). If the embedding is implemented on low frequency, the extracted watermark is good, but the invisibility of the watermarked image is bad and vice versa. For DWT transformation, the watermark is commonly inserted on LL low sub-domain to archive a robust result (Giri et al. 2015). However, to balance between the quality of the watermarked image and the robustness of the extracted watermark, the watermark is also embedded into HL and LH sub-bands.

For SVD decomposition, there are two trends for the embedding and extracting process. The first one used the first element D(1, 1) of the D triangular matrix to change pixel values (Sun et al. 2002; Vaishnavi and Subashini 2015), whereas another way executed modifying elements of the first column of the U matrix (Lai 2011; Luo et al. 2020). Sun et al. in (2002) designed a novel watermarking scheme based on SVD, in which the watermark was embedded into \(512\times 512\) images by modifying the first coefficient of the D triangular matrix. This method had better performance in terms of robustness because the authors proposed an excellent formula to embed and extract the watermark. In addition, there is a novel scheme that was proposed by An-Wei Luo in (2020). This proposal performed an optimal SVD blocks selection strategy to improve the imperceptibility and used different embedding strengths for each block. However, embedding on two elements U(2, 1) and U(3, 1) of the U matrix reduced the quality of the watermarked images.

While the time required to conduct SVD computation is about 11 \(n^{3}\) flops, Schur decomposition needs a fewer number of flops which is approximately \({8n^3}/{3}\) for an \(n\times n\) matrix. That is the reason why some researchers focused on kind of this matrix analysis (Liu et al. 2017; Su et al. 2020). Su (2020) in 2020 described a new Schur decomposition-based algorithm where U(2, k) and U(3, k) elements of U unitary matrix are chosen for embedding (with k is a row index of D triangular matrix that contains the biggest value). Although Schur decomposition takes execution time less than SVD factorization, it is still a complex transformation.

In addition, QR decomposition, which decomposes a square matrix into an orthogonal matrix and an upper triangular matrix, is a very important matrix transformation for watermarking images. The advantage of QR decomposition lies in its low computational complexity and stable numerical feature. Because QR decomposition is an intermediate step in Schur decomposition, it requires a fewer number of computations than SVD and Schur factorization  (Su et al. 2013; Sima et al. 2018). Therefore, it is appropriate for real-time systems. In many works, the elements in the first column of the Q matrix not only have the same sign but also have similar values (Su et al. 2013). The QR decomposition-based watermarking also has satisfactory performance in terms of imperceptibility and robustness (Chen et al. 2021). Furthermore, due to concentrating energy of QR analysis on the first element of the R triangular matrix, the information is often embedded in this element  (Qingtang et al. 2017, 2019). Discovering the suitable element to embed is one of the major factors for determining the effectiveness of an image watermarking scheme. This completely agrees with the purpose of watermarking technique which only focuses on some high-energy elements instead of embedding information on all elements of the pixel matrix to guarantee the quality of the watermarked image.

For the above importance of QR decomposition, many researchers utilized QR decomposition to transform pixel matrices in their watermarking techniques (Su et al. 2013; Naderahmadian and Hosseini-Khayat 2014; Su et al. 2014; Qingtang et al. 2017; Sima et al. 2018; Qingtang et al. 2019; Chen et al. 2021). From 2013 to 2019, Qingtang Su had three papers that focused on QR factorization. In the first method, Su etal performed a watermarking process that depends on the relation between the second-row first-column coefficient and the third-row first-column coefficient of the Q unitary matrix (Su et al. 2013). After that, Su improved it by other choices in the years 2017 and 2019 where the author divided the host image into \(3\times 3\) blocks instead of a size of \(4\times 4\) as in the paper (Su et al. 2013). These improvements enhanced the embedded watermark capacity; however, the quality of the watermarked image was heavier affected.

Besides using separately above methods, many authors also had hybrid image watermarking schemes to strengthen the robustness of the watermark in recent years. That is a combination of DWT and SVD (Singh et al. 2017; Yadav et al. 2018; Roy and Pal 2019; Ernawan and Kabir 2020; Laxmanika and Singh 2020), DCT and SVD (Li et al. 2018), DWT and DCT (Abdulrahman and Ozturk 2019), DWT and QR (Jia 2017; Singh et al. 2018), or DWT and LU (Wang et al. 2016). The experimental results of these proposals showed that the robustness of the extracted watermark is more improved than previous researches. Normalized correlation (NC) value, which measures the robustness, is often up to 90% under all image attacks. However, the invisibility of the watermarked images is only around 40dB by peak signal-to-noise ratio (PSNR) index. Furthermore, these methods cost the computational complexity and they are not suitable for real-time systems.

1.2 Challenging issues

As above discussions, an effective image watermarking scheme needs to satisfy three main criteria which involve quality of watermarked image, the robustness of extracted watermark, and execution time. To balance these requirements, a novel method, which is based on the formula of Sun (2002) and QR decomposition, is proposed in our paper. Sun (2002) embedded information on the first element D(1, 1) of D triangular matrix after decomposing SVD (called SunSVD). The embedding and extracting formula in this proposal was referred to by many researchers due to its stability. Because of high computational complexity, SVD decomposition should be replaced with QR decomposition. From this idea, a combination between QR decomposition and the formula of Sun (called SunQR) was experimented. It used the Gram–Schmidt algorithm (Vandenberghe 2018) for QR factorization and the formula of Sun for embedding as well as extracting watermark. To be similar to SVD decomposition, the first element R(1, 1) of the upper triangular matrix R is used to embed and extract information due to the concentration of energy on this element.

Fig. 1
figure 1

An example of GS-based QR decomposition is when the original matrix is in ill condition

The previous methods often utilized the Gram–Schmidt (GS) algorithm to decompose the image matrix. However, GS-based QR decomposition exists some disadvantages as follows. Firstly, according to Stewart (1998) and Vandenberghe (2018), the algorithm requires approximately \(n^3\) flops for a \(n\times n\) matrix. It means that its complexity is \(O(n^3)\) which is similar to SVD and Schur decomposition. Therefore, it is more effective if we find a novel solution to compute QR factorization with less complexity. Secondly, although the GS algorithm-based method is easier to set up, it gives out worse the invisibility and the robustness of the watermarked image than the one based on SVD decomposition according to experimental results. A reason for this is because the GS algorithm concurrently calculates Q and R column by column, so it does not inspect diagonal elements of the R matrix if these values are zero or negative. From the theoretical point of view, an important factor to make the Q matrix and R matrix unique is that all diagonal elements R(ii) of the R matrix must be positive (Vandenberghe 2018). However, the GS algorithm does not ensure this demand in some cases. There are two versions of the GS algorithm: the classical algorithm and the modified algorithm. While the modified version depends upon the condition of the original matrix and fails when the original matrix is singular, classic GS usually has very poor orthogonality (Stewart 1998). Therefore, GS is considered a less accurate and stable algorithm (Stewart 1998). Besides that, the GS algorithm is not recommended in practice due to being sensitive to rounding errors as mentioned on page 15 of (Vandenberghe 2018). Figure 1 is an example to illustrate the error of GS-based QR decomposition when the original matrix A is in an ill condition. A matrix in the example is a \(4\times 4\) pixel block of the “Girl” image (University of Granada 2022). We can see that some elements of Q and R matrices are unknown in this case. As the result, the product of \(Q^TQ\) is infinite and it is not equal to the unit matrix I, so the GS algorithm does not guarantee the orthogonality of the Q matrix. Moreover, an inverse QR factorization cannot be computed. In other words, GS-based QR decomposition fails in this situation.

1.3 Our contributions

Our contributions can be summarized as follows:

  1. 1.

    To overcome the drawbacks of SunQR, a new watermarking scheme based on QR decomposition is proposed in this paper where the R matrix is computed at first and diagonal elements of the R matrix are checked and modified if they are zero or negative. This action ensures that Q and R matrices are always unique without the loss of orthogonality. Due to this computation, the quality of the watermarked image can be significantly improved.

  2. 2.

    Calculating elements of R is performed by solving a set of linear equations. After that, Q is computed based on R. Therefore, the time complexity of the proposed QR decomposition is \(O(n^2)\) instead of \(O(n^3)\) as the GS-based QR factorization.

  3. 3.

    In addition, for improving extracting time, a novel formula is designed to get out the first element R(1, 1) of R matrix instead of calculating QR factorization as the previous proposals. Based on our proposed extracting scheme, our method can reduce significantly execution time compared with other methods. That makes our method can be suitable for real-time applications.

1.4 Roadmap

The rest of this paper is organized as follows. Section 2 describes the QR decomposition theory and its special features. Then, Sect. 3 introduces the details of our watermark embedding and our watermark extraction procedure. After that, Sect. 4 gives the experimental results and discussion. Finally, Sect. 5 concludes this paper.

2 Preliminaries

2.1 QR decomposition

QR decomposition (also called QR factorization) of a matrix A is a decomposition of the matrix into two matrices as Eq. (1).

$$\begin{aligned} A = QR, \end{aligned}$$
(1)

where Q is an orthogonal matrix (i.e.,  \(Q^TQ = QQ^T = I\)) and R is an upper triangular matrix. If A is non-singular, then this factorization is unique.

For example, a matrix A of size \(4\times 4\) as

$$\begin{aligned} A = \begin{bmatrix} 40 &{}\quad 39 &{}\quad 39 &{}\quad 38\\ 40 &{}\quad 40 &{}\quad 40 &{}\quad 39\\ 41 &{}\quad 42 &{}\quad 42 &{}\quad 40\\ 44 &{}\quad 46 &{}\quad 44 &{}\quad 41 \end{bmatrix} \end{aligned}$$

can be factored into an orthogonal matrix Q and an upper triangular matrix R by QR decomposition as follows.

$$\begin{aligned} Q= & {} \begin{bmatrix} 0.4845 &{}\quad -\, 0.6921 &{}\quad - \,0.3499 &{}\quad -\, 0.4049\\ 0.4845 &{}\quad - \,0.2374 &{} \quad 0.1917 &{}\quad 0.8199\\ 0.4966 &{}\quad 0.2113 &{}\quad 0.7381 &{}\quad - \,0.4049\\ 0.5329 &{}\quad 0.6481 &{}\quad - \,0.5440 &{}\quad 0.0000 \end{bmatrix}\\ R= & {} \begin{bmatrix} 82.5651 &{}\quad 83.6431 &{}\quad 82.5772 &{} \quad 79.0164\\ 0 &{}\quad 2.1996 &{}\quad 0.9033 &{}\quad -\, 0.5341\\ 0 &{}\quad 0 &{}\quad 1.0880 &{}\quad 1.4020\\ 0 &{} \quad 0 &{} \quad 0 &{}\quad 0.3947 \end{bmatrix} \end{aligned}$$

2.2 Arnold transform

For improving the security of watermarking method, Arnold transform is often used to permute the watermark image (Su et al. 2020), and its detailed permutation process is given by Eq. (2).

$$\begin{aligned} \begin{pmatrix} x'\\ y' \end{pmatrix} = \begin{pmatrix} 1 &{} 1\\ 1 &{} 2 \end{pmatrix} \begin{pmatrix} x\\ y \end{pmatrix} \begin{pmatrix} \mathrm{mod}&N \end{pmatrix}, \end{aligned}$$
(2)

where \(x'\), \(y'\), x, and y are integers in \(\{0,~ 1,~ 2, \ldots ,~ N - 1\}\) and N is order of watermark image matrix. The modulus operation is denoted by mod with a divisor with N. The image pixel at the coordinate (x, y) can be permuted to a new coordinate (\(x'\), \(y'\)) by Eq. (2), which disorganizes the order of the watermark image. Based on the Arnold transform, we can enhance the security in the visual identification of watermark images. Moreover, the number of permutation times of Arnold transform is often used as the secret key.

2.3 The special feature of Q and R matrix

2.3.1 Finding the elements of R matrix

By multiplying two sides of the equation with \(A^T\) (is a transposition of A), Eq. (1) in Sect. 2.1 becomes as follows:

$$\begin{aligned} A^TA&= A^TQR = M\nonumber \\&\Rightarrow {A^TA = {(QR)}^TQR = M}\nonumber \\&\Rightarrow {A^TA = R^TQ^TQR = M}\nonumber \\&\Rightarrow {A^TA = R^TR = M} \end{aligned}$$
(3)

(since Q is an orthogonal matrix, so \(Q^TQ = I\), where I is the identity matrix.)

Since R is an upper triangular matrix, R can be computed easily by solving a set of linear equations. Supposedly, the host matrix A has a size of \(4\times 4\). Therefore, the M, \(A^T\), \(R^T\), and R matrices are also \(4\times 4\) matrices. The elements of A are represented as follows.

$$\begin{aligned} A= \begin{bmatrix} a_{11} &{} a_{12} &{} a_{13} &{} a_{14}\\ a_{21} &{} a_{22} &{} a_{23} &{} a_{24}\\ a_{31} &{} a_{32} &{} a_{33} &{} a_{34}\\ a_{41} &{} a_{42} &{} a_{43} &{} a_{44} \end{bmatrix} = \begin{bmatrix} a_1&a_2&a_3&a_4 \end{bmatrix}, \end{aligned}$$

where \(a_1\), \(a_2\), \(a_3\), \(a_4\) are column vectors of A, respectively. We have

$$\begin{aligned} A^T= & {} \begin{bmatrix} a_{11} &{} a_{21} &{} a_{31} &{} a_{41}\\ a_{12} &{} a_{22} &{} a_{32} &{} a_{42}\\ a_{13} &{} a_{23} &{} a_{33} &{} a_{43}\\ a_{14} &{} a_{24} &{} a_{34} &{} a_{44} \end{bmatrix},\, M = A^TA \\= & {} \begin{bmatrix} m_{11} &{} m_{12} &{} m_{13} &{} m_{14}\\ m_{21} &{} m_{22} &{} m_{23} &{} m_{24}\\ m_{31} &{} m_{32} &{} m_{33} &{} m_{34}\\ m_{41} &{} m_{42} &{} m_{43} &{} m_{44} \end{bmatrix}\\ R= & {} \begin{bmatrix} r_{11} &{} r_{12} &{} r_{13} &{} r_{14}\\ 0 &{} r_{22} &{} r_{23} &{} r_{24}\\ 0 &{} 0 &{} r_{33} &{} r_{34}\\ 0 &{} 0 &{} 0 &{} r_{44} \end{bmatrix} \, R^T= \begin{bmatrix} r_{11} &{} 0 &{} 0 &{} 0\\ r_{12} &{} r_{22} &{} 0 &{} 0\\ r_{13} &{} r_{23} &{} r_{33} &{} 0\\ r_{14} &{} r_{24} &{} r_{34} &{} r_{44} \end{bmatrix} \end{aligned}$$

In order to find the elements of the R matrix, we will begin with Eq. (3).

$$\begin{aligned} R^TR= & {} M \Leftrightarrow \begin{bmatrix} r_{11} &{} 0 &{} 0 &{} 0\\ r_{12} &{} r_{22} &{} 0 &{} 0\\ r_{13} &{} r_{23} &{} r_{33} &{} 0\\ r_{14} &{} r_{24} &{} r_{34} &{} r_{44} \end{bmatrix} \begin{bmatrix} r_{11} &{} r_{12} &{} r_{13} &{} r_{14}\\ 0 &{} r_{22} &{} r_{23} &{} r_{24}\\ 0 &{} 0 &{} r_{33} &{} r_{34}\\ 0 &{} 0 &{} 0 &{} r_{44} \end{bmatrix}\\= & {} \begin{bmatrix} m_{11} &{} m_{12} &{} m_{13} &{} m_{14}\\ m_{21} &{} m_{22} &{} m_{23} &{} m_{24}\\ m_{31} &{} m_{32} &{} m_{33} &{} m_{34}\\ m_{41} &{} m_{42} &{} m_{43} &{} m_{44} \end{bmatrix} \end{aligned}$$

Therefore, we have

$$\begin{aligned}&r_{11}r_{11} = m_{11} \Rightarrow {r_{11} = \sqrt{m_{11}}} \end{aligned}$$
(4)
$$\begin{aligned}&r_{11}r_{12} = m_{12} \Rightarrow {r_{12} = \frac{m_{12}}{r_{11}}} \end{aligned}$$
(5)
$$\begin{aligned}&r_{11}r_{13} = m_{13} \Rightarrow {r_{13} = \frac{m_{13}}{r_{11}}} \end{aligned}$$
(6)
$$\begin{aligned}&r_{11}r_{14} = m_{14} \Rightarrow {r_{14} = \frac{m_{14}}{r_{11}}} \end{aligned}$$
(7)
$$\begin{aligned}&r_{12}r_{12} + r_{22}r_{22} = m_{22} \Rightarrow {r_{22} = \sqrt{m_{22} - r_{12}^2}} \end{aligned}$$
(8)
$$\begin{aligned}&r_{12}r_{13} + r_{22}r_{23} = m_{23} \Rightarrow {r_{23} = \frac{m_{23} - r_{12}r_{13}}{r_{22}}} \end{aligned}$$
(9)
$$\begin{aligned}&r_{12}r_{14} + r_{22}r_{24} = m_{24} \Rightarrow {r_{24} = \frac{m_{24} - r_{12}r_{14}}{r_{22}}} \end{aligned}$$
(10)
$$\begin{aligned}&r_{13}r_{13} + r_{23}r_{23} + r_{33}r_{33} = m_{33} \Rightarrow r_{33}\nonumber \\&\quad = \sqrt{m_{33} - r_{13}^2 - r_{23}^2} \end{aligned}$$
(11)
$$\begin{aligned}&r_{13}r_{14} + r_{23}r_{24} + r_{33}r_{34} = m_{34} \end{aligned}$$
(12)
$$\begin{aligned}&\Rightarrow r_{34} = \frac{m_{34} - r_{13}r_{14} - r_{23}r_{24} }{r_{33}}\nonumber \\&\quad r_{14}r_{14} + r_{24}r_{24} + r_{34}r_{34} + r_{44}r_{44} = m_{44}\nonumber \\&\quad \Rightarrow r_{44} = \sqrt{m_{44} - r_{14}^2 - r_{24}^2 - r_{34}^2} \end{aligned}$$
(13)

In general, if the host matrix A has a size of \(n\times n\), we have

$$\begin{aligned} r_{11}= & {} \sqrt{m_{11}} and r_{1j} = \frac{m_{1j}}{r_{11}} \end{aligned}$$
(14)
$$\begin{aligned} r_{ij}= & {} \left\{ \begin{array}{cl}\sqrt{m_{ij} - \sum _{k=1}^{i-1}r_{kj}^2} , &{} {i = j}\\ \\ \dfrac{(m_{ij} - \sum _{k=1}^{i-1}r_{ki}r_{kj})}{r_{ii}} , &{} {i \ne j}\end{array}\right. \end{aligned}$$
(15)

where \(i,j = 2,3,\cdots ,n\).

2.3.2 Finding the elements of Q matrix

Calculating the elements of the Q matrix is based on the R matrix. The Q matrix can be expressed by columns as follows.

$$\begin{aligned} Q = \begin{bmatrix} q_{11} &{} q_{12} &{} q_{13} &{} q_{14}\\ q_{21} &{} q_{22} &{} q_{23} &{} q_{24}\\ q_{31} &{} q_{32} &{} q_{33} &{} q_{34}\\ q_{41} &{} q_{42} &{} q_{43} &{} q_{44} \end{bmatrix} = \begin{bmatrix} q_1&q_2&q_3&q_4 \end{bmatrix} \end{aligned}$$

The Gram–Schmidt algorithm, which was introduced in (Vandenberghe 2018), computes Q column by column. According to that, the columns of Q are calculated as follows.

$$\begin{aligned} \widetilde{q_1}= & {} a_1 = \begin{bmatrix} a_{11}\\ a_{21}\\ a_{31}\\ a_{41} \end{bmatrix} \mathrm{and} q_1 = \frac{1}{r_{11}}\widetilde{q_1} \end{aligned}$$
(16)
$$\begin{aligned} \widetilde{q_2}= & {} a_2 - r_{12}q_1 = \begin{bmatrix} a_{12}\\ a_{22}\\ a_{32}\\ a_{42} \end{bmatrix} - r_{12} \begin{bmatrix} q_{11}\\ q_{21}\\ q_{31}\\ q_{41} \end{bmatrix} \mathrm{and}\nonumber \\ q_2= & {} \frac{1}{r_{22}}\widetilde{q_2}. \end{aligned}$$
(17)
$$\begin{aligned} \widetilde{q_3}= & {} a_3 - r_{13}q_1 - r_{23}q_2 = \begin{bmatrix} a_{13}\\ a_{23}\\ a_{33}\\ a_{43} \end{bmatrix}\nonumber \\&- r_{13} \begin{bmatrix} q_{11}\\ q_{21}\\ q_{31}\\ q_{41} \end{bmatrix} - r_{23} \begin{bmatrix} q_{12}\\ q_{22}\\ q_{32}\\ q_{42} \end{bmatrix} \mathrm{and} ~ q_3 = \frac{1}{r_{33}}\widetilde{q_3} \end{aligned}$$
(18)
$$\begin{aligned} \widetilde{q_4}= & {} a_4 - r_{14}q_1 - r_{24}q_2 - r_{34}\nonumber \\ q_3= & {} \begin{bmatrix} a_{14}\\ a_{24}\\ a_{34}\\ a_{44} \end{bmatrix} - r_{14} \begin{bmatrix} q_{11}\\ q_{21}\\ q_{31}\\ q_{41} \end{bmatrix} - r_{24} \begin{bmatrix} q_{12}\\ q_{22}\\ q_{32}\\ q_{42} \end{bmatrix} - r_{34} \begin{bmatrix} q_{13}\\ q_{23}\\ q_{33}\\ q_{43} \end{bmatrix} \mathrm{and}\nonumber \\ q_4= & {} \frac{1}{r_{44}}\widetilde{q_4} \end{aligned}$$
(19)

In general, if the host matrix A has a size of \(n\times n\), we have

$$\begin{aligned} \widetilde{q_1}= & {} a_1 \mathrm{and} q_1 = \frac{1}{r_{11}}\widetilde{q_1} \end{aligned}$$
(20)
$$\begin{aligned} \widetilde{q_i}= & {} a_i - (r_{1i}q_1 + r_{2i}q_2 + \cdots + r_{i-1,i}q_{i-1}) \mathrm{and} \nonumber \\ q_i= & {} \frac{1}{r_{ii}}\widetilde{q_i} \end{aligned}$$
(21)

where \(a_i, ~\widetilde{q_i}\) and \(q_i\) (with \(i = 2\) to n) are \(n\times 1\) vectors

2.3.3 The computational complexity of the proposed solution

Algorithm 1 presents shortly steps to discover the elements of the R matrix and Q matrix. According to Algorithm 1, it is easy to see that the computational complexity of the proposed approach is the sum of four calculations. These calculations comprise transposing A matrix, multiplying \(A^T\) and A, calculating the elements \(r_{ij}\) and \(q_{ij}\), respectively. Each calculation needs two nested for loops, so the execution time for each one is \(Cn^2\) (C is a constant). Therefore, the time complexity of the whole Algorithm 1 is \(O(n^2)\)

figure a

3 The proposed watermarking method

In this section, we describe a new watermarking scheme based on the improved QR decomposition and the formula of Sun in the paper (2002). The image watermarking scheme includes two stages, embedding and extracting, respectively.

3.1 Watermark embedding scheme

In the embedding process, the host color image is divided into \(4\times 4\) non-overlapping blocks at first. Then, the gray watermark image is permuted by Arnold transform and is converted to a binary sequence after that. Finally, the improved QR decomposition is performed on the image blocks in succession and the watermark is embedded into the R matrix. The proposed watermark embedding scheme can be summarized as follows.

  1. 1.

    Divide the host color image H into \(4\times 4\) non-overlapping blocks. In this image, each pixel is represented by three components (RGB).

  2. 2.

    Permute the gray watermark image by Arnold transform and then convert to a one-dimensional array \(w_i\) with \(i = 1, 2, \cdots , M\times M\). \(M\times M\) is the size of gray watermark image.

  3. 3.

    Perform QR decomposition on one block based on Sect. 2.3 as follows:

    • Assign B components of the block to A matrix.

    • Calculate \(A^T\) by transposing the matrix A

    • Compute \(M = A^TA\)

    • Find out R and Q matrices by solving a set of equations as represented in Eqs. (14), (15), (20) and (21).

  4. 4.

    Embed a watermark bit into the triangular matrix R based on the formula of Sun (2002):

    • Get the first element R(1, 1) of R matrix

    • Calculate \(z = R(1,1)~\text {mod} q\) (with q is a positive integer)

    • Case \(w_i=``0''\)

      $$\begin{aligned} R'(1,1) = \left\{ \begin{array}{cl}R(1,1) + \dfrac{q}{4} - z , &{} {z < 3\dfrac{q}{4}}\\ \\ R(1,1) + 5\dfrac{q}{4} - z , &{} \text{ elsewhere } \end{array}\right. \end{aligned}$$
      (22)
    • Case \(w_i=``1''\)

      $$\begin{aligned} R'(1,1) = \left\{ \begin{array}{cl}R(1,1) - \dfrac{q}{4} - z , &{} {z < \dfrac{q}{4}}\\ \\ R(1,1) + 3\dfrac{q}{4} - z , &{} \text{ elsewhere }\end{array}\right. \end{aligned}$$
      (23)

    Note that q is also the strength of watermark embedding.

  5. 5.

    Update matrix A by formula Eq. (1): \(A' = QR'\) and assign \(A'\) back to B components of the blocks.

  6. 6.

    Repeat steps 3–5 until all blocks are embedded watermark values. Finally, the watermarked B components are reconstructed to obtain the watermarked image \(H'\).

The detail of steps for the embedding stage can be represented in Fig. 2.

Fig. 2
figure 2

The embedding stage

3.2 Watermark extraction scheme

Since the watermark is only embedded into the R matrix in the embedding process, QR decomposition is not needed in the watermark extraction procedure. The main purpose of this extraction scheme is to find out the first element R(1, 1) of the R matrix. This improvement makes our paper is different from the other ones based on QR decomposition. Therefore, the watermark extraction steps are described as follows.

  1. 1.

    Divide the watermarked image \(H'\) into \(4\times 4\) non-overlapping blocks. In this image, each pixel is represented by three components (RGB).

  2. 2.

    Assign B components of the block to a \(4\times 4\) matrix (matrix \(A^*\)).

  3. 3.

    Obtain the first element \(R^*(1,1)\) of \(R^*\) matrix as follows: \(R^*(1,1)\) = length of the first column vector of \(A^*\) matrix (Vandenberghe 2018).

    $$\begin{aligned}&R^*(1,1) \nonumber \\&\quad = \sqrt{A^*(1,1)^2 + A^*(2,1)^2 + A^*(3,1)^2 + A^*(4,1)^2} \end{aligned}$$
    (24)
  4. 4.

    Extract the information of watermark based on algorithm of Sun (2002):

    • Calculate \(z = R^*(1,1)\) mod q

    • The watermark bit is extracted by using following equation.

      $$\begin{aligned} w = \left\{ \begin{array}{cl}``0'' , &{} z < \dfrac{q}{2}\\ \\ ``1'' , &{} \text{ elsewhere }\end{array}\right. \end{aligned}$$
      (25)
  5. 5.

    Repeat steps 2–4 until watermark values are extracted on all blocks. Finally, collect all extracted watermark values into an image and use inverse Arnold transform to get the final watermark.

The detail of the extracting stage can be represented in Fig. 3. And an example of the proposed image watermarking algorithm is also illustrated in Fig. 4.

Fig. 3
figure 3

The extracting stage

Fig. 4
figure 4

An example of the proposed watermarking algorithm

3.3 The computational complexity of the proposed scheme

According to Sect. 2.3.3, the time complexity for the proposed QR decomposition is \(O(n^2)\) with an image block size of \(n\times n\). For the proposed watermarking scheme, we only embed the watermark on the B channel instead of three color channels of the host image. The reasons for choosing component B are: (a) considering all components may distort the colors of the watermarked images; (b) human eyes are less sensitive to component B than components R and G according to the human visual system. Therefore, the overall complexity of the proposed embedding scheme for a color image of \(N\times N\) pixels is estimated as \(\dfrac{N\times N}{n\times n}O(n^2)\). And the overall complexity of the proposed extraction scheme is only \(\dfrac{N\times N}{n\times n}O(1)\) for a color image of \(N\times N\) pixels because we do not use QR decomposition as the previous QR-based methods in this stage. Instead of that, we calculate R(1, 1) of the R matrix based on Eq. (24).

4 Experimental results

4.1 Evaluation criteria

In general, the efficiency of image watermarking schemes is usually measured by their invisibility, robustness, and computing time. For evaluating the invisibility capability, not only the peak signal-to-noise ratio (PSNR) is used, but also the structural similarity index measurement (SSIM) is utilized to measure the similarity between the original color image H and the watermarked image \(H'\) with size of \(N\times N\) in this paper. PSNR is employed as a measure for evaluating the quality of the watermarked image. PSNR is described by the following equation.

$$\begin{aligned} \mathrm{PSNR} = 10\log _{10}\frac{{255^2}\mathrm{MSE}}{,} \end{aligned}$$
(26)

where the mean square error (MSE) between the original and watermarked image is defined as:

$$\begin{aligned} \mathrm{MSE} = \frac{1}{MN}\sum _{i=0}^{M-1}\sum _{j=0}^{N-1}(H(i,j) - H'(i,j))^2 \end{aligned}$$
(27)

Moreover, the SSIM is considered to be correlated with the quality perception of the human visual system (HVS). The SSIM, as denoted in Eq. (28), is also used to measure the similarity between the original color image H and the watermarked image \(H'\) (Jia 2017).

$$\begin{aligned} SSIM(H,H') = l(H,H')c(H,H')s(H,H'), \end{aligned}$$
(28)

where

(29)

The first term in Eq. (29) is the luminance comparison function which measures the closeness of the two images’ mean luminance (\(\mu _H\) and \(\mu _{H'}\)). The second term is the contrast comparison function which measures the closeness of the contrast of the two images. Here the contrast is measured by the standard deviation \(\sigma _H\) and \(\sigma _{H'}\). The third term is the structure comparison function which measures the correlation coefficient between the two images H and \(H'\). Note that \(\sigma _{HH'}\) is the covariance between H and \(H'\). The positive values of the SSIM index are in [0, 1]. A value of “0” means no correlation between images, and “1” means that \(H = H'\). The positive constants \(C_1\), \(C_2\), and \(C_3\) are used to avoid a null denominator.

Table 1 Various attacks used in our experiments

Furthermore, the normalized correlation (NC) coefficient is computed for evaluating robustness by using the original watermark W and the extracted watermark \(W'\), which is denoted as follows:

$$\begin{aligned} NC = \dfrac{\sum _{j=1}^4\sum _{x=1}^m\sum _{y=1}^n(W(x,y,j)W'(x,y,j))}{\sqrt{\sum _{j=1}^4\sum _{x=1}^m\sum _{y=1}^n(W(x,y,j))^2}\sqrt{\sum _{j=1}^4\sum _{x=1}^m\sum _{y=1}^n(W'(x,y,j))^2}},\nonumber \\ \end{aligned}$$
(30)

where W(xyj) and \(W'(x,y,j)\) present the value of pixel (xy) in component j of the original watermark and the extracted one and \(m\times n\) denote size of row and column of the watermark image, respectively.

In general, a larger PSNR or SSIM value denotes the watermarked image is very near to the original host image, which means that the watermarking method has better performance in terms of invisibility. A higher NC value reveals that the extracted watermark is alike to the original watermark, which shows that the watermarking method is more robust.

4.2 The simulation setting

In order to evaluate objectively the stability and the effectiveness of the proposed method, twelve 24-bit color images with a size of \(512\times 512\) in the CVG-UGR image database (University of Granada 2022) are selected as the host images, and two \(32\times 32\) gray images are used as original watermarks as shown in Fig. 5. The host images are standard color images that involve various types such as portrait, landscapes photograph, animal photograph, and fruit photograph. Pixel distribution of these images is different from each other. All tests are implemented by Visual Studio v15 and are performed on a laptop with \(\mathrm{Intel}^@\) \(\mathrm{Core}^\mathrm{TM}\) i5-6200U CPU at 2.30 GHz, 4.00 GB RAM and 64-bit OS. Table 1 describes shortly different image attacks which are used in our robustness tests.

Fig. 5
figure 5

The host images: a avion, b baboon, c Balloon, d couple, e Girl, f house, g lena, h milkdrop, i parrots, j peppers, k sailboat, l tree. The watermarks: m w1, n w2

To select a suitable embedding parameter, the watermark is embedded into all host images with different embedding coefficients q (from 5 to 20 with the step length 1). Table 2 gives a part of SSIM of the watermarked images and the NC of the extracted watermark with the different embedding coefficients q (\(q = 5,~ 10,~15,~20\), respectively).

Table 2 Values of SSIM and NC under different embedding coefficients

As shown in Table 2, each watermarked image has various SSIM and NC values with the same q and they are also different from other images. However, it is clear that when the coefficient q increases, the SSIM is smaller whereas the NC is bigger, and vice versa. This means that if the robustness of the watermark is better, then the invisibility of the watermarked image is worse when q goes up. Therefore, to balance between invisibility and robustness, a value of q is set to 10 for evaluating the performance of the proposed method.

Fig. 6
figure 6

A short description of the related works

A comparison between the methods of Sun (2002), Luo (2020), Su (2020), Su (2018), Chen (2021), Hu (2020), Chen (2021), Qin (2021), Kumar (2021) and our proposal is performed to simulate for the effectiveness of the proposed algorithms. Figure 6 reviews some important information of the related works in terms of utilized technique, evaluation tools, data set, performance metrics, advantages, and disadvantages. The first one is a scheme of Sun (2002) which used SVD decomposition as the main technique to embed a \(64\times 64\) binary image into a gray \(512\times 512\) image on the element D(1, 1) of the D matrix. This scheme has the advantages of distinguishing the JPEG lossy compression from other malicious manipulation and identifying modified portions of the image but it also has a big computational complexity. It is similar to the schemes of Lou (2020) and Hu (2020) because both algorithms applied SVD analysis in their image watermarking methods too. In (Luo et al. 2020), Lou combined DWT with SVD decomposition and logistic map to create a novel watermarking scheme. The method has an optimal SVD blocks selection strategy which improves the imperceptibility and robustness. Lou (2020) and Hu (2020) inserted the watermark bits into the U(2, 1) and U(3, 1); however, Lou used gray and binary images while Hu utilized color images for the host image and the watermark image. In addition, Su had two proposals based on Arnold transform, LU decomposition, and Schur factorization in (Qingtang et al. 2018; Su et al. 2020), respectively. The approach of Su (2018) has a low computational complexity \((O(n^2))\) and high embedding payload but the performance of resisting image rotating attack will be further considered in future work. QR decomposition is selected in the method of Chen (2021) and our method. However, while Chen embedded color watermark bits into two elements Q(2, 1) and Q(3, 1) of Q matrix, we chose R(1, 1) of R matrix as the modified element. In addition, three state-of-the-art algorithms were published in 2021 by Chen (2021), Qin (2021), and Kumar (2021), respectively. Firstly, Chen (2021) used WHT transform as a main technique for the proposed scheme. In this publish, the author calculated a correlation between the matrix coefficients to find out the embedded elements of the WHT blocks on three R, G, and B channels. This algorithm has higher embedding capacity and improves security by rearranging the pixel values and randomly selecting the embedded blocks. Secondly, a combination of DWT, QDFT, and QR decomposition was built by Qin (2021) to create a novel watermarking scheme. Qin performed the first-level DWT transform on R, G, and B channels at first. Next, three low-frequency components constituted a pure quaternion matrix and the left quaternion Fourier transform was performed to obtain the real part. Then, the watermark was embedded into the \(r_{14}\) element of the R matrix by QR decomposition. The algorithm has good robustness against attacks such as JPEG compression, cropping, and median filtering but the transparency of the watermarked image is very low because the PSNR values are only between 20 dB and 30 dB. Finally, an LWT-based image watermarking method, which hid the watermark into sub-band HH of Y component, was developed by Kumar (2021). In this article, Kumar applied the alpha blending technique to balance the trade-offs between the imperceptibility and the robustness, and Arnold’s Cat Map was used to enhance security of the watermarking technique. Unfortunately, this method is less robust against median and filtering attacks. In summary, all the above papers divide the host image into the blocks of \(4\times 4\) except Kumar (2021) and the evaluation tools are often PSNR, SSIM, NC, and BER.

Fig. 7
figure 7

PSNR and NC values of the proposed method for twelve host images and two watermark images in the absence of attack

4.3 Invisibility test

The quality of watermarked images is evaluated by PSNR and SSIM indexes. In general, the watermarked image is more invisible when the value of PSNR is bigger or the value of SSIM is near to 1. Theoretically, the extracted watermark should be the same original watermark under no attacks. It means that the NC value must be 1. However, it is not completely correct in our experimental tests. In fact, the NC value is less than 1 because it depends on the structure of the host image as well as the embedding strength. In all methods, the embedding strength is chosen to a suitable value in order to balance between the quality of the watermarked image and extracted watermark. Figure 7 shows that PSNR values of the proposed method are at a stable level of over 62 dB for all tested images except “peppers” and “Parrots”. For each host image, NC indexes of two watermarks are similar to each other.

Fig. 8
figure 8

A comparison of the quality of the watermarked images between the methods

The detailed results of the imperceptibility are also compared in Fig. 8. According to Fig. 8, PSNR/SSIM values of Su (2018), Luo (2020), Hu (2020), and Chen (2021) are lower than the other methods because the authors embedded the watermark on two elements of the L matrix, U matrix, and Q matrix, respectively. This causes a big change in two rows of the corresponding block after embedding. Therefore, the pixel values of the watermarked image will not be close to the original image. As the result, the quality of the watermarked image of these methods is worse. In addition, the figures in Fig. 8 display that the algorithms of Su (2018) and Hu (2020) bring a low result in terms of PSNR and SSIM. The reason for this is because these methods embedded the information on three channels instead of one channel as the others. Although embedding on three channels enhances the embedded capacity, it leads to distortion of the pixel values. Meanwhile, the methods of SunSVD (2002) and SunQR in Sect. 1.2 have higher PSNR/SSIM values. These methods used the embedding formula of Sun which impacts on one element of the triangular matrix, so the embedded block only changes on one row instead of two rows as the cases of Su (2018), Luo (2020), Hu (2020), and Chen (2021). That is a reason why the formula of Sun is utilized in the proposed method.

Figure 9 is a piece of evidence to demonstrate the influence of the embedded elements on the pixel matrix. In this figure, the proposed algorithm only embeds watermark bits on R(1, 1) of the R matrix. Thus, the matrix after embedding only is modified on the first column in comparison with the original matrix. Unlike that, the watermark bit is embedded into two elements Q(2, 1) and Q(3, 1) of the Q matrix in the method of Chen (2021) which leads to change in the second row and the third row of the embedded matrix. To some extent, Fig. 9 explains why the proposed method has better imperceptibility than the scheme of Chen (2021).

Fig. 9
figure 9

An example for comparison of original and embedded matrices between the proposed method and the approach of Chen (2021)

Table 3 An average comparison between the different methods in terms of PSNR, SSIM and NC values

In addition, it can be seen clearly in Table 3 that the proposed method gives much higher PSNR/SSIM and NC values than others. This means that the invisibility of the watermarked image is much better in the proposed scheme. In addition, the result table brings out that the proposed method can not only overcome the quality of the watermarked image but also effectively extract the embedded watermark.

Our results can be explained as follows. Theoretically, R is an upper triangular matrix with nonzero diagonal elements. According to Eq. (22) in Sect. 2.3, the first diagonal element \(r_{11}\) is always positive because pixel value is also positive. However, the other diagonal ones can be zero or negative which are based on Eqs. (8910), (1112), (13) in Sect. 2.3. From Eq. (8910) in Sect. 2.3, we have \(r_{22}\) = \(\sqrt{m_{22} - r_{12}^2}\). If \((m_{22} - r_{12}^2) = 0\) then \(r_{22} = 0\). Thus, \(r_{23}\) and \(r_{22}\) are infinite. Otherwise, if \((m_{22} - r_{12}^2) < 0\), \(r_{22}\) is infinite too. It is similar to \(r_{33}\) and \(r_{44}\). This leads to infinite values of R, Q, and \(A'\) matrices (with \(A'\) is the matrix A after embedding the watermark). This is a reason for reducing the quality of the watermarked image. Therefore, to solve this issue, we check the value below the square root before calculating \(r_{ii} (i = 2,3,4)\). If this value is zero or negative, \(r_{ii}\) is set up to 1. This action not only gives out the better invisibility of the watermarked image but also does not completely affect the embedding process as well as extraction because the two processes only use the first diagonal element \(r_{11}\). This solution makes the proposed method more stable and effective in terms of the quality of the watermarked image.

4.4 Execution time test

It is easy to see that the execution time of watermarking image algorithms, which are based on the transform domain, depends mainly on the type of used matrix decomposition. SVD decomposition needs about \(11n^3\) flops for a \(n\times n\) matrix, whereas the required time to compute LU factorization is \(n^2\) flops. And QR decomposition is considered as an intermediate stage between SVD and LU. For GS-based QR factorization, it costs (\(n^3 -\frac{n^2}{3}\)) floating-point additions and multiplications (Stewart 1998). In (Chen et al. 2021), Chen used quaternion QR decomposition (QQRD) which is based on Householder transformation for matrix calculation. According to Vandenberghe (2018), the Householder algorithm requires approximately \(\dfrac{4n^3}{3}\) flops for an \(n\times n\) matrix. On the other hand, the scheme of Hu (2020) is based on SVD factorization with mixed modulation incorporated. And its time complexity is the sum of the five basic processing modules with an image block size of \(n\times n\), as follows: \(SVD (O(4n^3))\), orthonormal restoration \((O(2n^3))\), distortion compensation \((O(3n^2))\), matrix recomposition \((O(2n^3))\), and tentative verification \((O(4n^3))\). The overall complexity of this method for a color image of \(N\times N\) pixels is estimated as \(\dfrac{N\times N}{n\times n}(12n^3 + 6n^2)\). Therefore, the SVD and QR decomposition-based approaches such as SunSVD (2002), Lou (2020), SunQR in Sect. 1.2, Chen (2021), and Hu (2020) have time complexity of \(O(n^3)\) for an \(n\times n\) matrix. For the proposed scheme, as shown in Sect. 3, the embedding time complexity is \(\dfrac{N\times N}{n\times n}O(n^2)\) while the extracting time complexity of the proposed approach is only \(\dfrac{N\times N}{n\times n}O(1)\) for a color image of \(N\times N\) pixels.

In these experiments, a computer with \(\mathrm{Intel}^@\) \(\mathrm{Core}^\mathrm{TM}\) i5-6200U CPU at 2.30 GHz and Visual Studio v15 is used as the computing platform. The embedding time and extraction time of the proposed methods are 0.2448s and 0.006 s, respectively. Table 4 shows a comparison of the execution time between different methods.

Table 4 Average execution time of different methods (in second)
Fig. 10
figure 10

Extracted watermarks and NC values of the different methods under the blurring attack

Fig. 11
figure 11

Extracted watermarks and NC values of the different methods under the sharpening operation

According to Table 4, the total execution time of the proposed method is bigger than the time of Su (2018) which uses LU decomposition, but it is smaller than the others. In the scheme of Luo (2020), the author proposed a combination of DWT and SVD, so this method spends more time than the others except for the approach of Hu (2020). Meanwhile, the algorithm of Hu (2020) applied many processing modules such as level shifting with dither noise, SVD, sign correction, mixed modulation, orthonormal restoration, distortion compensation, tentative verification, and iterative regulation. It is the reason why its running time is the biggest.

For embedding time, the algorithm SunQR in Sect. 1.2 and the method of Chen (2021) are similar because they use QR factorization based on GS and Household algorithms, respectively. However, the algorithm of Chen (2021) needs more time to measure the correlation between elements \(q_{ij}\) of the Q matrix and select an optimal quaternion embedding position, so it costs a higher number. For extraction time, the proposed method gives an effective result because it calculates the length of the first column vector of the A matrix to find out the first element R(1, 1) of the R matrix instead of using QR decomposition as the previous QR based schemes. This demonstrates that the proposed approach can significantly improve the speed of the watermarking process, especially the extraction time.

4.5 Robustness test

For testing the robustness of the proposed method, nine operations are used to attack three watermarked images. And then, the extracted results from the attacked images are compared to the related works with different kinds of matrix decomposition such as SunSVD (2002), SunQR in Sect. 1.2, Su(2018), Luo(2020), Hu (2020), and Chen(2021). The schemes of Sun (2002) and Hu (2020) used SVD decomposition for deposing the pixel matrix. While SunQR in Sect. 1.2 applied the GS algorithm for QR factorizing, the Household algorithm-based QR factorization was utilized by Chen (2021). Besides, LU decomposition was developed by Su in (2018), and the method of Lou(2020) was a combination of DWT and SVD decomposition.

First of all, blurring and sharpening are two of the common image processes. The blurring technique is set up by two arguments like radius and sigma. The first value radius is also important since it controls how big an area the operator should look at when spreading pixels. This value should typically be either ’0’ or at a minimum double that of the sigma. The second sigma value can be thought of as an approximation of just how much you want the image to blur in pixels. In the experiments, the radius is fixed to ’0,’ and sigma is designed to 0.2 and 0.5, respectively. The sharpening operation is also a sort of inverted blurring. Both operations work in just about the same way. Therefore, its arguments are similarly set to blur. Figures 10 and 11 give the results of the visual comparison and quantitative values. NC values from these figures inform us about the superiority of the proposed method over the others. Furthermore, it is easy to see that all schemes can prevent damage from blurring and sharpening attacks. The extracted watermark of Hu (2020) and Chen (2021) is clearer to recognize than the others for the “avion” and “lena” images when the sigma is set to 0.5.

Fig. 12
figure 12

Extracted watermarks and NC values of the different methods under the Salt & Peppers noise adding

Fig. 13
figure 13

Extracted watermarks and NC values of the different methods under the Gaussian noise adding

Adding noise is also one of the common operations in image processing. In this experiment, we select the Salt & Peppers noise and Gaussian noise as the attack noises. In the adding Salt & Peppers noise, the noise quantity is from 1 to 10% increase by 1%, and Fig. 12 shows a part of NC values and visual perception, respectively, moreover, adding Gaussian white noise of mean 0 and variances from 0.001 to 0.005 increasing with 0.001 to process the watermarked images. Figure 13 shows the NC values and visual perception results of the extracted watermark after adding Gaussian white noise of mean 0 and different variances (0.001, 0.003, respectively). As can be seen from these figures, the proposed method has better robustness than the others against the process of adding noise. In some cases, the scheme of Chen (2021) has advantages but the gap between this approach and the proposed one is not too big. While adding Salt & Peppers noise seems not to make all methods difficult, the Gaussian noise attack brings a poor performance to the approaches of Su (2018), Luo (2020), and Hu (2020). The extracted watermark of Luo (2020) is even presented in an unrecognized shape for the “lena” image.

Fig. 14
figure 14

Extracted watermarks and NC values of the different methods under the Mean Filter attack

Fig. 15
figure 15

Extracted watermarks and NC values of the different methods under the Cropping operation

For the filtering attack, the mean filter method is performed on the watermarked images. A mean filter with different window sizes from \(2\times 2\) to \(5\times 5\) is used to process the watermarked images. Figure 14 shows the extracted watermarks and NC values with the filtering sizes of \(2\times 2\) and \(3\times 3\), respectively. It is seen from this figure that the method of Chen (2021) is the most effective among all studies. Besides, the algorithm of Hu (2020) is more robust than the methods of SunSVD (2002), SunQR, Su (2018), and Luo (2020). Our method also gives positive results and the extracted watermarks can be recognized for the “avion” and “Girl” images.

For testing the cropping robustness, two cases are simulated to crop the three watermarked images. The first case is cropped in the upper left corner by 25%, while the second case is cropped in the upper half by 50%. Although NC values cannot be measured in this operation because they do not correctly reflect the quality of the extracted watermark. As the results displayed in Fig. 15, the invisibility of the extracted watermarks of the proposed method is clearer than the other methods. Obviously, the proposed method is robust against this cropping process. And the algorithm of Luo (2020) seems to be less effective for the “lena” image because the extracted watermark can not be recognized in this case.

Fig. 16
figure 16

Extracted watermarks and NC values of the different methods under the Rotation attack

Fig. 17
figure 17

Extracted watermarks and NC values of the different methods under the Scaling attack

Fig. 18
figure 18

Extracted watermarks and NC values of the different methods under the JPEG compression

Fig. 19
figure 19

NC values of the proposed method for two watermarked images and two watermark images under different attacks

Another type of well-known image operation is geometry attack, which mainly includes rotation and scaling. There are two rotation experiments to show the robustness in Fig. 16. One involves rotating the watermarked image to the right by 5 degrees. The other involves rotating the watermarked image to the right by 10 degrees. The images are first rotated a certain number of degrees clockwise and then are rotated the same number of degrees counterclockwise. Figure 17 shows the quantitative results and visual perception results for the case of scaling, respectively. In this experiment, two scaling operations of 200% and 50% are used to deteriorate the watermarked image. From data in Figs. 16 and 17, although the proposed method gives less robustness than the methods of SunSVD (2002), Luo (2020), Hu (2020), and Chen (2021), it is more effective than the schemes of SunQR in Sect. 1.2 and Su (2018). In these experiments, SVD decomposition-based studies such as SunSVD (2002), Luo (2020), and Hu (2020) bring better quality than others. Especially, the proposal of Hu (2020) is the most robust against geometric attacks.

Finally, JPEG compression is also known as an image process. In this experiment, the watermarked images are compressed by JPEG compression with the window size is \(8\times 8\) and \(16\times 16\), respectively. JPEG is a common ‘lossy’ compression algorithm for digital images, which allows a selectable trade-off between storage size and image quality by discarding perceptually unimportant information in middle and high frequencies. Pixel alterations in a local area (i.e., the \(4\times 4\) blocks used for image watermarking) can be treated as middle-to-high-frequency noise in the \(8\times 8\) and \(16\times 16\) blocks used for image compression. This makes it easy for JPEG compression to destroy watermark information hidden in the middle-to-high frequency region. Therefore, as the results are shown in Fig. 18, most schemes are weak against JPEG compression, especially the algorithms of SunSVD (2002), and Su (2018). The method of Chen (2021) has the best performance for the “avion” and “Girl” images, while the approach of Luo (2020) overcomes the others for the “lena” image. In the contrast, the proposal of Hu (2020) has limited resistance to this kind of attack. Although the proposed method is not the best method under JPEG compression, it has higher NC values than the methods of SunQR, Su (2018) and Luo (2020) for the “avion” image. Our study is also better than some methods such as SunSVD (2002), SunQR, and Su (2018) for the “lena” and “Girl” images.

To sum up, by the experimental results, we can see that the schemes which use SVD decomposition (SunSVD 2002, Luo (2020), and especially Hu (2020)) are more robust than other methods (SunQR in Sect. 1.2, Su (2018), Chen (2021) and the proposed one) under geometry attacks. However, the method of Lou (2020) is less effective under mean filter and cropping operations. Whereas, the algorithm of Chen (2021) is considered as a strong solution against most attacks, especially the mean filter. Figure 19 also displays NC values and the extracted watermarks of two watermarked images of the proposed method under different attacks. The figures indicate that the proposed approach is robust against the most used attacks such as blurring, sharpening, salt & pepper noise, Gaussian noise, cropping, and mean filter for both watermark images. Furthermore, the proposed method outperforms SunQR in all cases, although both these methods use QR decomposition. The reason for this is because the proposed method has an improvement to find out elements of Q and R matrices instead of using the GS algorithm as SunQR.

5 Conclusion

In this paper, a novel image watermarking scheme, which is based on QR decomposition, is presented. In the embedding stage, the color host image is divided into non-overlapping \(4\times 4\) blocks at first. For each block, the improved QR decomposition is applied on the B channel where calculating Q and R matrices is executed in succession. First, the elements of the R matrix are found by performing a set of linear equations as Eq. (15). Second, the Q matrix is computed column by column based on A and R matrices. Third, the watermark information is embedded into the first element R(1, 1) of the R matrix by using Eq. (23). Finally, we have the watermarked image after taking a reverse QR decomposition to update pixel values. In extracting stage, we get R(1, 1) by only one operation Eq. (24) without QR factorization as the previous methods. After that, the binary values of the watermark are extracted via Eq. (25). As the result, the image of the watermark is reconstructed from the received information. The tests are experimented on five color images and one gray-scale watermark image with PSNR/SSIM and NC indexes to evaluate the effectiveness of the proposed method. The results of the comparison in Sect. 4 show that our scheme overcomes the others in terms of the quality of the watermarked image. In addition, because we do not need to use QR decomposition in the extracting stage, the execution time is significantly improved. And our proposal is also more robust than the methods of SunSVD (2002), SunQR in Sect. 1.2, Su (2018) and Luo (2020) under attacks such as salt & peppers noise, Gaussian noise, blurring, sharpening, cropping, and mean filter.

In the future, a hybrid scheme should be developed to improve the robustness of the watermark under geometry attacks and JPEG compression. In recent years, many hybrid digital image watermarking methods have been expanded to enhance robustness, capacity, and security while still maintaining the quality of the watermarked image (Mahbuba and Mohammad 2020). In hybrid domain approaches, two or more image transformations are used for watermarking. These methods provide more imperceptibility and high robustness to multimedia data and are mainly used for multimedia security and copyright protection. Therefore, a combination of the proposed QR decomposition and another transform domain is necessary and will be further considered in the future study.