A skein photographing color measurement parameter optimization calculation method based on cloth piece color driving

By constructing a multi-objective optimization function for the correlation between yarn color and fabric color, and using a genetic algorithm to optimize the yarn color measurement parameters, the problem of lack of scientific basis for parameter settings in yarn color measurement is solved, and high-precision and consistent yarn color measurement is achieved.

CN122243897APending Publication Date: 2026-06-19WUHAN TEXTILE UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
WUHAN TEXTILE UNIV
Filing Date
2026-03-10
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing methods for measuring yarn color lack scientific basis, and parameter settings are highly subjective, resulting in poor consistency of measurement results, difficulty in distinguishing minute color differences, and impact on quality control.

Method used

Based on the color correlation between the yarn and its corresponding fabric piece, a multi-objective optimization function is constructed, and a genetic algorithm is used to automatically determine the optimal parameter combination. By constructing a composite objective function and combining it with the genetic algorithm for global search, parameters such as Gaussian filtering, filter kernel size, and binarization threshold are optimized.

🎯Benefits of technology

It significantly improves the accuracy and consistency of yarn color measurement, eliminates the subjective differences in traditional parameter settings, and ensures the scientific nature and stability of the measurement results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122243897A_ABST
    Figure CN122243897A_ABST
Patent Text Reader

Abstract

This invention discloses a method for optimizing and calculating parameters of yarn color measurement based on fabric color-driven photographic color measurement. The method includes: creating a fabric piece corresponding to the yarn; building a photographic color measurement system; acquiring digital images of the yarn and fabric piece; measuring standard color parameters of the fabric piece; defining the parameter optimization space and constraints; initializing the optimization algorithm parameters; constructing a composite objective function as the fitness; executing the parameter optimization process; determining the stopping criterion; updating the parameters; and outputting the optimal parameter combination. This invention overcomes the shortcomings of existing yarn color measurement methods, such as reliance on experience, strong subjectivity, and lack of scientific basis in parameter setting, providing a scientific and reliable parameter configuration scheme for accurate yarn color measurement and quality control in the textile industry.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer digital image processing and textile color measurement technology, specifically relating to an optimization calculation method for yarn photographic color measurement parameters driven by fabric color. Background Technology

[0002] In skein color photogrammetry, the selection of image processing parameters directly affects measurement accuracy and stability. While existing skein color measurement methods can achieve automated measurement, they suffer from the following key problems in practical applications: parameter settings lack scientific basis, relying mainly on experience or trial-and-error to determine key parameters such as Gaussian filter standard deviation, filter kernel size, binarization threshold coefficient, connected region area threshold, and minimum skeleton retention area; parameter selection is highly subjective, with different operators potentially choosing different parameter combinations, leading to poor consistency in measurement results; effective parameter optimization strategies are lacking, failing to guarantee that selected parameters maximize measurement accuracy and stability; existing methods ignore the color correlation between the skein and its corresponding fabric piece, failing to utilize fabric color as a reference standard for parameter optimization. For skein samples with minute color differences, traditional parameter setting methods struggle to distinguish color variations, affecting the effectiveness of quality control. Therefore, there is an urgent need for a scientifically based automatic optimization method for skein photogrammetry parameters. Summary of the Invention

[0003] The purpose of this invention is to solve the problems described in the background art. Based on the color correlation between yarn and its corresponding fabric piece, this invention proposes an optimization calculation method for yarn photographic color measurement parameters driven by fabric piece color. This method uses the measured color of the fabric piece corresponding to the yarn as a reference standard. By constructing a multi-objective optimization function, it simultaneously considers the stability of yarn color measurement and the trend correlation between the yarn color difference distribution and the fabric color difference distribution, and uses an intelligent optimization algorithm to automatically determine the optimal parameter combination. The technical implementation process includes: first, creating the fabric piece corresponding to the yarn; then, establishing a yarn photographic color measurement system and acquiring multiple sets of yarn sample images of different shapes and corresponding fabric piece images; then, using the average pixel method to measure the fabric color as a reference value; next, constructing a composite objective function including stability evaluation and correlation evaluation; using intelligent optimization methods such as genetic algorithms to perform a global search in the parameter space; setting scientific stopping criteria to ensure the effectiveness of the optimization process; finally, outputting the optimal parameter combination and verifying its effectiveness. The technical solution of this invention is a method for optimizing calculation of yarn photographic color measurement parameters driven by fabric piece color, specifically including the following steps: Step 1: Make the fabric pieces corresponding to the yarn strands; Step 2: Set up a photographic colorimetric system; Step 3: Acquire digital images of the yarn strands and their corresponding fabric pieces; Step 4: Measure the standard color parameters of the corresponding fabric piece; Step 5: Define the parameter optimization space and constraints; Step 6: Initialize the optimization algorithm parameters; Step 7: Construct a composite objective function as the fitness; Step 8: Perform the parameter optimization process; Step 9: Determine the stopping criteria; Step 10: Update the parameter population and output the optimal parameter combination.

[0004] Furthermore, in step 1, the method for producing the fabric pieces corresponding to the skeins is as follows: select m groups of skein samples with similar colors but slight differences as the research objects; use the same weaving process parameters to weave each group of skeins into corresponding plain weave fabric pieces; ensure that the fabric structure, warp and weft density, fabric thickness and other parameters are consistent to avoid the influence of fabric structure parameters on color measurement results; perform standardized finishing treatment on the woven fabric pieces to ensure that the fabric surface is flat and free of obvious defects.

[0005] Furthermore, in step 2, when setting up the photographic colorimetric system, the system's lighting needs to be unaffected by natural light, and the uniformity of lighting within the effective photographic area should be ensured. This ensures that the digital response values ​​of the same sample object are consistent at different locations within the photographic area, thus avoiding photographic system deviation problems.

[0006] Furthermore, in step 3, the method for acquiring digital images of the yarn strands and their corresponding fabric pieces is as follows: For each group of yarn strands, prepare n different placement patterns, including loose placement, tight placement, single-layer flat laying, double-layer stacking, random placement, etc., to simulate different states in actual use; set standard digital camera shooting parameters to ensure that all samples are image acquired under the same conditions; take high-resolution digital images of each of the n patterns of the yarn strands, capturing x images for each pattern; also take high-resolution digital images of each fabric piece sample, capturing x images for each fabric piece; establish a sample image database and numbering system to provide a complete data foundation for subsequent parameter optimization analysis.

[0007] Furthermore, in step 4, the method for measuring the standard color parameters of the fabric piece is as follows: A high-resolution digital image of the fabric sample is acquired using the same photometric colorimetric system as that used for yarn measurement, ensuring consistency of measurement conditions; the fabric image is preprocessed and an effective measurement area is cropped, avoiding fabric edges and areas with obvious weaving defects; the average pixel method is used to calculate the RGB average value of all pixels within the cropped area; the RGB average value is converted into CIELab color parameters using a colorimetric theory conversion algorithm; a correspondence table between yarn numbers and standard Lab values ​​of the fabric piece is established to provide a reference target for subsequent parameter optimization.

[0008] Furthermore, in step 5, the method for defining the parameter optimization space and constraints is as follows: The key parameters to be optimized include the Gaussian filter standard deviation σ, the Gaussian filter kernel size kernel_size, the binarization threshold adjustment coefficient k, the connected region area threshold area_threshold, and the skeleton minimum retained area threshold skeleton_threshold; Reasonable value ranges and constraints are set for each parameter, and the parameter range is defined as shown in equation (1): (1) In the formula, σ is the standard deviation of the Gaussian filter, kernel_size is the size of the Gaussian filter kernel, k is the binarization threshold adjustment coefficient, area_threshold is the area threshold of the connected region, and skeleton_threshold is the minimum area threshold for the skeleton.

[0009] Furthermore, in step 6, the method for initializing the optimization algorithm parameters is as follows: Select the genetic algorithm as the optimization method, and set the algorithm parameters including population size, crossover probability, mutation probability, maximum number of iterations, etc.; the algorithm parameter settings are as follows:

[0010] In the formula, population_size is the population size, crossover_rate is the crossover probability, mutation_rate is the mutation probability, and max_generations is the maximum number of generations.

[0011] Furthermore, in step 7, the method for constructing the composite objective function is as follows: the objective function consists of two sub-objectives, namely the correlation objective and the stability objective, and the composite objective function is defined as shown in equation (2): (2) In the formula, F total For the composite objective function value, F correlation Let F be the correlation objective function. stability Let ω1 and ω2 be the weight coefficients of the two sub-objectives, respectively, to ensure stability.

[0012] The formula for calculating the correlation objective function is shown in equation (3): (3) In the formula, F correlation Let R be the correlation objective function. 2 This is the correlation coefficient between the L value of the yarn strand and the corresponding L value of the fabric piece.

[0013] The formula for calculating the stability objective function is shown in equation (4): (4) In the formula, i is the number of the skein sample, F stability For the stability objective function, MCDM i Let N be the average color difference of the i-th group of yarn samples, and N be the number of yarn groups.

[0014] The formula for calculating the correlation coefficient is shown in equation (5): (5) In the formula, i is the sample number, L yarn,i Let L be the measured value of the i-th group of yarn samples. fabric,i For the corresponding fabric piece, L is the L value. fabric is the average L value of the fabric pieces, and n is the total number of samples.

[0015] The formula for average color difference is shown in equation (6): (6) In the formula, i is the skein group number, j is the measurement number of the same skein group, and MCDM i Let m be the average color difference of the i-th group of skeins, m be the number of measurements for each group of skeins, and L be the average color difference. i,j a i,j b i,j The Lab value is the value of the j-th measurement for the i-th group of skeins. Let ΔE be the Lab average value of the i-th group of skeins. 00 This is the CIE DE2000 color difference formula.

[0016] Furthermore, the Lab value of the skein sample was calculated using the following method: (1) Converting RGB color images to grayscale images: The weighted average method is used to convert the RGB three-channel information into single-channel grayscale information. The grayscale conversion formula is as follows:

[0017] In the formula, Gray is the converted grayscale pixel value, R, G, and B are the pixel values ​​of the red, green, and blue channels, respectively. The weighting coefficients are determined based on the human eye's sensitivity to different colors, with the green component having the largest weight, followed by the red component, and the blue component having the smallest weight.

[0018] (2) Gaussian blur processing of grayscale images: A Gaussian filter of kernel_size is used to smooth the grayscale image to reduce image noise and detail interference. The Gaussian blur kernel function is:

[0019] In the formula, G(x,y) is the filter weight value at the position coordinates (x,y), x and y are the offset coordinates relative to the kernel center, and σ is the standard deviation parameter of the Gaussian filter.

[0020] (3) Perform adaptive histogram equalization: Divide the image into several sub-blocks, and perform histogram equalization on each sub-block. The cumulative distribution function of each sub-block is calculated using the following formula:

[0021] In the formula, CDF(i) is the cumulative distribution function value of gray level i, i is the current gray level, j is the summation variable, h(j) is the number of pixels at gray level j, and N is the total number of pixels in the sub-block. The formula for calculating the equalized pixel value is:

[0022] In the formula, i is the current gray level, g(i) is the new pixel value after equalization of gray level i, L is the total number of gray levels, CDF(i) is the cumulative distribution function value of gray level i, and round is the rounding function. Then, the final result is synthesized through bilinear interpolation. This method can enhance local contrast while maintaining the overall features of the image.

[0023] (4) Binarization using the improved Otsu thresholding method: First, calculate the global threshold T0 of the image, and then use the Otsu algorithm to determine the optimal segmentation threshold. The calculation formula is as follows:

[0024] In the formula, The inter-class variance is the variance at a threshold t, where t is the current threshold. (t) and (t) represents the weights of the foreground and background, respectively. and Let t represent the average gray values ​​of the foreground and background, respectively. The inter-class variance is calculated for each possible gray value t∈[0,255]. The optimal threshold T0 is chosen as the t-value that maximizes the inter-class variance.

[0025] Where T0 is the optimal threshold. Let be the inter-class variance at threshold t, where t is the current threshold, and argmax is the operator that maximizes the function. Then, the threshold is adjusted, and T = k × T0 is taken as the final binarization threshold, where k is an adjustment coefficient to better separate the yarn body and the background.

[0026] (5) Morphological operations are used to remove small noise regions: Connected regions are marked in the binarized image, and the 8-connectivity criterion is used for region analysis. The formula for calculating the area of ​​a connected region is:

[0027] In the formula, Area(C i ) represents the i-th connected region C i The area of ​​C, where i is the index of the connected region. i Let (x, y) be the i-th connected region, and (x, y) be the pixel coordinates within the region. This indicates the number of pixels counted. Connected regions with an area smaller than area_threshold are removed to eliminate noise interference.

[0028] (6) Extracting the centerline structure of the yarn strand using a skeletonization algorithm: A morphological thinning algorithm is used to extract the skeleton from the binary image. The skeletonization process is achieved by iteratively applying morphological erosion operations. The iterative formula is as follows:

[0029] In the formula, This is the image after the k'th iteration, where k' is the iteration number. This is the result of the (k'-1)th iteration, where S0 is the original binary image and B is the structuring element. This represents the erosion operation; the iterative process continues until the convergence condition S is met. k' =S k'-1 If the conditions are met, the centerline structure of the yarn is obtained, and the skeletonization process maintains the original image's topological structure unchanged; (7) Perform closing operation on the skeleton to connect breakpoints: Define a rectangular structuring element and perform morphological closing operation on the skeleton image. The closing operation is defined as: SE In the formula, Close(S) is the result of performing a closing operation on the skeleton image S, where S is the skeleton image and SE is the structuring element. This represents the expansion operation. This represents the erosion operation. The closing operation can connect broken skeleton line segments to form a complete strand centerline structure.

[0030] (8) Determine the effective measurement area: After the closing operation, morphological operations are used again to remove small areas with an area smaller than the set threshold. The formula for selecting the effective area is:

[0031] In the formula, Region eff C represents the final set of valid measurement areas. i Let Area(Ci) be the i-th connected region, and skeleton_threshold be the area threshold. This region represents the core structure of the yarn strand, has the highest visual saliency, and can accurately reflect the body color characteristics of the yarn strand.

[0032] (9) Extract RGB color information within the effective area: Obtain the set of pixel coordinates of the effective measurement area determined in step (8), and extract the RGB pixel values ​​corresponding to these coordinate positions in the original RGB image. The pixel extraction function is:

[0033] In the formula, i is the index of the pixel within the effective measurement area, RGB(i) is the RGB value of the i-th pixel, Image_RGB is the original RGB image, (x i ,y i ) represents the coordinates of the i-th valid pixel.

[0034] (10) Convert the RGB color information extracted in step (9) into LAB color space data and calculate the average color value: First, normalize the RGB values ​​to the range of [0,1]. The normalization formula is:

[0035] In the formula, R norm G norm B norm The values ​​are normalized RGB values, where R, G, and B are the original RGB values. Then, the RGB data is converted to the Lab color space using a standard color space conversion algorithm. The conversion process from RGB to Lab color space first requires conversion to the XYZ color space, using the following formula:

[0036] In the formula, X, Y, and Z are the tristimulus values ​​of the XYZ color space, and R... norm G norm B norm These are the normalized RGB values. Then, the XYZ color space is converted to the Lab color space using the following formula:

[0037]

[0038] In the formula, L, a, and b are the brightness, red-green, and yellow-blue color values ​​of the skein sample in the CIELab color space, respectively; X, Y, and Z are the tristimulus values ​​in the XYZ color space; X n Y n Z n Let be the tristimulus value of the standard illuminator, and f(t) be the nonlinear transformation function. Finally, the Lab average value of all pixels within the effective area is calculated as the color measurement result of the yarn, using the following formula:

[0039] In the formula, Lmean a mean b mean The average values ​​of the L, a, and b components are respectively, which represent the Lab value of the yarn sample. N is the total number of pixels in the effective measurement area. i a i b i These are the Lab color component values ​​of the i-th pixel.

[0040] Furthermore, in step 8, the method for performing the parameter optimization process is as follows: an initial population is randomly generated within the defined parameter space, wherein the initial population is a parameter set composed of a random number of individuals, and each individual represents a set of parameter combinations to be optimized; fitness is evaluated for each individual; genetic operations such as selection, crossover, and mutation are performed; the population is updated and the optimal solution is recorded; the iteration is repeated until the stopping criterion is met.

[0041] Furthermore, in step 9, the method for determining the stopping criteria is as follows: multiple stopping conditions are set to ensure the effectiveness of the optimization process. Stopping criteria include maximum running time, target R² value, number of consecutive algebras without improvement, convergence tolerance, minimum improvement ratio, etc. The stopping conditions are determined as follows:

[0042] In the formula, t current t represents the current running time. max For maximum runtime, R 2 current R is the current R² value. 2 target For the target R² value, gen no_improve For continuous unimproved algebras, gen no_tolerance For tolerance algebra, F current F is the objective function value of the current generation. best F is the optimal objective function value to date. prev ε is the objective function value of the previous generation, ε is the convergence tolerance, and δ is the minimum improvement ratio.

[0043] Furthermore, in step 10, the method for updating the parameter population is as follows: if the stopping criterion is not met, the iterative process of the genetic algorithm continues; a selection operation is performed to retain individuals with higher fitness; a crossover operation is performed to generate new parameter combinations; a mutation operation is performed to increase population diversity; the population is updated and prepared for the next round of iteration. The method for outputting the optimal parameter combination is as follows: When the stopping criterion is met, output the current optimal parameter combination; record the objective function value, correlation coefficient, stability index, etc., corresponding to the optimal parameters; save the first N sets of optimal parameters for the user to choose from. The parameter output format is as follows:

[0044] In the formula, P optimal For the optimal parameter combination, σ opt The optimal value for the standard deviation of the Gaussian filter, kernel opt k is the size of the Gaussian filter kernel. opt The optimal value of the binarization threshold adjustment coefficient is area. opt The optimal value for the area threshold of the connected region is the skeleton. opt This represents the optimal value for the minimum retained area threshold of the skeleton. Thus, the method for optimizing the calculation of yarn photometric parameters based on fabric color-driven methods is complete.

[0045] The present invention also provides a yarn color measurement parameter optimization calculation system based on fabric color-driven skein photography, including a processor and a memory. The memory is used to store program instructions, and the processor is used to call the program instructions in the memory to execute the yarn color measurement parameter optimization calculation method based on fabric color-driven skein photography as described in the above technical solution.

[0046] This invention addresses the lack of scientific basis for parameter settings in photographic color measurement of yarn skein by proposing a parameter optimization calculation method based on fabric color-driven measurement. This method constructs a composite objective function considering measurement stability and color correlation, and uses an intelligent optimization algorithm to automatically determine the optimal parameter combination. This provides a scientific parameter configuration scheme for accurate yarn color measurement, significantly improving measurement accuracy and consistency, eliminating subjective differences in traditional parameter settings, and solving the problem of a lack of scientific basis for parameter optimization. Attached Figure Description

[0047] Figure 1 This is a flowchart of an embodiment of the present invention.

[0048] Figure 2 This is a physical image of the photographic colorimetric system built according to the present invention.

[0049] Figure 3 This is an example of a twisted yarn image after cutting, as described in an embodiment of the present invention.

[0050] Figure 4 This is an example of a cut fabric piece image in an embodiment of the present invention.

[0051] Figure 5 This represents the trend of the correlation between the yarn strands and the L-value of the fabric in the embodiments of the present invention.

[0052] Figure 6 This is a comparison of the L-value trends of the yarn strands and fabric pieces in the embodiments of the present invention. Detailed Implementation

[0053] To facilitate understanding and implementation of the present invention by those skilled in the art, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.

[0054] The technical solution of this invention can be implemented by those skilled in the art using computer software technology.

[0055] Combined with appendix Figure 1 This invention proposes an optimization calculation method for skein photographic color measurement parameters based on fabric color-driven methods, specifically including the following steps: Step 1: Make the fabric pieces corresponding to the yarn strands; Step 2: Set up a photographic colorimetric system; Step 3: Acquire digital images of the yarn strands and their corresponding fabric pieces; Step 4: Measure the standard color parameters of the corresponding fabric piece; Step 5: Define the parameter optimization space and constraints; Step 6: Initialize the optimization algorithm parameters; Step 7: Construct a composite objective function as the fitness; Step 8: Perform the parameter optimization process; Step 9: Determine the stopping criteria; Step 10: Update the parameter population and output the optimal parameter combination.

[0056] The following examples illustrate the processing procedure for each step: The examples are based on a self-developed enclosed daylighting light box, a Nikon D7200 digital camera, and yarns of different colors, to test the method of the present invention.

[0057] In step 1, the specific implementation of making the fabric pieces corresponding to the skeins is as follows: In this example, m groups of gray skein samples with similar but slightly different colors are used as raw materials. Each group of skeins is woven into a corresponding plain weave fabric piece sample, ensuring that the fabric structure parameters are consistent, including warp and weft density, fabric thickness, and other parameters remain uniform. Standard processes are used in the weaving process to avoid the influence of fabric structure differences on color measurement. The fabric pieces are 10×10cm in size, meeting the measurement requirements of a spectrophotometer. A numbered correspondence is established between the skeins and the fabric pieces: skein 1 corresponds to fabric piece 1, skein 2 corresponds to fabric piece 2, and so on, ensuring that each skein has a unique corresponding fabric piece sample. In this example, m is taken as 8.

[0058] In step 2, based on the self-developed enclosed fluorescent lighting box and in conjunction with a Nikon D7200 digital camera, a photographic color measurement system was constructed. The constructed photographic color measurement system is shown in the attached figure. Figure 2As shown. This system ensures that the system's illumination is unaffected by natural light, and that the illumination is uniform within the effective photographic area, effectively avoiding the problem of photographic system deviation. For a detailed implementation of the photographic colorimetric system, please refer to reference 1.

[0059] [1] Liang Jinxing, Hu Xinrong, Peng Tao, et al. A type of enclosed daylighting light box [P]. Hubei Province: CN218585157U, 2023-03-07. Step 3, the specific implementation of acquiring digital images of the yarn strands and their corresponding fabric pieces, is as follows: Prepare m groups of yarn strand samples with similar colors but slight differences. For each group of yarn strands, prepare n different arrangement patterns, including loose arrangement, tight arrangement, single-layer flat laying, double-layer stacking, and random arrangement, to simulate different states in actual use. Take photos of each group of yarn strands in each of the n patterns, capturing x images consecutively for each pattern. Similarly, take high-resolution digital images of each fabric piece sample, capturing x images for each fabric piece. An example of the cropped yarn strand images is attached. Figure 3 As shown, an example image of the cropped fabric piece is attached. Figure 4 As shown. A numbering system is established to facilitate subsequent data management and analysis. The image file naming format is "sample number_morphology number.jpg". In this embodiment, m, n, and x are 8, 5, and 10 respectively, and the digital camera imaging parameters are a focal length of 140mm, ISO 100, exposure time of 1 / 25s, and aperture of f5.6.

[0060] In step 4, the method for measuring the standard color parameters of the fabric piece is as follows: A high-resolution digital image of the fabric sample is acquired using the same photometric colorimetric system as that used for yarn measurement, ensuring consistency of measurement conditions; the fabric image is preprocessed, and an effective measurement area is cropped, avoiding fabric edges and areas with obvious weaving defects; the average pixel method is used to calculate the RGB average value of all pixels within the cropped area; the RGB average value is converted into CIE Lab color parameters using a colorimetric theory conversion algorithm; a correspondence table between yarn numbers and standard Lab values ​​of the fabric piece is established to provide a reference target for subsequent parameter optimization. The CIE Lab values ​​of all yarns in this embodiment are shown in Table 1, and the CIE Lab values ​​of all fabric pieces are shown in Table 2.

[0061] Table 1

[0062]

[0063]

[0064] Table 2

[0065] In step 5, the method for defining the parameter optimization space and constraints is as follows: The key parameters to be optimized include the Gaussian filter standard deviation σ, the Gaussian filter kernel size (kernel_size), the binarization threshold adjustment coefficient (k), the connected region area threshold (area_threshold), and the skeleton minimum retained area threshold (skeleton_threshold); Reasonable value ranges and constraints are set for each parameter, and the parameter range is defined as shown in equation (1): (1) In the formula, σ is the standard deviation of the Gaussian filter, kernel_size is the size of the Gaussian filter kernel, k is the binarization threshold adjustment coefficient, area_threshold is the area threshold of the connected region, and skeleton_threshold is the minimum skeleton retention area threshold. In the embodiment, σ min and σ max Take values ​​of 1 and 5 respectively, K min and K max Take values ​​of 5 and 10 respectively, k min and k max Take values ​​of 0.3 and 2 respectively, A min and A max Take 400 and 800 respectively, S min and S max Take 5 and 20 respectively.

[0066] In step 6, the method for initializing the optimization algorithm parameters is as follows: Select the genetic algorithm as the optimization method, and set the algorithm parameters including population size, crossover probability, mutation probability, maximum number of iterations, etc.; the algorithm parameter settings are as follows:

[0067] In the formula, population_size is the population size, crossover_rate is the crossover probability, mutation_rate is the mutation probability, and max_generations is the maximum number of generations. In the example, P... size C rate M rate and G max Take values ​​of 50, 0.8, 0.1, and 100 respectively.

[0068] In step 7, the method for constructing the composite objective function is as follows: the objective function consists of two sub-objectives, namely the correlation objective and the stability objective, and the composite objective function is defined as shown in equation (2): (2) In the formula, F total For the composite objective function value, F correlation Let F be the correlation objective function.stability The objective function is stability, where ω1 and ω2 are the weight coefficients of the two sub-objectives. In this embodiment, both ω1 and ω2 are 0.5, and the formula for calculating the correlation objective function is shown in equation (3): (3) In the formula, F correlation Let R be the correlation objective function. 2 The coefficient of determination is the relationship between the L value of the yarn strand and the L value of the corresponding fabric piece. The formula for calculating the stability objective function is shown in equation (4): (4) In the formula, i is the number of the skein sample, F stability For the stability objective function, MCDM i Let N be the average color difference of the i-th group of yarn samples, and N be the number of yarn groups.

[0069] The formula for calculating the correlation coefficient is shown in equation (5): (5) In the formula, i is the sample number, L yarn,i Let L be the measured value of the i-th skein sample. fabric,i For the corresponding fabric piece, L is the L value. fabric is the average L value of the fabric pieces, and n is the total number of samples.

[0070] The formula for average color difference is shown in equation (6): (6) In the formula, i is the skein group number, j is the measurement number of the same skein group, and MCDM i Let m be the average color difference of the i-th group of skeins, m be the number of measurements for each group of skeins, and L be the average color difference. i,j a i,j b i,j The Lab value is the value of the j-th measurement for the i-th group of skeins. Let ΔE be the Lab average value of the i-th group of skeins. 00 This is the CIE DE2000 color difference formula.

[0071] The Lab value of the yarn sample was calculated using the following method: (1) Converting RGB color images to grayscale images: The weighted average method is used to convert the RGB three-channel information into single-channel grayscale information. The grayscale conversion formula is as follows:

[0072] In the formula, Gray is the converted grayscale pixel value, R, G, and B are the pixel values ​​of the red, green, and blue channels, respectively. The weighting coefficients are determined based on the human eye's sensitivity to different colors, with the green component having the largest weight, followed by the red component, and the blue component having the smallest weight.

[0073] (2) Gaussian blur processing of grayscale images: A Gaussian filter of kernel_size is used to smooth the grayscale image to reduce image noise and detail interference. The Gaussian blur kernel function is:

[0074] In the formula, G(x,y) is the filter weight value at the position coordinates (x,y), x and y are the offset coordinates relative to the kernel center, and σ is the standard deviation parameter.

[0075] (3) Perform adaptive histogram equalization: Divide the image into several sub-blocks, and perform histogram equalization on each sub-block. The cumulative distribution function of each sub-block is calculated using the following formula:

[0076] In the formula, CDF(i) is the cumulative distribution function value of gray level i, i is the current gray level, j is the summation variable, h(j) is the number of pixels at gray level j, and N is the total number of pixels in the sub-block. The formula for calculating the equalized pixel value is:

[0077] In the formula, i is the current gray level, g(i) is the new pixel value after equalization of gray level i, L is the total number of gray levels, CDF(i) is the cumulative distribution function value of gray level i, and round is the rounding function. Then, the final result is synthesized through bilinear interpolation. This method can enhance local contrast while maintaining the overall features of the image.

[0078] (4) Binarization using the improved Otsu thresholding method: First, calculate the global threshold T0 of the image, and then use the Otsu algorithm to determine the optimal segmentation threshold. The calculation formula is as follows:

[0079] In the formula, The inter-class variance is the variance at a threshold t, where t is the current threshold. (t) and (t) represents the weights of the foreground and background, respectively. and Let t represent the average gray values ​​of the foreground and background, respectively. The inter-class variance is calculated for each possible gray value t∈[0,255]. The optimal threshold T0 is chosen as the t-value that maximizes the inter-class variance.

[0080] Where T0 is the optimal threshold. Let be the inter-class variance at threshold t, where t is the current threshold, and argmax is the operator that maximizes the function. Then, the threshold is adjusted, and T = k × T0 is taken as the final binarization threshold, where k is an adjustment coefficient to better separate the yarn body and the background.

[0081] (5) Morphological operations are used to remove small noise regions: Connected regions are marked in the binarized image, and the 8-connectivity criterion is used for region analysis. The formula for calculating the area of ​​a connected region is:

[0082] In the formula, Area(C i ) represents the i-th connected region C i The area of ​​C, where i is the index of the connected region. i Let (x, y) be the i-th connected region, and (x, y) be the pixel coordinates within the region. This indicates the number of pixels counted. Connected regions with an area smaller than area_threshold are removed to eliminate noise interference.

[0083] (6) Extracting the centerline structure of the yarn strand using a skeletonization algorithm: A morphological thinning algorithm is used to extract the skeleton from the binary image. The skeletonization process is achieved by iteratively applying morphological erosion operations. The iterative formula is as follows:

[0084] In the formula, This is the image after the k'th iteration, where k' is the iteration number. This is the result of the (k'-1)th iteration, where S0 is the original binary image and B is the structuring element. This represents the erosion operation; the iterative process continues until the convergence condition S is met. k' =S k'-1 If the conditions are met, the centerline structure of the yarn is obtained, and the skeletonization process maintains the original image's topological structure unchanged; (7) Perform closing operation on the skeleton to connect breakpoints: Define a rectangular structuring element and perform morphological closing operation on the skeleton image. The closing operation is defined as: SE In the formula, Close(S) is the result of performing a closing operation on the skeleton image S, where S is the skeleton image and SE is the structuring element. This represents the expansion operation. This represents the erosion operation. The closing operation can connect broken skeleton line segments to form a complete strand centerline structure.

[0085] (8) Determine the effective measurement area: After the closing operation, morphological operations are used again to remove small areas with an area smaller than the set threshold. The formula for selecting the effective area is:

[0086] In the formula, Region eff C represents the final set of valid measurement areas. i Let Area(Ci) be the i-th connected region, and skeleton_threshold be the area threshold. This region represents the core structure of the yarn strand, has the highest visual saliency, and can accurately reflect the body color characteristics of the yarn strand.

[0087] (9) Extract RGB color information within the effective area: Obtain the set of pixel coordinates of the effective measurement area determined in step (8), and extract the RGB pixel values ​​corresponding to these coordinate positions in the original RGB image. The pixel extraction function is:

[0088] In the formula, i is the index of the pixel within the effective measurement area, RGB(i) is the RGB value of the i-th pixel, Image_RGB is the original RGB image, (x i ,y i ) represents the coordinates of the i-th valid pixel.

[0089] (10) Convert the RGB color information extracted in step (9) into LAB color space data and calculate the average color value: First, normalize the RGB values ​​to the range of [0,1]. The normalization formula is:

[0090] In the formula, R norm G norm B norm The values ​​are normalized RGB values, where R, G, and B are the original RGB values. Then, the RGB data is converted to the Lab color space using a standard color space conversion algorithm. The conversion process from RGB to Lab color space first requires conversion to the XYZ color space, using the following formula:

[0091] In the formula, X, Y, and Z are the tristimulus values ​​of the XYZ color space, and R... norm G norm B norm These are the normalized RGB values. Then, the XYZ color space is converted to the Lab color space using the following formula:

[0092]

[0093] In the formula, L, a, and b are the brightness, red-green, and yellow-blue color values ​​of the skein sample in the CIELab color space, respectively; X, Y, and Z are the tristimulus values ​​in the XYZ color space; X n Y n Z n Let be the tristimulus value of the standard illuminator, and f(t) be the nonlinear transformation function. Finally, the Lab average value of all pixels within the effective area is calculated as the color measurement result of the yarn, using the following formula:

[0094] In the formula, L mean a mean b mean The average values ​​of the L, a, and b components are respectively, which represent the Lab value of the yarn sample. N is the total number of pixels in the effective measurement area. i a i b i These are the Lab color component values ​​of the i-th pixel.

[0095] In step 8, the parameter optimization process is performed as follows: an initial population is randomly generated within the defined parameter space; fitness is evaluated for each individual; genetic operations such as selection, crossover, and mutation are performed; the population is updated and the optimal solution is recorded; the iteration is repeated until the stopping criterion is met.

[0096] In step 9, the method for determining the stopping criteria is as follows: Multiple stopping conditions are set to ensure the effectiveness of the optimization process. Stopping criteria include maximum running time, target R² value, number of consecutive generations without improvement, convergence tolerance, minimum improvement ratio, etc. The stopping condition is determined as follows:

[0097] In the formula, t current t represents the current running time. max For maximum runtime, R 2 current R is the current R² value. 2 target For the target R² value, gen no_improve For continuous unimproved algebras, gen no_tolerance For tolerance algebra, F current F is the objective function value of the current generation. best F is the optimal objective function value to date. prev t represents the objective function value of the previous generation, ε represents the convergence tolerance, and δ represents the minimum improvement ratio. In the example, t max R 2target gen no_tolerance ε and δ are taken as 60, 0.96, 15, 0.00001 and 0.005, respectively.

[0098] In step 10, the method for updating the parameter population is as follows: if the stopping criterion is not met, the iterative process of the genetic algorithm continues; a selection operation is performed to retain individuals with higher fitness; a crossover operation is performed to generate new parameter combinations; a mutation operation is performed to increase population diversity; the population is updated and prepared for the next round of iteration. The method for outputting the optimal parameter combination is as follows: When the stopping criterion is met, output the current optimal parameter combination; record the objective function value, correlation coefficient, stability index, etc., corresponding to the optimal parameters; save the first N sets of optimal parameters for the user to choose from. The parameter output format is as follows:

[0099] In the formula, P optimal For the optimal parameter combination, σ opt The optimal value for the standard deviation of the Gaussian filter, kernel opt k is the size of the Gaussian filter kernel. opt The optimal value of the binarization threshold adjustment coefficient is area. opt The optimal value for the area threshold of the connected region is the skeleton. opt This represents the optimal value for the minimum retained area threshold of the skeleton. In this example, N is set to 100. The results of yarn strand stability and the correlation between yarn strand and fabric L value are shown in Table 3, and the trend of the correlation between yarn strand and fabric L value is shown in the appendix. Figure 5 As shown in the attached figure, the trend of L-values ​​for skein yarn and fabric pieces is compared. Figure 6 As shown. This completes the optimization calculation of skein color measurement parameters based on fabric color-driven skein photography.

[0100] Table 3

[0101] This invention also provides a system for optimizing and calculating yarn color measurement parameters based on fabric color-driven photographic methods, including a processor and a memory. The memory stores program instructions, and the processor calls the program instructions in the memory to execute the yarn color measurement parameter optimization calculation method based on fabric color-driven photographic methods described above.

[0102] The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to substitute them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.

Claims

1. A method for optimizing and calculating color measurement parameters of skein yarn based on fabric color-driven methods, characterized in that, Includes the following steps: Step 1: Make the fabric pieces corresponding to the yarn strands; Step 2: Set up a photographic colorimetric system; Step 3: Acquire digital images of the yarn strands and their corresponding fabric pieces; Step 4: Measure the standard color parameters of the corresponding fabric piece; Step 5: Define the parameter optimization space and constraints; Step 6: Initialize the optimization algorithm parameters; Step 7: Construct a composite objective function as the fitness; Step 8: Perform the parameter optimization process; Step 9: Determine the stopping criteria; Step 10: Update the parameter population and output the optimal parameter combination.

2. The method for optimizing and calculating color measurement parameters of yarn skein based on fabric color-driven methods as described in claim 1, characterized in that: In step 3, the method for acquiring digital images of the yarn strands and their corresponding fabric pieces is as follows: For each group of yarn strands, n different placement configurations were prepared to simulate different states in actual use; standard digital camera shooting parameters were set to ensure that the yarn strands or fabric pieces were imaged under the same conditions; high-resolution digital images were taken for each of the n configurations of each yarn strand, with x images taken for each configuration; high-resolution digital images were also taken for each fabric piece sample, with x images taken for each fabric piece; a sample image database and numbering system were established to provide a complete data foundation for subsequent parameter optimization analysis.

3. The method for optimizing and calculating color measurement parameters of yarn skein based on fabric color-driven methods as described in claim 1, characterized in that: In step 4, the method for measuring the standard color parameters of the fabric piece is as follows: A high-resolution digital image of the fabric sample is acquired using the same photometric colorimetric system as that used for yarn measurement, ensuring consistency of measurement conditions; the fabric image is preprocessed and the effective measurement area is cropped; the average pixel method is used to calculate the RGB average value of all pixels within the cropped area; the RGB average value is converted into CIE Lab color parameters using a colorimetric theory conversion algorithm; a correspondence table between yarn number and standard Lab value of the fabric piece is established to provide a reference target for subsequent parameter optimization.

4. The method for optimizing and calculating skein photographic color measurement parameters based on fabric color-driven methods as described in claim 1, characterized in that: In step 5, the method for defining the parameter optimization space and constraints is as follows: Determine the key parameters that need to be optimized, including the Gaussian filter standard deviation σ, the Gaussian filter kernel size kernel_size, the binarization threshold adjustment coefficient k, the connected region area threshold area_threshold, and the skeleton minimum retained area threshold skeleton_threshold, and set reasonable value ranges and constraints for each parameter.

5. The method for optimizing and calculating skein photographic color measurement parameters based on fabric color-driven methods as described in claim 1, characterized in that: In step 7, the method for constructing the composite objective function is as follows: The composite objective function consists of a correlation objective and a stability objective, and the composite objective function is defined as follows: ; In the formula, F total is a composite objective function value, F correlation is a correlation objective function, F stability is a stability objective function, and ω1 and ω2 are weight coefficients; the correlation objective function calculation formula is: ; In the formula, F correlation is the correlation objective function, R 2 is the correlation coefficient between the value of the skein L and the value of the corresponding cloth piece L; the stability objective function calculation formula is as follows: ; where i is the number of the skein sample, F stability MCDM is the stability objective function, and i is the average color difference of the i-th group of skein samples, and N is the number of skein groups.

6. The method for optimizing and calculating color measurement parameters of skein yarn based on fabric color-driven methods as described in claim 5, characterized in that: The formula for calculating the correlation coefficient is as follows: ; In the formula, i is the sample number, L yarn,i Let L be the measured value of the i-th group of yarn samples. fabric,i For the corresponding fabric piece, L is the L value. fabric is the average L value of the fabric pieces, and n is the total number of samples; The formula for calculating the average color difference is: ; In the formula, i is the skein group number, j is the measurement number of the same skein group, and MCDM i Let m be the average color difference of the i-th group of skeins, m be the number of measurements for each group of skeins, and L be the average color difference. i,j a i,j b i,j The Lab value is the value of the j-th measurement for the i-th group of skeins. Let ΔE be the Lab average value of the i-th group of skeins. 00 This is the CIE DE2000 color difference formula.

7. The method for optimizing and calculating skein photographic color measurement parameters based on fabric color-driven methods as described in claim 6, characterized in that: The Lab value of the skein sample is calculated using the following method: (1) Convert RGB color images to grayscale images: Use a weighted average method to convert the RGB three-channel information into single-channel grayscale information; (2) Gaussian blur processing of grayscale images: Use a Gaussian filter of kernel_size to smooth the grayscale image to reduce image noise and detail interference; the Gaussian blur kernel function is as follows: ; In the formula, G(x,y) is the filter weight value at the position coordinates (x,y), x and y are the offset coordinates relative to the kernel center, and σ is the standard deviation of the Gaussian filter; (3) Perform adaptive histogram equalization: Divide the image into several sub-blocks and perform histogram equalization on each sub-block separately; (4) Binarization using the improved Otsu thresholding method: First, calculate the global threshold T0 of the image, and then use the Otsu algorithm to determine the optimal segmentation threshold. The calculation formula is as follows: ; In the formula, The inter-class variance is the variance at a threshold t, where t is the current threshold. (t) and (t) represents the weights of the foreground and background, respectively. and Let t be the average gray values ​​of the foreground and background, respectively; calculate the inter-class variance for each possible gray value t∈[0,255] by iterating through all possible gray values ​​t∈[0,255]. The optimal threshold T0 is chosen as the t-value that maximizes the inter-class variance. ; Where T0 is the optimal threshold. Let T be the inter-class variance at threshold t, where t is the current threshold, and argmax is the operator that finds the maximum value of the function. Then, the threshold is adjusted, and T = k × T0 is taken as the final binarization threshold, where k is the binarization threshold adjustment coefficient. (5) Remove small noise regions using morphological operations: Mark connected regions in the binarized image, perform region analysis using the 8 connectivity criterion, and remove connected regions whose area is smaller than the area threshold area_threshold; (6) Extracting the centerline structure of the yarn strand using a skeletonization algorithm: A morphological thinning algorithm is used to extract the skeleton from the binary image. The skeletonization process is achieved by iteratively applying morphological erosion operations. The iterative formula is as follows: ; In the formula, This is the image after the k'th iteration, where k' is the iteration number. This is the result of the (k'-1)th iteration, where S0 is the original binary image and B is the structuring element. This represents the erosion operation; the iterative process continues until the convergence condition S is met. k' =S k'-1 If the conditions are met, the centerline structure of the yarn is obtained, and the skeletonization process maintains the original image's topological structure unchanged; (7) Perform closing operation on the skeleton to connect breakpoints: Define a rectangular structuring element and perform morphological closing operation on the skeleton image. The closing operation is defined as: SE; In the formula, Close(S) is the result of performing a closing operation on the skeleton image S, where S is the skeleton image and SE is the structuring element. This indicates the expansion operation. This represents the erosion operation; (8) Determine the effective measurement area: After the closing operation, morphological operations are used again to remove small areas with an area smaller than the set connected region area threshold; (9) Extract RGB color information within the effective area: Obtain the set of pixel coordinates of the effective measurement area determined in step (8), and extract the RGB pixel values ​​corresponding to these coordinate positions in the original RGB image; (10) Convert the RGB color information extracted in step (9) into LAB color space data and calculate the average color value: First, normalize the RGB values ​​to the range of [0,1]. The normalization formula is: ; In the formula, R norm G norm B norm The values ​​are the normalized RGB values, where R, G, and B are the original RGB values. Then, the RGB data is converted to the Lab color space using a standard color space conversion algorithm. The conversion process from RGB to Lab color space first requires conversion to the XYZ color space, using the following formula: ; In the formula, X, Y, and Z are the tristimulus values ​​of the XYZ color space, and R... norm G norm B norm The values ​​are the normalized RGB values; then the XYZ color space is converted to the Lab color space using the following formula: ; ; In the formula, L, a, and b are the luminance, red-green, and yellow-blue color values ​​of the CIELab color space, respectively, and X, Y, and Z are the tristimulus values ​​of the XYZ color space. n Y n Z n Let f(t) be the tristimulus value of the standard illuminator, f(t) be the nonlinear transformation function, and t be the independent variable; and calculate the average Lab value of all pixels in the effective area as the Lab value of the yarn sample.

8. The method for optimizing and calculating color measurement parameters of yarn skein based on fabric color-driven methods as described in claim 1, characterized in that: In step 9, the method for determining the stopping criteria is as follows: multiple stopping conditions are set to ensure the effectiveness of the optimization process. The stopping criteria include maximum running time, target R² value, number of consecutive generations without improvement, convergence tolerance, and minimum improvement ratio. The stopping conditions are determined as follows: ; In the formula, t current t represents the current running time. max For maximum runtime, R 2 current R is the current R² value. 2 target For the target R² value, gen no_improve For continuous unimproved algebras, gen no_tolerance For tolerance algebra, F current F is the objective function value of the current generation. best F is the optimal objective function value to date. prev ε is the objective function value of the previous generation, ε is the convergence tolerance, and δ is the minimum improvement ratio.

9. The method for optimizing and calculating color measurement parameters of yarn skein based on fabric color-driven methods as described in claim 1, characterized in that: The method for outputting the optimal parameter combination is as follows: When the stopping criterion is met, output the current optimal parameter combination; record the objective function value, correlation coefficient, and stability index corresponding to the optimal parameters; save the first N sets of optimal parameters for the user to choose from. The parameter output format is as follows: ; In the formula, P optimal For the optimal parameter combination, σ opt The optimal value for the standard deviation of the Gaussian filter, kernel opt k is the size of the Gaussian filter kernel. opt The optimal value of the binarization threshold adjustment coefficient is area. opt The optimal value for the area threshold of the connected region is the skeleton. opt This is the optimal value for the minimum retained area threshold of the skeleton.

10. A system for optimizing and calculating color measurement parameters of yarn skein based on fabric color-driven methods, characterized in that: It includes a processor and a memory, the memory being used to store program instructions, and the processor being used to call the program instructions in the memory to execute the optimization calculation method for yarn photographic color measurement parameters based on fabric color-driven method as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Closed daylight lighting lamp box

    CN218585157U