# Deep-Space Background Low-Light Image Enhancement Method Based on Multi-Image Fusion
## 3 Method
### Enhancement of Satellite Images Containing Celestial Bodies
#### 3.2.1 Extract the Earth Region
Contour analysis and region optimization  
Extract the contours of the connected component, extract all the closed contours \(\{C_{i}\}_{i=1}^{N}\) from \(B_{\text{split}}(x,y)\), and calculate the area \(A_{i}\) and the average brightness \(\mu_{i}\) of each contour. Establish a multi-feature scoring mechanism, and construct a comprehensive evaluation function:  
\[S_{i}=A_{i}\times\mu_{i}, \tag{11}\]  
and select the contour \(C_{\text{max}}\) with the highest score as the Earth candidate area. The extracted regions are expanded and filled, and a morphological dilation operation [24] is performed on the region of contour \(C_{\text{max}}\) to compensate for segmentation errors:  
\[B_{\text{expanded}}(x,y)=B_{C_{\text{max}}}(x,y)\oplus K_{\text{dilate}}, \tag{12}\]  
where \(K_{\text{dilate}}\) represents the circular structural element and \(B_{\text{expanded}}(x,y)\) denotes the binary image of the filling expansion after selecting the contour \(C_{\text{max}}\). Figure 7 illustrates an example of the process of extracting the Earth region. Figure 7: An example of the process of extracting the Earth region. (**a**) Original image; (**b**) initial binary image; (**c**) binary image of the extracted part of the halo; (**d**) separate the halo from the Earth; (**e**) binary image of the Earth region (including halo); (**f**) select the highest rated contour; (**g**) final binary image of the Earth region; (**h**) extracted Earth region image. Post-processing and mask generation  
Apply a Bilateral Filter to smooth the noise inside the region while preserving the edge information [25]. The filtering equation is as follows. \[I_{\text{filtered}}(x,y)=\frac{1}{W_{p}}\sum_{q\in\Omega}G_{\sigma_{s}}(\|p-q\|)G _{\sigma_{r}}(|I(p)-I(q)|)I(q), \tag{13}\]  
where \(G_{\sigma_{s}}\) and \(G_{\sigma_{r}}\) denote the spatial-domain and luminance-domain Gaussian kernels, respectively, and \(W_{p}\) is the normalization factor. Removing noise from the edges of the Earth by morphological operation, using the closing operation [24], eliminating fine noise, using first a dilation operation to enhance the selected region and then an erosion operation to clean up the fine noise:  
\[B_{\text{final}}(x,y)=(B_{\text{expanded}}(x,y)\oplus K_{\text{dilate}})\ominus K _{\text{erode}}, \tag{14}\]  
where \(K_{\text{dilate}}\) and \(K_{\text{erode}}\) denote the dilation and erosion structural elements, respectively. \(B_{\text{final}}(x,y)\) represents the binary image obtained after the closing operation [24]. The optimized binary image \(B_{\text{final}}(x,y)\) serves as the definitive mask \(M_{\text{earth}}(x,y)\) for the Earth region, with its logical definition articulated as follows:  
\[M_{\text{earth}}(x,y)= \begin{cases}1&\text{Internal }(B_{\text{final}}(x,y)=255, \text{ Earth region})\\ 0&\text{External }(\text{otherwise})\end{cases} , \tag{15}\]  
where \(M_{\text{earth}}\) represents the final Earth region mask. This module effectively solves the problems of halo interference, edge blur, and noise sensitivity through multi-stage refinement processing.