## 3 Nonuniform Background Elimination
### Gray-Scale Morphological Operation  
First, we use the self-adaptive adjustable structural operator \(\Delta B\) to execute a dilation operation \(\oplus\) on each image block \(f_{c}\), and then stitch the operated image blocks into the size of the original image to obtain image \(F_{1}\), as shown in Equation (11). \[F_{1}=\sum_{c=1}^{k}f_{c}(i,j)\oplus\Delta B=\sum_{c=1}^{k}\max\Bigl{\{}f_{c} (i-m,j-n)+\Delta B(m,n)\Bigl{|}(i-m),(j-n)\in D_{f_{c}},(m,n)\in D_{\Delta B} \Bigr{\}} \tag{11}\]  
where \(D_{f_{c}}\) and \(D_{\Delta B}\) refer to the domains of \(f_{c}\) and \(\Delta B\), respectively. In terms of the definition of the dilation operation, if a target is exactly in the internal structural operator \(B_{i}\), since it is not in the defined domain of \(\Delta B\), the pixel value of this part will not participate in the dilation procedure. As a result, the dilation process will only use pixels in the background surrounding targets. In this way, the target pixels are replaced by background pixels to protect them from being eliminated. We choose the value of the largest side in each image block to be the \(K\)-value of the structural operator \(\Delta B\) to ensure that targets are in the internal structural operator \(B_{i}\). As most stars and space targets are circular, the internal structural operator \(B_{i}\), which is also circular, can perform the replacement most accurately. This is equivalent to a \"keying\" operation and fundamentally improves the accuracy of nonuniform background elimination. Regarding the two parameters of \(\Delta B\), \(K\) is ascertained in Section 3.2. For \(L\), it controls the number of background pixels involved in calculation. If \(L\) is too large, some targets will mistake their neighboring target pixels as their surrounding background pixels during the dilation operation. Incorrect replacement causes mutual interference between targets. Therefore, we assign \(L\) a value of \(K+2\), which not only avoids interference, but also ensures  
Figure 5: Process of finding the maximum target size in an image block. that enough background pixels are included in the calculation, thereby ensuring accuracy. The result of this process is shown in Figure 6b. Then, as described by Equation (12), we employ the structural operator \(B_{b}\) to execute an erosion operation \(\Theta\) on image \(F_{1}\). \[F_{2}=F_{1}\Theta B_{b}=\min\{F_{1}(i+m,j+n)-B_{b}(m,n)\big{|}(i+m),(j+n)\in D_{ F_{1}},(m,n)\in D_{B_{b}}\} \tag{12}\]  
where \(D_{F_{1}}\) and \(D_{B_{b}}\) refer to the domains of \(F_{1}\) and \(B_{b}\), respectively. The optimal structural operator \(\Delta B\) for each image block is presented in Section 3.2. If the target is too large (bigger than 32 \(\times\) 32 pixels) or does not appear completely within an image block, some target pixels will be mistaken as background pixels and will remain in image \(F_{1}\). Hence, we need to retrieve these lost targets by performing an erosion operation through the structural operator \(B_{b}\) on image \(F_{1}\). Considering the previously acquired surveillance image information, the majority of targets will not exceed 50 \(\times\) 50 pixels. Furthermore, in terms of the surveillance image features described in Section 2, most of the pixels in \(F\) are occupied by background-region pixels. As a result, we set the value of parameter \(Q\) to 50, which not only ensures that large targets are retrieved, but also confirms that stray light backgrounds are not confused for targets. Moreover, the dilation operation in Equation (11) will improve the overall gray value of the image and dilate the range of the nonuniform background region. The erosion operation not only adjusts the overall brightness of image \(F_{1}\), but also further reduces the target-region gray value that is replaced by the surrounding background region in the dilation process, which ensures that the brightness of the target is not overly diminished. The result is shown in Figure 6c.