A yarn photometric colorimetry method and system based on texture feature weighted correction
By employing a yarn photogrammetry method based on texture feature weighted correction, and utilizing K-means clustering and Skeletonization algorithms, combined with spectral reconstruction and colorimetric principles, the stability and visual perception consistency issues of yarn color measurement are resolved, achieving both accuracy in yarn color measurement and consistency with human visual perception.
Patent Information
- Application Number
- CN202510037460.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-09
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2045-01-09
AI Technical Summary
Traditional yarn color measurement methods are easily affected by yarn density, arrangement, and sample uniformity, resulting in poor stability and repeatability. Existing photographic colorimetry methods are difficult to reflect human visual perception when yarn texture is complex, leading to deviations between color measurement results and reality.
A yarn photometric method based on texture feature weighting correction is adopted. The yarn and background are segmented by K-means clustering algorithm, the center line is extracted by Skeletonization algorithm, and nonlinear texture weighting calculation is performed by combining spectral reconstruction and colorimetry principles to obtain yarn color correction data.
It improves the stability and consistency of yarn color measurement, and the results of yarn photographic color measurement are consistent with human visual perception, overcoming the limitations of traditional spectrophotometers and existing photographic color measurement methods.
Smart Images

Figure CN119941815B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer digital image processing technology, specifically relating to a yarn photographic color measurement method based on texture feature weighted correction. Background Technology
[0002] Yarn color is a key factor determining the appearance and market competitiveness of fabrics, and its measurement accuracy is crucial to the production quality of textiles. Traditional yarn color measurement typically relies on spectrophotometers, requiring the yarn to be wound into regular samples for measurement. This process is cumbersome, and the measurement results are easily affected by factors such as yarn density, arrangement, and sample uniformity, resulting in poor stability and repeatability. To overcome these limitations, photographic colorimetry and multispectral imaging methods have been proposed in recent years. Photographic colorimetry uses a digital camera to capture yarn images and extracts color information using image processing algorithms and colorimetric principles; multispectral imaging achieves more precise color measurement through the acquisition and analysis of multi-band spectral data. However, both methods still struggle to fully reflect human visual perception when the yarn surface has complex textures and significant light and shadow effects, leading to significant discrepancies between measurement results and subjective perception. This results in mismatched colors in the actual fabric products produced by enterprises, causing inventory backlogs and economic losses. Currently, neither the academic nor industrial communities, both domestically and internationally, have proposed a satisfactory solution to the limitations of spectrophotometers in the color measurement of textured fabrics. Summary of the Invention
[0003] The purpose of this invention is to solve the problems described in the background art. Based on photographic colorimetry, this invention proposes a yarn photographic colorimetry method based on texture feature weighted correction. The implementation of this technology first requires building a photographic colorimetry system, using a digital camera to capture yarn images and extract image data of the area to be measured; secondly, the image is segmented using a K-means clustering algorithm to accurately separate the yarn from the background area; further, the center line of the yarn is extracted using a skeletonization algorithm to reduce the influence of yarn surface texture on the color measurement results; subsequently, digital images of training samples are captured using a digital camera, and the RGB values of each color block are extracted; using the training samples, a spectral reconstruction matrix is constructed; based on this, the chromaticity value of each pixel of the yarn center line is calculated based on spectral reconstruction and colorimetric principles; then, the XYZ color space is converted to the Lab color space; finally, based on the nonlinear perception characteristics of human eye brightness, a nonlinear texture weighting method is used to weight and calculate the chromaticity value of the center line, thereby obtaining the corrected color data of the yarn. This invention effectively overcomes the limitations of traditional spectrophotometers in yarn color measurement, and also solves the problem of existing photographic colorimetry methods ignoring the influence of yarn texture features on color measurement results, achieving consistency between photographic colorimetry results and real human visual perception. The technical solution of this invention is a yarn photographic colorimetry method based on texture feature weighted correction, specifically including the following steps:
[0004] Step 1: Set up a photographic colorimetry system;
[0005] Step 2: Use a photometric colorimetry system to capture images of the yarn and extract the image of the area to be measured;
[0006] Step 3: Use the K-means clustering algorithm to segment the yarn and background in the image of the region to be measured;
[0007] Step 4: Extract the yarn centerline using the Skeletonization algorithm;
[0008] Step 5: Use a photographic colorimetry system to capture digital images of the training samples and extract their RGB values;
[0009] Step 6: Construct a spectral reconstruction matrix based on the training samples;
[0010] Step 7: Reconstruct the spectrum of each pixel in the area to be measured using the spectral reconstruction matrix;
[0011] Step 8: Calculate the color data corresponding to the spectral data of each pixel in the area to be measured in Step 7 based on the principle of colorimetry to obtain the yarn color data.
[0012] Step 9: Based on the yarn color data in Step 8, calculate the yarn color correction measurement data using the texture weighting method.
[0013] Furthermore, in step 1, when building the photographic colorimetric system, the system's illumination needs to be unaffected by natural light, and the uniformity of illumination within the effective photographing area should be ensured. This ensures that the digital response values of the same sample object are consistent at different locations within the photographing area, thus avoiding the problem of photographic system deviation. For a detailed implementation of the photographic colorimetric system, please refer to reference 1.
[0014] [1] Liang Jinxing, Hu Xinrong, Peng Tao, et al. A type of enclosed daylighting light box [P]. Hubei Province: CN218585157U, 2023-03-07.
[0015] Furthermore, in step 2, the method for capturing yarn images using a digital camera and extracting the image of the area to be measured is as follows: Under standard lighting conditions, acquire yarn images using a digital camera to ensure the accuracy and consistency of color information during the imaging process. Extract the effective area of the yarn, removing the background and irrelevant edges. Standardize the size of the extracted image, unifying its pixel resolution and spatial scale to provide standardized input for subsequent color analysis and data processing. Save the processed image in a lossless data format while retaining the original image file to ensure high accuracy and traceability of the results in the spectral reconstruction and color calculation process.
[0016] Furthermore, in step 3, the method for segmenting the yarn from the background using the K-means clustering algorithm is as follows:
[0017] First, the image undergoes preprocessing, including color correction and noise reduction, enhancing contrast and detail to ensure the segmentation accuracy of the clustering algorithm. The image is then converted from the RGB color space to a color space more suitable for the segmentation task, improving color discrimination.
[0018] Next, using the color features of image pixels as input data, a K-means clustering model is constructed. Euclidean distance is selected as the similarity metric between pixels, and clustering is performed based on the geometric distance of pixels in the color space to ensure the accuracy and stability of the segmentation process.
[0019] Finally, the segmented image is binarized based on the clustering results, and pixels are classified into yarn regions or background regions. To improve the segmentation effect, morphological operations (dilation and erosion) are applied to repair the segmentation boundaries, eliminate isolated noise points and segmentation errors, and median filtering is used to smooth the regions to ensure the continuity of the boundaries and the integrity of the yarn contours.
[0020] Furthermore, in step 4, the binary image obtained from K-means segmentation is input into a morphological thinning skeletonization algorithm. Edge pixels are removed recursively while preserving the yarn's centerline structure. During each iteration, connectivity constraints are satisfied and the topological structure is preserved. Morphological restoration is performed on the skeleton extraction results, removing isolated points and small branches, and irrelevant small regions are removed through connected component analysis to ensure the continuity and uniqueness of the yarn's centerline.
[0021] Furthermore, in step 5, the method for capturing digital images of the training samples using a digital camera and extracting their RGB values is as follows:
[0022] First, prepare or create training samples. Training samples can be common standard color charts, such as the X-Rite ColorChecker SG140 color chart, or solid-color fabric samples. Since the color portion of the training samples directly affects the accuracy of photographic color measurement, the larger the color gamut volume of the solid-color fabric samples and the more uniform the sample distribution in the color space, the better its application performance. For specific preparation methods, please refer to the method for preparing solid-color fabric physical samples in Reference 2.
[0023] [2] Liang Jinxing, Zuo Zhuan, Zhou Jing, et al. A digital measurement method for fabric color based on digital camera [P]. Hubei Province: CN114235153B, 2022-05-13.
[0024] Secondly, when placing the training sample within the effective photographic area of the photometric system, it is essential to ensure that the shooting conditions are exactly the same as those used when photographing the training sample. Otherwise, the inconsistency in shooting conditions will lead to errors in the reconstruction of the yarn spectrum, ultimately affecting the accuracy of the color measurement results.
[0025] Finally, the RGB values of each training sample are extracted to construct the spectral reconstruction matrix. For each training sample, the RGB data of all pixels within its central m×m pixel region are extracted, and the RGB data of the m×m pixels are averaged to obtain the RGB data of the sample, as shown in Equation (1):
[0026]
[0027] In the formula, i represents the i-th color patch in the training sample set; j represents the j-th pixel in the extracted region; r i,j g i,j b i,j These represent the red, green, and blue RGB values of the j-th pixel of the i-th solid color sample; d i Let be the RGB value of the i-th color patch in the sample set, and let be a 1×3 row vector.
[0028] Furthermore, in step 6, the method for constructing the spectral reconstruction matrix using the training samples is as follows:
[0029] First, the RGB values of the training samples are polynomially expanded using a third-order homogeneous polynomial, as shown in equation (2), which contains 13 expansion terms:
[0030]
[0031] In the formula, r, g, and b are the RGB values of the R, G, and B channels of the color block, respectively, and d... *,exp The expanded RGB value vector of a color block, after homogeneous polynomial expansion, results in the expanded RGB response value matrix of the training samples as shown in equation (3).
[0032] D train,exp = (d train ,exp,1, d train ,exp,2, ... , d train,exp,j ) T (j=1, 2, ... ,P) (3)
[0033] In the formula, the subscript 'j' indicates the j-th training sample, P is the number of training samples, and d train,exp,j Let D be the extended vector of the RGB values of the j-th training sample. train,exp This is an extended RGB matrix for the training sample set.
[0034] Then, the spectral reconstruction matrix is solved using the spectral matrix and extended RGB matrix of the training samples, and the Tikhonov regularization method is used to constrain the solution process to overcome the influence of imaging noise signal on the accuracy of the spectral reconstruction matrix solution. The specific solution method is shown in equations (4) to (7): First, the extended RGB matrix D of the training samples is... train,exp Singular value decomposition is performed, and then a minimal number α is added to the eigenvalues to obtain constrained eigenvalues, thereby reducing the condition number of the extended RGB matrix. The extended RGB matrix D after regularization constraint is then reconstructed. train,exp,rec Finally, the pseudo-inverse algorithm is used to solve for the spectral reconstruction matrix Q.
[0035] D train,exp = USV T (4)
[0036] P = S + αI (5)
[0037] D train,exp,rec = UPV T (6)
[0038] Q = R train ·pinv(D train,exp,rec(7)
[0039] In the formula, U and V are the orthogonal decomposition matrices obtained by singular value decomposition, S and P are diagonal matrices containing eigenvalues, I is the identity matrix, pinv() is the pseudo-inverse operator, and R train This is the spectral data matrix for the training sample set.
[0040] Furthermore, in step 7, the method for reconstructing the spectrum of each pixel in the region to be measured using the spectral reconstruction matrix is as shown in equation (8):
[0041] r = Qd(8)
[0042] In the formula, d is the extended RGB value of the selected area to be measured; Q is the spectral reconstruction matrix calculated by formula (7); and r is the reconstructed spectral data.
[0043] Furthermore, in step 8, the method for calculating the corresponding color data based on the principles of colorimetry to reconstruct the spectrum and obtain the yarn color data is as follows:
[0044] First, based on colorimetric theory, the CIEXYZ tristimulus values of the yarn are obtained by calculating the final weighted summation spectrum. The calculation method is shown in equations (9) to (12).
[0045]
[0046] in,
[0047]
[0048] In the formula, x(λ), y(λ), and z(λ) are standard observer color matching functions, E(λ) is the spectral reflectance of the object, S(λ) is the relative spectral power distribution function of the light source, λ is the wavelength, η is the adjustment factor, and X, Y, and Z are the tristimulus values of the yarn, respectively.
[0049] Then, the corresponding CIELab color data is calculated. Based on colorimetric theory, the method for calculating the corresponding CIELab color data from the tristimulus values CIEXYZ is shown in equations (11) to (12).
[0050]
[0051] in,
[0052]
[0053] In the formula, L, a, and b represent the brightness, red-green, and yellow-blue color values of the yarn in the CIELab color space, respectively; X, Y, and Z represent the tristimulus color data of the yarn, respectively; X... n Yn and Z n The tristimulus color data of the reference light source are respectively, where H and H are in equation (12). n These represent the CIEXYZ tristimulus values of the yarn and the reference light source, respectively.
[0054] Furthermore, in step 9, the method for calculating the yarn color correction measurement data using the texture weighting method is as follows:
[0055] First, extract the lightness value (L) from the area to be measured. i ), and normalize it to normalized_L i As shown in equation (13),
[0056]
[0057] In the formula L min and L max These are the minimum and maximum values of the centerline pixel's brightness, respectively. i represents the i-th pixel in the measurement area, and L... i Let be the brightness value of the i-th pixel in the measurement area.
[0058] Then, texture-weighted color correction is performed on the area to be tested to obtain the weighted value of lightness, weighted_L, as shown in equation (14):
[0059]
[0060] In the formula, normalized_L is the normalized lightness value calculated in formula (13), and eps is a small constant to avoid the denominator being 0. Thus, the yarn photometric color measurement based on texture feature weighted correction is completed.
[0061] The present invention also provides a yarn photographic colorimetric system based on texture feature weighted correction, comprising:
[0062] The system includes a processor and a memory. The memory stores program instructions, and the processor calls the stored instructions in the memory to execute a yarn photographic color measurement method based on texture feature weighted correction as described in the above technical solution.
[0063] This invention addresses the shortcomings of current spectrophotometers in measuring yarn color and the limitations of existing photographic colorimetry methods in measuring yarn texture color. It proposes a yarn photographic colorimetry method based on texture feature weighted correction, which makes the photographic colorimetry results of yarn more consistent with real visual perception and further improves the promotion and application of photographic colorimetry technology in the textile production field. Attached Figure Description
[0064] Figure 1 This is a flowchart of an embodiment of the present invention.
[0065] Figure 2 This is a physical image of the photographic colorimetric system built according to an embodiment of the present invention.
[0066] Figure 3 This is a binarized image of the yarn and background segmentation result obtained by the K-means algorithm in this embodiment of the invention.
[0067] Figure 4 This is a centerline image generated on the yarn by the skeletonization algorithm in an embodiment of the present invention.
[0068] Figure 5 The Lab values of six yarn colors tested in this embodiment of the invention and their color differences compared with spectrophotometry.
[0069] Figure 6 The average score of 20 experimenters for different methods used to test a single yarn in an embodiment of the present invention.
[0070] Figure 7 The results are the average of the scores obtained from testing six different yarn colors in this embodiment of the invention. Detailed Implementation
[0071] The technical solution of this invention can be implemented by those skilled in the art using computer software technology.
[0072] Combined with appendix Figure 1 This invention proposes a yarn photographic colorimetric method based on texture feature weighted correction, which specifically includes the following steps:
[0073] Step 1: Set up a photographic colorimetry system;
[0074] Step 2: Use a digital camera to capture images of the yarn and extract images of the area to be measured;
[0075] Step 3: Use the K-means clustering algorithm to segment the yarn from the background;
[0076] Step 4: Extract the yarn centerline using the Skeletonization algorithm;
[0077] Step 5: Use a digital camera to capture digital images of the training samples and extract their RGB values;
[0078] Step 6: Construct a spectral reconstruction matrix based on the training samples;
[0079] Step 7: Reconstruct the spectrum of each pixel in the area to be measured using the spectral reconstruction matrix;
[0080] Step 8: Calculate the color data corresponding to the spectral data of each pixel in the area to be measured in Step 7 based on the principle of colorimetry to obtain the yarn color data.
[0081] Step 9: Based on the yarn color data in Step 8, calculate the yarn color correction measurement data using the texture weighting method.
[0082] The following examples illustrate the processing procedure for each step: The examples are based on a self-developed enclosed daylighting light box, an X-Rite ColorChecker SG140 color chart, a Nikon D7200 digital camera, and six different colored yarns, to test the method of the present invention.
[0083] In step 1, based on a self-developed enclosed fluorescent lighting box and in conjunction with a Nikon D7200 digital camera, a photographic color measurement system was constructed, as shown in the attached diagram. Figure 2 As 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.
[0084] [1] Liang Jinxing, Hu Xinrong, Peng Tao, et al. A type of enclosed daylighting light box [P]. Hubei Province: CN218585157U, 2023-03-07.
[0085] In step 2, the method for capturing yarn images using a digital camera and extracting the image of the area to be measured is as follows:
[0086] First, prepare yarn samples that are free from contamination, have no obvious color variations, and are uniformly colored. In this embodiment of the invention, six yarn samples of different colors are placed sequentially on the shooting platform, and the two ends are fixed with magnets to ensure that the yarns are flat and wrinkle-free, and that the center of each yarn is within the effective shooting range of the camera lens.
[0087] Next, set the shooting parameters of the digital camera. In this embodiment, the imaging parameters of the digital camera are a focal length of 140mm, ISO 100, exposure time of 1 / 25s, and aperture of f5.6. After shooting, save the image as a JPG file, maintaining the original shooting resolution, and name it according to the yarn color.
[0088] Finally, crop the image based on the area where the yarn is located, keeping only the yarn portion and avoiding the inclusion of background or other distracting information.
[0089] In step 3, the method for segmenting the yarn from the background using the K-means clustering algorithm is as follows:
[0090] First, the image undergoes preprocessing, including color correction and noise reduction, enhancing contrast and detail to ensure the segmentation accuracy of the clustering algorithm. The image is then converted from the RGB color space to a color space more suitable for the segmentation task, improving color discrimination.
[0091] Next, using the color features of image pixels as input data, a K-means clustering model is constructed. Euclidean distance is selected as the similarity metric between pixels, and clustering is performed based on the geometric distance of pixels in the color space to ensure the accuracy and stability of the segmentation process.
[0092] Finally, the segmented image is binarized based on the clustering results, classifying pixels into either yarn or background regions. To improve segmentation performance, morphological operations (dilation and erosion) are applied to repair segmentation boundaries, eliminating isolated noise points and segmentation errors. Median filtering is also used to smooth regions, ensuring boundary continuity and the integrity of the yarn outline. In this embodiment, the image is converted from the RGB color space to the HSV color space, and the number of clusters is set to two (yarn and background). The final binarized result of the segmented image is shown in the appendix. Figure 3 .
[0093] In step 4, the binary image obtained from K-means segmentation is input into a morphological thinning skeletonization algorithm. Edge pixels are removed recursively while preserving the yarn's centerline structure. During each iteration, connectivity constraints are satisfied and the topological structure is preserved. Morphological restoration is performed on the skeletonized image, removing isolated points and small branches, and irrelevant small regions are removed through connected component analysis to ensure the continuity and uniqueness of the yarn's centerline. In this example, a red centerline is generated on the yarn using the skeletonization algorithm; the result is shown in the appendix. Figure 4 Subsequent algorithms are performed along the center line to reduce texture interference.
[0094] In step 5, the method for capturing digital images of the training samples using a digital camera and extracting their RGB values is as follows:
[0095] First, prepare or create training samples. Training samples can be common standard color charts, such as X-Rite's ColorChecker SG140, or solid-color fabric samples. Since the color portion of the training samples directly affects the accuracy of photographic color measurement, the larger the color gamut volume of the solid-color fabric samples and the more uniform the color space distribution, the better their application performance. For specific preparation methods, please refer to the method for preparing solid-color fabric samples in Reference 2. This embodiment uses the X-Rite ColorChecker SG140 color chart as the training sample.
[0096] [2] Liang Jinxing, Zuo Zhuan, Zhou Jing, et al. A digital measurement method for fabric color based on digital camera [P]. Hubei Province: CN114235153B, 2022-05-13.
[0097] Secondly, when placing the training samples within the effective imaging area of the photographic colorimetry system, it is crucial to ensure that the shooting conditions are completely identical to those used when photographing the yarn samples. Otherwise, inconsistencies in shooting conditions will lead to errors in the reconstruction of the yarn spectrum, ultimately affecting the accuracy of the color measurement results. In this embodiment, the imaging parameters of the digital camera are: focal length 35mm, ISO 100, exposure time 1 / 25s, and aperture size f5.6.
[0098] Finally, the RGB values of each training sample are extracted to construct the spectral reconstruction matrix. For each training sample, the RGB data of all pixels within its central m×m pixel region are extracted, and the RGB data of the m×m pixels are averaged to obtain the RGB data of the sample, as shown in Equation (1):
[0099]
[0100] In the formula, i represents the i-th color patch in the training sample set; j represents the j-th pixel in the extracted region; r i,j g i,j b i,j These represent the red, green, and blue RGB values of the j-th pixel of the i-th solid color sample; d i Let m be the RGB value of the i-th color patch in the sample set, and let m be a 1×3 row vector. In this example, the value of m is 50.
[0101] In step 6, the method for constructing the spectral reconstruction matrix using the X-Rite ColorChecker SG140 color chart (training sample) is as follows:
[0102] First, the raw response values of the training samples are polynomially expanded using a third-order homogeneous polynomial, as shown in equation (2), which contains 13 expansion terms:
[0103]
[0104] In the formula, r, g, and b are the RGB values of the R, G, and B channels of the color block, respectively, and d... *,exp Let be the extended RGB value vector of a color block, with the superscript 'T' indicating transpose. After homogeneous polynomial expansion, the RGB value expansion matrix of the training samples is shown in equation (3).
[0105] D train,exp = (d train ,exp,1, d train ,exp,2, ... , d train,exp,j ) T (j=1, 2, ... ,P) (3)
[0106] In the formula, the subscript 'j' indicates the j-th training sample, P is the number of training samples, and dtrain,exp,j Let D be the expanded vector of the raw response value of the j-th training sample. train,exp This is an expanded RGB matrix for the training sample set. In the example, D train,exp The dimensions are 140×13.
[0107] Then, the spectral reconstruction matrix is solved using the spectral matrix and extended RGB matrix of the training samples, and the Tikhonov regularization method is used to constrain the solution process to overcome the influence of imaging noise signal on the accuracy of the spectral reconstruction matrix solution. The specific solution method is shown in equations (4) to (7): First, the extended RGB matrix D of the training samples is... train,exp Singular value decomposition is performed, and then a minimal number α is added to the eigenvalues to obtain constrained eigenvalues, thereby reducing the condition number of the extended RGB matrix. The extended RGB matrix D after regularization constraint is then reconstructed. train,exp,rec Finally, the pseudo-inverse algorithm is used to solve for the spectral reconstruction matrix Q.
[0108] D train,exp = USV T (4)
[0109] P = S + αI (5)
[0110] D train,exp,rec = UPV T (6)
[0111] Q = R train ·pinv(D train,exp,rec (7)
[0112] In the formula, U and V are the orthogonal decomposition matrices obtained by singular value decomposition, S and P are diagonal matrices containing eigenvalues, I is the identity matrix, pinv() is the pseudo-inverse operator, and R train R is the spectral data matrix of the training sample set. In the example, R train The spectral data were obtained by i1Profiler spectrophotometer, and the dimension of the spectral reconstruction matrix Q is 13×31.
[0113] In step 7, the method for reconstructing the spectrum of each pixel in the region to be measured using the spectral reconstruction matrix is as shown in equation (8):
[0114] r = Qd(8)
[0115] In the formula, d is the extended RGB value of the selected area to be measured; Q is the spectral reconstruction matrix calculated by formula (7); and r is the reconstructed spectral data.
[0116] In step 8, the color data corresponding to the spectral reconstruction is calculated based on the principles of colorimetry. The method for obtaining the yarn color data is as follows:
[0117] First, based on colorimetric theory, the CIEXYZ tristimulus values of the yarn are obtained by calculating the final weighted summation spectrum. The calculation method is shown in equations (9) to (12).
[0118]
[0119] in,
[0120]
[0121] In the formula, x(λ), y(λ), and z(λ) are standard observer color matching functions, E(λ) is the spectral reflectance of the object, S(λ) is the relative spectral power distribution function of the light source, λ is the wavelength, η is the adjustment factor, and X, Y, and Z are the tristimulus values of the yarn, respectively.
[0122] Then, the corresponding CIELab color data is calculated. Based on colorimetric theory, the method for calculating the corresponding CIELab color data from the tristimulus values CIEXYZ is shown in equations (11) to (12).
[0123]
[0124] in,
[0125]
[0126] In the formula, L, a, and b represent the brightness, red-green, and yellow-blue color values of the yarn in the CIELab color space, respectively; X, Y, and Z represent the tristimulus color data of the yarn, respectively; X... n Y n and Z n The tristimulus color data of the reference light source are respectively, where H and H are in equation (12). n These represent the CIEXYZ tristimulus values of the yarn and the reference light source, respectively.
[0127] In step 9, the method for calculating the yarn color correction measurement data using the texture weighting method is as follows:
[0128] First, extract the lightness value (L) from the area to be measured. i ), and normalize it to normalized_L i As shown in equation (13),
[0129]
[0130] In the formula L min and L max These are the minimum and maximum values of the centerline pixel brightness, respectively, where i is the i-th pixel in the measurement area, and L...i Let be the brightness value of the i-th pixel in the measurement area.
[0131] Then, texture-weighted color correction is performed on the area to be tested to obtain the weighted value of lightness, weighted_L, as shown in equation (14):
[0132]
[0133] In the formula, normalized_L is the normalized lightness value calculated in formula (13), and eps is a small constant to avoid a denominator of 0. In this embodiment, eps is taken as 0.001. The color data of the six yarns and the color difference between them and the spectrophotometric method are shown in [reference needed]. Figure 5 Thus, the yarn photometric colorimetry based on texture feature weighted correction is complete.
[0134] Figure 5 This invention demonstrates that the color data obtained by the method of this invention is close to that obtained by spectrophotometry. Furthermore, this invention also proves through psychophysical experiments that the method of this invention is more consistent with human visual perception. The psychophysical experimental procedure is as follows: A calibrated monitor and a standard viewing platform are placed together in a dark room, ensuring that the ambient light source is a D65 standard light source to avoid interference from external light. The monitor displays yarn color images measured by different colorimetric methods, while six yarn samples are placed on the standard viewing platform, ensuring that the monitor and yarn samples are under the same observation conditions. Twenty participants are selected to participate in the experiment, ensuring that they have passed color blindness and color weakness tests and can normally distinguish colors. After entering the dark room, participants are given a certain amount of time to adapt to the dark room environment and the light conditions of the experimental environment. Participants observe the yarn color displayed on the monitor and the actual yarn color on the standard viewing platform in the dark room, making visual comparisons and scoring according to the closeness of the colors. The scoring standard is 1-7 points, where 1 point represents the least similar color and 7 points represents the closest color. To ensure the stability and reliability of the experimental results, the scoring experiment for each participant is repeated three times. After the experiment, an analysis of variance was performed on the scoring data from the three rounds of experiments. The final experimental results are as follows: Figure 6 and Figure 7 As shown, it can be concluded that the method of the present invention is more in line with human visual perception.
[0135] On the other hand, embodiments of the present invention also provide a yarn photographic colorimetric system based on texture feature weighted correction, comprising:
[0136] The system includes a processor and a memory. The memory stores program instructions, and the processor calls the stored instructions in the memory to execute a yarn photographic color measurement method based on texture feature weighted correction as described in the above technical solution.
[0137] 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 photographic colorimetry of yarn based on texture feature weighted correction, characterized in that, Includes the following steps: Step 1: Set up a photographic colorimetry system; Step 2: Use a photometric colorimetry system to capture images of the yarn and extract the image of the area to be measured; Step 3: Use the K-means clustering algorithm to segment the yarn and background in the image of the region to be measured; Step 4: Extract the yarn centerline using the Skeletonization algorithm; Step 5: Use a photographic colorimetry system to capture digital images of the training samples and extract their RGB values; Step 6: Construct a spectral reconstruction matrix based on the training samples; Step 7: Reconstruct the spectrum of each pixel in the area to be measured using the spectral reconstruction matrix; Step 8: Calculate the color data corresponding to the spectral data of each pixel in the area to be measured in Step 7 based on the principle of colorimetry to obtain the yarn color data. Step 9: Based on the yarn color data in Step 8, calculate the yarn color correction measurement data using the texture weighting method; The specific implementation method for calculating yarn color correction measurement data using the texture weighting method is as follows: First, extract the brightness value L from the area to be measured. i and normalize it to normalized_L i As shown in equation (13), (13); In the formula L min and L max These are the minimum and maximum values of the centerline pixel brightness, respectively, where i is the i-th pixel in the measurement area, and L... i Let be the brightness value of the i-th pixel in the measurement area; Then, the texture weighted color correction is performed on the area to be tested to obtain the weighted lightness value weighted_L, as shown in Equation (14); (14); In the formula, normalized_L is the normalized brightness value calculated in formula (13), and eps is a small constant to avoid the denominator being 0.
2. The yarn photographic colorimetric method based on texture feature weighted correction as described in claim 1, characterized in that: The photographic color measurement system in step 1 includes an enclosed daylight-illuminated light box and a digital camera.
3. The yarn photographic colorimetric method based on texture feature weighted correction as described in claim 1, characterized in that: The specific implementation method of step 2 is as follows; First, prepare yarn samples: Place various yarn samples of different colors on the shooting platform in sequence, fix the two ends with magnets, ensure that the yarn is flat and wrinkle-free, and that the center of each yarn is within the effective shooting range of the camera lens. Secondly, set the shooting parameters of the digital camera: focal length, ISO, exposure time, aperture size. After shooting, save the image as a JPG file, keep the original shooting resolution, and name it according to the yarn color. Finally, crop the image based on the area where the yarn is located, keeping only the yarn portion and avoiding the inclusion of background or other distracting information.
4. The yarn photographic colorimetric method based on texture feature weighted correction as described in claim 1, characterized in that: The method for segmenting the yarn from the background using the K-means clustering algorithm in step 3 is as follows: First, the image is preprocessed, including color correction and noise reduction, enhancing contrast and detail; and then the image is converted from the RGB color space to the HSV color space. Next, using the color features of image pixels as input data, a K-means clustering model is constructed, and Euclidean distance is selected as the similarity metric between pixels. Clustering is performed based on the geometric distance between pixels in the color space. Finally, based on the clustering results, a binarized image is generated to segment the image, classifying the pixels into the yarn region or the background region. Morphological operations are applied to repair the segmentation boundaries, eliminate isolated noise points and segmentation errors, and median filtering is used to smooth the region to ensure the continuity of the boundaries and the integrity of the yarn contour.
5. The yarn photographic colorimetric method based on texture feature weighted correction as described in claim 1, characterized in that: The specific implementation method of step 5 is as follows; First, prepare or create training samples; Secondly, the training samples were placed within the effective photographic area of the photometric system, and the photographic conditions were exactly the same as those used when photographing the yarn samples. Finally, the RGB values of each training sample are extracted to construct the spectral reconstruction matrix; for each training sample, its center is extracted. m × m The RGB data of all pixels within the pixel region, and for m × m The RGB data of the pixels are averaged to obtain the RGB data of the sample, as shown in equation (1): (1); In the formula, i represents the i-th color patch in the training sample set; j represents the j-th pixel in the extracted region; r i,j g i,j b i,j These represent the red, green, and blue RGB values of the j-th pixel of the i-th solid color sample; d i Let be the RGB value of the i-th color patch in the sample set, and let be a 1×3 row vector.
6. The yarn photographic colorimetric method based on texture feature weighted correction as described in claim 1, characterized in that: The specific implementation method of step 6 is as follows; First, the raw response values of the training samples are polynomially expanded using a third-order homogeneous polynomial, as shown in equation (2), which contains 13 expansion terms: (2) ; In the formula, r , g , b These are the RGB values of the R, G, and B channels of the color block, respectively, d *,exp For a color patch, the extended RGB value vector, superscript T Let represent the transpose. After homogeneous polynomial expansion, the expanded RGB value matrix of the training samples is shown in equation (3). (3); In the formula, the subscript j Instruction No. j There are training samples, P is the number of training samples, and d train,exp,j For the first j The expanded vector of the raw response values of each training sample, D train,exp This is an expanded RGB matrix for the training sample set; Then, the spectral reconstruction matrix is solved using the spectral matrix and extended RGB matrix of the training samples, and the Tikhonov regularization method is used to constrain the solution process to overcome the influence of imaging noise signal on the accuracy of the spectral reconstruction matrix solution. The specific solution method is shown in equations (4) to (7): First, the extended RGB matrix D of the training samples is... train,exp Perform singular value decomposition, then add a minimal number to the eigenvalues. α The constraint eigenvalues are obtained to reduce the condition number of the extended RGB matrix, and the extended RGB matrix D after regularization constraints is reconstructed. train,exp,rec Finally, the pseudo-inverse algorithm is used to solve for the spectral reconstruction matrix Q. (4); (5); (6); (7); In the formula, U and V are the orthogonal decomposition matrices obtained by singular value decomposition, S and P are diagonal matrices containing eigenvalues, and I is the identity matrix. pinv () is the pseudo-inverse operator, R train This is the spectral data matrix for the training sample set.
7. The yarn photographic colorimetric method based on texture feature weighted correction as described in claim 1, characterized in that: In step 7, the specific implementation method of reconstructing the spectrum of each pixel in the region to be measured using the spectral reconstruction matrix is shown in equation (8): (8); In the formula, d is the extended RGB value of the selected area to be measured; Q is the calculated spectral reconstruction matrix; and r is the reconstructed spectral data.
8. The yarn photographic colorimetric method based on texture feature weighted correction as described in claim 1, characterized in that: The specific implementation method of step 8 is as follows; First, based on colorimetric theory, the CIE value of the yarn is calculated from the final weighted summation spectrum. XYZ The tristimulus values are calculated using equations (9) to (12). (9); in, (10); In the formula, x ( λ ) y ( λ )and z ( λ All of these are standard observer color matching functions. E ( λ ) represents the spectral reflectance of the object. S ( λ Let be the relative spectral power distribution function of the light source. λ For wavelength, η As a regulating factor, X , Y and Z These are the tristimulus values of the yarn; Then, the corresponding CIE is calculated. Lab Color data; based on colorimetric theory, derived from tristimulus values (CIE). XYZ The data was calculated to obtain its corresponding CIE. Lab The method for color data is shown in equations (11) to (12). (11); in, (12); In the formula, L , a and b The yarns are respectively in CIE Lab The brightness, red-green, and yellow-blue color values of the color space. X , Y and Z These are the tristimulus values and color data for the yarn. X n , Y n and Z n The tristimulus values and color data of the reference light source are respectively, in equation (12) H and H n CIE symbols representing the yarn and reference light source, respectively. XYZ Tristimulus values.
9. A yarn photographic colorimetric system based on texture feature weighted correction, characterized in that, include: The processor and memory, wherein the memory is used to store program instructions, and the processor is used to call the stored instructions in the memory to execute the yarn photographic color measurement method based on texture feature weighted correction as described in any one of claims 1-8.
Citation Information
Patent Citations
Method for automatically segmenting warp yarn area of yarn dyed fabric
CN105118058A
Textile fabric photographing and color measuring method and system based on texture feature weighted correction
CN117073842A