# An Image Denoising Method for a Visible Light Camera in a Complex Sky-Based Background
## 2 Materials and Methods
### Mean Wavelet Transform Denoising Process  
In a space target image, the background information is primarily represented by pixels with low grayscale values, while the edges and details of the target are mainly represented by pixels with higher grayscale values, assuming there is no contamination from stray light. The curvelet transform is known for its multi-scale and multi-directional sensitivity, which enables effective capture of detailed features in images. However, in practical scenarios, space target images usually contain significant amounts of non-uniform stray light, which can vary in intensity. When the grayscale value of the background information is similar to that of the target edges, the curvelet transform may struggle to effectively capture these subtle changes. As a result, it becomes challenging to distinguish the target from the background, leading to blurry outcomes.  
To address this issue, we introduce the mean filtering algorithm to enhance contrast and aid in distinguishing the target from the background. Subsequently, we apply the curvelet transform for filtering. Nevertheless, mean filtering has its limitations, such as insufficient smoothing of the grayscale values in the background information and potential blurring of the target edges. These limitations restrict the denoising capability of the current transform. Furthermore, the non-uniformity of stray light in the space target image can result in regions with no stray light or severely weak stray light, where pixel values already contain valid target information. However, the mean filtering averages over these regions, potentially leading to blurring of object detail.  
Hence, in this paper, we propose an image processing approach based on weighted averaging. We denote the two source images as X and Y, where the X image is denoised directly using the curvelet transform and the Y image is filtered by the mean prior to the current transform. The final composite image, denoted as Z, is obtained by taking the weighted average of the two images. The mean curvelet denoising formula can be expressed as follows:  
\[C(Z,p)=KC(X,p)+(1-k)C(Y,p) \tag{19}\]  
The weighting coefficient, denoted as \(k\), its expression is as follows:  
\[k=\text{a}\times\frac{\sum_{x=M_{x}}^{N_{x}}\sum_{y=M_{y}}^{N_{y}}\frac{I(x,y) }{2^{N}}}{\left(N_{x}-M_{x}+1\right)\times\left(N_{y}-M_{y}+1\right)} \tag{20}\]  
\(M_{x},M_{y},N_{x},N_{y}\) represent the coordinates of a pixel in the image, \(I(x,y)\) represents the value of the pixel at coordinates (x,y), N represents the number of gray levels in the image, a represents an empirical value within the range of \(a\in[0,1]\).  
In regions of the background where strong stray light is present, we amplify the k value to enhance the proportion of the denoised image Y, which is obtained after mean filtering, in the composite image Z. Conversely, in regions with weak stray light in the background, we reduce the k value to enhance the proportion of the denoised image X, obtained through direct curvelet filtering, in the composite image Z. The flowchart of the mean wavelet transform denoising algorithm is shown in Figure 2.