Printing pattern color matching scheme graph recommendation method based on color analysis
Through the method based on color analysis, the color characteristics of the printed pattern and color scheme diagram are extracted, and color segmentation and similarity calculation are performed, which solves the complex calculation and cold start problems of recommendation system in the existing technology, and achieves a fast and diverse color scheme diagram recommendation.
Patent Information
- Application Number
- CN202411378831.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-03-14
AI Technical Summary
The existing deep learning recommendation system has problems such as complex calculation, high computing resource consumption, cold start problems and poor real-time performance in the recommended printed pattern color scheme diagrams, making it difficult to quickly and effectively recommend color scheme diagrams.
Using a color analysis method, the color feature extraction, color subdivision of printed patterns and color scheme diagrams, cosine similarity calculation and sorting are achieved, and the rapid recommendation of color scheme diagrams is achieved.
While ensuring real-time recommendations, a variety of color schemes are provided, which solves the problems of complex computing, high resource consumption and cold start in the prior art, and improves the efficiency and effect of recommendations.
Smart Images

Figure CN119622841A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent auxiliary design of printed patterns, and in particular to a method for recommending a printed pattern color scheme diagram based on color analysis. Background Art
[0002] The textile industry is an important part of China's economic industry and has played an important role in China's economic development. Digital printing technology has become a development trend in the production of cloth in the textile industry due to its advantages of green energy saving, fast proofing and low cost. With the promotion of economic development and the Internet, personalized, novel and fashionable clothing has gradually become a new market demand, bringing a large number of digital printing pattern market orders. Printing pattern color matching technology can produce a multi-color pattern with one flower, which is one of the key factors for designers and factories to win market orders. The printing pattern color matching workflow is mainly divided into two links: selecting color scheme diagrams and printing pattern color matching. Among them, selecting color scheme diagrams often requires designers to spend a lot of time and energy. This is because the selection of color scheme diagrams needs to take into account the complexity and diversity of color matching, the color style between printing patterns and color scheme diagrams, and the aesthetic needs of consumers. Therefore, designers have an urgent need for color scheme diagram recommendation technology.
[0003] The existing patent application with application number 202311846821.2 discloses a multi-layer printed pattern color matching method based on global feature guidance, including: pre-processing the original printed pattern in a multi-layer format to obtain a content map, a material map of each layer, and a corresponding layer effect; constructing a multi-layer printed pattern color matching model for color matching the content map by extracting style map features to obtain global features, and guiding the material map to color match based on the global features; based on the style map and the content map, using the multi-layer printed pattern color matching model to obtain the output results about each material map; post-processing the output results based on the layer effect to obtain the multi-layer printed pattern color matching results. And the patent application with application number 202310702614.3 discloses a high-resolution printed pattern color matching method based on a deep neural network, building a neural network including a symmetrical encoder module and a decoder module, and setting a feature transformation module corresponding to the encoder module and the decoder module; extracting style map features with the trained neural network and obtaining feature transformation parameters of the original content map thumbnail, completing the original image style migration with the feature transformation parameters and style map features, and obtaining a high-resolution printed pattern color matching result map.
[0004] At present, deep learning technology has begun to be applied in various recommendation systems, but it also faces various problems. Lu et al. proposed a graph-based algorithm (see LU SY, CHEN HP, ZHOU XZ, et al. Graph-based collaborative filtering with MLP. Mathematical Problems in Engineering. 2018: 1-10) to learn the preferences and interests of all users with an improved kernel function, and use the MLP method to map the vectors of users and items to the neural network. Through the operation of neurons, more potential information between users and items can be learned. This method can not only discover some potential features between users by mapping user information to the network, but also obtain higher accuracy and recommendation effects. However, this method is overly dependent on user information, and has problems such as complex calculations, high consumption of computing resources, and cold start. Tuinhof et al. used convolutional neural networks as image feature extractors (see TUINHOF H, PIRKER C, HALTMEIER M. Image based fashion product recommendation with deep learning. 4th International Conference on Machine Learning, Optimization and Data Science. Volterra: Springer Cham, 2018), extracted the type features of images uploaded by customers, and used ranking algorithms to provide image recommendations similar to the images, which has better robustness and performance than more traditional content-based recommendation systems. However, this method requires labeling of images, preprocessing of images and storage of features, which has problems such as poor real-time performance, high storage consumption, and poor interpretability of recommendation logic. Summary of the invention
[0005] In order to avoid the problems existing in the existing deep learning recommendation system and realize the fast and effective recommendation of color scheme diagrams, the present invention provides a method for recommending a print pattern color scheme diagram based on color analysis, and the specific steps are as follows:
[0006] (1) Input the print pattern and color scheme library;
[0007] The user inputs a print pattern to be matched and a color scheme library, where the library is a set of color scheme images selected by the user according to color matching requirements, including various color matching styles.
[0008] (2) Color feature extraction of color scheme diagram;
[0009] There are many choices for color scheme diagrams, which can be designed prints, hand-painted pictures, or photos of scenery, etc. The contents of these color scheme diagrams vary greatly, so it is necessary to extract and save the color features required in the content through color analysis methods. In addition, the image formats of color scheme diagrams are different, and the color space, data storage format, compression method, etc. are all different. Therefore, when processing, the format of the color scheme diagram needs to be converted first to ensure that it can be processed normally. Based on the above analysis, the specific steps of the present invention for extracting color features of the color scheme diagram are as follows:
[0010] (2-1) Color scheme image format conversion;
[0011] The color scheme image data format is converted into png format using existing image processing tools to obtain the color scheme Figure S1, and the color space is in RGB format.
[0012] (2-2) Calculate the average brightness and black and white identifiers of the color scheme diagram;
[0013] First, calculate the mean of the three channel values of R, G, and B of the color scheme S1 respectively, and combine the three means to get the mean color of S1. mean ; Then calculate the average brightness S of the color scheme in the HSL color space according to formula (1): Lmean .
[0014]
[0015] In formula (1), CMax represents Color mean The maximum value of the three channels R, G, and B. CMin represents Color mean The minimum value of the three channels R, G, and B.
[0016] Then, the average brightness S is calculated according to formula (1): Lmean , S Lmean With the threshold T W and T B Compare and obtain the black and white identifier S FWB The value of .
[0017]
[0018] In formula (2), T W Represents the pure white threshold, T B Represents the pure black threshold, T W The value range is [210,230], T B The value range is [50,90]. Lmean Greater than T W Color scheme diagram and average brightness SLmean Less than T B The color scheme diagram of the black and white identifier S FWB Set to true; otherwise, the black and white identifier S FWB Set to false. The black-white identifier is used to distinguish between a color scheme diagram that is dominated by black and white and other color scheme diagrams.
[0019] (2-3) Calculate the main color hue of the color scheme diagram;
[0020] The theme color hue can effectively distinguish the printed pattern and the color scheme diagram with similar main colors, ensuring the difference between the printed pattern and the color scheme diagram. Considering that the Kmeans clustering algorithm only focuses on color distribution and is less affected by the image resolution, the present invention uses the Kmeans clustering algorithm to calculate the main color hue of the color scheme diagram. The specific sub-steps are as follows:
[0021] (2-3-1) First, use the nearest neighbor interpolation method to scale the color scheme image S1 to the long side L s1 The color scheme obtained is shown in Figure S2, L s1 The value range is [200,400].
[0022] (2-3-2) Then flatten S2 to obtain an image data string D in the form of (W2×H2,C), where W2 and H2 are the length and width of S2, and C is the number of channels of S2. Then use the Kmeans clustering algorithm to process the image data string D and select K n cluster heads, the number of iterations is K p . Where K n The value range is [10,15], K p The value range is [100,150].
[0023] After the Kmeans clustering algorithm is completed, the values of the three channels are combined according to the output of the algorithm to obtain a color list (n1, n2, ..., n k ) and the corresponding color proportion (r1, r2, …, r k ). Where n i represents the center color of the cluster, r i Represents the proportion of the number of pixels in each cluster to the total number of pixels. Among these colors, the color with the highest proportion is selected as the main color of the color scheme Figure S1, denoted as Color m According to the hue conversion formula (3), Color m Hue S hue , where CMax represents Color mean The maximum value of the three channels R, G, and B. CMin represents Color meanThe minimum value of the three channels R, G, and B.
[0024]
[0025] (2-4) extracting the color histogram and hue histogram of the color scheme diagram;
[0026] The color scheme image S1 is scaled to size (k, k) using the nearest neighbor interpolation method to obtain the color scheme image S3, where the value range of k is [32,128]. The RGB color channels in S3 are mapped to M c color intervals, where M c The value range is [8,64]; according to formula (4), the unique color index value of each pixel is calculated, and then the number of occurrences of each color index value, that is, the number of pixels corresponding to the color index value, is counted to obtain the color histogram SH color .
[0027]
[0028] In the above statistical color histogram SH color At the same time, the RGB channel value of each pixel is calculated according to the hue conversion formula (3) to obtain the corresponding hue, and the number of occurrences of the hue value is counted to obtain the hue histogram SH hue .
[0029] (3) Extraction of color features of printed patterns;
[0030] Print patterns are usually products of artistic design, and the content information they contain is usually abstract, such as color, color distribution, brightness, and color style. In order to accurately perceive the content of the pattern, a color analysis method is needed to extract and save the information. In addition, due to the high-definition requirements of printed patterns, the resolution of uploaded printed patterns is relatively large. In order to ensure speed, the uploaded high-definition patterns need to be scaled. Based on the above analysis, the sub-steps of extracting the color features of printed patterns are as follows:
[0031] (3-2) Scaling the printed pattern;
[0032] According to the resolution W×H of the input print pattern P1, the print pattern P1 is scaled to the long side L using the nearest neighbor interpolation method. s2 Get the printed pattern P2, where L s2 The value range is [700,1500].
[0033] (3-2) Calculate the average brightness of the printed pattern, the main color hue, and extract the color histogram and phase histogram;
[0034] Refer to step (2-2) to calculate the average brightness C of the printed pattern P2 Lmean And black and white identifier C FWB, (2-3) Calculate the main color hue C of the printed pattern P2 hue And (2-4) extract the color histogram CH of the printed pattern P2 color and hue histogram CH hue , and obtain a printed pattern P3 with a length and width of (k, k).
[0035] (3-3) Extracting the color style of printed patterns
[0036] Traverse the color histogram CH color , find CH color The continuous peaks in the interval are merged into one interval to obtain the peak interval set R = ([idx1, idx2],…, [idx n-2 ,idx n-1 ],[idx n ,idx n+1 ]). At the same time, in order to reduce redundancy, the distance R between two adjacent peaks is calculated according to formula (5): d , R d The distance threshold T from the peak d If the comparison is less than, the two peak intervals are merged into one peak interval, where T d The value range is [2,5].
[0037] R d =idx n -idx n-1 (5)
[0038] where idx n Represents the index value of the next peak interval, idx n-1 The index value representing the end of the previous peak interval.
[0039] After completing the peak interval division and merging, the peak interval set R is obtained pk , calculate the proportion of pixels in the peak interval in the printed pattern P3 according to formula (6): pk .
[0040]
[0041] where idx i Represents the index value of the beginning of the peak interval, idx j Represents the index value at the end of the peak interval, CH color [m] represents the number of pixels under the index value, and k is the length and width of the printed pattern P3. p , if Per pk Less than T p From R pk Delete this interval, otherwise keep this interval, where Tp The value range is [0.009,0.030].
[0042] After filtering, the peak set R is obtained. mpk , use the following rules to determine whether the printed pattern has a distinct color style or a blurred color style.
[0043] If the peak set R mpk The number of peak intervals is greater than the set threshold T num , then the printed pattern is considered to have a distinct color style, among which T num The value range is [2,6].
[0044] If R mpk The number of peak intervals is less than the set threshold T num , then further according to the printed pattern black and white identifier C FWB Judge, when C FWB If it is true, the color style of the printed pattern is judged to be distinct, otherwise it is judged to be fuzzy.
[0045] If R mpk The number of peak intervals is equal to the set threshold T num Then further according to CH hue Judge, when CH hue If the corresponding peak interval in is not concentrated in two adjacent hue values, the printed pattern is considered to have a distinct color style; otherwise, further according to the printed pattern black and white identifier C FWB Judge, if C FWB If it is true, the color style of the printed pattern is judged to be fuzzy, otherwise it is judged to be clear in color style.
[0046] (4) Classification and scoring of color scheme diagrams;
[0047] The print pattern can be viewed as a vector in a high-dimensional space, where each dimension represents a feature of the image, such as color, brightness, hue, etc. Therefore, by using cosine similarity to calculate the distance between the print pattern and the color scheme map in the color histogram and hue histogram, the similarity between the print pattern and the color scheme map can be determined. In addition, the efficient calculation of cosine similarity can ensure the rapid response of the recommendation method, and alleviate the cold start problem in the face of a lack of user interaction data through similarity.
[0048] Based on the above analysis, the steps of classifying and scoring the color scheme diagram in the present invention are as follows:
[0049] (4-1) Color scheme diagram color subdivision;
[0050] The color style of printed patterns is often specially designed by designers and can be considered as a high-dimensional color distribution information. Therefore, it is necessary to distinguish printed patterns according to their color style and use different color segmentation methods to classify the color scheme diagram. According to the above analysis, the color segmentation steps of the color scheme diagram are as follows:
[0051] (4-1-1) Classification of printing patterns, colors and styles;
[0052] According to step (3-3), the printed patterns are divided into printed patterns with distinct color styles and printed patterns with fuzzy colors. Different color scheme diagram color segmentation methods are used for printed patterns with different color styles. The color segmentation steps of the color scheme diagram of printed patterns with different color styles are as follows:
[0053] (4-1-1-1) Color scheme and color subdivision of printed patterns with distinctive color styles
[0054] First, according to formula (7), the color scheme diagram is divided into two categories, Cate1 and Cate2.
[0055]
[0056] Where S represents the color scheme diagram, C hue and S hue Respectively represent the hue of the theme color of the printed pattern and the hue of the theme color of the color scheme diagram, S FWB Represents the black and white identifier of the color scheme. If the hue of the theme color of the color scheme is different from the hue of the main color of the printed pattern and the black and white identifier of the color scheme is false, the color scheme S belongs to Cate1; otherwise, the color scheme S belongs to Cate2.
[0057] Cate1 and Cate2 are further classified according to the average brightness of the color scheme map.
[0058]
[0059] In the formula, S represents the color scheme diagram, S Lmean represents the average brightness of the color scheme diagram, T Low and T high Represent the dark tone threshold and the light tone threshold, T Low The value range is [50,70], T high The value range is [200,210]. Thus, Cate1 and Cate2 are further classified into bright color Cate 11 , Cate 21 ; Medium tone Cate 12 , Cate 22 ; Dark Tone Cate 13 , Cate23 .
[0060] (4-1-1-2) Color scheme subdivision of printed patterns with fuzzy color styles;
[0061] First, calculate the average brightness difference d between the printed pattern and the color scheme diagram Lmean :
[0062]
[0063] Where C Lmean and S Lmean The average brightness of the printed pattern and the average brightness of the color scheme are respectively. According to the set brightness threshold T L With d Lmean The absolute value of the color scheme is divided into two categories, Cate3 and Cate4. L Less than d Lmean Absolute value, the color scheme belongs to Cate3; otherwise, the color scheme belongs to Cate4; where T L The value range is [0.1, 0.3]. According to formula (8), Cate3 and Cate4 are further classified into bright color Cate 31 , Cate 41 ; Medium tone Cate 32 , Cate 42 ; Dark Tone Cate 33 , Cate 43 .
[0064] (4-2) Scoring of color scheme diagrams;
[0065] According to formula (10), the cosine similarity a between the printing pattern and the color scheme diagram on the color histogram is calculated. rgb , and the cosine similarity a on the hue histogram hue :
[0066]
[0067] Where n represents the number of histogram index values, a i represents the value of the color histogram (hue histogram) of the printed pattern at position i, b i Represents the value of the color histogram (hue histogram) of the color scheme diagram at position i. The score β is further calculated according to formula (11).
[0068] β=ε×α rgb +(1-ε)×α hue +σ (11)
[0069] In formula (11), ε represents the proportionality coefficient, α rgb and α hueis the color cosine similarity and hue cosine similarity calculated according to formula (10). σ represents the adjustment factor, which is used to adjust the scores of the two color schemes: the color scheme with the same hue as the main color of the printed pattern and the color scheme with black and white as the main color in visual effect.
[0070] The adjustment factor σ is given in formula (12), where Cate represents the category to which the color scheme belongs, T L Indicates setting the brightness threshold, d Lmean Represents the average brightness difference between the printed pattern and the color scheme diagram:
[0071]
[0072] (5) Color scheme diagram sorting output;
[0073] Sorting is a key step in the entire recommendation method. Sorting can help users find the prints they are interested in faster, thereby improving user satisfaction and overall user experience. Sorting needs to take into account the diversity of the recommendation list to ensure that the recommendation results are not limited to a few popular color schemes, but color schemes that contain a variety of content to meet the different needs of users. In addition, users often hope that the color schemes are as different as possible, and they also hope that the color schemes can cover all hues. Based on the above analysis, the steps for sorting the color schemes are as follows:
[0074] (5-2) Score and sort the color scheme diagram;
[0075] 360° hue represents a complete hue circle, including all visible colors. But for the color matching of printed patterns, this level of detail is redundant. The 12-hue circle simplifies the color relationship by classifying colors into 12 basic categories, making the color difference between each hue large enough for the human eye to easily identify and distinguish different hues. Therefore, when sorting, the hue is no longer used but the more intuitive hue index value H. idx , as shown in formula (13):
[0076]
[0077] Categorize the six color schemes classified in step (4-1) 11 , Cate 21 , Cate 12 , Cate 22 , Cate 13 , Cate 23 (Cate 31 , Cate 41 , Cate 32 , Cate 42, Cate 33 , Cate 43 ), sort the β values calculated by formula (11) in descending order within the class, and at the same time, the hue index value H of the corresponding color scheme diagram idx Combined with it to form (β,H idx ), and finally the two categories of bright colors 11 , Cate 21 (Cate 31 , Cate 41 ) to obtain a new bright tone Cate1, and the two types of medium tone Cate 12 , Cate 22 (Cate 32 , Cate 42 ) to obtain a new medium-tone Cate2, and the two dark-tone Cate 13 , Cate 23 (Cate 33 , Cate 43 ) to obtain a new dark tone Cate3.
[0078] (5-3) Output sorting of color scheme diagram;
[0079] Take the hue index value H from the three categories Cate1, Cate2, and Cate3 in turn idx The inconsistent and top-scoring color schemes form P N Output sorting graph, P N is a multiple of 3, and the selected P N The color scheme is removed from Cate1, Cate2, and Cate3.
[0080] Compared with the prior art, the present invention makes full use of the color characteristics of the printed pattern, and provides a variety of color schemes while ensuring the real-time recommendation. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] Figure 1 It is a flowchart of the present invention;
[0082] Figure 2 Enter a color scheme diagram for the section;
[0083] Figure 3 To input the printing pattern;
[0084] Figure 4 Sort graph for partial output color scheme graph;
[0085] Figure 5 The color matching result map generated by the intelligent color matching system. DETAILED DESCRIPTION
[0086] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0087] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.
[0088] The implementation objects of the style transfer of the present invention are various printed patterns. The processing platform selected by the present invention is a combination of Inteli7-11800K, NVIDIARTX 3090 and 32G RAM, and the operating system is Windows.
[0089] like Figure 1 A method for recommending a color scheme diagram of a printed pattern based on color analysis is shown, and is performed in the following steps:
[0090] (1) Input the print pattern and color scheme library;
[0091] Step (1) specifically includes:
[0092] The user inputs a color to be matched. Figure 3 The prints shown, as well as the color scheme gallery are as follows Figure 2 As shown, the gallery is a set of color scheme images selected by the user according to color matching requirements, including various color matching styles. The formats of printing patterns and color scheme images are png, jpeg, and tiff.
[0093] (2) Color feature extraction of color scheme diagram;
[0094] There are many choices for color scheme diagrams, which can be designed prints, hand-painted pictures, or photos of scenery, etc. The contents of these color scheme diagrams vary greatly, so it is necessary to extract and save the color features required in the content through color analysis methods. In addition, the image formats of color scheme diagrams are different, and the color space, data storage format, compression method, etc. are all different. Therefore, when processing, the format of the color scheme diagram needs to be converted first to ensure that it can be processed normally. Based on the above analysis, the specific steps for extracting the color features of the color scheme diagram in this embodiment are as follows:
[0095] Step (2) specifically includes:
[0096] (2-1) Color scheme image format conversion;
[0097] Use the io module of the skimage library to read the image data, and then use the imencode function of the OpenCV library to encode the image data into png format to obtain the color scheme S1, and the color space is RGB.
[0098] (2-2) Calculate the average brightness and black and white identifiers of the color scheme diagram;
[0099] Use the mean function of the OpenCV library to calculate the mean color of the color scheme S1 mean Then, the average brightness S of the color scheme diagram is calculated according to formula (1): Lmean .
[0100] Then, the average brightness S is calculated according to formula (1): Lmean , S Lmean With the threshold T W and T B Compare and obtain the black and white identifier S FWB The value of .
[0101] For the average brightness S Lmean Greater than T W Color scheme diagram and average brightness S Lmean Less than T B The color scheme diagram of the black and white identifier S FWB Set to true; otherwise, the black and white identifier S FWB Set to false. Here T W and T B The values are 30 and 220.
[0102] (2-3) Calculate the main color hue of the color scheme diagram;
[0103] The theme color hue can effectively distinguish the printed pattern and the color scheme diagram with similar main colors, ensuring the difference between the printed pattern and the color scheme diagram. Considering that the Kmeans clustering algorithm only focuses on color distribution and is less affected by the image resolution, the present invention uses the Kmeans clustering algorithm to calculate the main color hue of the color scheme diagram. The specific sub-steps are as follows:
[0104] (2-3-1) First, use the nearest neighbor interpolation method to scale the color scheme diagram S1 to the long side Ls1 to obtain the color scheme diagram S2, and the value range of Ls1 is [200,400].
[0105] (2-3-2) Then S2 is flattened to obtain an image data string D in the form of (W2×H2,C), where W2 and H2 are the length and width of S2, and C is the number of channels of S2. Then the Kmeans clustering algorithm is used to process the image data string D, and Kn cluster heads are selected, and the number of iterations is Kp. The value range of Kn is [10,15], and the value range of Kp is [100,150].
[0106] In this embodiment, the Kmeans clustering algorithm in the skimage library is used to calculate the main color hue of the color scheme diagram. First, the color scheme diagram S1 is scaled to the long side L using the nearest neighbor interpolation method. s1 , we get the color scheme Figure S2, where L s1 The value of is 200. Flatten S2 to obtain an image data string D in the form of (W2×200,3), where W2 is the length of S2. Use the Kmeans clustering algorithm in the skimage library to calculate the image data string D, and select K n cluster heads, the number of iterations is K p Here K n The value is 10, K n The value range is 100. According to the output of the algorithm, the values of the three channels are combined to obtain a color list (n1, n2, ..., n 10 ) and the corresponding color proportion (γ1, γ2, …, γ 10 ). Select the color with the highest proportion as the main color of color scheme S1, denoted as Color m According to the hue conversion formula (3), Color m Hue S hue . Where CMax represents Color mean The maximum value of the three channels R, G, and B. CMin represents Color mean The minimum value of the three channels R, G, and B.
[0107] (2-4) extracting the color histogram and hue histogram of the color scheme diagram;
[0108] The color scheme S1 is scaled to (k, k) using the nearest neighbor interpolation method to obtain the printed pattern S3, where k is 32. The RGB color channels in S3 are mapped to M c Color intervals, M c Here, the value is 8; calculate the unique color index value of each pixel according to formula (4), and then count the number of occurrences of each color index value to obtain the color histogram SH color In the statistical color histogram SH colorAt the same time, the RGB channel value of each pixel is calculated according to the hue conversion formula (3) to obtain the corresponding hue, and the number of hue occurrences is counted to obtain the hue histogram SH hue .
[0109] (3) Extraction of color features of printed patterns;
[0110] Step (3) specifically includes:
[0111] (3-1) Scaling the printed pattern;
[0112] According to the resolution W×H of the input print pattern P1, the print pattern P1 is scaled to the long side L using the nearest neighbor interpolation method. s2 Get the printed pattern P2, where L s2 The value is 1500.
[0113] (3-2) Calculate the average brightness of the printed pattern, the main color hue, and extract the color histogram and hue histogram;
[0114] Refer to step (2-2) to calculate the average brightness C of the printed pattern P2 Lmean And black and white identifier C FWB , (2-3) Calculate the main color hue C of the printed pattern P2 hue And (2-4) extract the color histogram CH of the printed pattern P2 color and hue histogram CH hue , and obtain a printed pattern P3 with a length and width of (k, k).
[0115] (3-3) Extracting the color style of the printed pattern;
[0116] Traverse the color histogram CH color , find CH color The continuous peak interval in the middle, and to reduce redundancy, the distance R between two adjacent peaks is calculated according to formula (5) d , R d The distance threshold T from the peak d Compare and merge to get the peak interval set R pk , where T d The value is 2. After completing the peak interval division and merging, the peak interval set R is obtained. pk , calculate the proportion of pixels in the peak interval in the printed pattern P3 according to formula (6): pk According to the threshold T p Filter out R pk The part that is smaller than the threshold, here T p The value is 0.009.
[0117] After filtering, the peak set R is obtained. mpk, use the following rules to determine whether the printed pattern has a distinct color style or a blurred color style.
[0118] If the peak set R mpk The number of peak intervals is greater than the set threshold T num It is believed that the printed pattern has a distinct color style. num The value is 2.
[0119] If R mpk The number of peak intervals is less than the set threshold T num Then further according to the printed pattern black and white identifier C FWB Judge, when C FWB If it is true, the color style of the printed pattern is considered to be distinct; otherwise, the color style of the printed pattern is considered to be fuzzy.
[0120] If R mpk The number of peak intervals is equal to the set threshold T num Then further according to CH hue Judge, when CH hue If the corresponding peak interval in is not concentrated in two adjacent hue values, the printed pattern is considered to have a distinct color style; otherwise, further according to the printed pattern black and white identifier C FWB Judge, if C FWB If it is true, the color style of the printed pattern is considered to be fuzzy, otherwise, the color style of the printed pattern is considered to be clear.
[0121] (4) Classification and scoring of color scheme diagrams;
[0122] Step (4) specifically includes:
[0123] (4-1) Color scheme diagram color subdivision;
[0124] (4-1-1) Classification of printing patterns, colors and styles;
[0125] According to the color style of the printed pattern obtained in step (3-3), the printed pattern is divided into a printed pattern with a distinct color style and a printed pattern with a fuzzy color style. Different color scheme diagram color segmentation methods are used for printed patterns with different color styles. The color segmentation steps of the color scheme diagram of printed patterns with different color styles are as follows:
[0126] (4-1-1-1) The colors and styles of the printed patterns are distinct;
[0127] First, according to formula (7), the color scheme map is divided into two categories Cate1 and Cate2. Then according to formula (8), Cate1 and Cate2 are further classified into bright color Cate 11 , Cate 21 ; Medium tone Cate 12 , Cate22 ; Dark Tone Cate 13 , Cate 23 , where T in formula (8) Low The value is 70, T high The value is 200.
[0128] (4-1-1-2) The color style of the printed pattern is fuzzy;
[0129] According to formula (9), the average brightness difference d between the printed pattern and the color scheme is calculated Lmean , according to the set brightness threshold T L With d Lmean The absolute value of the color scheme is divided into two categories, Cate3 and Cate4. According to formula (8), Cate3 and Cate4 are further classified into Cate 31 , Cate 32 , Cate 33 , Cate 41 , Cate 42 , Cate 43 Here T L The value of is 0.2.
[0130] (4-2) Scoring of color scheme diagrams;
[0131] According to formula (10), the cosine similarity a of the printing pattern and the color scheme diagram on the color histogram and hue histogram is calculated. rgb and a hue The score β is further calculated according to the scoring formula (11). Here, the proportional coefficient ε in formula (11) is 0.3.
[0132] (5) color scheme diagram sorting;
[0133] Step (5) specifically includes:
[0134] (5-1) Color scheme diagram sorting output;
[0135] like Figure 4 As shown, the hue index value H of the color scheme is calculated according to formula (13): idx , and then the six classified color schemes Cate 11 , Cate 21 , Cate 12 , Cate 22 , Cate 13 , Cate 23 (Cate 31 , Cate 41 , Cate 32 , Cate 42 , Cate33 , Cate 43 ), sort the β values calculated by formula (11) in descending order within the class, and at the same time, the corresponding color scheme hue index value H idx Combined with it to form (β,H idx ). Finally, the two categories of bright colors 11 , Cate 21 (Cate 31 , Cate 41 ) to obtain a new bright tone Cate1, and the two types of medium tone Cate 12 , Cate 22 (Cate 32 , Cate 42 ) to obtain a new medium-tone Cate2, and the two dark-tone Cate 13 , Cate 23 (Cate 33 , Cate 43 ) to obtain a new dark tone Cate3.
[0136] (5-2) Output sorting of color scheme diagram;
[0137] like Figure 5 As shown, the hue index value H is taken from the three categories Cate1, Cate2, and Cate3 in turn. idx The inconsistent and top-scoring color schemes form P N Output sorting graph, P N is a multiple of 3, and the selected P N The color scheme is removed from Cate1, Cate2, and Cate3. N The value of is 12.
[0138] The above description is only an example of a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for recommending a color scheme diagram of a printed pattern based on color analysis, characterized in that: include: (1) Input the print pattern and color scheme library; (2) Color feature extraction of the color scheme diagram: Calculate the average brightness, black and white identifiers, and main color hue of the color scheme diagram, and extract the color histogram and hue histogram of the color scheme diagram; (3) Print pattern color feature extraction: calculate the average brightness of the print pattern, the main color hue, extract the color histogram and hue histogram, and complete the print pattern color style extraction; (4) Classification and scoring of color scheme diagrams: Print patterns are distinguished according to their color styles, and different color segmentation methods are used to classify and score color scheme diagrams; (5) Color scheme graph sorting output.
2. The method for recommending a print color scheme diagram based on color analysis according to claim 1, characterized in that: The specific steps of extracting color features from the color scheme diagram include: (2-1) Convert the color scheme image data format into png format to obtain the color scheme diagram S1, and the color space is in RGB format; (2-2) Calculate the mean of the three channel values of R, G, and B of the color scheme S1 respectively, and combine the three means to obtain the mean color of S1. mean , and then calculate the average brightness S of the color scheme in the HSL color space Lmean , S Lmean With the threshold T W and T B Compare and obtain the black and white identifier S FWB The value of (2-3) Use Kmeans clustering algorithm to calculate the main color hue of the color scheme diagram; (2-4) Extract the color histogram and hue histogram of the color scheme diagram.
3. The method for recommending a print color scheme diagram based on color analysis according to claim 2, characterized in that: The specific process of using the Kmeans clustering algorithm to calculate the main color hue of the color scheme diagram in step (2-3) is as follows: (2-3-1) Use the nearest neighbor interpolation method to scale the color scheme image S1 to the long side L s1 The color scheme is obtained in Figure S2, L s1 The value range is [200,400]; (2-3-2) Flatten S2 to obtain an image data string D in the form of (W2×H2,C), where W2 and H2 are the length and width of S2, and C is the number of channels of S2; then use the Kmeans clustering algorithm to process the image data string D and select K n cluster heads, the number of iterations is K p ; where K n The value range is [10,15], K p The value range is [100,150]; According to the output results, the values of the three channels are combined to obtain a color list (n1, n2, ..., n k ) and the corresponding color proportion (r1, r2, …, r k );where n i represents the center color of the cluster, r i Represents the proportion of the number of pixels in each cluster to the total number of pixels; the color with the highest proportion is selected as the main color of the color scheme Figure S1 m , and Color m Hue S hue .
4. The method for recommending a print color scheme diagram based on color analysis according to claim 3, characterized in that: The method for extracting a color histogram and a hue histogram of a color scheme diagram comprises: Use the nearest neighbor interpolation method to scale the color scheme image S1 to size (k, k) to obtain the color scheme image S3, where the value range of k is [32, 128]; map the RGB color channels in S3 to M c color intervals, where M c The value range is [8,64]; calculate the unique color index value of each pixel, count the number of times each color index value appears, that is, the number of pixels corresponding to the color index value, and obtain the color histogram SH color ; In the statistical color histogram SH color At the same time, the corresponding hue is calculated according to the RGB channel value of each pixel, and the number of occurrences of the hue value is counted to obtain the hue histogram SH hue .
5. The method for recommending a print pattern color scheme diagram based on color analysis according to claim 1, characterized in that: Step (3) The specific steps of extracting the color features of the printed pattern include: (3-1) Scaling the printed pattern: According to the resolution W×H of the input print pattern P1, the print pattern P1 is scaled to the long side L using the nearest neighbor interpolation method. s2 Get the printed pattern P2, where L s2 The value range is [700,1500]; (3-2) Calculate the average brightness of the printed pattern, the main color hue, extract the color histogram and the phase histogram; obtain the printed pattern P3 with a length and width of (k, k); (3-3) Extracting the color style of the printed pattern; Traverse the color histogram CH color , find CH color Calculate the percentage of pixels in the peak interval in the printed pattern P3. pk , delete Per pk Less than the filtering threshold T p The corresponding interval; according to the set threshold T num Determine the color style of the printed pattern.
6. The method for recommending a print pattern color scheme diagram based on color analysis according to claim 5, characterized in that: After filtering, the peak set R is obtained mpk , use the following rules to determine whether the printed pattern has a distinct color style or a blurred color style: If the peak set R mpk The number of peak intervals is greater than the set threshold T num , then the printed pattern is considered to have a distinct color style, among which T num The value range is [2,6]; If R mpk The number of peak intervals is less than the set threshold T num , then further according to the printed pattern black and white identifier C FWB Judge, when C FWB If it is true, the color style of the printed pattern is determined to be distinct, otherwise it is determined that the color style of the printed pattern is fuzzy; If R mpk The number of peak intervals is equal to the set threshold T num Then further according to CH hue Judge, when CH hue If the corresponding peak interval in is not concentrated in two adjacent hue values, the printed pattern is considered to have a distinct color style; otherwise, further according to the printed pattern black and white identifier C FWB Judge, if C FWB If it is true, the color style of the printed pattern is judged to be fuzzy, otherwise it is judged to be clear in color style.
7. The method for recommending a print color scheme diagram based on color analysis according to claim 1, characterized in that: Step (4) Case image classification and scoring includes: (4-1) Color segmentation of color scheme diagram: the printed patterns are divided into printed patterns with distinct color styles and printed patterns with fuzzy colors; different color segmentation methods of color scheme diagrams are used for printed patterns with different color styles; (4-2) Scoring of color scheme diagram: Calculate the cosine similarity of the printed pattern and the color scheme diagram on the color histogram and the cosine similarity on the hue histogram; then calculate the score β.
8. The method for recommending a print pattern color scheme diagram based on color analysis according to claim 7, characterized in that: Step (4-1) The specific method of color segmentation of the color scheme diagram includes: First, the color scheme diagram is divided into two categories, Cate1 and Cate2, according to the following formula; Where S represents the color scheme diagram, C hue and S hue Respectively represent the theme color hue of the printed pattern and the theme color hue of the color scheme diagram, S FWB Represents the color scheme diagram black and white identifier; Cate1 and Cate2 are further classified according to the average brightness of the color scheme diagram; In the formula, S represents the color scheme diagram, S Lmean represents the average brightness of the color scheme diagram, T Low and T high Represent the dark tone threshold and the light tone threshold, T Low The value range is [50,70], T high The value range is [200,210]; (4-1-1-2) Color scheme subdivision of printed patterns with fuzzy color styles; First, calculate the average brightness difference d between the printed pattern and the color scheme diagram Lmean : Where C Lmean and S Lmean The average brightness of the printed pattern and the average brightness of the color scheme diagram are respectively; according to the set brightness threshold T L With d Lmean The absolute value size divides the color scheme diagram into two categories Cate3 and Cate4; if T L Less than d Lmean Absolute value, the color scheme belongs to Cate3; otherwise, the color scheme belongs to Cate4; where T L The value range is [0.1,0.3].
9. The method for recommending a print pattern color scheme diagram based on color analysis according to claim 8, characterized in that: The specific method of scoring the color scheme diagram in step (4-2) includes: Calculate the cosine similarity a of the print pattern and the color scheme diagram on the color histogram rgb , and the cosine similarity a on the hue histogram hue : Where n represents the number of histogram index values, a i represents the value of the color histogram of the printed pattern at position i, b i Represents the value of the color histogram at position i in the color scheme graph; The score β is further calculated according to the formula. β=ε×αrgb+(1-ε)×αhue+σ Among them, ε represents the proportional coefficient, αrgb and αhue are the color cosine similarity and hue cosine similarity; σ represents the adjustment factor, which is used to adjust the scores of the two color schemes: the color scheme with the same hue as the main color of the printed pattern and the color scheme with black and white as the main color in visual effect; The adjustment factor σ is: Among them, Cate represents the category to which the color scheme diagram belongs, T L Indicates setting the brightness threshold, d Lmean Represents the average brightness difference between the printed pattern and the color scheme diagram.
10. The method for recommending a print pattern color scheme diagram based on color analysis according to claim 1, characterized in that: The color scheme diagram sorting output in step (5) includes: (5-1) Sorting the color scheme graphs; sorting the color scheme graphs classified in step (4-1) in descending order according to the calculated β values, and sorting the corresponding color scheme graph hue index values H idx Combined with it to form (β,H idx ), the classified color scheme diagrams are spliced to obtain new light tone Cate1, medium tone Cate2 and dark tone Cate3; (5-1) Output sorting of color scheme diagram; Take the hue index value H from the three categories Cate1, Cate2, and Cate3 in turn idx The inconsistent and top-scoring color schemes form P N Output sorting graph and select P N The color scheme is removed from Cate1, Cate2, and Cate3.
Citation Information
Patent Citations
High-resolution printing pattern color matching method based on deep neural network
CN116703712A
Multi-layer printing pattern color matching method based on global feature guidance
CN117745863A