## 1 Introduction
With image feature-based methods, the problems of nonuniform background elimination can be solved well in unknown situations because only the imaging features of the image itself need to be considered. These methods can be divided into frequency domain and spatial domain methods. For the frequency domain method, wavelet-based and curvelet-based approaches are most common [18; 19]. Due to the demand for domain conversions, these methods are too complex and require much computation time. We need to utilize the difference between the target and background noise in the frequency domain to eliminate the background; however, they are very similar in the frequency domain, which can cause confusion. Since it is difficult to distinguish a low-SNR target from a nonuniform background [20], the accuracy to eliminate the nonuniform background is limited. For the spatial-domain method, since the image is processed directly in the spatial domain, it tends to have a faster runtime than frequency-domain filtering. Methods include mean iterative filtering [21], filtering based on average or gradient thresholding [22], new star target segmentation (NSTS) [23], morphology operation [24] and improved new top-hat transformation (INTHT) [25]. Although these spatial-domain filtering methods can be used to eliminate nonuniform backgrounds from surveillance images, they have some disadvantages: (1) the calculation includes all pixels in the filter, which will have a significant impact on the accuracy of nonuniform background estimation, and (2) they are quite sensitive to the size of the filter. An unreasonable size will decrease the background elimination effect and could even cause some targets to be lost. Therefore, effective and reliable elimination of nonuniform backgrounds from surveillance images while retaining targets remains an open challenge. To solve these problems, a new, accurate and robust stray light nonuniform background elimination method is proposed, named image block self-adaptive gray-scale morphology (IBSGM). A flowchart of the procedure is shown in Figure 1, which can be broken down into three steps: (1) definition of structural operators, (2) division of the original surveillance image into blocks and determination of the optimal size of the structural operator suitable for each block by the method of the minimum bounding rectangle, and (3) a morphological operation based on constructed structural operators to estimate and eliminate the nonuniform background. In the first step, two structural operators with varying sizes and domains are defined. We analyze the features of surveillance images and the gray value difference between the target pixels and surrounding background pixels, which provides evidence for constructing new structural operators. In the second step, we block the original surveillance image and find the size of the largest target in each image block by the method of the minimum bounding rectangle. This establishes the optimal size of structural operator suitable for each image block. In the third step, we perform morphological processing on the surveillance images using the designed structural operators. With structural operators of the optimal size, we can reliably conserve target pixels while only using pixels from the surrounding background in the morphological operations. In this way, we solve the problem of surveillance images being sensitive to the size of the filter, which plagued previous methods. Finally, experiment with simulated image datasets and real acquired image datasets show that the proposed ISSGM approach eliminates stray light nonuniform backgrounds with greater accuracy and robustness than other methods.