# An Optimized Genetic Algorithm-Based Wavelet Image Fusion Technique for PCB Detection
## 3 Method
As the algorithm progresses, the mutation rate is dynamically reduced using a linear decay function, allowing for more focused exploitation of high-quality solutions. Similarly, the crossover probability is set to 0.8 to promote the recombination of superior solutions, with a potential decrease in the later stages of optimization to fine-tune and exploit existing solutions. The elite strategy further enhances convergence by retaining the top 20% of the best-performing individuals in each generation, ensuring they are directly passed to the next generation without modification. The population size is set to 50, which plays a critical role in balancing exploration with computational efficiency and can be dynamically adjusted throughout the algorithm to improve convergence. The fitness function \(\rm F(x_{i})\) evaluates the quality of an individual solution by measuring how well the fusion performs in terms of edge preservation, contrast enhancement, and feature extraction. Each individual i is a vector \(x_{i}=(x_{i1},x_{i2},x_{i3},...)\), where \(x_{ij}\) represents the parameters related to wavelet transformation. A composite fitness score is used, combining multiple performance metrics:  
\[F(x_{i})=\alpha A(x_{i})-\beta B(x_{i})+\gamma C(x_{i})+\delta D(x_{i}) \tag{3}\]  
where \(A(x_{i})\) represents RSD, \(B(x_{i})\) represents PSNR, \(C(x_{i})\) represents SF, \(D(x_{i})\) represents image clarity, \(\alpha\), \(\beta\), \(\gamma\) and \(\delta\) are weight coefficients. RSD measures the consistency and uniformity of the image fusion process. Lower values of RSD indicate better consistency across the fused image. PSNR is a measure of the quality of the reconstructed image. Higher PSNR values indicate that the fused image retains more of the original image quality. SF measures the amount of information or detail in the image. A higher spatial frequency indicates that the image contains more spatial detail, which is important for accurate feature extraction. Image clarity quantifies the sharpness and overall visual clarity of the fused image. Higher clarity values suggest better preservation of important features and edges. The elite selection mechanism ensures that only the top solutions are chosen to form the next generation. Crossover and mutation operations are applied to generate new candidate solutions based on the selected individuals. After applying crossover and mutation, the best solutions, elite individuals, are directly carried over to the next generation without alteration, improving the convergence speed and avoiding premature stagnation. The genetic algorithm proceeds iteratively until convergence is reached or a predefined number of generations are completed. Finally, the final fused image \(I_{f}(x,y)\) is obtained by applying two-dimensional inverse discrete wavelet transform (IDWT) to each subband after fusion:  
\[I_{f}(x,y)=W^{-1}(LL_{fused}(x,y),LH_{fused}(x,y),HL_{fused}(x,y),HH_{fused}(x,y)) \tag{4}\]  
where \(I_{f}(x,y)\) presents the final fused image in the spatial domain which gives the pixel intensity at the spatial location (x,y) after the fusion process is complete. \(W^{-1}\) denotes the IDWT operator whose role is to reconstruct the spatial-domain image from the wavelet subband coefficients. \(LL_{fused}(x,y)\) refers to the fused low-frequency subband. \(LH_{fused}(x,y)\) refers to the fused high-frequency subband that contains horizontal detail information. \(HL_{fused}(x,y)\) refers to the fused high-frequency subband that contains vertical detail information. \(HH_{fused}(x,y)\) refers to the fused high-frequency subband corresponding to diagonal details.