## 4 The Proposed Method
### Flow of the Proposed Method  
The proposed IFOA-DTCWT-BF can be summarized as follows:  
Step 2.1: The noisy image is first transformed into a gray image. The parameters of IFOA are initialized, like population size \(PS\), maximum iteration number \(IN_{max}\), location range \(LR\) and the fly step range \(FR\).  
Step 2.2: The location of each fly individual is gained through the fly group and \(FR\). The distance and smell concentration of each fly individual are calculated according to Equation (14). Each smell concentration is considered as a potential threshold. A new threshold is just a new noise variance. Then, the noisy image is denoised through DTCWT and bivariate shrinkage function of the new variance. To evaluate the performance, the fitness function \(f\) is calculated as follows:  
\[f=1/10 log\frac{255^{2}}{MSE}dB, \tag{24}\]  
Figure 4: Flowchart of the improved fruit fly optimization algorithm.  
where \(MSE\) is the mean square error between the noisy image and denoised image with size \(m\times n\), and it can be calculated as follows:  
\[MSE=\frac{1}{m\times n}\sum_{x=1}^{m}\sum_{y=1}^{n}\Bigl{[}f(x,y)-\hat{f}(x,y) \Bigr{]}, \tag{25}\]  
where \(f(x,y)\) is the noisy image before processing, \(\hat{f}(x,y)\) is the denoised image using proposed IFOA-DTCWT. The fitness function\(f\) reaches the maximal when \(MSE\) is the maximum.  
Step 2.3: Fruit fly with maximal fitness is selected as _bestsmell_. If the present _bestsmell_ is bigger than the former value, _smellbest_, the corresponding coordinates are updated. Otherwise, _smellbest_, \(X\_axis\) and \(Y\_axis\) are reserved.  
Step 2.4: If the ending conditions are researched, _smellbest_, \(X\_axis\) and \(Y\_axis\) are treated as the optimum. Otherwise, Steps 2.2 and 2.3 are repeated.  
Step 2.5: The optimal threshold is regarded as the noise variance of noisy image and the noisy image is denoised by the DTCWT based on bivariate shrinkage function.  
Step 2.6: After being denoised by the DTCWT, the image will be processed with bilateral filter. Then the final denoised image is obtained.  
The Pseudocode code of the proposed method is demonstrated as Algorithm 1:  
```
Inputs: Noisy image y Outputs: Denoised image y\({}^{*}\) % Initialization Set the parameters of the IFOA: population size \(PS\), maximum iteration number \(IN\_max\), location range \(LR\), the fly step range \(FR\) and inertia weight \(\omega(g)\). % Randomly search the noise variance \(\sigma\) For \(i=1,2,\ \ldots,\ PS\) \(\left\{\begin{array}{l}X_{i}=X\_axis+rand(FR)\\ Y_{i}=Y\_axis+rand(FR)\end{array}\right.\) \(\sigma(i)=\left(1/\sqrt{X(i)+Y(i)}\right)\) % obtain denoised image through DTCWT K=DTCWT(y, \(\sigma(i)\)) % obtain smell concentration \(Smell(i)=\) Objective function(y, K) through Equations (24) and (25) End % Set individual with best smell concentration \(S\)best \(\leftarrow\)\(\max\limits_{i=1,2,\ldots PS}\) For \(g=1:IN\_max\) For \(i=1,2,\ \ldots\ PS\) \(\left\{\begin{array}{l}X_{i}=X\_axis+rand(\omega(g)FR)\\ Y_{i}=Y\_axis+rand(\omega(g)FR)\end{array}\right.\) \(\sigma(i)=\left(1/\sqrt{X(i)+Y(i)}\right)\) % obtain denoised image through DTCWT K=DTCWT(y,\(\sigma(i)\)) % obtain smell concentration \(Smell(i)=\) Objective function(y, K)through Equations (24) and (25) End \(best\) \(\leftarrow\)\(\max\limits_{i=1,2,\ldots PS}\) \(Smell(i)\) If \(best\)\(S\)\(>\)\(S\)best than \(S\)best \(=\)\(best\)\(S\); \(X\_axis=X\)(bestsmellex); \(Y\_axis=Y\)(bestsmellex); \(Y\_best(g)=Y\_axis\); \(\sigma\)best \(=\)\(\left(1/\sqrt{Xbest(g)+Y\best(g)}\right)\) End \(y=\) DTCWT(y,\(\sigma\)best) % obtain final denoised image through bilateral filter \(y^{*}=\) bilateral filter(y)
```  
**Algorithm 1**IFOA-DTCWT-BF