Consideration of a robust watermarking algorithm for color image using improved QR decomposition

In order to protect the digital image copyright, it is necessary to design a robust watermarking algorithm. To achieve this purpose, a novel color image watermarking scheme based on an improved QR decomposition is proposed in this paper. The proposed method gives a new algorithm to find elements of Q and R matrices instead of using the Gram–Schmidt algorithm for QR factorization. First, the R matrix is performed by solving a set of linear equations where diagonal elements of R are checked and modified if they are zero or negative. After that, the Q matrix is computed based on the R matrix. In addition, a novel formula is proposed to improve the extracting time where the first element R(1, 1) of the R matrix is found instead of computing QR decomposition as the previous proposals. Experimental results show that the proposed method outperforms other considered methods in this paper in terms of the quality of the watermarked images. Furthermore, the execution time is significantly improved, and the extracted watermark is more robust against almost tested attacks.


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 B Ta  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 × 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×n matrix. That is the reason why some researchers focused on kind of this matrix analysis (Liu et al. 2017;.  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, Q R 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 Q R decomposition lies in its low computational complexity and stable numerical feature. Because Q R 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 Q R decomposition-based watermarking also has satisfactory performance in terms of imperceptibility and robustness ). Furthermore, due to concentrating energy of Q R analysis on the first element of the R triangular matrix, the information is often embedded in this element (Qingtang et al. 2017(Qingtang et al. , 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 highenergy 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 Q R decomposition, many researchers utilized Q R 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;. From 2013 to 2019, Qingtang Su had three papers that focused on Q R factorization. In the first method, Su et. al 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 × 3 blocks instead of a size of 4 × 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 Q R (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.

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 Q R 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 SunSV D). 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 Q R decomposition. From this idea, a combination between Q R decomposition and the formula of Sun (called Sun Q R) was experimented. It used the Gram-Schmidt algorithm (Vandenberghe 2018) for Q R 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.
The previous methods often utilized the Gram-Schmidt (G S) algorithm to decompose the image matrix. However, G S-based Q R decomposition exists some disadvantages as follows. Firstly, according to Stewart (1998) and Vandenberghe (2018), the algorithm requires approximately n 3 flops for a n×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 Q R factorization with less complexity. Secondly, although the G S 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 G S 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(i, i) of the R matrix must be positive (Vandenberghe 2018). However, the G S algorithm does not ensure this demand in some cases. There are two versions of the G S 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 G S usually has very poor orthogonality (Stewart 1998). Therefore, G S is considered a less accurate and stable algorithm (Stewart 1998). Besides that, the G S 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 G S-based Q R decomposition when the original matrix A is in an ill condition. A matrix in the example is a 4 × 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 T Q is infinite and it is not equal to the unit matrix I , so the G S algorithm does not guarantee the orthogonality of the Q matrix. Moreover, an inverse Q R factorization cannot be computed. In other words, G S-based Q R decomposition fails in this situation.

Our contributions
Our contributions can be summarized as follows: 1. To overcome the drawbacks of Sun Q R, a new watermarking scheme based on Q R 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. 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 Q R decomposition is O(n 2 ) instead of O(n 3 ) as the GSbased Q R factorization. 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 Q R 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.

Roadmap
The rest of this paper is organized as follows. Section 2 describes the Q R 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.

QR decomposition
Q R decomposition (also called Q R factorization) of a matrix A is a decomposition of the matrix into two matrices as Eq. (1).
where Q is an orthogonal matrix (i.e., Q T Q = Q Q T = I ) and R is an upper triangular matrix. If A is non-singular, then this factorization is unique.

Arnold transform
For improving the security of watermarking method, Arnold transform is often used to permute the watermark image , and its detailed permutation process is given by Eq. (2).
where x , y , x, and y are integers in {0, 1, 2, . . . , 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.

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: (since Q is an orthogonal matrix, so Q T Q = 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 × 4. Therefore, the M, A T , R T , and R matrices are also 4 × 4 matrices. The elements of A are represented as follows.
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 where a 1 , a 2 , a 3 , a 4 are column vectors of A, respectively. We have In order to find the elements of the R matrix, we will begin with Eq. (3). ⇒ r 34 = m 34 − r 13 r 14 − r 23 r 24 r 33 r 14 r 14 + r 24 r 24 + r 34 r 34 + r 44 r 44 = m 44 In general, if the host matrix A has a size of n × n, we have r 11 = √ m 11 and r 1 j = m 1 j r 11 (14) where i, j = 2, 3, · · · , n.

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.
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.
In general, if the host matrix A has a size of n × n, we have q 1 = a 1 and q 1 = 1 r 11 q 1 (20) and where a i , q i and q i (with i = 2 to n) are n × 1 vectors

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 i j and q i j , 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 ) Algorithm 1 Calculating R and Q matrices.
INPUT: An A matrix with size of n × n OUTPUT: The upper triangular matrix R and the orthogonal matrix Compute the element r i j of R matrix based on Eq. (14) and Eq. (15) 4. Compute the elements q i j of Q matrix based on Eq. (20) and Eq. (21) return r i j and q i j END.

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

Watermark embedding scheme
In the embedding process, the host color image is divided into 4 × 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 Q R 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.  (14), (15), (20) and (21).
4. Embed a watermark bit into the triangular matrix R based on the formula of Sun (2002): Note that q is also the strength of watermark embedding. 5. Update matrix A by formula Eq. (1): A = Q R and assign A back to B components of the blocks. 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.

Watermark extraction scheme
Since the watermark is only embedded into the R matrix in the embedding process, Q R 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 Q R decomposition. Therefore, the watermark extraction steps are described as follows.
1. Divide the watermarked image H into 4 × 4 nonoverlapping blocks. In this image, each pixel is represented by three components (R, G, B). 2. Assign B components of the block to a 4 × 4 matrix (matrix A * ). 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).
4. Extract the information of watermark based on algorithm of Sun (2002): The watermark bit is extracted by using following equation.
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.

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 × 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.
PSNR = 10 log 10 255 2 MSE , where the mean square error (MSE) between the original and watermarked image is defined as: 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).

SS I M(H
where The first term in Eq. (29) is the luminance comparison function which measures the closeness of the two images' mean luminance (μ H and μ 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 σ H and σ H . The third term is the structure comparison function which measures the correlation coefficient between the two images H and H . Note that σ H H 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. Fig. 3 The extracting stage Furthermore, the normalized correlation (N C) coefficient is computed for evaluating robustness by using the original watermark W and the extracted watermark W , which is denoted as follows: where W (x, y, j) and W (x, y, j) present the value of pixel (x, y) in component j of the original watermark and the extracted one and m × 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 N C value reveals that the extracted watermark is alike to the original watermark, which shows that the watermarking method is more robust.  Mean filter Use the filter with size of window from 2 × 2 and 5 × 5

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 × 512 in the CVG-UGR image database (University of Granada 2022) are selected as the host images, and two 32 × 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 Intel @ Core 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.
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 N C of the extracted watermark with the different embedding coefficients q (q = 5, 10, 15, 20, respectively).
As shown in Table 2, each watermarked image has various SSIM and N C 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 N C 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.
A comparison between the methods of Sun (2002), Luo (2020), Su (2020), Su (2018), , Hu (2020), Chen  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×64  binary image into a gray 512 × 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;, 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. Q R 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 , 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 Q R 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 Q R 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 H H 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 × 4 except Kumar (2021) and the evaluation tools are often PSNR, SSIM, N C, and BER.

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 N C value must be 1. However, it is not completely correct in our experimental tests. In fact, the N C 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, N C indexes of two watermarks are similar to each other. 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  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 . 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 Fig. 7 PSNR and NC values of the proposed method for twelve host images and two watermark images in the absence of attack 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 .
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. 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.

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 × n matrix, whereas the required time to compute LU factor-   . 9 An example for comparison of original and embedded matrices between the proposed method and the approach of  ization is n 2 flops. And Q R decomposition is considered as an intermediate stage between SVD and LU . For GSbased Q R factorization, it costs (n 3 − n 2 3 ) floating-point additions and multiplications (Stewart 1998). In ), Chen used quaternion Q R decomposition (Q Q R D) which is based on Householder transformation for matrix calculation. According to Vandenberghe (2018), the Householder algorithm requires approximately 4n 3 3 flops for an n × 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 × n, as follows: SV D(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 × N pixels is estimated as N × N n × n (12n 3 + 6n 2 ). Therefore, the SVD and Q R decomposition-based approaches such as SunSVD for a color image of N × N pixels.
In these experiments, a computer with Intel @ Core 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.
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 Q R factorization based on GS and Household algorithms, respectively. However, the algorithm of Chen (2021) needs more time to measure the correlation between elements q i j 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 Q R decomposition as the previous Q R based schemes. This demonstrates that the proposed approach can significantly improve the speed of the watermarking process, especially the extraction time.

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 Q R factorizing, the Household algorithm-based Q R factorization was utilized by . 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. N C 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  is clearer to recognize than the others for the "avion" and "lena" images when the sigma is set to 0.5.
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 N C 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 N C 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.
For the filtering attack, the mean filter method is performed on the watermarked images. A mean filter with different window sizes from 2 × 2 to 5 × 5 is used to process the watermarked images. Figure 14 shows the extracted watermarks and N C values with the filtering sizes of 2×2 and 3×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 N C 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.
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  (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 × 8 and 16 × 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 × 4 blocks used for image watermarking) can be treated as middle-to-high-frequency noise in the 8 × 8 and 16 × 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 N C 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),  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.

Conclusion
In this paper, a novel image watermarking scheme, which is based on Q R decomposition, is presented. In the embedding stage, the color host image is divided into non-overlapping 4×4 blocks at first. For each block, the improved Q R 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 Q R decomposition to update pixel values. In extracting stage, we get R(1, 1) by only one operation Eq. (24) without Q R 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 N C 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 Q R 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 Q R decomposition and another transform domain is necessary and will be further considered in the future study.
Funding This research is funded by Vietnam National Foundation for Science and Technology Development (NAFOSTED) under grant number 102.01-2019.12.
Data availability Enquiries about data availability should be directed to the authors.

Conflict of interest
The authors have not disclosed any competing interests.