A digital camouflage generation method and device based on color and texture feature clustering

Through a clustering method based on color and texture features, local binary patterns and genetic algorithms are used to optimize the cluster center, which solves the problem of texture features being ignored in existing camouflage generation methods. The generated camouflage images have good camouflage performance and calculation efficiency.

CN114648595BActive Publication Date: 2024-09-24CENT SOUTH UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210328448.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-31
Publication Date
2024-09-24
Estimated Expiration
2042-03-31

AI Technical Summary

Technical Problem

Existing camouflage generation methods mainly focus on color features and ignore texture features, resulting in poor camouflage effects and complex and time-consuming calculations.

Method used

A method based on color and texture feature clustering is used to extract texture features through a local binary pattern algorithm. The genetic algorithm and k-means clustering algorithm are combined to optimize the cluster center to form a digital camouflage image similar to the background.

Benefits of technology

The generated camouflage image takes into account the texture and color characteristics of the background image, improving camouflage performance and reducing computational complexity and time-consuming.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114648595B
    Figure CN114648595B
Patent Text Reader

Abstract

The present application relates to a method, device, computer equipment and storage medium for generating digital camouflage based on color and texture feature clustering. The method comprises: extracting texture features of a background image by an LBP algorithm, and the binary matrix obtained by the LBP method can display the local texture information of the original background image; clustering the color and texture features, color clustering can extract the main color tone of the background image, and texture clustering aims to obtain the texture spots of the image, taking into account the two main features of color and texture; filling the clustered texture spots with the extracted main color to form camouflage, and the color and texture features can be integrated into the camouflage technology, so that the pixel area of ​​each clustered texture spot is equal to the area of ​​each main color. The camouflage generated by the present invention takes into account the texture features and color features of the background image, and has good camouflage performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of digital image processing, and in particular to a method, device, computer equipment and storage medium for generating digital camouflage patterns based on color and texture feature clustering. Background Art

[0002] Camouflage technology is an important part of camouflage technology. Color and texture are two main characteristic elements of camouflage technology. Most traditional camouflage generation methods mainly focus on color feature extraction, while ignoring texture features. Although the method based on the watershed algorithm and background contour segmentation takes the background texture into consideration, the texture features are not obvious, making it difficult to form a texture that is highly similar to the background, and the calculation is complex and time-consuming. Therefore, the existing technology has the problem of poor effect. Summary of the invention

[0003] Based on this, it is necessary to provide a digital camouflage generation method, device, computer equipment and storage medium based on color and texture feature clustering that can take into account the texture and color features of the background image in order to address the above technical problems.

[0004] A digital camouflage generation method based on color and texture feature clustering, the method comprising:

[0005] Acquire an image to be processed, grayscale the image to be processed, extract texture features using a local binary pattern algorithm, and obtain a texture feature matrix;

[0006] Performing color clustering according to the color feature matrix of the image to be processed to determine the main color information of the image to be processed and the pixel area size of each main color;

[0007] Taking the pixel area size of each main color as the cluster size of texture clustering, performing texture clustering according to the texture feature matrix to obtain various types of texture spots;

[0008] According to the pixel area size of each main color and the main color information, the clustered main colors are filled into various texture spots to form a digital camouflage image.

[0009] In one of the embodiments, the method further includes: obtaining color features (R, G, B) and texture features (T) of the pixels of the image to be processed;

[0010] The color feature (R, G, B) and the texture feature (T) are combined into a four-dimensional feature vector (R, G, B, T), and a feature matrix is ​​formed by the four-dimensional feature vector of each pixel;

[0011] The characteristic matrix is ​​optimized by a genetic algorithm to obtain an optimized initial clustering center.

[0012] In one of the embodiments, the method further includes: optimizing the feature matrix by an improved genetic algorithm to obtain optimized initial cluster centers; using the distance between each cluster center in the improved genetic algorithm as the inter-class distance, and using the inter-class distance as the fitness function of the improved genetic algorithm.

[0013] In one of the embodiments, it further includes: obtaining an initial color clustering center according to the initial clustering center;

[0014] Performing color clustering by using a k-means clustering algorithm according to the color initial clustering center and the color feature matrix of the image to be processed;

[0015] The main color information of the image to be processed and the pixel area size of each main color are obtained.

[0016] In one of the embodiments, the method further includes: obtaining an initial texture clustering center according to the initial clustering center;

[0017] Taking the pixel area size of each main color as the cluster size of texture clustering, and performing texture clustering by a k-means clustering algorithm according to the texture initial clustering center and the texture feature matrix;

[0018] Get various texture spots.

[0019] In one embodiment, the method further includes: filling the clustered primary colors into various texture spots according to the pixel area of ​​each primary color; wherein the primary color with a large pixel area is filled into the texture spot with a corresponding large cluster area;

[0020] Forming a digital camouflage image.

[0021] In one of the embodiments, the number of clusters is set to 3 to 6 based on the principle that there should not be too many main camouflage colors.

[0022] A digital camouflage generation device based on color and texture feature clustering, the device comprising:

[0023] A texture feature matrix determination module is used to obtain an image to be processed, grayscale the image to be processed, extract texture features through a local binary pattern algorithm, and obtain a texture feature matrix;

[0024] A color clustering module, used for performing color clustering according to the color feature matrix of the image to be processed, and determining the main color information of the image to be processed and the pixel area size of each main color;

[0025] A texture clustering module, used to take the pixel area size of each main color as the cluster size of texture clustering, perform texture clustering according to the texture feature matrix, and obtain various types of texture spots;

[0026] The color filling module is used to fill the clustered main colors into various texture spots according to the pixel area size of each main color and the main color information to form a digital camouflage image.

[0027] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0028] Acquire an image to be processed, grayscale the image to be processed, extract texture features using a local binary pattern algorithm, and obtain a texture feature matrix;

[0029] Performing color clustering according to the color feature matrix of the image to be processed to determine the main color information of the image to be processed and the pixel area size of each main color;

[0030] Taking the pixel area size of each main color as the cluster size of texture clustering, performing texture clustering according to the texture feature matrix to obtain various types of texture spots;

[0031] According to the pixel area size of each main color and the main color information, the clustered main colors are filled into various texture spots to form a digital camouflage image.

[0032] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0033] Acquire an image to be processed, grayscale the image to be processed, extract texture features using a local binary pattern algorithm, and obtain a texture feature matrix;

[0034] Performing color clustering according to the color feature matrix of the image to be processed to determine the main color information of the image to be processed and the pixel area size of each main color;

[0035] Taking the pixel area size of each main color as the cluster size of texture clustering, performing texture clustering according to the texture feature matrix to obtain various types of texture spots;

[0036] According to the pixel area size of each main color and the main color information, the clustered main colors are filled into various texture spots to form a digital camouflage image.

[0037] The digital camouflage generation method, device, computer equipment and storage medium based on color and texture feature clustering extract texture features of the background image through the LBP algorithm, and the binary matrix obtained by the LBP method can display the texture information of the original background image; by clustering the color and texture feature clusters, the color clustering can extract the main color of the background image, and the texture clustering aims to obtain the texture spots of the image, taking into account the two main features of color and texture; the clustered texture spots are filled with the extracted main color to form camouflage, which can integrate color and texture features into the camouflage technology, and at the same time ensure that the pixel area of ​​each clustered texture spot is equal to the area of ​​each main color. The camouflage generated by the present invention takes into account the texture features and color features of the background image and has good camouflage performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 A schematic diagram of a process of a digital camouflage generation method based on color and texture feature clustering in one embodiment;

[0039] Figure 2 A schematic diagram of an LBP method in an embodiment;

[0040] Figure 3 This is a flowchart of the implementation of the cluster center algorithm optimized by genetic algorithm in the specific embodiment 1;

[0041] Figure 4 Schematic diagrams of two crossover modes of the genetic algorithm in the first specific embodiment, wherein (a) is a schematic diagram of a cluster center crossover operation, and (b) is a schematic diagram of a eigenvalue crossover operation;

[0042] Figure 5 A flowchart of implementing a k-means clustering algorithm for color and texture is provided for a specific embodiment;

[0043] Figure 6 It is a flow chart of a method for generating digital camouflage based on color and texture feature clustering in a specific embodiment 2;

[0044] Figure 7 Graphs of texture features extracted in the second specific embodiment, wherein (a) is a grayscale image after the original image is processed by the grayscale formula, and (b) is a texture feature image obtained by using the LBP method;

[0045] Figure 8 1 is a diagram of the color feature clustering result in the second specific embodiment, wherein (a) is the original image of the snow mountain, (b) is the result image after color clustering, and (c) is the four main color images extracted from the original image;

[0046] Fig. 9 The texture spot diagrams obtained by clustering the texture feature diagrams in the second specific embodiment, wherein (a), (b), (c), and (d) are four types of texture spot diagrams respectively;

[0047] Fig.10 It is a diagram of the camouflage result in the second specific embodiment;

[0048] Fig.11 It is a flowchart of a method for generating digital camouflage based on color and texture feature clustering in specific embodiment 3;

[0049] Fig.12 is a structural block diagram of a digital camouflage generation device based on color and texture feature clustering in one embodiment;

[0050] Fig.13 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is 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 application and are not used to limit the present application.

[0052] In one embodiment, Figure 1 As shown, a digital camouflage generation method based on color and texture feature clustering is provided, comprising the following steps:

[0053] Step 102, obtaining an image to be processed, graying the image to be processed, and then extracting texture features using a local binary pattern algorithm to obtain a texture feature matrix.

[0054] Common texture feature extraction methods include local binary pattern (LBP), gray-level co-occurrence matrix and wavelet transform. Among them, the gray-level co-occurrence matrix and wavelet transform methods obtain feature quantities about texture, which are mainly used for texture analysis and evaluation, and cannot reflect the grayscale image of texture. The LBP method can extract the local texture features of the image, and the binary matrix output by it can obviously reflect the texture of the image. According to the above analysis, the present invention uses the LBP method to extract the texture features of the image. The binary matrix obtained by the LBP method is the same size as the pixel matrix of the original image. The binary matrix can be directly output as an image to directly characterize the local texture features of the image.

[0055] In this embodiment, the image has a uniform pixel size of 256*256, and the LBP method is used to extract image texture features. The local binary pattern (LBP) method is expressed as follows:

[0056] First, grayscale the input RGB color image to obtain a grayscale image. The formula is as follows:

[0057] Gray=0.2989R+0.5870G+0.1140B

[0058] This formula uses a psychological formula, and each coefficient is determined by the sensitivity of the human eye to different colors.

[0059] Each value of the grayscale matrix represents the grayscale value of the pixel in the image, ranging from 0 to 255; the original LBP operator is expressed as taking the grayscale value of the central pixel as the threshold in a 3*3 square matrix, and comparing the grayscale values ​​of the surrounding 8 adjacent pixels with it. If the grayscale value of the surrounding pixels is large, the position of this pixel is marked as 1, otherwise, it is marked as 0. Thus, 8 binary numbers can be generated in the 3*3 area. These 8 binary numbers are encoded clockwise to generate 8-bit binary numbers. When converted to decimal, the value is 0 to 255. This value represents the LBP value of this center point, and is used to represent the texture information of the area. In the above way, a texture matrix of size 256*256 can be formed. The mathematical expression is as follows:

[0060]

[0061] x>0,S(x)=1;

[0062] x<=0, S(x)=0;

[0063] Where (x, y) is the coordinate of the center pixel, p represents the 8 pixels in the neighborhood, and i p is the gray value of the neighborhood pixel, i c is the grayscale value of the center pixel, and the binary matrix of the entire pixel matrix is ​​generated to represent the texture features of the original image. The specific process is as follows Figure 2 .

[0064] Step 104 , color clustering is performed according to the color feature matrix of the image to be processed to determine the main color information of the image to be processed and the pixel area size of each main color.

[0065] Color clustering is used to extract the main color of the image to be processed. After color clustering, the area size of each main color is counted.

[0066] Step 106 , taking the pixel area size of each main color as the cluster size of texture clustering, texture clustering is performed according to the texture feature matrix to obtain various types of texture spots.

[0067] Texture clustering is used to obtain texture spots in an image. Texture spots are clustered according to the size of the main color pixel area, so that the pixel area of ​​each clustered texture spot is equal to the area of ​​each main color.

[0068] Step 108, according to the pixel area size of each main color and the main color information, the clustered main colors are filled into various texture spots to form a digital camouflage image.

[0069] By filling the main color into the texture spots, the generated camouflage has similar texture and color features to the background image and has better camouflage performance.

[0070] In the digital camouflage generation method based on color and texture feature clustering, the texture feature of the background image is extracted by the LBP algorithm, and the binary matrix obtained by the LBP method can show the local texture information of the original background image; by clustering the color and texture feature clusters, the color clustering can extract the main color of the background image, and the texture clustering aims to obtain the texture spots of the image, taking into account the two main features of color and texture; the clustered texture spots are filled with the extracted main color to form camouflage, and the color and texture features can be integrated into the camouflage technology, so that the pixel area of ​​each clustered texture spot is equal to the area of ​​each main color. The camouflage generated by the present invention has texture features and color features similar to those of the background image, and has good camouflage performance.

[0071] In one of the embodiments, the method further includes: obtaining the color features (R, G, B) and texture features (T) of the pixels of the image to be processed; combining the color features (R, G, B) and texture features (T) into a four-dimensional feature vector (R, G, B, T), and forming a feature matrix by the four-dimensional feature vector of each pixel; optimizing the feature matrix by an improved genetic algorithm to obtain an optimized initial clustering center; wherein, in the improved genetic algorithm, the distance between each clustering center is used as the inter-class distance, and the inter-class distance is used as the fitness function of the improved genetic algorithm. Obtaining the color initial clustering center according to the initial clustering center; performing color clustering by the k-means clustering algorithm according to the color initial clustering center and the color feature matrix of the image to be processed; obtaining the main color information of the image to be processed and the pixel area size of each main color. Obtaining the texture initial clustering center according to the initial clustering center; taking the pixel area size of each main color as the cluster size of texture clustering, performing texture clustering by the k-means clustering algorithm according to the texture initial clustering center and the texture feature matrix; obtaining various texture spots.

[0072] K-means clustering is one of the most commonly used algorithms in the field of image segmentation. The algorithm is fast, simple, and efficient. It has high real-time performance. The general steps of the K-means algorithm are:

[0073] (1) Determine the number of clusters to be K clusters, and randomly select K data points from the data as the initial cluster centers;

[0074] (2) Calculate the Euclidean distance from each data point to the K initial cluster centers. Select the initial cluster center with the minimum distance and assign the data point to the cluster corresponding to the cluster center.

[0075] (3) Calculate the average value of each cluster and use the average value to update the cluster center of all clusters;

[0076] Repeat (2)(3) until the criterion function converges.

[0077] It can be analyzed that the selection of the initial cluster center is random, and the clustering result depends on the initial cluster center, resulting in unstable clustering results. Therefore, many researchers use other methods to optimize the k-means algorithm, such as ant colony algorithm, three-level k-means clustering algorithm, genetic algorithm, etc. The genetic algorithm has excellent global optimization capabilities, and the algorithm is simple and easy to implement. Based on this, this embodiment uses a genetic algorithm to optimize the initial cluster center of the k-means algorithm. The optimized clustering algorithm is used for primary color extraction and texture clustering, so that the clustering results are relatively stable and better.

[0078] The general process of genetic algorithm optimization of k-means clustering is as follows:

[0079] (1) Population initialization: randomly select m individuals as initial cluster centers and encode the individuals;

[0080] (2) Fitness function design: clustering criterion function is used as the fitness function to evaluate the fitness value of individuals and distinguish the advantages and disadvantages of individuals. Individuals with large fitness values ​​are more likely to be selected.

[0081] (3) Perform k-means clustering based on the selected initial cluster centers.

[0082] (4) Selection operation: According to the clustering results, the initial centers with different fitness values ​​are selected. Individuals with high fitness have a high probability of being selected for inheritance;

[0083] (5) Crossover operation: exchange some genes of two encoded individuals to form a new cluster center;

[0084] (6) Mutation operation: partially mutate the encoded individuals to form new cluster centers;

[0085] (7) Repeat steps (3), (4), (5), (6) until the maximum number of iterations is reached.

[0086] (8) Clustering is performed using the optimized results as cluster centers.

[0087] In general, clustering algorithms use the maximum inter-class distance and the minimum intra-class distance as a common evaluation of clustering results. The above-mentioned optimization using the intra-class distance as the fitness function is the most common method. Its disadvantage is that each genetic iteration requires a k-means clustering. Although the clustering result optimization accuracy is better, it causes a greater time cost and appears redundant in the algorithm program. This patent proposes an improved method, using the distance between various cluster centers as the inter-class distance, and the inter-class distance as the fitness function of the genetic algorithm, to optimize the initial cluster center of the k-means algorithm so that the selected cluster center meets the principle of maximum inter-class clustering. After the improvement, each iteration of the genetic algorithm does not need to be clustered. After optimization, a k-means clustering is performed. The algorithm program is simplified and the algorithm running time is reduced.

[0088] In the first specific embodiment, Figure 3 The figure shows a specific flow chart of an embodiment of an algorithm for optimizing the initial clustering center of k-means using a genetic algorithm in the method proposed by the present invention. The algorithm embodiment is used to output the optimized initial clustering center, and includes the following steps:

[0089] Step 301, setting parameters, including: number of clusters K, population size m, number of iterations T, crossover and mutation probabilities P and P respectively. c and P m . Generally speaking, the number of camouflage color clusters should not be too many, generally 3 to 6. This patent embodiment takes the cluster number K=4 as an example. The size of the entire data set is the number of pixels of the background image, so the population number is 50, the number of iterations is 100, the crossover probability is 0.6, and the mutation probability is 0.02.

[0090] Step 302, population initialization, includes: converting the color and texture (T) matrices into a (256*256)*4 feature matrix, each row of the feature matrix is ​​a four-feature quantity (R, G, B, T), and the four columns represent the red, green, blue, and texture pixel values, respectively. The image matrix pixels are encoded with real numbers as population individuals, so the value range of the individual is an integer from 0 to 255. K eigenvectors (R1, G1, B1, T1; R2, G2, B2, T2; ...; Rk, Gk, Bk, Tk) are randomly selected from the feature matrix as the initial clustering center to form an individual, the encoding length is 4*K, and the selection is repeated m times to form an initial population with a population size of m.

[0091] Step 303, calculate the fitness value of individuals in the group according to the fitness function. The fitness function value is used to evaluate the quality of individuals in the population. Individuals with large fitness values ​​are more likely to be selected. Define the Euclidean distance of each cluster center as the inter-class distance, and use the inter-class distance as the fitness function, which is expressed as follows:

[0092]

[0093] Among them, Ri and Rj are the selected population individuals, that is, the initial cluster centers, and k is the number of clusters.

[0094] Step 304, select the initial cluster center according to the fitness value, and the individual with a large fitness value has a high probability of being selected. The probability of an individual being selected is as follows:

[0095]

[0096] Ps(i) is the probability of the i-th individual being selected, and Fitness(i) is the fitness value of the i-th individual.

[0097] Step 305, crossover operation is performed on the selected individuals according to the crossover probability. For the two individuals to be crossed, a random number of 0-1 is generated. If the random number is less than the crossover probability Pc, the two individuals are crossed. In the k-means clustering algorithm, the initial cluster center should be generated in the existing data set. To meet this condition, the crossover operation of the genetic algorithm is processed as follows: the cluster centers or the corresponding eigenvalues ​​of the cluster centers of the two individuals are randomly exchanged. The number of centers exchanged is less than the number of clusters, and the number of eigenvalues ​​exchanged is less than the number of eigenvector columns. The two crossover methods increase the possibility of new cluster centers. The schematic diagram is as follows. Figure 4 .

[0098] Step 306, perform mutation operation on the individuals after the crossover operation according to the mutation probability. Similarly, the mutated individuals should be selected from the feature vector set to ensure that the initial cluster center is the data in the data set. Specifically, for a feature value of the first cluster center, replace other values ​​of the same feature according to the mutation probability, repeat four times, and complete the mutation of the first feature value of the four cluster centers. Repeat four times to complete the mutation of the four feature values ​​of the four cluster centers.

[0099] Step 307, output the optimized cluster centers. At this time, the initial cluster centers belong to the above feature matrix and meet the condition of maximum inter-class distance. K-means clustering is performed on color (R, G, B) and texture features (T) according to the optimized initial k cluster centers (R, G, B, T). The algorithm flow chart is as follows Figure 5 shown.

[0100] like Figure 5 The following is a flowchart of the implementation of color and texture clustering in this patent. To ensure that the pixel area of ​​the main color is equal to the pixel area of ​​the texture spot, the color features are first clustered by k-means, the pixel area size of each main color is recorded, and texture clustering is performed according to the pixel area size of the main color. The main color of the image and the texture spots are obtained. The details are as follows:

[0101] Step 501, input the feature matrix to be clustered. The feature matrix is ​​the color matrix of the background image, which is an RGB feature matrix with a size of (256*256)*3, or the binary texture matrix of the background image with a size of (256*256)*1.

[0102] Step 502: Input the initial cluster centers optimized by the genetic algorithm, including the cluster centers of color features and the cluster centers of textures.

[0103] Step 503, clustering the color feature matrix: calculating the Euclidean distance between the color feature value X in the color feature matrix and each cluster center Ci, the expression is as follows:

[0104]

[0105]

[0106] D=(XC) 2

[0107] Step 504: Compare the distance between the pixel feature value X and each cluster center Ci according to the Euclidean distance calculated above, and divide the pixel into the class to which the cluster center belongs according to the principle of minimum distance between the feature value and each cluster center, thus completing the initial cluster division.

[0108] Step 505, calculate the average value of each point in each category, and update the previous cluster center with the average value. It is expressed as follows:

[0109]

[0110] |C i | is the number of all elements in the i-th category.

[0111] Step 506, determine whether the criterion function has converged. If the criterion function is less than the set threshold, the final clustering result is output. Otherwise, the updated cluster center executes operations 503 to 505 until the criterion function converges. The criterion function is the sum of the squares of the distances of each class, and the formula is as follows:

[0112]

[0113] Step 507: Output the result. The main color extraction is completed, and the pixel area size of each main color is calculated at the same time.

[0114] Step 508: Cluster the texture features according to the above color clustering process and record the cluster center. Then, re-cluster and divide according to the area of ​​the main color pixels.

[0115] Step 509: record the sizes of the main color areas as m1, m2, ..., mk, and the texture cluster centers as Ct1, ..., Ctk. Calculate the distance from the texture feature value to the texture cluster center Cti.

[0116] Step 510: reclassify the m1 points closest to the first cluster center Ct1 into one category. Remove the classified data and reclassify the m2 data closest to Ct2 into one category. Repeat k times to complete the final classification.

[0117] In one of the embodiments, the method further includes: filling the clustered primary colors into various texture spots according to the pixel area of ​​each primary color; wherein the primary color with a large pixel area is filled into the texture spot with a corresponding large cluster area; and a digital camouflage image is formed.

[0118] In the second specific embodiment, Figure 6 As shown, a digital camouflage generation method based on color and texture feature clustering is provided, including: inputting a background image, extracting image texture features using the LBP method, optimizing the initial clustering center using a genetic algorithm, clustering the color and texture feature matrix using the optimized k-means algorithm, and filling the main color into the clustered texture spots to form camouflage.

[0119] Figure 7 The figure shows an example of extracting a texture feature map in the second specific embodiment, where 7(a) is a grayscale image obtained by processing the grayscale formula of the original image, and the grayscale image is used to extract texture features. 7(b) shows a texture feature image obtained by using the LBP method for the grayscale image of 7(a), which reflects the texture features of the original image.

[0120] Figure 8 The figure shows an example of color feature map extraction in the second specific embodiment, using the above clustering algorithm to extract the main color of the background image, and the number of clusters is 4. 8(a) is the original image of the snow mountain, 8(b) is the result image after color clustering, and 8(c) is the four main color images of the extracted original image.

[0121] The pixel areas (area percentage) of each main color are calculated as follows: 38076 (0.581), (11338) 0.173, 8126 (0.124), 8061 (0.123).

[0122] Fig. 9 The following is an example of a texture spot map of the second specific embodiment. Figure 7 The texture image in (b) is clustered with 4 clusters, and we get Fig. 9There are 4 types of texture spot maps (the brightness of spots is 1, and the brightness of non-spots is 0). The pixel area of ​​each type of spot should be determined by the above main color area, which are 38076(0.581), (11338)0.173, 8126(0.124), and 8061(0.123) respectively.

[0123] Fig.10 The following is an example of generating a camouflage image in the second embodiment. The background image is a snowy field. Figure 8 The four primary colors obtained in (c) are filled into Fig. 9 The camouflage image is formed from the four types of texture spots in the image. The camouflage image combines the main color features and texture features, and ensures that the main color area is the same as the texture spot area.

[0124] In specific embodiment 3, Fig.11 As shown in the figure, taking the forest grassland background as an example, the LBP method is first used to extract the texture features of the background grayscale image; then the genetic algorithm is used to optimize the initial clustering centers of color and texture features; the color features are first clustered to obtain the main color features, and the area of ​​each main color is calculated; then the texture features are clustered according to the size of the main color area to obtain texture spots; the extracted main color is filled into the texture spots to synthesize the final camouflage image.

[0125] The camouflage image shown in this patent is displayed as a black and white image after grayscale processing and does not represent the actual color of the image.

[0126] It should be understood that although Figure 1 , 3 The steps in the flowcharts of , 5, and 6 are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 , 3 At least part of the steps in , 5, and 6 may include multiple sub-steps or multiple stages. These sub-steps or stages do not necessarily have to be executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages does not necessarily have to be sequentially, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0127] In one embodiment, Fig.12 As shown, a digital camouflage generation device based on color and texture feature clustering is provided, comprising: a texture feature matrix determination module 1202, a color clustering module 1204, a texture clustering module 1206 and a color filling module 1208, wherein:

[0128] The texture feature matrix determination module 1202 is used to obtain an image to be processed, grayscale the image to be processed, and extract texture features using a local binary pattern algorithm to obtain a texture feature matrix;

[0129] A color clustering module 1204 is used to perform color clustering according to the color feature matrix of the image to be processed, and determine the main color information of the image to be processed and the pixel area size of each main color;

[0130] A texture clustering module 1206 is used to perform texture clustering according to a texture feature matrix using the pixel area of ​​each main color as the cluster size of texture clustering to obtain various types of texture spots;

[0131] The color filling module 1208 is used to fill the clustered main colors into various texture spots according to the pixel area size of each main color and the main color information to form a digital camouflage image.

[0132] The color clustering module 1204 is also used to obtain the color features (R, G, B) and texture features (T) of the pixels of the image to be processed; combine the color features (R, G, B) and texture features (T) into a four-dimensional feature vector (R, G, B, T), and form a feature matrix with the four-dimensional feature vector of each pixel; optimize the feature matrix through a genetic algorithm to obtain an optimized initial clustering center.

[0133] The color clustering module 1204 is also used to optimize the feature matrix through an improved genetic algorithm to obtain optimized initial cluster centers; in the improved genetic algorithm, the distance between each cluster center is used as the inter-class distance, and the inter-class distance is used as the fitness function of the improved genetic algorithm.

[0134] The color clustering module 1204 is also used to obtain the color initial clustering center according to the initial clustering center; perform color clustering through the k-means clustering algorithm according to the color initial clustering center and the color feature matrix of the image to be processed; and obtain the main color information of the image to be processed and the pixel area size of each main color.

[0135] The texture clustering module 1206 is also used to obtain the initial texture clustering center based on the initial clustering center; take the pixel area size of each main color as the cluster size of texture clustering, and perform texture clustering through the k-means clustering algorithm based on the texture initial clustering center and the texture feature matrix; and obtain various types of texture spots.

[0136] The color filling module 1208 is also used to fill the clustered main colors into various texture spots according to the pixel area of ​​each main color; wherein the main color with a large pixel area is filled into the texture spot with a corresponding large cluster area, thereby forming a digital camouflage image.

[0137] The specific definition of the digital camouflage generation device based on color and texture feature clustering can be found in the above definition of the digital camouflage generation method based on color and texture feature clustering, which will not be repeated here. Each module in the above digital camouflage generation device based on color and texture feature clustering can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0138] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.13 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a digital camouflage generation method based on color and texture feature clustering is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse, etc.

[0139] Those skilled in the art will understand that Fig.13 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0140] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above method embodiment when executing the computer program.

[0141] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiment are implemented.

[0142] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0143] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0144] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A digital camouflage generation method based on color and texture feature clustering, characterized in that: The method comprises: Acquire an image to be processed, grayscale the image to be processed, extract texture features using a local binary pattern algorithm, and obtain a texture feature matrix; Obtaining color features R, G, B and texture features T of the pixels of the image to be processed, combining the color features R, G, B and the texture features T into a four-dimensional feature vector R, G, B, T, and forming a feature matrix from the four-dimensional feature vector of each pixel; The characteristic matrix is ​​optimized by an improved genetic algorithm to obtain an optimized initial cluster center; in the improved genetic algorithm, the distance between each cluster center is used as the inter-class distance, and the inter-class distance is used as the fitness function of the improved genetic algorithm; Performing color clustering according to the color feature matrix of the image to be processed to determine the main color information of the image to be processed and the pixel area size of each main color; Taking the pixel area size of each main color as the cluster size of texture clustering, performing texture clustering according to the texture feature matrix to obtain various types of texture spots; According to the pixel area size of each main color and the main color information, the clustered main colors are filled into various texture spots to form a digital camouflage image.

2. The method according to claim 1, characterized in that: Performing color clustering according to the color feature matrix of the image to be processed to determine the main color information of the image to be processed and the pixel area size of each main color includes: Obtaining a color initial clustering center according to the initial clustering center; Performing color clustering by using a k-means clustering algorithm according to the color initial clustering center and the color feature matrix of the image to be processed; The main color information of the image to be processed and the pixel area size of each main color are obtained.

3. The method according to claim 2, characterized in that The pixel area size of each main color is used as the cluster size of texture clustering, and texture clustering is performed according to the texture feature matrix to obtain various types of texture spots, including: Obtaining an initial texture clustering center according to the initial clustering center; Taking the pixel area size of each main color as the cluster size of texture clustering, and performing texture clustering by a k-means clustering algorithm according to the texture initial clustering center and the texture feature matrix; Get various texture spots.

4. The method according to claim 3, characterized in that According to the pixel area size of each main color, the clustered main color is filled into various texture spots according to the main color information to form a digital camouflage image, including: According to the pixel area of ​​each primary color, the clustered primary colors are filled into various texture spots; wherein the primary colors with large pixel areas are filled into the texture spots with corresponding large cluster areas; Forming a digital camouflage image.

5. The method according to any one of claims 1 to 4, characterized in that: According to the principle that the main camouflage color should not be too much, the number of clusters is 3 to 6.

6. A digital camouflage generation device based on color and texture feature clustering, characterized in that: The device comprises: A texture feature matrix determination module is used to obtain an image to be processed, grayscale the image to be processed, extract texture features through a local binary pattern algorithm, and obtain a texture feature matrix; A color clustering module is used to obtain the color features R, G, B and texture features T of the pixels of the image to be processed, combine the color features R, G, B and the texture features T into a four-dimensional feature vector R, G, B, T, and form a feature matrix with the four-dimensional feature vector of each pixel; optimize the feature matrix by an improved genetic algorithm to obtain an optimized initial cluster center; in the improved genetic algorithm, the distance between each cluster center is used as the inter-class distance, and the inter-class distance is used as the fitness function of the improved genetic algorithm; perform color clustering according to the color feature matrix of the image to be processed, and determine the main color information of the image to be processed and the pixel area size of each main color; A texture clustering module, used to take the pixel area size of each main color as the cluster size of texture clustering, perform texture clustering according to the texture feature matrix, and obtain various types of texture spots; The color filling module is used to fill the clustered main colors into various texture spots according to the pixel area size of each main color and the main color information to form a digital camouflage image.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Digital camouflage pattern generation method based on image fractal texture

    CN108510562A

  • Digital camouflage generation method and system based on error diffusion dithering algorithm

    CN108765267A