Cloud density calculation method combining image features and superpixel partitioning
By combining image features with superpixel partitioning and merging methods, the problem of insufficient segmentation accuracy in cloud density calculation scenarios with limited sample numbers is solved, and high-precision, low-resource consumption cloud density calculation is achieved.
Patent Information
- Application Number
- CN202510105046.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2045-01-23
AI Technical Summary
Existing deep learning-based image semantic segmentation methods have insufficient segmentation accuracy in scenarios with limited sample numbers in cloud density calculations, and traditional methods are difficult to adapt to image diversity requirements in complex scenarios.
Combining image features with superpixel partitioning and merging methods, cloud density calculation is performed through SLIC superpixel segmentation, adjacency graph structure and multiple feature merging, including color enhancement, texture feature extraction, morphological operations and K-means clustering.
It improves segmentation accuracy, reduces computing resource consumption, adapts to different image quality and background conditions, and has high robustness and real-time processing capabilities.
Smart Images

Figure CN119992147B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer vision, and specifically relates to a cloud density calculation method that combines image features with superpixel partitioning, and a corresponding device. Background Art
[0002] Cloud density refers to the number or mass of clouds per unit volume and is often used to describe the density of clouds in the atmosphere. Cloud density can be measured and estimated using a variety of methods. Ground-based observation stations may capture images, identify the sky and clouds within them, and then calculate the corresponding cloud density. Image-based cloud density estimation is typically performed by computers. When processing image-based cloud density calculation tasks, computers first need to identify the areas of sky and clouds contained in the image, requiring the computer to be able to perform semantic image segmentation.
[0003] Semantic segmentation is a fundamental task in computer vision, aiming to assign each pixel in an image to a specific semantic category. Semantic segmentation technology has broad application in areas such as autonomous driving, medical image analysis, remote sensing image processing, and video surveillance. Traditional semantic segmentation methods are typically based on image processing and machine learning techniques. These methods rely primarily on manually designed features and rules or models for segmentation. Common traditional methods include threshold-based segmentation, region growing, edge detection, graph optimization, and cluster analysis. While these traditional methods have addressed the semantic segmentation problem to some extent, they still suffer from numerous shortcomings in complex scenarios. For example, these methods are sensitive to noise, illumination variations, and object morphology, making them difficult to adapt to the diverse demands of different images. Furthermore, due to their limited feature representation capabilities, traditional methods struggle to capture high-level semantic information in images, resulting in suboptimal performance when processing images with complex structures. To address these issues, deep learning methods have been widely used in the field of semantic segmentation. However, deep learning often struggles to achieve good performance in data-scarce scenarios or applications with limited computing resources.
[0004] Considering that deep learning-based image semantic segmentation methods require a high sample size for training, traditional segmentation methods still have important practical value. Therefore, improving traditional methods to effectively address the semantic segmentation needs of complex scenes with a small number of image samples has become a direction worthy of further research. Summary of the Invention
[0005] In order to solve the problem that the image semantic segmentation method based on deep learning is not suitable for scenarios with limited sample numbers, such as cloud density calculation, and the traditional segmentation method has insufficient segmentation accuracy in such scenarios, the present invention provides a cloud density calculation method that combines image features with superpixel partitioning.
[0006] The technical solution provided by the present invention is:
[0007] A cloud density calculation method that combines image features with superpixel partitioning is used to analyze and calculate the cloud density of clouds contained in the sky in an image. The cloud density calculation method includes the following steps:
[0008] Take the original RGB image P0 and convert it to the HSV, GREY, and Lab color spaces, respectively, to obtain the corresponding HSV image P1, grayscale image H1, and Lab image P2. Histogram equalization is performed on the S channel of P1, and the logarithm of the V channel is taken to obtain the color-enhanced image E1. Texture features are extracted from H1 to obtain the texture feature map F1, and morphological operations are performed on F1 to obtain the contour mask Mask1. Highly illuminated areas in P1 are identified and the intensity of the V channel of the pixels in the corresponding areas is reduced. Mask1 is then superimposed and converted to a grayscale image, resulting in the grayscale-enhanced image E2.
[0009] SLIC superpixel segmentation is performed on P0. Background detection is then performed on the resulting superpixel regions using H1. The spatial distribution of the superpixel regions, after background exclusion, is then converted into an adjacency graph. Regions are then merged based on texture difference, color difference, and grayscale difference using F1, E1, and E2, respectively. Next, unclear superpixel regions within the cloud edge are merged using features extracted from the cloud edge. Finally, isolated regions within the cloud edge and interior are merged.
[0010] Based on P1 and P2, the S channel and Lab color space channel values corresponding to each superpixel region after multiple rounds of merging are extracted and a corresponding four-dimensional feature vector is generated. Each four-dimensional feature vector is input into the K-means algorithm for clustering, and the cloud mask Mask0 is extracted from the clustering results. The cloud density is calculated by calculating the area ratio of the cloud area in Mask0 to the total area of clouds and sky.
[0011] As a further improvement of the present invention, the morphological operation for generating the contour mask Mask1 includes erosion and dilation.
[0012] As a further improvement of the present invention, a method for identifying the high-brightness area in P1 and reducing the intensity of the V channel of the pixels in the corresponding area is as follows:
[0013] First, the V channel value of each pixel in P1 is extracted. Pixel regions with V values above the preset brightness threshold v0 are identified as high-light areas, and a binary mask representing these high-light areas is generated. Next, the binary mask is Gaussian filtered to smooth the mask edges. Finally, the binary mask is normalized and multiplied by an appropriate value. The binary mask is subtracted from the original V channel value, ensuring that the resulting V channel value is between 0 and 255.
[0014] As a further improvement of the present invention, the method for background recognition of the segmented super-pixel area in combination with the grayscale image H1 is as follows:
[0015] The grayscale of each pixel in each superpixel area is obtained, and the grayscale mean of the superpixel area is calculated. If the grayscale mean of any superpixel area is lower than 100, it is identified as the background area, otherwise it is the target area.
[0016] As a further improvement of the present invention, a method for merging the segmented superpixel regions based on texture differences in combination with F1 includes:
[0017] (1) Establish an adjacency graph by taking each superpixel region identified as the target region as a node and the adjacent relationship between each node as an edge.
[0018] (2) According to F1, the Euclidean distance between the texture feature means of the two superpixel regions corresponding to each edge is calculated to obtain the texture difference SF between the two and set it as the edge weight.
[0019] (3) A texture difference threshold sf0 is preset, and the superpixel regions corresponding to the two nodes whose edge weights in the adjacency graph are lower than sf0 are merged.
[0020] As a further improvement of the present invention, a method for merging the segmented superpixel regions based on color difference in combination with E1 includes:
[0021] (1) Obtain the adjacency graph after merging based on texture difference.
[0022] (2) According to E1, the Euclidean distance between the color feature means of the superpixel regions corresponding to the two nodes of each edge is calculated to obtain the color difference SC between the two nodes and set it as the edge weight.
[0023] (3) A color difference threshold sc0 is preset, and the superpixel regions corresponding to the two nodes whose edge weights in the adjacency graph are lower than sc0 are merged.
[0024] As a further improvement of the present invention, a method for merging the segmented superpixel regions based on grayscale differences in combination with E2 includes:
[0025] (1) Obtain the adjacency graph after merging based on color difference.
[0026] (2) According to E2, the grayscale mean difference DG between the superpixel regions corresponding to the two nodes of each edge is calculated and set as the edge weight.
[0027] (3) A grayscale difference threshold dg0 is preset, and the superpixel regions corresponding to the two nodes whose edge weights in the adjacency graph are lower than dg0 are merged.
[0028] As a further improvement of the present invention, the method for extracting the features of the cloud edge and merging the unclear superpixel areas at the edge is as follows:
[0029] (1) Obtain the adjacency graph after merging based on grayscale difference.
[0030] (2) Obtain the area of the superpixel region corresponding to each node in the adjacency graph and filter out nodes whose area is smaller than a preset threshold.
[0031] (3) Calculate the texture difference SC between the filtered node and its neighbor nodes, and set it as the edge weight between the two.
[0032] (4) The two superpixel regions corresponding to the node screened out in the adjacency graph and the node with the largest edge weight among its neighboring nodes are merged.
[0033] As a further improvement of the present invention, the method for merging the isolated areas at the edge and inside of the cloud layer is as follows:
[0034] Get the adjacency graph after merging the small areas in the previous step, and filter out the edge nodes that contain only one neighbor node.
[0035] It is determined whether each group of edge nodes and their neighboring nodes meets the following conditions: the average value of the texture feature value of the edge nodes is less than a preset texture threshold f0 and the area of the neighboring nodes is less than a preset area threshold s0.
[0036] If yes, the edge node and its neighbor nodes are merged into superpixel regions.
[0037] The present invention also includes a cloud density calculation device that combines image features with superpixel partitioning, comprising a memory, a processor, and a computer program stored in the memory and executed by the processor. When the processor executes the computer program, it implements the aforementioned cloud density calculation method that combines image features with superpixel partitioning, thereby analyzing and calculating the cloud density of clouds within the sky in an input RGB image.
[0038] The technical solution provided by the present invention has the following beneficial effects:
[0039] The solution provided by this invention solves the image semantic segmentation task in cloud density calculation by creatively combining superpixel segmentation with hierarchical merging using an adjacency graph structure, overcoming the limitations of traditional pixel-level segmentation methods. The SLIC superpixel algorithm divides the image into uniform small regions, reducing the impact of image noise on the segmentation results in traditional methods and improving segmentation accuracy. Spatial relationships between pixels are introduced by establishing an adjacency graph. Multiple feature similarities between graph nodes are gradually merged to enhance segmentation accuracy and improve computational efficiency.
[0040] Compared to deep learning methods, this method does not require large-scale annotated datasets or computationally intensive model training, significantly reducing computing resource consumption and making it suitable for real-time processing and resource-constrained applications. Furthermore, the proposed method is highly robust in addressing common image issues such as noise and illumination variations. It specifically processes image areas with high illumination levels and overlays the enhanced image outline onto the original image, adapting to a variety of image quality and background conditions. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 This is a schematic diagram of the cloud density calculation method that combines image features with superpixel partitioning provided in Example 1 of the present invention.
[0042] Figure 2 It is the original image to be segmented in the verification experiment.
[0043] Figure 3 To verify the experimental Figure 2 Generated texture feature map.
[0044] Figure 4 To verify the experimental Figure 2 The resulting contour mask.
[0045] Figure 5 To verify the experimental Figure 2 The resulting color-enhanced image.
[0046] Figure 6 To verify the experimental Figure 2 The generated grayscale enhanced image.
[0047] Figure 7 To verify the experiment Figure 2 The preliminary segmentation results of the superpixel area.
[0048] Figure 8 The spatial distribution of superpixel regions after identifying and separating the background.
[0049] Figure 9 It is the merging result of super-pixel regions based on texture features.
[0050] Figure 10 It is the merging result of super-pixel regions based on color features.
[0051] Figure 11 It is the merging result of the identified super-pixel regions with high and similar grayscale values.
[0052] Figure 12 It is the merged result of the identified superpixel regions with low and similar grayscale values.
[0053] Figure 13 is the spatial distribution of the superpixel regions after local merging of the superpixel regions belonging to the edge of the cloud.
[0054] Figure 14 The spatial distribution of superpixel regions after local merging of isolated regions contained in the clouds and sky.
[0055] Figure 15 This is the final clustering result diagram of the K-Means algorithm. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0057] Example 1
[0058] This embodiment provides a cloud density calculation method that combines image features with superpixel partitioning, which is used to analyze and calculate the cloud density of clouds contained in the sky in an image. Figure 1 As shown, the cloud density calculation method provided in this embodiment includes the following process:
[0059] Step 1: Preprocess the original image P0 containing the sky and clouds to obtain the grayscale image H1, HSV image P1, Lab image P2, color-enhanced image E1, and grayscale-enhanced image E2 corresponding to different color spaces. The process includes:
[0060] 1.1. Obtain the original RGB image P0 and convert it to HSV, GRAY, and Lab color spaces respectively to obtain the corresponding HSV image P1, grayscale image H1, and Lab image P2. The solution of this embodiment is applicable to RGB images of any size.
[0061] 1.2. Perform histogram equalization on the S channel of P1 and take the logarithm of the V channel to obtain the color enhanced image E1.
[0062] To generate the color-enhanced image, this embodiment first separates the three channels of image P1 within the HSV color space: hue (H), saturation (S), and brightness (V). Histogram equalization is then applied to the S channel to enhance contrast. Finally, the V channel is logarithmically mapped to a range of 0-255 to balance the overall brightness of the image.
[0063] 1.3. Extract the texture features in H1 to obtain the texture feature map F1, and perform morphological operations on F1 to obtain the contour mask Mask1.
[0064] Specifically, for the grayscale image H1, this embodiment uses a rotation-invariant local binary pattern (LBP-ROR) to extract texture features, applies median filtering to the obtained texture feature map and binarizes it to retain the edge contour; finally, the obtained edge contour is enhanced by morphological operations such as corrosion and expansion, and finally a corresponding binary mask Mask1 is obtained.
[0065] 1.4. Identify the high-brightness area in P1 and reduce the intensity of the V channel of the pixels in the corresponding area; then superimpose Mask1 and convert it into a grayscale image to obtain a grayscale enhanced image E2. Specifically, the method of identifying the high-brightness area in P1 and reducing the intensity of the V channel of the pixels in the corresponding area in this embodiment is as follows:
[0066] First, the V channel value of each pixel in P1 is extracted. Pixel regions with V values above the preset brightness threshold v0 are identified as high-light areas, and a binary mask representing these high-light areas is generated. Next, the binary mask is Gaussian filtered to smooth the mask edges. Finally, the binary mask is normalized and multiplied by an appropriate value. The binary mask is subtracted from the original V channel value, ensuring that the resulting V channel value is between 0 and 255.
[0067] Step 2: Use the superpixel segmentation method to divide the original image P0 into multiple superpixel regions. Then, combine the characteristic information contained in the pre-processed grayscale image H1, HSV image P1, Lab image P2, and color enhanced image E1 and grayscale enhanced image E2 to exclude non-detection targets belonging to the background in P0; and gradually merge the superpixel regions belonging to the clouds or sky. The process includes:
[0068] 2.1. Perform SLIC superpixel segmentation on P0.
[0069] In this embodiment, the SLIC superpixel algorithm is used to divide the original image into N=400 superpixel regions to enhance local consistency.
[0070] 2.2. Combine H1 to perform background recognition on the segmented superpixel area.
[0071] Considering that the sky and clouds typically have higher grayscale values in grayscale images, this embodiment sets the labels corresponding to superpixel regions with grayscale values less than 100 to 0, i.e., sets them as background regions and excludes them from subsequent processing. The remaining regions serve as target regions and participate in the subsequent merging of sky and cloud regions.
[0072] 2.3. The spatial distribution of the superpixel area after excluding the background is converted into an adjacency graph. On the adjacency graph, F1, E1, and E2 are combined to merge regions based on texture difference, color difference, and grayscale difference; this allows for a preliminary merging of regions belonging to the sky or clouds.
[0073] Specifically, in the superpixel region merging process, this embodiment first constructs a pixel graph structure based on the superpixel region. In the construction of the graph structure, this embodiment regards each superpixel as a node, and adjacent superpixel regions are connected by edges in the graph structure. The weights of each edge in the graph structure need to be set separately in combination with the features between different superpixel regions, so that each superpixel region can be targeted and merged in combination with different feature information.
[0074] In this embodiment, the merging process is mainly implemented by relying on the texture difference, color difference and grayscale difference between the superpixel areas of adjacent nodes in the graph structure. Generally speaking, areas with small texture differences and color differences should usually belong to the same cloud layer or sky, and for the sky or cloud layer, the color, texture and grayscale of the different areas contained therein should be relatively close. The subsequent three rounds of merging in this embodiment are mainly based on this principle. The three-round merging process includes: (1) combining F1 to merge the segmented superpixel areas based on texture difference; (2) combining E1 to merge the segmented superpixel areas based on color difference. (3) combining E2 to merge the segmented superpixel areas based on grayscale difference.
[0075] It should be noted that in actual applications, the order of merging the three rounds of superpixel regions can be adjusted arbitrarily. In this embodiment, the step-by-step implementation is based on texture differences, color differences, and grayscale differences. This is only one implementation of the present invention. In other embodiments, technicians can adjust this as needed.
[0076] Specifically, the method for merging the segmented superpixel regions based on texture difference in combination with F1 includes the following steps:
[0077] S1: Build an adjacency graph with each superpixel region identified as the target region as a node and the adjacent relationships between nodes as edges.
[0078] S2: Obtain the texture features of each pixel in the texture feature map F1 and calculate the mean texture feature value of all pixels within each superpixel region. Then, calculate the Euclidean distance between the texture feature means of the two superpixel regions corresponding to each edge, and use this distance as the texture difference SF between the two regions. This difference is then set as the edge weight of each edge in the graph structure at this stage.
[0079] S3: Preset a texture difference threshold sf0 and merge the superpixel regions corresponding to the two nodes whose edge weights in the adjacency graph are lower than sf0.
[0080] Specifically, the method for merging the segmented superpixel regions based on color difference in combination with E1 includes the following steps:
[0081] S4: Obtain the adjacency graph after merging based on texture difference.
[0082] S5: Obtain the color features of each pixel in the color enhancement graph E1 and calculate the mean color feature value of all pixels within each superpixel region. Then, calculate the Euclidean distance between the color feature means of the superpixel regions corresponding to the two nodes connected by each edge, and use this distance as the color difference between the two nodes, SC, which is then set as the edge weight of each edge in the graph structure at this stage.
[0083] S6: Preset a color difference threshold sc0 and merge the superpixel regions corresponding to two nodes whose edge weights in the adjacency graph are lower than sc0.
[0084] Specifically, the method for merging the segmented superpixel regions based on grayscale differences in combination with E2 includes the following steps:
[0085] S7: Obtain the adjacency graph after merging based on color difference.
[0086] S8: Obtain the grayscale features of all pixels in the grayscale enhancement image E2 and calculate the mean grayscale feature value of all pixels in each superpixel region. Then, calculate the grayscale mean difference DG between the superpixel regions corresponding to the two nodes connected by each edge, and set it as the edge weight of each edge in the graph structure at this stage.
[0087] S9: Preset a grayscale difference threshold dg0 and merge the superpixel regions corresponding to the two nodes whose edge weights in the adjacency graph are lower than dg0.
[0088] In the process of merging superpixel regions based on grayscale difference, not only the adjacent superpixel regions with larger grayscale intensities can be merged, but also the adjacent superpixel regions with smaller grayscale intensities can be merged.
[0089] 2.4. Combine the features of the extracted cloud edges and merge the unclear superpixel areas in the edges.
[0090] This step is used to identify smaller, simpler textured regions adjacent to multiple more complex textured regions, merging them into a single region. Furthermore, the unclear cloud edges are merged with the clear edges of the cloud.
[0091] Specifically, to achieve the above purpose, the method provided in this embodiment for extracting features of cloud edges and merging unclear superpixel areas at the edges is as follows:
[0092] S10: Obtain an adjacency graph after merging based on grayscale differences.
[0093] S11: Obtain the area of the superpixel region corresponding to each node in the adjacency graph, and filter out nodes whose area is smaller than a preset threshold.
[0094] S12: Calculate the texture difference SC between the filtered node and its neighboring nodes, and set it as the edge weight between the two.
[0095] S13: Merge the two superpixel regions corresponding to the node screened out in the adjacency graph and the node with the largest edge weight among its neighboring nodes.
[0096] 2.5. Merge the isolated areas at the edge and inside of the cloud.
[0097] This step takes into account the fact that, after the previous merge, the cloud layer is divided into its edge outline and its interior. The cloud interior and the sky are quite similar. To distinguish between the two, we consider the characteristics of the cloud layer. The cloud interior is an isolated node, adjacent only to the entire area belonging to the cloud edge. Furthermore, the cloud interior has a simple texture, and the adjacent edge area is small. Therefore, based on this characteristic, the two can be merged.
[0098] In the actual processing process, in order to achieve this effect, it is necessary to find isolated areas with only one adjacent node, determine whether the texture is simple and whether the adjacent area is small, and merge them into one area if so. Specifically, the method for merging the isolated areas at the edge and inside of the cloud layer in this embodiment is as follows:
[0099] S14: Obtain the adjacency graph after the small area regions are merged in the previous step, and filter out the edge nodes that contain only one neighbor node.
[0100] S15: Determine whether each group of edge nodes and their neighboring nodes meets the following conditions: the average texture feature value of the edge node is less than a preset texture threshold f0 and the area of the neighboring nodes is less than a preset area threshold s0. If so, merge the superpixel regions of the edge node and its neighboring nodes.
[0101] Step 3: Extract the values of the S channel and the three channels of the Lab color space of the superpixel area after the above multiple rounds of merging, generate a four-dimensional feature vector, and use the feature vector in the K-means algorithm to cluster each superpixel area.
[0102] In this embodiment, P1 contains the values of the H, S, and V channels corresponding to each pixel in the original image, and P2 contains the values of the L, a, and b channels corresponding to each pixel in the original image. Therefore, combined with each superpixel region after multiple rounds of merging in step 2, the values of the S channel and the three channels of the Lab color space corresponding to each superpixel region can be obtained. By merging the feature information of the above four channels corresponding to each superpixel region, a four-dimensional feature vector corresponding to each superpixel region can be generated. Finally, each four-dimensional feature vector is input into the K-means algorithm for clustering, and the cloud mask Mask0 is extracted from the clustering result.
[0103] Step 4: Calculate the area ratio of the cloud area in Mask0 to the total area of the clouds and sky, which is the cloud density.
[0104] In this embodiment, Mask0 is a mask used to classify clouds and sky (excluding the background area, which has been excluded in the previous process). Therefore, the final cloud density D CF The calculation formula is:
[0105]
[0106] In the above formula, S1 represents the pixel area of the cluster corresponding to the cloud layer in the clustering result in the original image; S2 represents the pixel area of the cluster corresponding to the sky in the original image.
[0107] Example 2
[0108] Based on the solution in Example 1, this embodiment provides a cloud density calculation device that combines image features with superpixel partitioning. The device includes a memory, a processor, and a computer program stored in the memory and executed by the processor. When the processor executes the computer program, it implements the aforementioned cloud density method that combines image features with superpixel partitioning, thereby analyzing and calculating the cloud density of clouds in the sky within an input RGB image.
[0109] The cloud density calculation device provided in this embodiment, which combines image features with superpixel partitioning, is essentially a computer device used to implement the solution in Example 1. In actual application, the computer device can be a program-executable smart terminal, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server, or cabinet server (including a standalone server or a server cluster consisting of multiple servers).
[0110] The computer device described in this embodiment includes at least, but is not limited to, a memory and a processor that can be interconnected via a system bus. The memory (i.e., a readable storage medium) includes flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, a magnetic disk, an optical disk, and the like. In some embodiments, the memory can be an internal storage unit of the computer device, such as the hard disk or internal memory of the computer device. In other embodiments, the memory can also be an external storage device of the computer device, such as a plug-in hard disk equipped with the computer device, a smart media card (SMC), a secure digital (SD) card, a flash memory card, and the like. Of course, the memory can also include both the internal storage unit of the computer device and its external storage devices. In this embodiment, the memory is generally used to store the operating system and various application software installed on the computer device. In addition, the memory can also be used to temporarily store various types of data that have been output or are about to be output.
[0111] In some embodiments, the processor may be a central processing unit (CPU), a graphics processing unit (GPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor is generally used to control the overall operation of the computer device. In this embodiment, the processor is used to run program code stored in the memory or process data.
[0112] Performance Verification
[0113] In order to verify the effectiveness of the cloud density calculation method provided by the present invention that combines image features with superpixel partitioning, technicians conducted Figure 2 The image shown is semantically segmented to test whether the method can effectively segment the clouds with complex textures contained in the sky.
[0114] Among them, this experiment obtained Figure 2 The texture feature map is as follows Figure 3 As shown, the texture feature map is subjected to morphological operations such as corrosion and expansion to obtain a rough contour mask as shown in Figure 4 As shown. The color enhanced image obtained by processing the HSV channel image of the original image is as follows Figure 5 As shown in the figure. The grayscale enhanced image obtained by preprocessing the original image is as follows Figure 6 As shown. The original image is segmented into superpixels, and the 400 original superpixel regions are obtained as follows Figure 7 As shown. After identifying and separating the background, the remaining super-pixel area is as follows Figure 8 As shown. The super pixel area after merging based on the difference of texture features is shown as Figure 9 As shown. The super pixel area after merging based on the color feature difference is shown as Figure 10 As shown. The super-pixel areas with higher grayscale intensity are merged, and the result is as follows Figure 11 As shown. The super-pixel areas with low grayscale intensity are merged, and the result is as follows Figure 12 As shown in the figure, the superpixel areas belonging to the edge of the cloud are locally merged, and the results are as follows Figure 13 The isolated areas contained in the clouds and sky are merged, and the result is as follows Figure 14 shown.
[0115] Finally, according to the four-dimensional feature vector of the merged super-pixel area, after processing by the K-Means algorithm, the mask Mask0 is obtained as follows: Figure 15 As shown. Figure 15 In the figure, the black part is the pre-identified background area, the purple part is the cloud area clustered by the K-Means algorithm, and the yellow part is the cloudless sky area clustered by the K-Means algorithm.
[0116] Combined with the results of the above verification experiments, it can be found that the method of the present invention can achieve accurate semantic segmentation of the background, clouds and sky contained in natural images through traditional methods without relying on a large number of sample images and deep learning-based network models. The performance is very outstanding and the practicability is strong.
[0117] Further analysis of the technical solution provided by this invention reveals that traditional semantic segmentation methods often rely solely on pixel-level color or texture features, which are susceptible to image noise, illumination variations, and complex backgrounds, resulting in low segmentation accuracy, especially at image edges and detailed areas. By introducing superpixel segmentation and graph structure optimization techniques, this method effectively enhances the spatial consistency of segmented regions, significantly improves the accuracy of boundary processing, and avoids pixel-level over-segmentation and noise.
[0118] The advantages of the present invention specifically include:
[0119] 1. Higher segmentation accuracy
[0120] The present invention divides the image into relatively uniform small areas through superpixel segmentation, making the segmentation results more stable and in line with human visual habits. It shows higher accuracy in the representation of edges and detail areas, especially when processing complex scenes.
[0121] 2. Higher computing efficiency
[0122] Compared to complex deep learning methods based on global pixels, the superpixel and clustering methods used in this paper effectively reduce the amount of computation. By first performing superpixel segmentation on the image, the number of pixels involved in the calculation is reduced, reducing the consumption of memory and computing resources.
[0123] 3. Simple and easy to implement
[0124] Compared to deep learning methods, this method does not rely on large-scale annotated datasets or complex neural network models. Its implementation is relatively simple, and the algorithm can be quickly implemented in a conventional computer environment. It can be implemented using open image processing libraries (such as OpenCV and scikit-image), making it highly operational.
[0125] 4. Highly targeted
[0126] This paper focuses on calculating cloud density in images and specifically addresses this problem. Of course, based on the same technical concept, this solution can also be quickly deployed and applied to various other types of image segmentation tasks by adjusting parameters.
[0127] 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 and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A cloud density calculation method combining image features and superpixel partitioning, characterized in that: It includes: Get the original RGB image P0 and convert it to HSV, GREY and Lab color spaces respectively to obtain the corresponding HSV image P1, grayscale image H1 and Lab image P2; perform histogram equalization on the S channel of P1 and take the logarithm of the V channel to obtain the color-enhanced image E1; extract the texture features in H1 to obtain the texture feature map F1, and perform morphological operations on F1 to obtain the contour mask Mask1; identify the high-light areas in P1 and reduce the intensity of the V channel of the pixels in the corresponding area; then superimpose Mask1 and convert it to a grayscale image to obtain the grayscale-enhanced image E2; Perform SLIC superpixel segmentation on P0, and then perform background recognition on the segmented superpixel area in combination with H1. Then, convert the spatial distribution of the superpixel area after excluding the background into an adjacency graph. On the adjacency graph, combine F1, E1, and E2 to merge regions based on texture difference, color difference, and grayscale difference. Then, extract the features of the cloud edge and merge the unclear superpixel areas at the edge. Finally, merge the isolated areas at the cloud edge and inside. The S channel and Lab color space three-channel values corresponding to each superpixel area after multiple rounds of merging are extracted from P1 and P2 to generate the corresponding four-dimensional feature vector and input it into the K-means algorithm for clustering; the cloud mask Mask0 is extracted from the clustering result; the area ratio of the cloud area in Mask0 to the total area of the cloud layer and sky is calculated, which is the cloud density.
2. The cloud density calculation method combining image features and superpixel partitioning as claimed in claim 1, characterized in that: The morphological operations for generating the contour mask Mask1 include erosion and dilation.
3. The cloud density calculation method combining image features and superpixel partitioning as claimed in claim 2, characterized in that: The method to identify the high brightness area in P1 and reduce the intensity of the V channel of the pixels in the corresponding area is: First, extract the V channel value of each pixel in P1, identify the pixel area with a V value higher than the preset brightness threshold v0 as the high-light area, and generate a binary mask to represent the high-light area; then, perform Gaussian filtering on the binary mask to smooth the mask edge; finally, normalize the binary mask and multiply it by a suitable value, subtract the binary mask from the original V channel value, and make the final V channel value between 0 and 255.
4. The cloud density calculation method combining image features and superpixel partitioning as claimed in claim 1, characterized in that: The method for background recognition of the segmented super-pixel area combined with the grayscale image H1 is: The grayscale of each pixel in each superpixel area is obtained, and the grayscale mean of the superpixel area is calculated. If the grayscale mean of any superpixel area is lower than 100, it is identified as the background area, otherwise it is the target area.
5. The cloud density calculation method combining image features and superpixel partitioning as claimed in claim 4, characterized in that: The method of combining F1 with the segmented superpixel regions to merge regions based on texture differences includes: (1) Establish an adjacency graph by taking each superpixel region identified as the target region as a node and the adjacent relationships between nodes as edges; (2) Calculate the Euclidean distance between the texture feature means of the two superpixel regions corresponding to each edge based on F1, obtain the texture difference SF between the two, and set it as the edge weight; (3) A texture difference threshold sf0 is preset, and the superpixel regions corresponding to the two nodes whose edge weights in the adjacency graph are lower than sf0 are merged.
6. The cloud density calculation method combining image features and superpixel partitioning according to claim 5, characterized in that: The method for merging the segmented superpixel regions based on color difference in combination with E1 includes: (1) Obtaining an adjacency graph after merging based on texture difference; (2) Calculate the Euclidean distance between the color feature means of the superpixel regions corresponding to the two nodes on each edge based on E1, obtain the color difference SC between the two, and set it as the edge weight; (3) A color difference threshold sc0 is preset, and the superpixel regions corresponding to the two nodes whose edge weights in the adjacency graph are lower than sc0 are merged.
7. The cloud density calculation method combining image features and superpixel partitioning according to claim 6, characterized in that: The method of combining E2 to merge the segmented superpixel regions based on grayscale differences includes: (1) Obtaining the adjacency graph after merging based on color difference; (2) Calculate the grayscale mean difference DG between the superpixel regions corresponding to the two nodes on each edge according to E2, and set it as the edge weight; (3) A grayscale difference threshold dg0 is preset, and the superpixel regions corresponding to the two nodes whose edge weights in the adjacency graph are lower than dg0 are merged.
8. The cloud density calculation method combining image features and superpixel partitioning according to claim 7, characterized in that: The method to extract the features of the cloud edge and merge the unclear superpixel areas at the edge is: (1) Obtaining the adjacency graph after merging based on grayscale difference; (2) Obtain the area of the superpixel region corresponding to each node in the adjacency graph and filter out nodes whose area is smaller than a preset threshold; (3) Calculate the texture difference SC between the selected node and its neighbor nodes, and set it as the edge weight between the two; (4) The two superpixel regions corresponding to the node screened out in the adjacency graph and the node with the largest edge weight among its neighboring nodes are merged.
9. The cloud density calculation method combining image features and superpixel partitioning as claimed in claim 8, characterized in that: The method for merging the isolated areas at the edge and inside the cloud is: Get the adjacency graph after merging the small areas in the previous step, and filter out the edge nodes that contain only one neighbor node; Determine whether each group of edge nodes and their neighboring nodes meets the following conditions: the mean value of the texture feature value of the edge nodes is less than a preset texture threshold f0 and the area of the neighboring nodes is less than a preset area threshold s0; If yes, the edge node and its neighbor nodes are merged into superpixel regions.
10. A cloud density calculation device that combines image features with superpixel partitioning, comprising a memory, a processor, and a computer program stored in the memory and executed in the processor, characterized in that: When the processor executes the computer program, it implements the cloud density method combining image features and superpixel partitioning as described in any one of claims 1 to 9, thereby analyzing and calculating the cloud density of the cloud layer contained in the sky in the input RGB image.
Citation Information
Patent Citations
Plant leaf identification method based on improved dung beetle optimization algorithm and integrated learning model
CN118840663A
LiDAR point cloud reflection intensity complementation method and system
US11099275B1