1 Introduction

Nowadays, the development of internet and computer networks has made multimedia (images, videos, audios, and so on) easily accessible and replicable. The quality of the replicated digital contents are exactly the same as of the original ones. This case sometimes causes critical negative conditions like abusing data. Digital watermarking is a technique to overcome such issues. It provides appropriate methods to protect the copyright of digital contents. Digital watermarking is an approach to hiding data, which insures media security. In this technique, a watermark, which can be a digital text or image, is embedded inside a digital content. In the watermarking process, two major criteria are mandatory to be fulfilled. These are (1) imperceptibility of embedded watermark and (2) robustness of the watermark embedding scheme. Indeed, the embedded watermark should be undetectable (fulfilling the first criteria), and should not be removed by malicious attacks or common communication channel processes (fulfilling the second criteria). It is worth noting, imperceptibility and robustness of the watermark are two main contradictory objectives to evaluate any watermarking algorithm.

In elementary watermarking methods, the watermark is directly embedded into image bits using easy methods like embedding in the least significant bits (LSB) of the covering image as well as the vector quantization (VQ) method. In addition to the simplicity of usage of these approaches, the required time to embed the watermark is very short. However, they are not robust enough against common image processing operations and attacks. In contrast, many techniques were proposed to embed the watermark in the frequency domain. These techniques mostly employ different transformations, including discrete Fourier transformation (DFT), discrete cosine transformation (DCT), discrete wavelet transformation (DWT), singular value decomposition(SVD), and their combinations, e.g. DCT-DWT, DCT-SVD, DWT-SVD [4, 5, 11, 15, 16, 18, 20, 22]. Among them, wavelet transformation can be known as one of the most powerful methods due to its transparency and robustness. By using the combination of SVD and DWT the imperceptibility and robustness of the watermarking methods have been increased [15].

In most watermarking techniques, there are variable amounts of changes on host images for embedding the watermark. Thus, it is crucial to determine the amount of these changes in a way that a good trade-off is achieved between imperceptibility and robustness of the watermarking method. These amounts of changes are usually adjusted by parameters calling strength factors. In most watermarking methods, single strength factor is used, which will not usually have good imperceptibility and robustness results due to ignoring the features of each part of the content [3, 6, 11, 13, 24]. Also, some other watermarking methods have utilized multiple strength factors. Selecting these factors is more difficult than it seems. High values of strength factors, increase the robustness of the watermark, while makes it tangible and thus reduces content transparency. On the other hand, low values of strength factors preserve imperceptibility however decrease robustness of the watermark. Therefore, an efficient and powerful algorithm is necessary to find the optimal multiple strength factors to reach a good trade-off between imperceptibility and robustness. Since, the goal is to find the optimal multiple strength factors, this issue can be addressed as an optimization problem and heuristic methods can be used to solve it. Recently, researchers have employed population-based and swarm intelligent methods (particle swarm, ant colony optimization, artificial bee colony, firefly algorithm, and etc.) to find optimal multiple strength factors in watermarking techniques, which have significantly improved the results [2, 17, 19, 27].

Musrrat Ali et al. [2] have proposed an image watermarking method in the DWT-SVD domain with a fixed distribution in which the artificial bee colony algorithm (ABC) is applied to optimize the multiple strength factors (MSFs). Lai et al. [12] employed tiny genetic algorithm (tiny-GA) based on the SVD to find optimal MSF values. Ishtiaq et al. [8] utilized PSO to find optimal MSFs in the DCT domain. They used PSNR value as the objective function to evaluate the strengths. Loukhaoukha et al. [17] employed multi-objective ant colony optimization in the LWT-SVD domain to find optimal MSFs.

The aforementioned approaches are usually complex with several control parameters. The firefly algorithm is one of the collective intelligence based optimization methods, which was introduced by Yang [29]. Many researchers have used FA in different applications and have realized that this approach outperforms other aforementioned heuristic methods [7, 31]. The improved versions of the firefly algorithms, which were recently proposed, have eliminated the weaknesses of this method. The most important modification was the chaotic based [30] and opposition and dimensional based [26] firefly algorithms. The opposition and dimensional based firefly algorithm (ODFA) is proposed by Verma et al. [26] to promote the original FA. In this method, the oppositional-based learning is used to increase convergence rate and also the dimensional-based method is used to find the global optimum among all optimal solutions in all dimensions. Due to the purposeful movement of fireflies and the reduction in their random movements, this hybrid version of FA has a higher convergence speed and lower time complexity. Recently, researchers have utilized the firefly algorithm to create optimal trade-offs between imperceptibility and robustness in image watermarking methods. Mishra et al. [19] have proposed an image watermarking method in the DWT-SVD domain in which a simple FA is used to detect MSFs. In their approach, the objective function is a linear combination of the imperceptibility and robustness of the watermark. However, Musrrat Ali et al. [2] have shown that this method has false positive errors and the algorithm poses watermark ambiguity. Dong et al. [4] have proposed a gray scale image watermarking method in the DCT-SVD domain in which the chaotic FA is used to find MSFs. Their results indicate an increase in robustness and imperceptibility. Although, in their method, the existence of the original image is essential to reveal the watermark. Kazemivash and Ebrahimi Moghaddam [9] proposed a robust technique for gray scale image watermarking which is based on the lifting wavelet transform and firefly algorithm to select appropriate blocks in the host image for embedding watermark. Also they proposed in [10] another watermarking technique that utilizes the firefly algorithm. Their proposal technique is based on lifting wavelet transform and the watermark is embedded using predicted value of regression tree. The multiple scaling factors are achieved by the firefly algorithm. Although they increase the robustness in both techniques but image transparency is not well maintained.

This paper proposes an image watermarking scheme in the DWT domain based on SVD, and tries to discover multiple strength factors by using the opposition and dimensional based firefly algorithm. The proposed scheme presents a robust and imperceptible image watermarking scheme. The process begins by dividing the cover image into certain blocks, then by using the human visual system the appropriate embedding blocks are selected. Moreover, the optimized MSFs are detected by using the opposition and dimensional based firefly algorithm. The objective function of the optimization problem is a linear combination of the normal correlation coefficient (NC) and the value of peak signal-to-noise ratio (PSNR).

The rest of this paper is organized as follows. Section 2 briefly explains oppositional dimensional based firefly algorithm. In Section 3 a brief summary of the entropy, DWT and SVD are discussed. Section 4 introduces the embedding and extracting of proposed scheme, Section 5 presents the application of the ODFA to find thresholds and Section 6 discusses experiments and empirical results. Finally, Section 7 concludes the paper.

2 The modified oppositional dimensional-based firefly algorithm

The firefly algorithm (FA) is a meta-heuristic method inspired by the behaviors of fireflies, which presents good optimal solutions for many problems. The firefly algorithm has a fewer number of the control parameters in comparison to the other methods in this domain. Therefore, it is more simple and effective approach. Despite the good performance of the FA, this algorithm is prone to the premature convergence like other collective intelligence algorithms and may be stuck in the local optima. In order to find the most optimal solution, this algorithm does not consider all dimensions of a firefly separately. This makes some dimensions closer to optimal values and the rest farther. Therefore, the global optimum is not achieved. The opposition and dimensional based FA (ODFA) improves the simple FA in two ways. First, using the oppositional method during initialization of the selected solutions provides to search all directions of the corresponding interval and consequently increases the convergence of the solutions. Second, using the dimensional-based method, fireflies are updated along different dimensions. This approach generates more optimal and less time complex solutions due to the effective updates and initialization. Here the ODFA presented by Verma et al. [26] is reviewed briefly.

Opposite numbers:

Let x ∈ [m, n] be a real number and \( \tilde{x} \) be the opposite number of x and is given by:

$$ \tilde{x}=m+n-x $$
(1)

In multidimensional space, the definition of the opposite number is slightly different. Suppose x = (x1, x2, …, xD) is a point in a D-dimensional space, where x1, x2, …, xD are real numbers and xj ∈ [mj, nj] for all j ∈ {1, 2, …D}. The opposite point \( \tilde{x} \) at dimension j is given by:

$$ {\tilde{x}}_j={m}_j+{n}_j-{x}_j\kern0.5em ,j=1,\dots, D $$
(2)

Opposition-based optimization:

Suppose that f(.) be the objective function, x be a selected solution in D-dimensional space and \( \tilde{x} \) be its opposite point. If \( f\left(\tilde{x}\right)>f(x) \) then x is replaced by \( \tilde{x} \). Therefore, in the optimization process to specify the more suitable point, any point and its opposite are evaluated simultaneously.

In the FA, suppose that N fireflies are defined as x = (x1, x2, …, xN) in the D-dimensional space such that ith firefly is defined as xi = (xi1, xi2, …, xiD), the following changes have been applied on the original firefly algorithm:

  1. a)

    The oppositional method is used to initialize the fireflies. More specifically, in order to generate the N initial fireflies, for each randomly generated firefly, its opposite is also created. Finally, there are 2N fireflies and the best N ones are selected among them according to the objective function.

  2. b)

    Each firefly represents a solution of the problem. In the simple FA, all D dimensions of each firefly are updated simultaneously. This makes some dimensions reach close to the optimum and the rest go far from it. The values that are far from the optimum will become worse in the next iterations. Thus, it is impossible to achieve the global optimum in environments with a large number of dimensions. The ODFA proposes to update each dimension separately. This is realized through the introduction of the concept called Gbest. Gbest (global best) represents the most optimal firefly in the current generation. At each dimension, the GBest values is replaced separately according to the corresponding values of other fireflies. Subsequently, GBest is updated if each value increases the objective function. This process repeats for all dimensions of each firefly at each iteration, and at the end of each iteration, all fireflies will move towards GBest. The pseudo code of the ODFA is shown in Fig. 1 [26].

Fig. 1
figure 1

Pseudo code of the oppositional dimensional-based firefly algorithm

2.1 Complexity analysis

In the FA the main program has two nested loops requiring O(N2) operations, where N is the number of fireflies. ODFA also has two nested loops requiring O(DN) operations; the outer loop requires O(D) operations and the inner loop needs O(N) operations, where D is the dimensions of the fireflies. These operations should be run for each iteration, thus the overall time complexity of FA and ODFA are O(MG × N2) and O(MG × ND), respectively, where MG is the maximum number of generations. In this way the time complexity of ODFA will be less than FA when D < N. Although ODFA converges much faster than FA, it is also possible to adjust a small value for MG to reduce the running time of ODFA more. In our experiments the value of D, the dimensions of fireflies, is adjusted according to the watermark size. To be specific, for a watermark of size n × n, dimensions of each firefly is considered to be n2/10 instead of n2 to reduce the overall running time.

3 Summary of concepts and algorithms

This section briefly presents the concepts and algorithms used to select proper blocks and to perform transformations.

3.1 Discrete wavelet transform

Wavelets are a group of mathematical functions for decompose signal to its frequency components of constant bandwidth using logarithmic scaling. Discrete wavelet transform is the result of sampling on wavelet function. DWT can be implemented as a multistage transformation. An image in first stage is decomposed to the four sub bands denoted LL, LH, HL and HH. LL sub band can be decomposed again to obtain the next level of decomposition. This process can be continued on LL sub bands until the desired number of levels reached. Since the human visual systems are much more sensitive to the LL sub band, most of compression processes avoid variation on this sub band. Therefore, for higher robustness it is better to hide watermark in the LL sub band.

3.2 Singular value decomposition

Singular value decomposition (SVD) is an important concept in linear algebra to decompose matrices and has many theoretical and practical applications. SVD has several applications in watermarking and image processing. It provides structural information of an image that can be used for prediction of image quality. Formally, the SVD of an M × N rectangular matrix A is a decomposition of the form A = USVT, where, U is an M × M orthogonal matrix that its columns are called the left-singular vectors of A, S is an M × N rectangular diagonal matrix with non-negative real numbers on the diagonal that are known as the singular values of A and V is an N × N orthogonal matrix that its columns are called the right-singular vectors of A.

3.3 HVS based block selection

The human visual system (HVS) extracts perceptual information from a group of pixels instead of a single pixel. There exists a special correlation between the neighboring pixels in images, known as structural information. Image entropy is a quantity, which is used to describe the “business” of an image, i.e. the amount of information, which must be embedded by a watermarking algorithm. Low entropy images, such as those containing a lot of black sky, have very little contrast and large runs of pixels with the same or similar values. An image that is perfectly flat will have an entropy of zero. Consequently, the correlation of neighboring pixels are very high. On the other hand, high entropy images such as an image of heavily cratered areas on the moon have a great deal of contrast from one pixel to the next and consequently the neighboring pixels are correlated highly. Thus, entropy is an appropriate measure of spatial correlation of neighboring pixels. Shannon’s definition of entropy to calculate the entropy of an image is given by [25]:

$$ E=-\sum \limits_{i=1}^n{p}_i\mathit{\log}{p}_i $$
(3)

where pi is the probability of occurrence of the event i, 0 ≤ pi ≤ 1 and \( {\sum}_{i=1}^n{p}_i=1 \). At this Eq., the signal is considered as a sequence of symbols. Entropy depends on the relative occurrence of the symbols, irrespective of the positions of occurrence. Obviously, it is necessary to have some information about image features to reach an imperceptible and robust watermark. Pal and Pal in [21] defined average edge information as an exponential form to calculate the entropy that can capture two dimensional spatial correlation of images better than Shannon’s entropy. The entropy is defined in [21] as:

$$ E=\sum \limits_{i=1}^n{p}_i{e}^{1-{p}_i} $$
(4)

where 1 − pi is the uncertainty of the pixel value i. This definition of entropy gives more information about pixel dispersion and edges of an image.

The first step at the watermarking process is to select appropriate blocks to embed watermark. Das et al. [3] applied the entropy to choose the blocks. More specifically, for each block, mean gray information and mean edges information are calculated by using Eqs. (3) and (4), respectively and then summed together. The information obtained from each block is sorted in an ascending order to form a chain. This chain is divided into three equal parts; where the first, second, and third parts consist of blocks with low, average, and high irregularities, respectively. Information embedding in blocks with high irregularities is less detectable and the HVS is less capable to detect them. However, embedding in this part makes the information vulnerable against malicious attacks, particularly against image compressions. In contrast, blocks with low irregularities are more resistant against attacks and image compressions. However, embedding information in these areas reduces the image quality and causes detectable changes. In this study, to reach a robust watermarking scheme the areas with low and average irregularities are selected to embed the watermark.

4 The proposed watermarking scheme

There are three main steps in a watermarking scheme, which are choosing the appropriate blocks to embed the watermark, the process of embedding and the process of extracting the watermark. The first step is explained at Section 3.3. In Sections 4.1 and 4.2, the embedding and extracting processes in DWT domain and using SVD techniques are presented, respectively. Finally in Section 4.3, the main contribution of the proposed study which reveals the robustness and imperceptibility of the watermarking scheme is presented.

4.1 The process of embedding the watermark

Suppose a binary n × n image, the watermark, is given to embed in an M × N image, and here after is called the host image. At first, the host image is segmented into equal non-overlapping 8 × 8 blocks. Then the information of each block is calculated according to Section 3.3 and the suitable blocks, i.e., blocks with low and average irregularities, are chosen to embed the watermark. Since all blocks are categorized into three parts (blocks with low, average and high irregularities) and just two parts (low and average irregularities blocks) are selected, thus the number of the selected blocks are equal to 2/3((M/8) × (N/8)). Therefore, the number of watermark bits could not be higher than this value. The coordinates (x, y) of the selected blocks are stored in two matrices denoted by A and B for further considerations.

The n × n watermark image is rearranged into an n2 dimensional vector and the orders of its elements are shuffled using a key that is generated using the key-based Hash pseudo-random permutation algorithm based on MD5 [23]. This key will be used as the first secret key. For each bit of the watermark, the followings are applied to embed this bit in the selected blocks of the host image.

One level DWT is applied to the current selected block to obtain the LL1 sub-band of this block. Then, SVD is applied to the obtained LL1 sub-band to achieve matrices U, S, and V. Fan et al. in [6] show that first column of U and V component of SVD are most stable and invariable under general image processing so in the proposed scheme to embed the watermark bit, second and third elements of the first column of the obtained U matrix (i.e., u2, 1 and u3, 1 of the matrix U) are used to achieve more robust watermark. Let us call the difference between these two values u2, 1and u3, 1 as Δ, i.e.,

$$ \Delta ={u}_{2,1}-{u}_{3,1} $$
(5)

In our proposed scheme, if u2, 1 is greater than u3, 1, then a watermark bit value 1 is embedded in the current block. To this end, it is desired that u2, 1 be greater than u3, 1, i.e., Δ > 0. Also to embed a watermark bit value 0 in the current block, it is desired that u2, 1 be less than u3, 1, i.e., Δ < 0. If these conditions already presents no modification is needed otherwise, u2, 1 should be increased or decreased to satisfy above conditions. Usually in the blocks with sharp edges, Δ has large values, so changing u2, 1 will have a large variation and causes the image quality to reduce. Therefore, in both cases, if variation of Δ exceeds a predefined threshold then the embedding process is reversed. That means the conditions for embedding watermark bit 1 and 0 are exchanged. Thus, in this case, to embed a watermark bit 1 the value of Δ will be negative instead of positive and vice versa for a watermark bit 0. Accordingly, the approach proposed in [3] is used to overcome this problem. First, the interval that Δ is allowed to vary in it (possible values for Δ) is divided into five areas according to the value of the threshold as shown in Fig. 2. The threshold value that controls the Δ value is called Th. In Section 5, an efficient optimization algorithm will be presented to find the optimal threshold values for each block. These threshold values stored in a matrix denoted as C. Matrices A and B (The coordinates (x, y) of the selected blocks) and C have been encrypted using AES-192 and stored as the second secret key for extraction process.

Fig. 2
figure 2

The interval that Δ can vary; (a) Five areas to embed a bit 1, and (b) Five areas to embed a bit 0

In the case of embedding a watermark bit 1, if Δ becomes negative and is greater than \( -\frac{Th}{2} \) (in the first area), then u2, 1 should be modified to bring Δ in area 2. Also, if Δ becomes negative and is less than \( -\frac{Th}{2} \) (Δ is in area 4), in order to satisfy the desired condition, i.e., Δ > 0 the variation of Δ will exceed Th. Thus to have less modification on u2, 1, u2, 1 is modified to bring Δ in area 5 (reversing the embedding strategy). Moreover, when the value of Δ is itself positive (Δ is in area 1) and the desired condition is already present the value of u2, 1 is modified to bring Δ in area 2, too. This modification is made to decrease the value of Δ as desired. Similarly, in order to embed a watermark bit 0, u2, 1 is modified to bring Δ in area 1 if it is in area 2 (Δ value is greater than \( +\frac{Th}{2} \)), and bring Δ in area 4 if it is in area 3 or 5 (Δ is less than\( +\frac{Th}{2} \)). Despite of these modifications, the value of the elements of matrix U may be changed and also the change will happen by compressions or other image processing operations or attacks. Therefore, the Δ values that are closer to the boundary areas may move to the adjacent areas, which causes errors during the extraction process. In order to eliminate this issue, Δ is distanced from boundary areas by a value k. If k has a larger value, the watermark becomes more robust; while the image quality will diminish. Thus choosing an appropriate value for k as well as for Th is challenging. In fact, these two values, Th and k values make a trade-off between imperceptibility and robustness of the watermark. In the proposed scheme, the value of k is considered as one-tenth of the value of Th.

The next step of the proposed embedding process is to obtain \( {LL}_1^{\prime } \), which is

$$ {LL}_1^{\prime }={U}^{\prime }.S.{V}^T $$
(6)

where U' is obtained by modifying the two elements of U as explained above. Finally, the inverse of DWT is applied on \( {LL}_1^{\prime } \) to achieve the watermarked image.

Figures 3 and 4 show the pseudo-code and the schematic view of the process of embedding the watermark, respectively.

Fig. 3
figure 3

The Pseudo-code of the embedding process

Fig. 4
figure 4

The schematic view of the proposed embedding process

4.2 The process of extracting the watermark

In the proposed scheme, the watermark is recovered blindly. That means during the extraction process, the original image is not necessary at all. The watermark image and two secret keys are necessary to extract the watermark. Secret keys should be sent to authorize party using a covert channel. The watermark extraction process is as follows. At first, the watermarked image is divided into equal non-overlapping 8 × 8 blocks and the blocks with low and average irregularity levels are selected. Also, the threshold values are specified by decrypting the encoded matrices A, B and C. One watermark bit have been embedded in each block, thus for each target block the followings are applied to extract the corresponding watermark bit. The one-level DWT is applied to the specified block of the watermarked image and the \( {LL}_1^{\prime } \) sub-band is calculated. Then, SVD is applied on \( {LL}_1^{\prime } \) sub-band to achieve the matrix U. After, the difference of elements u2, 1 and u3, 1 (Δ) are computed using Eq. (5). According to Fig. 5, if Δ is in area 2 or 4, the bit value 1 is extracted, otherwise the bit value 0 is extracted. At last, after extracting all bits hash inverse permutation is performed on the watermark bits using the first secret key, to reconstruct the watermark image.

Fig. 5
figure 5

Extraction areas for bit value 0 and 1

Also the pseudo-code and the schematic view of the process of extracting the watermark are shown in Figs. 6 and 7, respectively.

Fig. 6
figure 6

The Pseudo-code of the extracting process

Fig. 7
figure 7

The schematic view of the proposed embedding process

4.3 Finding optimal threshold values by ODFA

As it was mentioned previously, a threshold value determines the strength of the watermark and controls its robustness and imperceptibility. Most existing methods use the same threshold value for all blocks. Since, all blocks do not have the same texture, using the same threshold value causes that the image quality to reduce. In order to overcome this issue in this paper, for each block, a separate threshold value is applied in a specific range. Therefore, for each watermark bit one threshold value should be defined. Since an optimal values for threshold is desired, using an optimization algorithm is inevitable. The ODFA as an optimization algorithm is used to find the optimal threshold values adaptively. Thus, each firefly is a D-dimenssional vector, where D is the number of watermark bits which is at most 2/3((M/8) × (N/8)) as mentioned in Section 4.1.

To define the objective function of ODFA, different attacks are applied to the watermarked image to evaluate the quality of the thresholds and the watermark is then extracted from them. The objective function of the optimization problem is a linear combination of the quality of the watermarked image (PSNR) and the quality of the extracted watermark (NC) after encountering attacks.

The peak signal to noise ratio is a ratio between the maximum possible power of a signal and the power of corrupting noise that affects the fidelity of its representation and is measured in decibels. The Root Mean Square Error (RMSE) between the M × N original image I and the M × N modified images \( \overline{I} \) is calculated as,

$$ RMSE=\sqrt{\frac{1}{MN}{\sum}_{M,N}{\left[I\left(i,j\right)\hbox{--} \overline{I}\left(i,j\right)\ \right]}^2} $$
(7)

and then peak signal to noise ratio given by:

$$ PSNR=10\ \mathit{\log}10\ \left(255/ RMSE\right) $$
(8)

The Normalized Correlation (NC) is the similarity between the reference (original) watermark w and extracted watermark \( \overline{w} \) and is defined as:

$$ NC=\frac{\sum_{i=1}^M{\sum}_{j=1}^N\left[w\left(i,j\right).\overline{w}\left(i,j\right)\right]}{\sum_{i=1}^M{\sum}_{j=1}^N{\left[w\left(i,j\right)\right]}^2} $$
(9)

NC is a value between 0 and 1. The closer this value to 1, there is higher similarity between the original and extracted watermark [14]. The objective function of the optimization problem is given by:

$$ f=\left|{PSNR}_{ideal}-{PSNR}_t\right|+\sum \limits_{i=1}^N\left(1-{NC}_i\right) $$
(10)

where N is the number of attacks, NCi is the normalized correlation of extracted watermark corresponding to the ith attack, and PSNRt is the PSNR value that is obtained after embedding the watermark using the optimum (minimum) values of the thresholds. PSNRideal is the ideal value of the PSNR, which is set to 52 in our experiments. This is a minimization problem. Thus, as the value of f decreases, the PSNRt value approaches PSNRideal and the NCi value approaches 1 in Eq. (10).

Eventually, the ODFA that is shown in Fig. 1 is applied to find optimal threshold values for each selected block. At each solution that is represented by a firefly, the watermark image is embedded by using the threshold values given by this solution according to the method presented in Section 4.1. Then at the objective function evaluation, N different attacks are applied to this watermarked image and the objective function is calculated by Eq. (10) and the steps of the algorithm given in Fig. 1 will continue.

5 Experimental results

In this Section the results of the proposed watermarking scheme naming DWT-SVD-ODFA are compared to the same method where a simple firefly algorithm is used as optimizer, which is called here DWT-SVD-FA and the base method where a constant threshold value (0.006) and consequently no optimizer is used, that is called DWT-SVD. Six standard test images of size 512 × 512 from USC-SIPI database [1] are used as host images that are given in Fig. 8a-f. Binary logo of the University of Jirort-Jiroft-IRAN of size 32 × 32 that is shown in Fig. 8g is taken as the watermark to verify image copyright. In all experiments, the host and watermark image sizes are the same. In order to evaluate the robustness of the proposed scheme, ten common image processing operations are applied as attacks. Table 1 describes these attacks briefly.

Fig. 8
figure 8

(a-f) Test images, (g) watermark image

Table 1 Description of ten different attacks used for the robustness analysis

The parameter settings of ODFA and FA are β0 = 1, α = 0.01 and γ = 1 that are adjusted from [26]. The total number of initial fireflies is 10, and also the number of iterations is 100. Number of dimensions of each firefly should be the same as the number of watermark bits. Indeed, to embed an n × n watermark, n2 threshold values are needed that implies each firefly should have n2 dimensions. In the proposed scheme to reduce the time complexity the dimension of each firefly is considered as n2/10, thus for each ten adjacent blocks in the chain an equal threshold value is taken. The rational is that, the adjacent blocks in a chain have similar entropy and texture, therefore using the same threshold value for them does not affect on the efficiency, while decreasing the time complexity.

Threshold values are the most important values that have great influence on the imperceptibility and robustness of the watermarking scheme. Therefore finding the appropriate interval to vary these values is another important aspect. To achieve this goal, we designed an experiment that examines the effect of different values of the threshold on the two objectives; the PSNR and the NC values as the measure of imperceptibility and robustness of the watermark. Figure 9 shows two plots of PSNR values and mean values of NC versus different threshold values. In this experiment, the DWT-SVD watermarking scheme is performed on the six test images with threshold values varies from 0.002 to 0.016. PSNR plots show the PSNR values of each image with different values of thresholds and NC plots show the mean of NC values obtained by applying ten attacks mentioned on Table 1 on each image with different values of thresholds.

Fig. 9
figure 9

Effects of different threshold values (a) on PSNR, (b) on NC values

As Fig. 9a shows for all test images, the PSNR value is higher than 43 db where the threshold values approach to 0.01 and the threshold values greater than 0.01 worsen the PSNR value. Thus threshold values less than 0.01 are suitable. On the other hand as shown in Fig. 9b, increasing the threshold values increases the NC value, too. Let us accept the NC values greater than 0.8, where the threshold value goes upper than 0.004. Thus the interval [0.004, 0.01] for threshold values is an acceptable range.

In order to show the overall preference of the proposed scheme the comparison of the objective function values of two watermarking schemes based on the FA (DWT-SVD-FA and DWT-SVD-ODFA) is presented in Fig. 10. These results are obtained on the Lena test image as the host image. The results obtained on 30 different runs and the best ones are shown. According to the Fig. 10, the proposed scheme using DWT-SVD-ODFA outperforms DWT-SVD-FA at all iterations. Specially, the DWT-SVD-FA scheme is at least 0.521 after 53 runs, while the DWT-SVD-ODFA reaches lower than 0.504 after just 25 runs. This improvement is due to the initial population generation based on the opposition theory, as well as updating all dimensions of fireflies in each iteration. After the 53 runs, DWT-SVD-FA converges to 0.521. This is due to the fact that this approach does not search all dimensions that causes it to get in the local optimum. DWT-SVD-ODFA converges to 0.504 at the 25th run, which indicates its faster convergence while finding the more optimal solution. Also the first watermarking scheme, i.e., DWT-SVD with the fixed threshold value for all blocks that is 0.006 is examined on the Lena image and the best objective function value that it achieves is 1.0769 which is worse than both watermarking schemes with threshold optimization.

Fig. 10
figure 10

Average objective function values of DWT-SVD-FA compared to DWT-SVD-ODFA for 100 iterations

The rest of this Section discusses the imperceptibility and robustness of the proposed scheme in comparison to the results of Musrrat Ali et al. [2], Loukhaoukha et al. [17], Lai et al. [11] and Kazemivash and Ebrahimi Moghaddam [10]. Watermarking schemes proposed by [2, 10, 17], were briefly reviewed in the introduction. They employ the artificial bee colony, firefly and ant colony algorithms to optimize the multiple scaling factors, respectively. Also in [11], in order to embed the watermark, coefficients of matrix U resulting from SVD are changed using a single strength factor. This strength factor (single strength factor) is determined manually and it is constant for all blocks. The recommended parameter settings from the corresponding studies are taken. In what follows, the results are investigated from three standpoints; imperceptibility, robustness, and security. The best results among the comparison in Tables 3, 4, 5 and 6 are highlighted in bold faced.

In order to evaluate the imperceptibility of a watermarked image, it is compared with the original host image. In this evaluation, peak signal-to-noise ratio (PSNR) is usually used. The full description of calculating the PSNR was presented at Section 5. Here, the structural similarity index measurement (SSIM) as a measure of the quality of the watermarked images is applied, too. Despite of MSE or PSNR, SSIM considers image degradation as perceived change in structural information, incorporating important perceptual phenomena, including loss of correlation, luminance masking and contrast masking terms. SSIM of an M × N host image I and watermarked image \( \overline{I} \) of same size is given by:

$$ SSIM\left(I,\overline{I}\right)=l\left(I,\overline{I}\right).c\left(I,\overline{I}\right).s\left(I,\overline{I}\right) $$
(11)

where

$$ \left\{\begin{array}{c}l\left(I,\overline{I}\right)=\frac{2{\mu}_I{\mu}_{\overline{I}}+{c}_1}{\mu_I^2+{\mu}_{\overline{I}}^2+{c}_1}\\ {}c\left(I,\overline{I}\right)=\frac{2{\sigma}_I{\sigma}_{\overline{I}}+{c}_2}{\sigma_I^2+{\sigma}_{\overline{I}}^2+{c}_2}\\ {}s\left(I,\overline{I}\right)=\frac{\sigma_{I\overline{I}}+{c}_3}{\sigma_{I\overline{I}}+{c}_3}\ \end{array}\right. $$
(12)

\( l\left(I,\overline{I}\right) \) measures the closeness, \( c\left(I,\overline{I}\right) \) measures the closeness of the contrast and \( s\left(I,\overline{I}\right) \) measures the correlation coefficient between the two images. µI and \( {\upmu}_{\overline{I}} \) are the mean luminance and σI and \( {\sigma}_{\overline{I}} \) are the standard deviation of I and \( \overline{I} \), respectively. \( {\sigma}_{I\overline{I}} \) is the covariance between I and \( \overline{I} \). c1, c2, and c3 are three positive constants to stabilize the division with weak denominator. SSIM is a value between [0, 1] and values close to 1 represent higher similarity between I and \( \overline{I} \).

At first the visual results of Lena image after watermarking are shown in Table 2, they are the extracted watermark, the PSNR, the SSIM and the NC values of three proposed comparative watermarking schemes (DWT-SVD, DWT-SVD-FA and DWT-SVD-ODFA). In all these three schemes the extracted watermark is identical to original one and NC = 1, while the PSNR and SSIM values of the proposed DWT-SVD-ODFA scheme is the highest value.

Table 2 The PSNR, the SSIM and the NC values and the extracted watermark (visual) of different proposed schemes

Also, Table 3 presents the PSNR and the SSIM values of the proposed DWT-SVD-ODFA scheme comparing to DWT-SVD and DWT-SVD-FA, for different test images. It is obvious from the results of Tables 2 and 3 that the PSNR and the SSIM values of the proposed DWT-SVD-FA and DWT-SVD-ODFA schemes are all higher than 51 db and 0.9814 which indicates the acceptable imperceptibility given by the proposed schemes. In the DWT-SVD approach, since all threshold values are taken the same and also the image texture features are ignored, it has achieved poor results.

Table 3 The PSNR and the SSIM results on different host images of DWT-SVD, DWT-SVD-FA and DWT-SVD-ODFA

Table 4 presents the PSNR and SSIM results of the proposed DWT-SVD-ODFA scheme in comparison to the schemes proposed in [2, 10, 11, 17] for different images. The scheme that is proposed by Lai. et al. [11] uses single strength factor to embed the watermark and consequently its results are poor. The approaches proposed in [2, 17] get better results than Lai. et al. [11], since they have used multiple threshold values for embedding and they have applied artificial bee and ant colony optimizations (ABC and ACO), respectively. Although scheme [10] has used firefly algorithm as optimizer but the PSNR values are low and it is because of its high robustness that affects its imperceptibility. However, the proposed DWT-SVD-ODFA outperforms all these schemes. The rational is behind of using ODFA for optimization of multiple threshold values as well as inversing the bit embedding process when large coefficient variations are necessary.

Table 4 The PSNR and the SSIM results on different host images of DWT-SVD-ODFA comparing to the existing schemes

The next experiments are designed to investigate the robustness of the watermarking process against the several attacks mentioned in Table 1. Accordingly, attacks are applied to the watermarked image one by one and the watermark is extracted and then evaluated. The similarity of the original and extracted watermarks is computed by normal correlation (NC) (by using Eq. (9)).

The NC results of the proposed DWT-SVD-ODFA scheme, always becomes 1 without applying any attacks. Figure 11 presents the watermarked Lena image after applying the attacks given in Table 1 and Fig. 12 presents the extracted watermarks. It is clear that in all cases after applying each attack, the recovered watermark is clear and visible. However, by applying the attack number 7, which is cropping 1/8 of the image from center of it (that is a harmful attack), the quality of the extracted watermark is diminished drastically. To clarify, Table 5 presents the numerical values of the NC results of the proposed schemes for Lena image after applying 10 attacks listed in Table 1. At all cases the NC results of the proposed schemes are encouraging especially at the third proposed scheme, DWT-SVD-ODFA the obtained NC results are the highest in case of average. The proposed scheme proved experimentally that by using multiple threshold values and using ODFA as the optimizer the robustness will improve.

Fig. 11
figure 11

Watermarked Lena image after applying 10 attacks listed in Table 1

Fig. 12
figure 12

The extracted watermarks from Lena image after applying 10 attacks listed in Table 1

Table 5 The NC results of the proposed schemes DWT-SVD, DWT-SVD-FA, and DWT-SVD-ODFA for Lena image

Also the proposed scheme DWT-SVD-ODFA is compared with three mentioned existing schemes [2, 10, 11, 17]. Table 6 presents the NC results after applying 10 different attacks to the watermarked Lena images. The average NC results are also presented to show a fair comparison. According to the results of Table 6, the least average NC value corresponds to scheme proposed in [11], which uses single scaling factors, while schemes [2], [10, 17] show higher robustness against attacks. That is due to finding multiple threshold values using meta-heuristic approaches. Scheme [10] has highest NC values but in cost of low transparency. Anyway, in most cases, the robustness of our proposed schemes is high. Selecting blocks based on the image texture and optimal selection of threshold values using oppositional dimensional based optimization in the firefly algorithm has led to the high robustness of the proposed scheme.

Table 6 The NC results of the proposed scheme DWT-SVD-ODFA comparing with existing schemes

Most watermarking methods, which use SVD, are prone to false positive errors due to embedding singular value of the watermark within the image. In other words, a watermark may be extracted from an image that really any watermark does not embedded in it. In the proposed scheme, the watermark is revealed blindly and since watermark bits are fully embedded in the image, it is not likely that this error occurs. During the extraction process, the chain of blocks with low and average irregularities and threshold values are required as the second secret key to find the blocks containing watermark bits. Moreover, the first secret key that is used to shuffle the order of watermark bits is necessary to reveal the watermark image. The existence of these two keys prevent unauthorized parties to reveal the watermark and increases the security level of the proposed watermarking scheme.

The embedding rate is used to analyze the capacity of the watermarking scheme. The embedding rate is the amount of embedded bits divided by the amount of all pixels in host image and is presented by bit per pixel (b/p) [28]. For example, for a 512 × 512 host image and a 52 × 52 binary image (the watermark), the capacity is (52 × 52)/(512 × 512) = 0.0103 (b/p). As mentioned in Section 4.1, in the proposed watermarking scheme the length of the watermark is at most 2/3((M/8) × (N/8)) bits. Table 7 presents the capacity of the proposed DWT-SVD-ODFA and three mentioned existing schemes [11, 13, 24, 31]. Using low and medium informative blocks and ignoring high informative blocks causes low capacity of the proposed watermarking scheme, however the capacity of our proposed scheme is greater than the capacity of the methods proposed in [11, 13, 31]. The embedding rate of Loukhaoukha et al. scheme [24] outperforms ours, instead according to the results of Tables 4 and 6 our proposed scheme has higher watermark invisibility and also stronger robustness against the common image processing attacks.

Table 7 Capacity results of the proposed scheme DWT-SVD-ODFA comparing with existing schemes

In order to examine the performance of the proposed method on the high and low texture images, five images from each category are selected and tested under proposed algorithm. Visual and numerical results as the SSIM, PSNR and NC values of high and low texture images after watermarking are shown in Tables 8 and 9, respectively. As the results point out, SSIM values for high texture images are higher than low texture ones in most cases but PSNR values are almost in the same ranges. High texture images are more vulnerable against gamma correction, resizing, median and Gaussian filtering while low texture ones have lower results for histogram equalization and cropping. In general for all images with different textures, the results are acceptable.

Table 8 The PSNR, the SSIM and the NC values for five high texture images
Table 9 The PSNR, the SSIM and the NC values for five low texture images

6 Conclusions

This paper proposed a watermarking scheme using multiple thresholds in the SVD-DWT domain. Image blocks, to embed watermark bits, are selected according to the human visual system. The watermark bits are embedded by changing the coefficients of singular matrices. The amounts of these variations are determined by a threshold parameter. Since, blocks textures are not the same, different thresholds are used to embed the watermark bits. Moreover, the threshold values are optimized using the recently published oppositional dimensional-based firefly algorithm (ODFA), which is a modified version of the FA. By using the ODFA the imperceptibility and robustness of the watermark increases significantly. The robustness of the proposed scheme was evaluated using 10 different processing tasks on six standard test images. Experimental results indicate an increase in transparency and robustness of the proposed scheme in comparison to other similar approaches. The proposed scheme is the first scheme that applies the ODFA in image watermarking to optimize the multiple threshold values. Furthermore, the watermark is extracted blindly and thus, it is not likely to occur the false positive errors. Despite the good robustness of the proposed scheme against attacks, the robustness is limited against rotation and cropping. Our future works will include improving the robustness against such attacks and will generalize this approach to color images and videos.