# An Optimized Genetic Algorithm-Based Wavelet Image Fusion Technique for PCB Detection
## 3 Method  
The DWT in this paper serves as a cornerstone for multiscale image fusion frameworks due to its ability to decompose images into spatially localized frequency components while preserving critical edge and texture information. In the context of multispectral image fusion between visible (VS) and infrared (IR) modalities, the DWT-driven mechanism systematically addresses spectral disparities through hierarchical decomposition and reconstruction. To ensure compatibility between input images, a preprocessing module enforces dimensional consistency through automated resizing and interpolation. Let \({I^{\prime}}_{IR}\) represent the resized IR image derived from the original I\({}_{\text{IR}}\) of dimensions p \(\times\) q:  
\[{I^{\prime}}_{IR}=\gamma({I_{IR}},m,n),\ \gamma\colon{R^{p\times q}}\to{R^{m\times n}} \tag{1}\]  
where \(\gamma\) denotes a bicubic interpolation operator. This step mitigates spatial misalignment artifacts in subsequent fusion operations. The decomposition process begins by applying a mother wavelet to each input image. This operation splits the images into approximation and detail coefficients at multiple scales. The approximation coefficients capture low-frequency content, representing the overall structure of the image, while the detail coefficients encode high-frequency information, such as edges and textures, in three orientations: vertical, horizontal, and diagonal. By iterating this decomposition across multiple levels, the framework constructs a hierarchical representation of the input images, enabling precise control over feature extraction at different spatial resolutions. This multiscale approach ensures that global thermal patterns and fine structural details are preserved for subsequent fusion. The subband fusion process employs distinct strategies for low-frequency and high-frequency components to optimize complementary information retention. For low-frequency subbands, an energy-adaptive weighting scheme dynamically allocates fusion weights based on the relative energy contributions of the vs. and IR modalities. This prioritizes the modality with stronger energy signatures in coarse-scale regions, ensuring the preservation of thermal patterns from IR and structural integrity from vs. For high-frequency subbands, a gradient saliency maximization criterion selectively retains coefficients with higher edge activity by comparing local gradient energy between modalities. The inverse wavelet reconstruction phase synthesizes the fused approximation and detail coefficients into a final fused image. This critical step reverses the multilevel decomposition process through the inverse discrete wavelet transform (IDWT). The fused low-frequency subband provides the foundational structure of the image, while the fused high-frequency subbands inject detailed edge and texture information. The fused approximation \(A_{F}^{I}\) and detail coefficients \(\{D_{v,F}^{j},D_{h,F}^{j},D_{d,F}^{j}\}\) are synthesized through the inverse DWT (IDWT):  
\[{I_{F}}=IDWT(A_{F}^{I},\{D_{v,F}^{j},D_{h,F}^{j},D_{d,F}^{j}\}_{j=1}^{J}) \tag{2}\]  
The reconstruction guarantees perfect invertibility, ensuring no information loss during fusion. In addition, in this study, we utilize a specialized version of GA, called the Elite Decision-Making Genetic Algorithm (EDA), to optimize the parameters involved in wavelet-based image fusion. The elite decision-making approach ensures that the best solutions from each generation are retained, enhancing the convergence rate of the algorithm. In the application of the EDA to wavelet-based image fusion, the selection and dynamic adjustment of key parameters, including mutation rate, crossover probability, elite strategy, population size, and selection pressure, are essential for optimizing performance and ensuring effective convergence. In this study, the mutation rate is set to 0.2 to facilitate exploration by introducing diversity into the population.