A quasi-regular pattern color matching method based on color palette

The quasi-regular pattern color matching method addresses the lack of color harmony and recoloring by integrating color harmony templates and a color decomposition model, enhancing aesthetic appeal and efficiency in pattern design.

CN114862983BActive Publication Date: 2024-12-03ZHEJIANG SCI-TECH UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210499795.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-29
Publication Date
2024-12-03
Estimated Expiration
2042-04-29

AI Technical Summary

Technical Problem

Existing methods for generating quasi-regular patterns lack color harmony and efficient recoloring schemes, making it difficult to enhance their aesthetic appeal and apply them effectively in pattern design.

Method used

A quasi-regular pattern color matching method based on a color palette, which combines color harmony templates with a color decomposition model to generate harmonious patterns, extract a color palette statistically, and recolor using a graph structure to maintain color differences and achieve efficient recoloring.

Benefits of technology

Enhances the aesthetic quality of quasi-regular patterns, allowing designers to adjust colors intuitively while improving recoloring efficiency and suitability for real-time applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114862983B_ABST
    Figure CN114862983B_ABST
Patent Text Reader

Abstract

The present invention discloses a color matching method for quasi-regular patterns based on a color palette, which limits the color of the quasi-regular pattern within the sector range of a color harmony template through function mapping to generate a basic graphic with color harmony; then, a statistical method is applied to extract the color palette from the color harmony quasi-regular pattern, and the adjacent relationship between different color blocks in the graphic is stored as a "graph", and finally, a color decomposition optimization model based on color difference preservation is applied to implement recoloring. The present invention can enhance the aesthetic feeling of the generated quasi-regular pattern, and can facilitate designers to adjust the color of the graphic according to their own intentions, so that it can be better applied to flower pattern design; compared with the traditional quasi-regular pattern generation method, the color of the generated graphic of the present invention is more harmonious, natural and aesthetic; compared with the previous image recoloring methods, the present invention has improvements in recoloring quality and efficiency, and is suitable for real-time interactive applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image color beautification, and in particular relates to a quasi-regular pattern color matching method based on a color palette. Background Art

[0002] Quasi-regular patterns refer to a type of nonlinear graphics generated by deriving a mathematical model based on weak chaos theory by performing Hamiltonian transformation and smoothing operations on uniform random networks. Quasi-regular patterns have strong symmetry and regularity in their structure and are widely used in the pattern design of clothing products. They are an important source of pattern materials in the field of product design. However, the colors of quasi-regular patterns often use random color matching methods, which cannot directly meet the needs of designers and often require cumbersome and complex secondary design.

[0003] Existing research on quasi-regular patterns mainly focuses on the field of textile design. The literature [Pan Hanfei, Zhang Yu. Design method of blue and white artistic style scarves based on weak chaotic graphics [J]. Art and Design (Theory), 2011, 2(3): 237-239] applies weak chaotic graphics to the design of blue and white artistic style scarves; the literature [Jia Fengxia, Zhang Yu. Clothing pattern design method using shadow-type quasi-regular patterns [J]. Journal of Textile Research, 2017, 38(7): 124-129] studies a method for generating quasi-regular patterns with shadow-light effects and applies it to clothing pattern design. The above method achieves the change of pattern by changing the function model and parameters of the quasi-regular pattern.

[0004] In the field of image processing, methods such as image color harmonization and recoloring have been used to study how to improve the beauty of images. Color harmony refers to the harmonious and unified distribution of image colors and can bring people a pleasant visual experience. The literature [Cohen-or D, Sorkine O, Gal R, et al. Color harmonization [J]. ACM Transactions on Graphics, 2006, 25 (3): 624-630] proposed a method to enhance the color harmony of images so that the image color distribution conforms to the color harmony template; the literature [Guo F, Li FX, Nagamachi M, et al. Research on color optimization of tricolor product considering color harmony and users' emotion [J]. Color Research & Application, 2020, 45 (1): 156-171] studied the color optimization of tricolor products based on the principle of color harmony and user emotional characteristics. Image recoloring refers to converting the color of an image while minimizing image distortion. Among them, image recoloring based on the color palette is a method that has been studied more frequently in recent years and is efficient and easy to use. The literature [Zhang Q, Xiao CX, Sun HQ, et al. Palette-based image recoloring using color decomposition optimization [J]. IEEE transactions on image processing, 2017, 26 (4): 1952-1964] uses K-means clustering to obtain the palette, improves the extraction effect through contour filtering, and proposes a recoloring algorithm based on the color decomposition optimization model; the literature [Zhang Q, Nie YW, Zhu L, XiaoC X and Zhang W S. 2021. A blind color separation model for faithful palette-based image recoloring [J]. IEEE Transactions on Multimedia, 2021, PP (99): 1-13] combines palette extraction and recoloring and solves them based on the L0 optimization model. Although it improves the coloring effect, the efficiency is low.

[0005] It can be seen that there are few reports on how to generate aesthetically pleasing quasi-regular patterns, and there is currently no color harmony or recoloring scheme for quasi-regular patterns; how to design a method to enhance the aesthetics of graphics based on the generation principle and color characteristics of quasi-regular patterns so that it can be better applied to pattern design still requires further research and exploration. Summary of the invention

[0006] In view of the above, the present invention provides a quasi-regular pattern color matching method based on a color palette, which first generates a color-harmonious quasi-regular pattern basic graphic based on color harmony and template, and then recolors the basic graphic based on a color decomposition model to enhance the beauty of the generated graphic, while facilitating designers to adjust the graphic color according to their own intentions.

[0007] A quasi-regular pattern color matching method based on a color palette comprises the following steps:

[0008] (1) The generation process of the quasi-regular pattern is combined with the color harmony template, and the color of the graphic is restricted within the range of the color harmony template through the function mapping method to generate a quasi-regular pattern with harmonious color;

[0009] (2) Taking advantage of the small number of colors in the quasi-regular pattern, a statistical method is used to extract the color palette from the quasi-regular pattern;

[0010] (3) To achieve the recoloring goal, the colors in the quasi-regular pattern are represented as linear combinations of colors in the color palette. Based on the block-shaped distribution of the colors in the quasi-regular pattern, the color block distribution of the quasi-regular pattern is stored in the form of a graph structure to construct the color difference preservation energy term in the color decomposition optimization model.

[0011] (4) A color decomposition optimization model based on color difference preservation is applied to recolor the quasi-regular pattern to generate a quasi-regular pattern under a specified color palette.

[0012] Furthermore, the specific implementation process of step (1) is as follows: first, a color harmony template and a rotation angle θ of the sector (ranging from 0° to 360°) are selected, and the number of sectors (generally 1 to 2) and the upper and lower bounds of each sector are recorded; then, the Hamiltonian of each pixel is calculated according to the standard mathematical model of the quasi-regular pattern, and the color of the quasi-regular pattern is restricted to the hue range of the sector by contour segmentation method or direct assignment method, so as to generate a color-harmonious quasi-regular pattern.

[0013] Furthermore, the contour segmentation method sets the segmentation interval according to the calculated Hamiltonian, and assigns the same color to pixels falling in the same interval; assuming that the number of contour cutting is t, the color change step length and step length coefficient K of the sector are calculated by the following formula:

[0014]

[0015]

[0016] Where: S k is the color change step of the kth sector, upbound k and lowbound k are the upper and lower bounds of the kth sector, σ is a constant greater than 0, is the Hamiltonian of the pixel, mod is the modulus operator, k = 1 or 2;

[0017] Then the saturation C of each pixel is S and brightness C v All set to 100, hue C H It is determined by the number of sectors of the selected template;

[0018] When the template contains two sectors, C H The calculation formula is as follows:

[0019]

[0020] When the template contains a sector, C H The calculation formula is as follows:

[0021]

[0022] Furthermore, the direct assignment method directly calculates the color value according to the Hamiltonian, and limits the color value to the hue range covered by the template sector. Specifically, the color change step of the sector is calculated by the following formula:

[0023]

[0024] Where: S k is the color change step of the kth sector, upbound k and lowbound k are the upper and lower bounds of the kth sector, σ is a constant greater than 0, is the Hamiltonian of the pixel, mod is the modulus operator;

[0025] Then the saturation C of each pixel is S and brightness C v All set to 100, hue C H It is determined by the number of sectors of the selected template;

[0026] When the template contains two sectors, C H The calculation formula is as follows:

[0027]

[0028] When the template contains a sector, C H The calculation formula is as follows:

[0029] C H =lowbound1+S1

[0030] Furthermore, the specific implementation method of step (2) is as follows: firstly, the number of pixels of each color in the quasi-regular pattern is counted, and the color with the largest number of pixels is initially added to the color palette, and then the following steps are repeated until no new colors are added to the color palette;

[0031] 2.1 For any color outside the color palette, if the Euclidean distance between the color and every color in the color palette is less than a given threshold, then the color is excluded; if the Euclidean distance between the color and every color in the color palette is greater than a given threshold, then the color is added as the standard color;

[0032] 2.2 Select the color with the largest number of pixels from all the colors to be added. If the number of pixels of this color is greater than a given threshold, then add this color to the color palette.

[0033] Furthermore, in step (3), the colors in the quasi-regular pattern are expressed as linear combinations of colors in the color palette by the following expression:

[0034]

[0035] Where: C j is the color value of the two channels ab in the Lab space of the color j in the quasi-regular pattern, P i is the color value of the two channels ab in the Lab space of color i in the palette, m is the number of colors in the palette, is the linear combination coefficient, that is, P i For C j The weight of .

[0036] Furthermore, the graph structure in step (3) is composed of a point set and an edge set. The vertices in the point set represent simply connected color blocks of the same color, and the edges in the edge set represent the spatial adjacent relationship between color blocks. When two color blocks are connected by an edge, it means that the two color blocks are adjacent. With this representation method, color blocks with the same color value only need to store m variables, which can greatly reduce the storage space and realize the compact representation of the graph, thereby making it possible to improve the computational efficiency. Secondly, the relationship between color blocks is obtained by the edges of the graph, which is convenient for describing the color distribution law.

[0037] Furthermore, the expression of the color decomposition optimization model in step (3) is as follows:

[0038]

[0039] in: Corresponding to the linear combination coefficients from different angles The energy term for the constraint, λ n , r and λ d is the weight of the energy term.

[0040] Furthermore, the energy term The expression is as follows:

[0041]

[0042]

[0043]

[0044]

[0045] Where: n is the number of colors in the quasi-regular pattern.

[0046] Furthermore, the energy term The expression is as follows:

[0047]

[0048]

[0049] Where: C p is the color value of the color of the color block p in the quasi-regular pattern in the Lab space in two channels ab, Φ(p) represents the set of color blocks adjacent to the color block p, P is the number of color blocks in the quasi-regular pattern, q is any color block in the color block set Φ(p), C q is the color value of the two channels ab in the Lab space. is the weight coefficient, that is, the ratio of the sum of the number of pixels of color block p and color block q to the total number of pixels in the image. and is the linear combination coefficient, where Indicates P i For C p The weight of Indicates P i For C q The weight of .

[0050] Furthermore, the step (4) obtains the linear combination coefficients by using the color decomposition optimization model After that, the user edits the color palette and uses the coefficients obtained Recombining with the adjusted color palette achieves recoloring of the aligned regular pattern.

[0051] Based on the above technical solution, the present invention has the following beneficial technical effects:

[0052] 1. The present invention can enhance the aesthetic feeling of the generated quasi-regular pattern, and can facilitate the designer to adjust the color of the pattern according to his own intention, so that it can be better applied to pattern design.

[0053] 2. Compared with the traditional quasi-regular pattern generation method, the color of the generated pattern is more harmonious, natural and aesthetically pleasing.

[0054] 3. Compared with the previous image recoloring methods, the present invention has improved recoloring quality and efficiency and is suitable for real-time interactive applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 It is a schematic diagram of the process of the quasi-regular pattern color matching method of the present invention.

[0056] Figure 2 This is a schematic diagram of the color harmony template used in the present invention.

[0057] Figure 3(a) shows the quasi-regular pattern and the corresponding harmonic template generated by the contour segmentation method.

[0058] Figure 3(b) shows the quasi-regular pattern and the corresponding harmonic template generated by the direct assignment method.

[0059] Figure 4 This is a color palette extracted based on the statistical method of the present invention.

[0060] Figure 5 The diagram is a schematic diagram of storing the adjacent relationship between color blocks in a graph according to the present invention.

[0061] Figure 6 This is a diagram showing the effect of recoloring the regular pattern according to the present invention. DETAILED DESCRIPTION

[0062] In order to describe the present invention more specifically, the technical solution of the present invention is described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0063] like Figure 1 As shown, the quasi-regular pattern color matching method based on the color palette of the present invention comprises the following steps:

[0064] (1) Generate a quasi-regular pattern with harmonious colors.

[0065] The standard mathematical model of quasi-regular pattern is:

[0066]

[0067] Where: x, y are drawing coordinates, q is the drawing control parameter, generally taken as an integer, is the Hamiltonian.

[0068] The family of contour curves determined by the above formula constitutes a quasi-regular pattern showing q-order symmetry. The graphics are generated pixel by pixel, that is, for each pixel coordinate, the Hamiltonian is calculated by the above formula, and the pixel point is assigned a color by dividing the contour lines. Different cutting methods and color assignment methods of the contour curve family will lead to different visual effects.

[0069] Color harmony templates such as Figure 2 As shown, the color harmony template is defined in the HSV space (including hue H, saturation S and lightness V), and the colors in the gray sector area are harmoniously distributed, and the colors of the sector area remain harmonious after rotation.

[0070] The present invention is based on a color harmony template and transforms the regular pattern generation method to make the color of the generated graphics harmonious. The specific steps are as follows:

[0071] ① Select the color harmony template and the sector rotation angle θ (ranging from 0° to 360°), and record the number of sectors and the upper and lower limits of each sector.

[0072] ② Iterate the mathematical model of the quasi-regular pattern, calculate the Hamiltonian of each pixel, and limit the color of the quasi-regular pattern to the hue range of the sector through contour segmentation method or direct assignment method to generate a quasi-regular pattern with harmonious color.

[0073] For the contour segmentation method, the segmentation interval is set according to the calculated Hamiltonian, and the pixels falling in the same interval are given the same color; assuming that the number of contour cutting is t, the color change step size and step size coefficient K of the sector are calculated by the following formula:

[0074]

[0075]

[0076] Where: S k is the color change step of the kth sector, upbound k and lowbound k are the upper and lower bounds of the kth sector, σ is a constant greater than 0, is the Hamiltonian of the pixel, mod is the modulus operator, k = 1 or 2;

[0077] In order to increase the distinction between adjacent color blocks, the present invention sets the saturation C of each pixel S and lightness C v All set to 100, hue C H It is determined by the number of sector areas of the selected template;

[0078] When the template contains two sectors, C H The calculation formula is as follows:

[0079]

[0080] When the template contains a sector, C H The calculation formula is as follows:

[0081]

[0082] For the direct assignment method, the color value is directly calculated according to the Hamiltonian, and the color value is limited to the hue range covered by the template sector. The step size of the color change is calculated by the Hamiltonian:

[0083]

[0084] Then the saturation C of each pixel is S and lightness C v All set to 100, hue C H It is determined by the number of sectors of the selected template;

[0085] When the template contains two sectors, C H The calculation formula is as follows:

[0086]

[0087] When the template contains a sector, C H The calculation formula is as follows:

[0088] C H =lowbound1+S1

[0089] Figure 3(a) and Figure 3(b) show the quasi-regular pattern and its color harmony template generated by the contour segmentation method and the direct assignment method, respectively. The colors of the generated graphics are all within the sector range of the color harmony template, and the graphics are all natural, harmonious, bright and beautiful.

[0090] (2) Extract the color palette.

[0091] According to the characteristic of the quasi-regular pattern having a small number of colors, the present invention applies a statistical method to extract the main color palette of the quasi-regular pattern.

[0092] First, we obtain each color c of the pattern by statistics. i and its corresponding number of pixels n i , and then select the color with the largest number of pixels as the initial palette color; it should be noted that each time a color is added to the palette, each of the remaining colors needs to be examined using the following formula:

[0093]

[0094] Where: p i represents the color that has been added to the palette, d(x, y) measures the Euclidean distance between the two colors x and y, T1 is a given threshold, s i Indicates color c i Is it possible to be selected as a palette color: If it is 1, c i may be selected, otherwise it will not be selected; if the remaining s of each color i If both are 0, it means that no new colors will be added to the palette, and the palette extraction ends directly.

[0095] Then, select the color to be added to the palette using the following formula:

[0096]

[0097] sts i =1

[0098] Where: p i is the selected color. This formula means that the color with the largest number of pixels is selected from the colors that may be added to the palette as the color to be added to the palette. i The number n i Conduct an inspection:

[0099] n i >T2

[0100] Where: T2 is a given threshold; if the above formula is established, the color p will eventually i Add to the palette, otherwise discard, and the palette extraction ends.

[0101] The present invention first uses the color with the largest number of pixels as the initial palette color, and then iteratively adds new colors to the palette through the above formula. The threshold T1 ensures that a reasonable distance is maintained between the palette colors, and the threshold T2 ensures that the palette colors can represent most of the colors of the pattern. Figure 4 The color palette extracted from the color-harmonious and quasi-regular pattern is shown.

[0102] (3) Store the adjacent relationship between color blocks in a graph.

[0103] To achieve the recoloring goal, the present invention represents the color of the quasi-regular pattern as a linear combination of the colors in the palette:

[0104]

[0105] Where: C j is the color value of the two channels ab in the Lab space of the color j in the quasi-regular pattern, Pi is the color value of the two channels ab in the Lab space of color i in the palette, m is the number of colors in the palette, is the linear combination coefficient, that is, P i For C j The weight of .

[0106] According to the characteristic of block-shaped distribution of the color of the quasi-regular pattern, the present invention stores the color block distribution of the quasi-regular pattern using the data structure of "graph":

[0107] G=(V,E)

[0108] Among them: the vertex set V represents the simply connected domain color blocks of the same color (generally the number of color blocks |V| is greater than the number of colors n, that is, |V|>n), and the edge set E represents the spatial adjacent relationship between the color blocks.

[0109] Figure 5 The graph is used to store the adjacent relationship between color blocks. In the graph, color block A is connected to color blocks B and C by edges, indicating that color block A is adjacent to color blocks B and C in the graph. With this representation method, only m variables need to be stored for color blocks with the same color value, which can greatly reduce the storage space and realize the compact representation of the graph, thus making it possible to improve the computational efficiency. Secondly, the relationship between color blocks is obtained by the edges of the graph, which is convenient for describing the color distribution law.

[0110] (4) Recoloring.

[0111] The present invention obtains the combination coefficient by solving the minimum value of the following energy function:

[0112]

[0113] Where: and is the energy term that constrains the linear combination coefficients from different angles, λ n , r and λ d To balance the weights of various energy items.

[0114] Reconstruct the energy term for the color, that is, the reconstructed color should be as close to the original color as possible.

[0115]

[0116] Used to constrain the reconstruction coefficients is a non-negative value to ensure the rationality of the color mixing of the palette, which can be expressed as:

[0117]

[0118] In order to make the reconstructed pattern present as much of the main color given by the color palette as possible, the energy term The L1 norm is used to characterize the sparsity of local combination coefficients, so that the optimizer can choose the color of the palette as much as possible:

[0119]

[0120] In addition, unlike the local smoothness of natural images, the quasi-regular pattern may not be smooth. Since the original quasi-regular pattern adopts the principle of harmonious color distribution, in order to maintain this color distribution law, the present invention adopts the color difference to maintain the energy term Constrain the color difference of adjacent color blocks of the regular pattern:

[0121]

[0122]

[0123] Where: C p is the color value of the color of the color block p in the quasi-regular pattern in the Lab space in two channels ab, Φ(p) represents the set of color blocks adjacent to the color block p, P is the number of color blocks in the quasi-regular pattern, q is any color block in the color block set Φ(p), C q is the color value of the two channels ab in the Lab space. is the weight coefficient, that is, the ratio of the sum of the number of pixels of color block p and color block q to the total number of pixels in the image. and is the linear combination coefficient, where Indicates P i For C p The weight of Indicates P i For C q The weight of .

[0124] In order to calculate the minimum value of the energy function, the present invention adopts the iteratively reweighted least squares (IRLS) method for solution. Each iterative calculation of this method is converted into an m|V|×m|V| positive definite sparse linear system, so the efficient Cholesky decomposition method can be used for solution. At the same time, since the coefficient matrix structure of the linear system is determined by the topological connection relationship of the graph, the structure of the matrix remains unchanged during the iteration process, so the matrix structure can be pre-decomposed to further improve the calculation efficiency.

[0125] After the linear combination coefficients are obtained through the color decomposition optimization model, the user edits the color palette and recombines the obtained coefficients with the adjusted color palette to achieve recoloring of the aligned regular pattern. Figure 6It demonstrates the recoloring of aligned regular patterns. Regardless of editing 1, 2, or 3 colors in the palette, the recolored image can better reflect the colors of the palette.

[0126] The above description of the embodiments is to facilitate the understanding and application of the present invention by those skilled in the art. It is obvious that those skilled in the art can easily make various modifications to the above embodiments and apply the general principles described herein to other embodiments without creative work. Therefore, the present invention is not limited to the above embodiments, and improvements and modifications made to the present invention by those skilled in the art based on the disclosure of the present invention should be within the scope of protection of the present invention.

Claims

1. A quasi-regular pattern color matching method based on a color palette, comprising the following steps: (1) The generation process of the quasi-regular pattern is combined with the color harmony template, and the color of the graphic is restricted within the range of the color harmony template through the function mapping method to generate a quasi-regular pattern with harmonious color; (2) Taking advantage of the small number of colors in the quasi-regular pattern, a statistical method is used to extract the color palette from the quasi-regular pattern; (3) To achieve the recoloring goal, the colors in the quasi-regular pattern are represented as linear combinations of colors in the color palette. Based on the block-shaped distribution of the colors in the quasi-regular pattern, the color block distribution of the quasi-regular pattern is stored in the form of a graph structure to construct the color difference preservation energy term in the color decomposition optimization model. (4) A color decomposition optimization model based on color difference preservation is applied to recolor the quasi-regular pattern to generate a quasi-regular pattern under a specified color palette.

2. The quasi-regular pattern color matching method according to claim 1, characterized in that: The specific implementation process of step (1) is as follows: first, a color harmony template and a rotation angle θ of a sector are selected, and the number of sectors and the upper and lower bounds of each sector are recorded; then, the Hamiltonian of each pixel is calculated according to a standard mathematical model of a quasi-regular pattern, and the color of the quasi-regular pattern is limited to the hue range of the sector by a contour segmentation method or a direct assignment method, so as to generate a color-harmonious quasi-regular pattern.

3. The quasi-regular pattern color matching method according to claim 2, characterized in that: The contour segmentation method sets the segmentation interval according to the calculated Hamiltonian and assigns the same color to pixels in the same interval. Assuming the number of contour cutting is t, the color change step length and step length coefficient K of the sector are calculated by the following formula: Where: S k is the color change step of the kth sector, upbound k and lowbound k are the upper and lower bounds of the kth sector, σ is a constant greater than 0, is the Hamiltonian of the pixel, mod is the modulus operator, k = 1 or 2; Then the saturation C of each pixel is S and brightness C v All set to 100, hue C H It is determined by the number of sectors of the selected template; When the template contains two sectors, C H The calculation formula is as follows: When the template contains a sector, C H The calculation formula is as follows:

4. The quasi-regular pattern color matching method according to claim 2, characterized in that: The direct assignment method directly calculates the color value according to the Hamiltonian and limits the color value to the hue range covered by the template sector. Specifically, the color change step of the sector is calculated by the following formula: Where: S k is the color change step of the kth sector, upbound k and lowbound k are the upper and lower bounds of the kth sector, σ is a constant greater than 0, is the Hamiltonian of the pixel, mod is the modulus operator, k = 1 or 2; Then the saturation C of each pixel is S and lightness C v All set to 100, hue C H It is determined by the number of sectors of the selected template; When the template contains two sectors, C H The calculation formula is as follows: When the template contains a sector, C H The calculation formula is as follows: C H =lowbound1+S1。 5. The quasi-regular pattern color matching method according to claim 1, characterized in that: The specific implementation method of step (2) is as follows: firstly, the number of pixels of each color in the quasi-regular pattern is counted, and the color with the largest number of pixels is initially added to the color palette, and then the following steps are repeated until no new colors are added to the color palette; 2.1 For any color outside the color palette, if the Euclidean distance between the color and every color in the color palette is less than a given threshold, then the color is excluded; If the Euclidean distance between the color and every color in the palette is greater than a given threshold, the color is added as the standard color; 2.2 Select the color with the largest number of pixels from all the colors to be added. If the number of pixels of this color is greater than a given threshold, then add this color to the color palette.

6. The quasi-regular pattern color matching method according to claim 1, characterized in that: In the step (3), the colors in the quasi-regular pattern are expressed as linear combinations of colors in the color palette by the following expression; Where: C j is the color value of the two channels ab in the Lab space of the color j in the quasi-regular pattern, P i is the color value of the two channels ab in the Lab space of color i in the palette, m is the number of colors in the palette, is the linear combination coefficient, that is, P i For C j The weight of .

7. The quasi-regular pattern color matching method according to claim 1, characterized in that: The graph structure in step (3) is composed of a point set and an edge set. The vertices in the point set represent simply connected color blocks of the same color, and the edges in the edge set represent the spatial adjacent relationship between the color blocks. When two color blocks are connected by an edge, it means that the two color blocks are adjacent.

8. The quasi-regular pattern color matching method according to claim 6, characterized in that: The expression of the color decomposition optimization model in step (3) is as follows: in: Corresponding to the linear combination coefficients from different angles The energy term for the constraint, λ n , r and λ d is the weight of the energy term.

9. The quasi-regular pattern color matching method according to claim 8, characterized in that: The energy term The expression is as follows: Where: n is the number of colors in the quasi-regular pattern.

10. The quasi-regular pattern color matching method according to claim 8, characterized in that: The energy term The expression is as follows: Where: C p is the color value of the color of the color block p in the quasi-regular pattern in the Lab space in two channels ab, Φ(p) represents the set of color blocks adjacent to the color block p, P is the number of color blocks in the quasi-regular pattern, q is any color block in the color block set Φ(p), C q is the color value of the two channels ab in the Lab space. is the weight coefficient, that is, the ratio of the sum of the number of pixels of color block p and color block q to the total number of pixels in the image. and is the linear combination coefficient, where Indicates P i For C p The weight of Indicates P i For C q The weight of .