A method for removing thin clouds from remote sensing images
By applying the conditional variational automatic encoding model and grayscale transformation technology in high-resolution remote sensing images, the problem of poor thin cloud removal in high-resolution remote sensing images is solved, and high-precision and efficient thin cloud removal processing is achieved. And ensure the image gray balance.
Patent Information
- Application Number
- CN202410734754.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-06-07
AI Technical Summary
Existing thin cloud removal methods are ineffective and inefficient in high-resolution, large-size remote sensing images. They cannot obtain clear images accurate to pixels, and the images after removal have the problem of grayscale inconsistency.
Using a thin cloud removal model based on conditional variational automatic coding, the high-resolution remote sensing image is divided into blocks and multiple clear thin cloud removal intermediate images are generated through the trained thin cloud removal model, and the entire image is transformed through grayscale transformation. Grayscale equalization uses the encoder network, intermediate network and decoder network to establish a one-to-many mapping from the image with thin clouds to the intermediate image without thin clouds, and combines the Wallis transform to perform grayscale adjustment.
It improves the accuracy and efficiency of thin cloud removal, ensures that the details and texture of the removed image are clear, and achieves gray balance of the entire image through grayscale transformation. Thin cloud removal and grayscale transformation are performed simultaneously, reducing waiting time. , improving processing efficiency.
Smart Images

Figure CN118314052B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing, and in particular to a method for removing thin clouds from remote sensing images. Background Art
[0002] Thin clouds in remote sensing images usually appear semi-transparent. Compared with images polluted by thick clouds, images polluted by thin clouds still retain some ground object information. Therefore, thin clouds can be removed from images to improve image utilization. Since images polluted by thin clouds usually also contain some surface structure and color information, the focus of the thin cloud removal task is how to achieve fine restoration of surface structure information and color information.
[0003] The current thin cloud removal method is mainly aimed at low-resolution remote sensing images. When it is applied to high-resolution, large-size remote sensing images, the thin cloud removal effect is poor and the efficiency is low. In the related art, the thin cloud removal image is restored based on a single thin cloud image. Since only the thin cloud image is used for restoration, a clear image accurate to the pixel cannot be obtained. In addition, although there is a method for thin cloud removal by dividing large-size remote sensing images in the related art, when the image after block processing is reorganized into a whole image, the image has the problem of grayscale inconsistency. Summary of the invention
[0004] The present invention provides a remote sensing image thin cloud removal method, which is applicable to high-resolution remote sensing images. A single image with thin clouds is used to generate a plurality of clear intermediate images after thin clouds are removed, so that a high-precision image after thin clouds are removed can be obtained. At the same time, grayscale transformation is performed to make the grayscale of the entire image after thin clouds are removed balanced.
[0005] The present invention provides a method for removing thin clouds from a remote sensing image, the method comprising:
[0006] S1: Get the image to be processed;
[0007] S2: Divide the image to be processed into blocks to obtain a plurality of first sub-images;
[0008] S3: acquiring the first sub-image in a preset order, and removing the thinning clouds from the first sub-image using a trained thinning cloud removal model to obtain a sub-image without thinning clouds;
[0009] S4: performing grayscale transformation on the sub-image without thin clouds to obtain a second sub-image;
[0010] S5: performing stitching processing on all the second sub-images to obtain a de-clouded image for the image to be processed.
[0011] Furthermore, the de-thinning cloud model includes an encoder network, an intermediate network and a decoder network, and the training steps of the de-thinning cloud model include:
[0012] Step a: obtaining a training data set, wherein the training data set includes a plurality of pairs of images containing thin clouds and images without thin clouds;
[0013] Step b: using the encoder network to estimate latent variables based on the thin cloud image;
[0014] Step c: using the intermediate network to sample the latent variable to obtain a plurality of sampling signals, and generating a plurality of meta-images based on the plurality of sampling signals;
[0015] Step d: reconstructing a plurality of thin cloud-removed intermediate images based on a plurality of the elementary images and the thin cloud-containing images using the decoder network, and calculating a mean based on the plurality of the thin cloud-removed intermediate images to obtain a thin cloud-removed image;
[0016] Step e: Calculate the comprehensive loss based on the image containing thin clouds, the image without thin clouds and the latent variables, and adjust the parameters of the thin cloud removal model according to the comprehensive loss; Step f: Iteratively execute steps a to e until the preset convergence condition is reached to obtain the trained thin cloud removal model.
[0017] Furthermore, the comprehensive loss is a weighted sum of the divergence loss and the reconstruction loss, and the divergence loss is calculated using the following formula:
[0018]
[0019] Among them, μ is the mean parameter, 6 is the standard deviation parameter, tr(·), |·| represent the trace and determinant of the matrix respectively, and d is the dimension of the distribution;
[0020] The reconstruction loss is calculated using the following formula:
[0021]
[0022] Among them, c represents the number of channels, p represents the number of pixels, C represents the total number of channels, P represents the total number of pixels, α is the adjustment coefficient, and Y c (p) represents the de-thinned cloud image output by the de-thinned cloud model, G c (p) represents the image without thin clouds as the reference image.
[0023] Furthermore, the training data set is obtained based on real thin cloud images.
[0024] Furthermore, the step S2 comprises:
[0025] Each of the first sub-images is numbered according to its position in the image to be processed, and the numbers are saved as a first sub-image position matrix.
[0026] Further, acquiring the first sub-image in a preset order includes:
[0027] According to the first sub-image position matrix, selecting the first sub-images one by one from the first row from left to right;
[0028] Select the first sub-images in the first column except the first row one by one from the top to the bottom of the first column;
[0029] Starting from the second row, the first sub-images except the first column are selected row by row from left to right until all the first sub-images are selected.
[0030] Furthermore, each of the non-thin cloud sub-images is numbered according to the position of the corresponding first sub-image in the image to be processed, and the numbers are saved as a non-thin cloud sub-image position matrix.
[0031] Furthermore, the step S4 comprises:
[0032] According to the non-thin cloud sub-image position matrix, for the non-thin cloud sub-image in the first row, a Wallis transform is performed with the left image of the current non-thin cloud sub-image as a reference image;
[0033] For the non-thin cloud sub-images in the first column except the first row, Wallis transform is performed by taking the upper image of the current non-thin cloud sub-image as the reference image;
[0034] For the non-thin cloud sub-images except the first row and the first column, starting from the second row, a Wallis transform is performed with the left image and the upper image of the current non-thin cloud sub-image being used as reference images.
[0035] Furthermore, before removing the thinning cloud from the first sub-image by using the trained thinning cloud removal model, the method further includes:
[0036] Determine whether the first sub-image contains clouds. If so, remove clouds from the first sub-image containing clouds using a trained thinning cloud removal model to obtain a corresponding sub-image without thin clouds. If not, use the first sub-image without clouds as the corresponding sub-image without thin clouds.
[0037] Furthermore, the step S5 comprises:
[0038] A linear transition process is performed on the overlapping area of the second sub-image to obtain a cloud-removed image corresponding to the image to be processed.
[0039] The beneficial effects of the technical solution of the present invention include at least:
[0040] 1. Using the thin cloud removal model based on conditional variational auto-encoding, a one-to-many mapping from thin cloud images to thin cloud removal intermediate images is established, which can improve the accuracy of thin cloud removal, remove thin clouds cleanly, and make the details and texture of the thin cloud removal image clear.
[0041] 2. By performing grayscale transformation on the sub-image without thin clouds, the grayscale balance of the final spliced image after thin cloud removal is ensured.
[0042] 3. By performing thin cloud removal in a preset order, the thin cloud removal order and the grayscale transformation order correspond to each other, so that the thin cloud removal process and the grayscale transformation process can be carried out simultaneously, reducing waiting time and improving efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 A schematic diagram of a process for removing thin clouds from a remote sensing image according to an embodiment of the present invention;
[0045] Figure 2 A schematic diagram of acquiring a first sub-image according to a preset order according to an embodiment of the present invention;
[0046] Figure 3 This is a schematic diagram of a thin cloud removal model framework according to an embodiment of the present invention;
[0047] Figure 4 is a schematic diagram of an encoder network according to an embodiment of the present invention;
[0048] Figure 5 is a schematic diagram of a decoder network according to an embodiment of the present invention;
[0049] Figure 6 It is a schematic diagram of performing grayscale transformation according to a preset order according to an embodiment of the present invention. DETAILED DESCRIPTION
[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present invention.
[0051] Figure 1A flow chart of a method for removing thin clouds from a high-resolution remote sensing image provided by the present invention is shown, and the method comprises:
[0052] In step S1: an image to be processed is obtained.
[0053] In an embodiment of the present invention, the image to be processed is, for example, a high-resolution remote sensing image from which thin clouds are to be removed. Remote sensing images containing thin clouds are screened out from high-resolution remote sensing images collected by satellites and stored in a database of images containing thin clouds. When performing thin cloud removal processing, the image to be processed is obtained from the database of images containing thin clouds.
[0054] The high-resolution remote sensing images of the present invention are from images collected by remote sensing satellites. The remote sensing images have various star sources, including Gaofen-1, Ziyuan-1, Gaojing-1, etc. The resolution is 0.5m to 2m, and the size is about 30000*30000 on average. Among them, the images containing thin clouds can be screened manually or automatically screened by a thin cloud detection tool, and images with clouds and cloud thickness within a threshold range are selected as images containing thin clouds.
[0055] Step S2: Divide the image to be processed into blocks to obtain a plurality of first sub-images.
[0056] Specifically, the image to be processed is divided into blocks with overlapping areas to obtain a plurality of first sub-images of the same size, and any two adjacent first sub-images have overlapping areas. At the same time, each of the first sub-images is numbered according to its position in the image to be processed, and the number is saved as a first sub-image position matrix. The block size can be determined according to the size of the image to be processed. For example, the image to be processed is divided into a plurality of first sub-images of a size of 512×512. The overlapping area is, for example, a rectangular area, which may be overlapped up and down or left and right. The size of the overlapping area can be set based on actual needs or experience. If the overlapping area is too large, the amount of calculation will increase when the overlapping area is subjected to transition processing. If the overlapping area is too small, the boundary between blocks cannot be fully eliminated. In this embodiment, the overlapping area is set to one-fourth of the first sub-image.
[0057] At the same time, in order to facilitate grayscale transformation and splicing in the subsequent steps, each first sub-image is numbered according to its position in the image to be processed, and the first sub-image position matrix is obtained, which is recorded as Among them, a 11 represents the first sub-image located in the first row and first column, ..., a nn represents the first sub-image located at the nth row and the nth column. Assuming that the size of a high-resolution remote sensing image to be processed is N×N, the block size is 512×512, and the step size is 384, the number of block images obtained in each row is:
[0058] M = Floor ((N-512) / 384) + 1
[0059] Then, the total number of block images is M*M, and n is M in the first sub-image position matrix An×n.
[0060] The present invention divides high-resolution and large-size remote sensing images into blocks first and then removes thin clouds, which can reduce the amount of calculation and improve the processing speed. Compared with the direct block division without overlap in the related technical solution, the present invention adopts the block division with overlapping areas, which can eliminate the grayscale jump and stitching seam of the whole image after splicing, and achieve the grayscale consistency of the final complete image after removing thin clouds.
[0061] S3: Acquire the first sub-image in a preset order, and remove clouds from the first sub-image using a trained cloud removal model to obtain a sub-image without thin clouds.
[0062] In the solution provided in this embodiment, the first sub-image is de-clouded in a preset order, which can avoid waiting time, save the time of de-clouding, and improve efficiency. Figure 2 , according to the first sub-image position matrix A n×n , select the first sub-image in the following order:
[0063] First, select the first sub-images a one by one from the first row from left to right 11 , a 12 , …, a 1n .
[0064] Secondly, select the first sub-images a from the first column from top to bottom one by one except the first row in the first column 21 , a 31 , …, a n1 .
[0065] Next, starting from the second row, select the first sub-image a from left to right row by row except the first column. 22 , a 23 , …, a 2n , a 32 , a 33 , …, a 3n , …, a n2 , a n3 , …, a nn , until all the first sub-images are selected.
[0066] The first sub-image is de-thinned by the trained de-thinned cloud model, and all the first sub-images may be input into the trained de-thinned cloud model. Since there may be images without thin clouds among the multiple first sub-images obtained after the high-resolution remote sensing image is divided into blocks, in order to improve the image processing efficiency, in some embodiments, it is also possible to first determine whether the first sub-image contains thin clouds, and then only perform de-thinned cloud processing on the first sub-image containing thin clouds, while not performing processing on the first sub-image without clouds.
[0067] According to an embodiment of the present invention, if it is determined that the first sub-image contains clouds, the first sub-image is thinly clouded by using a trained thin cloud removal model to obtain a corresponding sub-image without thin clouds; if it is determined that the first sub-image does not contain clouds, the first sub-image without clouds is directly used as the corresponding sub-image without thin clouds. Whether the first sub-image contains thin clouds can be determined manually or by using a thin cloud detection tool.
[0068] According to one embodiment of the present invention, the above-mentioned thin cloud removal model is, for example, a remote sensing image thin cloud removal model based on conditional variational auto-encoding, which realizes the mapping from a thin cloud image to multiple clear images through an encoder network based on a visual transformer and a decoder network based on multi-scale feature fusion, and obtains the final thin cloud removal image based on multiple mapping results.
[0069] Reference below Figure 3 , Figure 4 and Figure 5 The structure of the thin cloud removal model and the training process of the thin cloud removal model are explained.
[0070] like Figure 3 The framework of the thin cloud removal model is shown. The thin cloud removal model includes an encoder network, an intermediate network and a decoder network. The encoder network is used to estimate the latent variable z based on the thin cloud image, the intermediate network is used to sample the latent variable to obtain multiple sampling signals and generate multiple meta-images, and the decoder network is used to reconstruct multiple thin cloud removal intermediate images based on multiple meta-images and the thin cloud image.
[0071] like Figure 4As shown, the encoder network adopts a Transformer-based encoder, including an embedding layer (Embedding), a Transformer encoding module and a feedforward neural network layer (Feedforward). The Transformer encoding module is composed of multiple stacked encoder blocks (EncoderBlock) with residuals. The encoding block includes parallel channel attention blocks (Channel Attention Block, CAB) and multi-head self-attention blocks (Multi-head Self-attention Block, MSB) and a feedforward neural network including a linear layer and a deep convolution layer (DeConv).
[0072] The intermediate network includes a sampling module and a generation module, wherein the sampling module adopts the reparameterization technique to sample in the latent space and outputs multiple sampling signals; the generation module includes a multi-layer perceptron (MLP) with two hidden layers, which is used to use the multiple sampling signals to generate multiple meta-images corresponding to the multiple change factors.
[0073] like Figure 5 As shown in FIG. 1 , the decoder network adopts a multi-scale prediction decoder, including 5 convolution blocks of different scales. Each convolution block of different scales includes a convolution block, a channel attention block, and a deconvolution block. The decoder network is used to combine the sampled signal obtained by a single sampling as a latent variable with the thin cloud image to generate a clear image.
[0074] The training steps for the de-thinning cloud network include:
[0075] Step a: Obtain a training data set, wherein the training data set includes multiple pairs of images containing thin clouds and images without thin clouds.
[0076] A large-size remote sensing image containing thin clouds is obtained from a real remote sensing image detected by a satellite. First, it is cropped, for example, into 256×256 images. Then, the thin cloud image is removed by removing the thin clouds, for example, by artificially removing the thin clouds, to obtain a corresponding image without thin clouds. Multiple pairs of images containing thin clouds and images without thin clouds are used as training data sets.
[0077] In the embodiment of the present invention, by processing real remote sensing images to obtain training data sets, the model can directly learn the underlying cloud removal principle from real-world cloud images. Compared with the model trained on synthetic data sets, the model trained based on real remote sensing images has better generalization performance.
[0078] Step b: using the encoder network to estimate latent variables Z based on the thin cloud image X.
[0079] Specifically, the encoder uses the prior distribution p s (z|X) to approximate the posterior l t (z|X). The latent variable z comes from the prior distribution, and s and t represent the parameter set of the distribution.
[0080] For a random latent variable z, it is decomposed into the following two parts:
[0081] z=μ+σ·ε
[0082] where μ is the mean parameter, σ is the standard deviation parameter, and ε is the noise sampled from the standard normal distribution N(0, I).
[0083] By decomposing the latent variables, the subsequent sampling process of samples can be converted into the sampling of μ and σ. The encoder network is used as a recognition model to infer the prior distribution.
[0084] Step c: Use the intermediate network to sample the latent variable z to obtain multiple sampling signals z m , and generate multiple elementary images based on the multiple sampling signals.
[0085] Specifically, the sampling module of the intermediate network samples the latent variable z from the latent space through the reparameterization technique to obtain multiple sampling signals, and uses the generation module to generate multiple meta-images based on the multiple sampling signals. By decomposing the latent variables, the sampling process of the sample is converted into the sampling of μ and σ, and the gradient estimation of these parameters is realized through the reparameterization technique. The reparameterization technique enables the use of a gradient-based optimization algorithm to learn the distribution of latent variables during the training process of the dethinning cloud model, thereby more effectively performing variational inference and generative model training.
[0086] Step d: reconstructing a plurality of thin cloud-removed intermediate images based on a plurality of the elementary images and the thin cloud-containing images using the decoder network, and calculating a mean based on the plurality of the thin cloud-removed intermediate images to obtain a thin cloud-removed image.
[0087] Specifically, Figure 5 As shown, first, the input thin cloud image X is downsampled to the same size as the original image V i The same size, get the downsampled image X1, then, the downsampled image X1 and the original image V iAfter being combined, they are input to the first layer of the decoder network. The decoder network extracts features and learns the basic principle of removing thin clouds, and outputs the first feature F1. Next, the downsampled image X1 is upsampled and combined with the first feature F1, and input to the second layer of the decoder network. The decoder network extracts features and learns the basic principle of removing thin clouds, and outputs the second feature F2, ..., and so on. The decoder takes the output F of the current layer j and the upsampled image X corresponding to the next layer j+1 Combine them and input them to the next layer. After extracting features and learning to remove thin clouds, the features F of the next layer are output. j+1 Each layer of the decoder network extracts features at different scales and learns the basic principle of removing thin clouds, and finally obtains a clear thin cloud-free image Y i Finally, multiple meta-images V i Corresponding multiple clear and cloud-free images Y i The average value is calculated to obtain the final clear image Y. The number of sampled signals can be set as required. In the embodiment of the present invention, the number of sampled signals i is set to 10, for example, to achieve maximum a posteriori probability.
[0088] The present invention reconstructs multiple images without thin clouds based on a single image with thin clouds. Multiple different outputs can ultimately improve the generalization ability of the thin cloud removal network. The average of multiple images without thin clouds is used as the final thin cloud removal image. The thin cloud removal effect is good, and the restored image has pixel-level accuracy and clear surface texture.
[0089] Step e: calculating a comprehensive loss based on the image containing thin clouds, the image without thin clouds and the latent variable, and adjusting the parameters of the thin cloud removal model according to the comprehensive loss.
[0090] The parameters of the encoder network, the intermediate network and the decoder network are adjusted according to the comprehensive loss. The comprehensive loss of the present invention includes the encoder loss and the decoder loss. The de-thinning cloud model uses KL divergence D KL (p s (z|X)||l t (z|X)) reduces the posterior l t (z|X) and the prior distribution p s The difference between (z|X), KL divergence D KL (p s (z|X)||l t (z|X)) is a regularization loss. Assume that the posterior l t (z|X) follows the standard normal distribution N(0, I). The calculation formula of the variational lower bound of the thinning cloud model is as follows:
[0091]
[0092] Among them, the encoder loss is the divergence loss, which can be expressed as:
[0093] L kl =D KL (p s (z|X)||l t (z|X))
[0094] Assume that p s (z|X) follows a normal distribution with parameters μ, σ 2 I, l t (z|X) obeys the standard normal distribution, then the divergence loss can directly calculate the closed form solution, the calculation formula is as follows:
[0095]
[0096] where tr(·) and |·| represent the trace and determinant of the matrix, respectively, and d is the dimension of the distribution.
[0097] The decoder network converts the latent variable z obtained by a single sampling into m Combined with the original thin cloud image, a clear image is generated. The decoder loss is the reconstruction loss, which can be expressed as:
[0098]
[0099] Among them, z m represents the sampled signal, and M is the number of samples.
[0100] The present invention selects the Smooth L1 loss function to calculate the reconstruction loss, and the reconstruction loss can be calculated according to the following formula:
[0101]
[0102] Among them, c represents the number of channels, p represents the number of pixels, C represents the total number of channels, P represents the total number of pixels, α is the adjustment coefficient, and Y c (p) represents the de-thinned cloud image output by the de-thinned cloud model, G c (p) represents the image without thin clouds as the reference image.
[0103] The present invention calculates the reconstruction loss by calculating the difference between the thinned cloud image and the corresponding thin cloud-free image.
[0104] The comprehensive loss is a weighted sum of the divergence loss and the reconstruction loss, and the calculation formula is as follows:
[0105] L sum =λ1L kl +λ2L rec
[0106] Among them, λ1 and λ2 are weights.
[0107] Step f: iteratively execute steps a to e until a preset convergence condition is reached to obtain the trained cloud thinning model.
[0108] The preset convergence conditions of the model include but are not limited to reaching a preset number of iterations or the loss value reaching a set threshold.
[0109] The present invention decomposes the thin cloud image into two parts: a clean surface image and a variation factor. In order to reconstruct a thin cloud-free image from the thin cloud image, a neural network is first used to infer the variation factor from the thin cloud image, and then a thin cloud-free image close to the clean surface image is reconstructed from the thin cloud image based on the variation factor. At the same time, it is assumed that the latent variable determines the generation of the variation factor. Since the thin cloud image contains the information of the variation factor, the latent variable is first estimated based on the thin cloud image, and then the variation factor is sampled from the latent variable.
[0110] It can be understood that the position numbers of all non-thin cloud sub-images inherit the position numbers of the corresponding first sub-images. Therefore, each non-thin cloud sub-image can be numbered according to the position of the corresponding first sub-image in the image to be processed, and the numbering can be saved as the non-thin cloud sub-image position matrix. n×n After all the first sub-images in step S3 are processed, the corresponding position matrix of the non-thin cloud sub-image can be obtained, which is recorded as Among them, b ij Represents the sub-image without thin clouds located at the i-th row and j-th column, i, j = 1, 2, ..., n.
[0111] According to an embodiment of the present invention, the first sub-image b containing thin clouds is ij Input the trained de-thinning cloud model, and after feature extraction and fusion, output the de-thinning cloud sub-image b ij For example, the first sub-image a containing thin clouds ij Input the thin cloud removal model, remove the thin clouds after the thin cloud removal, and output the corresponding sub-image b without thin clouds ij For the first sub-image without clouds, no processing is performed. i j +1 , without any processing, directly take the first sub-image a without cloud ij+1 As the corresponding thin cloud sub-image b ij +1.
[0112] S4: Perform grayscale transformation on the sub-image without thin clouds to obtain the second sub-image.
[0113] Since there are grayscale inconsistencies between the sub-images without thin clouds, if they are directly spliced into a whole image, the brightness of each image block will be uneven, and there will be grayscale jumps at the joints between blocks, resulting in uneven overall tone and splicing seams in the whole cloud-free image after splicing. Therefore, it is necessary to perform grayscale transformation on the sub-images without thin clouds to achieve grayscale balance between the sub-images without thin clouds.
[0114] In step S3, the first sub-image is obtained in a preset order, and in step S4, the non-thin cloud sub-image position matrix B is obtained in a corresponding order. n×n , grayscale transformation is performed on the first sub-image one by one. Figure 6 As shown, step S4 includes:
[0115] 1) For the non-thin cloud sub-image in the first row, a Wallis transform is performed using the left image of the current non-thin cloud sub-image as the reference image.
[0116] Specifically, take the non-thin cloud sub-image b 11 As the reference image, adjust the non-thin cloud sub-image b 12 , and then use the adjusted non-thin cloud sub-image b 12 As the reference image, adjust the non-thin cloud sub-image b 13 From left to right, the unthinned cloud sub-image is adjusted continuously until the unthinned cloud sub-image b is adjusted. 1n The adjustment process is as follows: for each non-thin cloud sub-image in the first row, after determining the reference image, calculate the mean and variance m of the reference image r 、v r And the mean and variance m of the image to be corrected t 、v t Then, adjust the image grayscale according to the following Wallis transformation formula:
[0117]
[0118] Wherein, t(x, y) is the gray value of the image to be corrected at point (x, y), and w(x, y) is the gray value of the corrected image at point (x, y).
[0119] 2) For the non-thin cloud sub-images in the first column except the first row, Wallis transform is performed using the upper image of the current non-thin cloud sub-image as the reference image.
[0120] Specifically, take the non-thin cloud sub-image b 11 As the reference image, adjust the non-thin cloud sub-image b 21 , and then use the adjusted non-thin cloud sub-image b 21 As the reference image, adjust the non-thin cloud sub-image b 31. From top to bottom, continuously adjust the thin cloud sub-image until the adjustment is completed. n1 The adjustment process is as follows: for each sub-image without thin clouds in the first column, after determining the reference image, calculate the mean and variance m of the reference image r 、v r And the mean and variance m of the image to be corrected t 、v t , and adjust the image grayscale according to the above Wallis transformation formula.
[0121] 3) For the non-thin cloud sub-images except the first row and the first column, starting from the second row, a Wallis transform is performed with the left image and the upper image of the current non-thin cloud sub-image as the reference images.
[0122] Specifically, at the same time, the adjusted non-thin cloud sub-image b 12 and the adjusted unthinned cloud sub-image b 21 As the reference image, adjust the non-thin cloud sub-image b 22 ; Then, at the same time, the adjusted cloud sub-image b 13 and the adjusted unthinned cloud sub-image b 22 As the reference image, adjust the non-thin cloud sub-image b 23 ; From the second row, adjust row by row until the adjustment is completed without thin cloud sub-image b nn The adjustment process is: calculate the mean m of the left reference image r1 and variance v r1 , the mean m of the upper reference image r2 and variance v r2 And the mean and variance m of the image to be corrected t 、v t , and calculate the mean m of the weighted reference image according to the following formula: r and variance v r :
[0123] m r =k1m r1 +k2m r2
[0124] v r =k1v r1 +k2v r2
[0125] Among them, k1 and k2 are weighting coefficients. Finally, the mean value m of the image to be corrected is t and variance v t And the mean m of the weighted reference image r and variance v r Substitute the above grayscale transformation formula to adjust the image.
[0126] Steps S3-S4 are repeated until all the first sub-images are processed.
[0127] The present invention performs grayscale transformation on the sub-images without thin clouds based on the Wallis filter, so that the grayscales of the second sub-images are consistent, and the color tone of the entire large-size cloud-removed remote sensing image finally obtained by splicing is uniform.
[0128] Due to the large size of high-resolution remote sensing images, the number of first sub-images obtained after segmentation is huge, and image de-clouding requires a certain amount of processing time, especially when manually judging whether the first sub-image contains clouds. If the grayscale conversion is started only after all the first sub-images are de-clouded, the waiting time is too long, and the processing cycle is long, which is not conducive to improving efficiency. The present invention de-clouds the first sub-images one by one in a preset order, and de-clouding and grayscale conversion can be performed simultaneously, thereby effectively saving processing time. For example:
[0129] Before time t1, the first sub-image a is processed by the trained de-thinning network. 12 Remove the thin clouds and get the sub-image b without thin clouds 12 ; The first sub-image a is trained through the thinning cloud network 21 Remove the thin clouds and get the sub-image b without thin clouds 21 .
[0130] At time t1, the first sub-image a is processed by the trained de-thinning network. 22 Remove the thin clouds and get the sub-image b without thin clouds 22 .
[0131] At time t2, the first sub-image a is processed by the trained de-thinning network. 23 Remove the thin clouds and get the sub-image b without thin clouds 23 , synchronously, for the non-thin cloud sub-image b 22 Perform grayscale conversion.
[0132] Since for the non-thin cloud sub-image b 22 The left image b on which the grayscale transformation depends 21 and the image b 12 Therefore, it is possible to 22 Grayscale transformation is performed immediately after thin cloud removal, without waiting for the completion of thin cloud removal for all first sub-images before starting grayscale transformation.
[0133] S5: performing stitching processing on all the second sub-images to obtain a de-clouded image for the image to be processed.
[0134] Specifically, a plurality of the second sub-images are spliced together. There are a variety of splicing methods that can be selected as needed. The present invention adopts linear transition processing to obtain a de-clouded image corresponding to the image to be processed.
[0135] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0136] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for removing thin clouds from remote sensing images, characterized in that: The method comprises: S1: Get the image to be processed; S2: Divide the image to be processed into blocks to obtain a plurality of first sub-images; S3: acquiring the first sub-image in a preset order, and removing the thinning clouds from the first sub-image using a trained thinning cloud removal model to obtain a sub-image without thinning clouds; S4: performing grayscale transformation on the sub-image without thin clouds to obtain a second sub-image; S5: performing stitching processing on all the second sub-images to obtain a de-clouded image for the image to be processed; The de-thinning cloud model includes an encoder network, an intermediate network and a decoder network, and the training steps of the de-thinning cloud model include: Step a: obtaining a training data set, wherein the training data set includes a plurality of pairs of images containing thin clouds and images without thin clouds; Step b: using the encoder network to estimate latent variables based on the thin cloud image; Step c: using the intermediate network to sample the latent variable to obtain a plurality of sampling signals, and generating a plurality of meta-images based on the plurality of sampling signals; Step d: reconstructing a plurality of thin cloud-removed intermediate images based on a plurality of the elementary images and the thin cloud-containing images using the decoder network, and calculating a mean based on the plurality of the thin cloud-removed intermediate images to obtain a thin cloud-removed image; Step e: adjusting the parameters of the thinning cloud model according to the comprehensive loss, wherein the comprehensive loss is a weighted sum of the divergence loss and the reconstruction loss; Step f: iteratively execute steps a to e until a preset convergence condition is reached to obtain the trained cloud thinning model.
2. The method according to claim 1, characterized in that The divergence loss is calculated using the following formula: Among them, μ is the mean parameter, σ is the standard deviation parameter, tr(·) and |·| represent the trace and determinant of the matrix respectively, and d is the dimension of the distribution; The reconstruction loss is calculated using the following formula: Among them, c represents the number of channels, p represents the number of pixels, C represents the total number of channels, P represents the total number of pixels, and Y c (p) represents the de-thinned cloud image output by the de-thinned cloud model, G c (p) represents the clean surface image G as the reference image; The comprehensive loss is calculated according to the following formula: L sum =λ1L kl +λ2L rec Among them, λ1 and λ2 are weights.
3. The method according to claim 1, characterized in that The training data set is obtained based on real thin cloud images.
4. The method according to claim 1, characterized in that: The step S2 comprises: Each of the first sub-images is numbered according to its position in the image to be processed, and the numbers are saved as a first sub-image position matrix.
5. The method according to claim 1, characterized in that The acquiring the first sub-image in a preset order comprises: According to the first sub-image position matrix, selecting the first sub-images one by one from the first row from left to right; Select the first sub-images except the first row in the first column one by one from the top to the bottom of the first column; Starting from the second row, the first sub-images except the first column are selected row by row from left to right until all the first sub-images are selected.
6. The method according to claim 1, characterized in that Each of the non-thin cloud sub-images is numbered according to the position of the corresponding first sub-image in the image to be processed, and the numbers are saved as a non-thin cloud sub-image position matrix.
7. The method according to claim 6, characterized in that The step S4 comprises: According to the non-thin cloud sub-image position matrix, for the non-thin cloud sub-image in the first row, a Wallis transform is performed with the left image of the current non-thin cloud sub-image as a reference image; For the non-thin cloud sub-images in the first column except the first row, Wallis transform is performed by taking the upper image of the current non-thin cloud sub-image as the reference image; For the non-thin cloud sub-images except the first row and the first column, starting from the second row, a Wallis transform is performed with the left image and the upper image of the current non-thin cloud sub-image being used as reference images.
8. The method according to claim 1, characterized in that Before removing the thinning cloud from the first sub-image by using the trained thinning cloud removal model, the method further includes: Determine whether the first sub-image contains clouds. If so, remove clouds from the first sub-image containing clouds by using the trained thinning cloud removal model to obtain a corresponding sub-image without thin clouds. If not, use the first sub-image without clouds as the corresponding sub-image without thin clouds.
9. The method according to claim 1, characterized in that: The step S5 comprises: A linear transition process is performed on the overlapping area of the second sub-image to obtain a cloud-removed image corresponding to the image to be processed.
Citation Information
Patent Citations
Single image defogging enhancement method and system based on generative adversarial network
CN111179202A
Model training method, commodity image management method and device
CN114494890A
Image protection method and device and storage medium
CN116188607A
Image synthesis method based on generative adversarial network
CN116524290A
Image cloud removal method and system based on optical remote sensing image and SAR image
CN117522738A
