# Improving DFT-Based Image Watermarking Using Particle Swarm Optimization Algorithm
## 4 Optimization Key Parameters by Particle Swarm Optimization (PSO)  
The PSO algorithm was first introduced by [5] in 1995. In general terms, PSO is a search and optimization method for swarm intelligence techniques and evolutionary algorithms. According to [5], the PSO algorithm is inspired by the social behavior of a group of individuals (in PSO denoted as a particle) e.g., as a flock of birds moving together. Each particle keeps track of the individual best value, and PSO searches the global best solution in terms of the objective fitness function [19]. PSO is defined as updating velocity \(\upsilon\) of each particle (11) and updating position \(\delta\) of each particle (12), respectively:  
\[v_{i,j}(t+1)=\omega\cdot v_{i,j}(t)+\underbrace{rand()C_{1}\big{(}p_{i,j}(t)- \delta_{i,j}(t)\big{)}}_{Cognitive\ component}+\underbrace{rand()C_{2}\big{(}\eta_{j}(t)- \delta_{i,j}(t)\big{)}}_{Social\ component}, \tag{11}\]  
\[\delta_{i,j}(t+1)=\delta_{i,j}(t)+v_{i,j}(t+1). \tag{12}\]  
From (11) and (12):  
* Subscript \(i\) denotes the particle index \(1\leq i\leq\) population size \(N\);
* Subscript \(j\) denotes the dimension of feature space index;
* \(\omega\) is the inertia coefficient;
* \(C_{1}\) is the personal speedup coefficient;
* \(C_{2}\) is the social speedup coefficient;
* \(rand()\) is a pseudo-random number generator (PRNG) with uniform distribution in the range \([0,1]\);
* \(t\) denotes time;
* \(p_{i,j}(t)\) is the position that provides the minimum cost of the \(j\)-th element of the \(i\)-th particle;
* \(\eta_{j}(t)\) is the position that provides the minimum cost of all existent particles. In the sake of brevity, interested readers on initialization, the search of best solution, iteration and convergency procedures of PSO, can refer to [5; 19] for more details. As was mentioned in Section 2, use of fixed values for the pair of radiuses \(r_{1}\) and \(r_{2}\) in the magnitude \(M(u,v)\) in a heterogeneous image database will imply that the watermark strength factor \(\alpha\) will be adjusted experimentally so as not to affect the robustness, but invariably the watermark imperceptibility will be affected. Thus, the aim of this proposal is to find the optimized values of the key parameters i.e., the pair of radiuses \(r_{1}\) and \(r_{2}\) in the magnitude \(M(u,v)\) used to build the annular area \(A\), and the watermark strength factor \(\alpha\), proper for each image, instead to fix these values as is performed by the conventional DFT-based invisible watermarking methods, improving the performance in terms of robustness and imperceptibility using color images. The optimization procedure of watermarking parameters based on PSO is shown in Figure 4.  
Figure 4: Optimization process of the key parameters in 2D DFT-based invisible watermarking using PSO. In PSO algorithm, the fitness value of each particle is assessed in each iteration. An objective fitness function for evaluation should reflect both imperceptibility and robustness. In this proposal, the fitness function is given by (13):  
\[f=VIF(I,I_{w})+\frac{\sum_{q=1}^{n}BCR\left(W,W_{q}^{\prime}\right)}{n}, \tag{13}\]  
where \(f\) represents the fitness value in each iteration. The VIF metric [29] measures the imperceptibility between the original image \(I\) and its watermarked version \(I_{w}\), BCR estimates the robustness, \(W\) and \(W^{\prime}\) are the original and extracted watermarks respectively, and \(n\) is the number of attacks applied to the watermarked images. The VIF metric is defined by (14) as:  
\[VIF=\frac{\sum_{k\in\text{chmends}}I(\overset{\rightarrow}{C};\overset{ \rightarrow}{G}|\overset{\rightarrow}{S}^{Z,k}|s^{Z,k})}{\sum_{k\in\text{chmends }}I(\overset{\rightarrow}{C};\overset{\rightarrow}{E}|s^{Z,k})}, \tag{14}\]  
where we sum the channels of interest, \(\overset{\rightarrow}{C}\) represents \(Z\) elements of the random field (RF), \(C_{k}\) describes the coefficients from channel \(k\), and so on [29].