Yarn photographing and color measuring method and system based on texture feature weighted correction
By introducing texture feature weighted correction technology into the yarn photographic color measurement method, the deviation problem of traditional yarn color measurement methods when the texture is complex and the light and shadow effect is significant, achieving more accurate and reliable yarn color measurement results, which are in line with the visual perception of the human eye.
Patent Information
- Application Number
- CN202510037460.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-09
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2045-01-09
AI Technical Summary
Traditional yarn color measurement methods such as spectrophotometers are complicated to operate, and the measurement results are easily affected by the density of winding yarns, arrangement method and sample uniformity. In addition, existing photographic chromatography and multi-spectral imaging methods are difficult to reflect the visual perception of the human eye when the yarn surface texture is complex and the light and shadow effect is significant, resulting in deviations from the measurement results and subjective perception.
The yarn color measurement method based on texture feature weighting correction is adopted. By building a photographic color measurement system, a digital camera is used to take yarn images, combined with the K-means clustering algorithm, Skeletonization skeletonization algorithm and spectral reconstruction matrix, the centerline color data of the yarn is extracted, and the correction of the yarn is corrected through the nonlinear texture weighting method to obtain the corrected color data of the yarn.
It effectively overcomes the limitations of traditional methods, improves the stability and repeatability of yarn color measurement, and the measurement results are more in line with the visual perception of the human eye, and improves the accuracy and reliability of textile color measurement.
Smart Images

Figure CN119941815A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of computer digital image processing, and in particular relates to a yarn photographic colorimetric method based on texture feature weighted correction. Background Art
[0002] Yarn color is a key factor in determining the appearance and market competitiveness of fabrics, and its measurement accuracy is crucial to the production quality of textiles. Traditional yarn color measurement usually relies on spectrophotometers, which require yarns 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. In order to overcome the above limitations, photographic colorimetry and multispectral imaging methods have been proposed in recent years. Photographic colorimetry uses a digital camera to collect yarn images and extracts color information by combining image processing algorithms and colorimetry principles; multispectral imaging achieves more precise color measurement by acquiring and analyzing multi-band spectral data. However, these two methods are still difficult to fully reflect the visual perception of the human eye when the yarn surface texture is complex and the light and shadow effects are significant. There is a significant deviation between the measurement results and subjective perception, which leads to the "mismatch" of the color of the fabric products actually produced by the enterprise, resulting in inventory backlogs and loss of economic benefits for the enterprise. In view of the limitations of current spectrophotometers in the application of textured fabric color measurement, the academic and industrial circles at home and abroad have not yet proposed a good solution. Summary of the invention
[0003] The purpose of the present invention is to solve the problems described in the background technology. The present invention is based on photographic colorimetry technology and proposes a yarn photographic colorimetry method based on texture feature weighted correction. The implementation of this technology first requires the construction of a photographic colorimetry system, using a digital camera to shoot yarn images and extract image data of the area to be measured; secondly, the image is segmented by the K-means clustering algorithm to accurately separate the yarn and the background area; further, the center line of the yarn is extracted by the skeletonization algorithm to reduce the influence of the yarn surface texture on the color measurement results; then, the digital image of the training sample is taken by a digital camera to extract the RGB value of each color block; the training sample is used to construct a spectral reconstruction matrix; on this basis, based on the principle of spectral reconstruction and colorimetry, the chromaticity value of each pixel of the yarn center line is calculated; then, the XYZ color space is converted to the Lab color space; finally, according to the nonlinear perception characteristics of the human eye to brightness, the nonlinear texture weighting method is used to weight the center line chromaticity value, thereby obtaining the corrected color data of the yarn. The method of the present invention effectively overcomes the application limitations of traditional spectrophotometers in yarn color measurement, and solves the problem that the existing photographic color measurement method ignores the influence of yarn texture features on color measurement results, and achieves the consistency between the yarn photographic color measurement results and the real visual perception of the human eye. The technical solution of the present invention is a yarn photographic color measurement method based on texture feature weighted correction, which specifically includes the following steps:
[0004] Step 1, build a photographic colorimetry system;
[0005] Step 2, using a photographic colorimetric system to capture a yarn image and extract an image of the area to be measured;
[0006] Step 3, using K-means clustering algorithm to segment the yarn and background in the image of the area to be measured;
[0007] Step 4, using the Skeletonization algorithm to extract the yarn centerline;
[0008] Step 5, using a photographic colorimetric system to capture a training sample digital image and extract its RGB value;
[0009] Step 6, constructing a spectral reconstruction matrix based on the training samples;
[0010] Step 7, reconstructing the spectrum of each pixel point in the area to be measured using the spectrum reconstruction matrix;
[0011] Step 8, calculating the color data corresponding to the spectrum data of each pixel point in the measured area in the spectrum reconstruction step 7 according to the principle of colorimetry, and obtaining the yarn color data;
[0012] Step 9: Based on the yarn color data in step 8, the yarn color correction measurement data is calculated using a texture weighting method.
[0013] Furthermore, in step 1, when building a photographic colorimetry system, the system lighting needs to be unaffected by natural light, and at the same time, the uniformity of light within the effective photographing area should be ensured, thereby ensuring that the digital response values of the same sample object at different positions within the photographing area are consistent, thereby avoiding the problem of photographic system deviation. The specific implementation method of building a photographic colorimetry system can be found in document 1.
[0014] [1] Liang Jinxing, Hu Xinrong, Peng Tao, et al. A closed daylight lighting box [P]. Hubei Province: CN218585157U, 2023-03-07.
[0015] Furthermore, in step 2, the method of taking the yarn image with a digital camera and extracting the image of the area to be measured is as follows: Under a standard lighting environment, the yarn image is collected with a digital camera to ensure the accuracy and consistency of the color information during the imaging process. The effective area of the yarn is extracted, and the background and irrelevant edges are removed. The extracted image is size-standardized to unify its pixel resolution and spatial scale to provide standardized input for subsequent color analysis and data processing. The processed image is saved in a lossless data format while retaining the original image file to ensure the high accuracy of the spectral reconstruction and color calculation process and the traceability of the results.
[0016] Furthermore, in step 3, the method of segmenting the yarn and the background using the K-means clustering algorithm is as follows:
[0017] First, the image is preprocessed, including color correction and denoising, to enhance contrast and details to ensure the segmentation accuracy of the clustering algorithm. The image is converted from the RGB color space to a color space more suitable for the segmentation task to improve color differentiation.
[0018] Next, the color features of image pixels are used as input data to construct a K-means clustering model. The 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, a binary segmentation image is generated based on the clustering results, and the pixels are classified into the yarn area or the background area. To improve the segmentation effect, morphological operations (dilation and erosion) are applied to repair the segmentation boundary, eliminate isolated noise points and segmentation errors, and use median filtering to smooth the area to ensure the continuity of the boundary and the integrity of the yarn contour.
[0020] Furthermore, in step 4, the binary image obtained by K-means segmentation is input into the morphological thinning skeletonization algorithm, and the edge pixels are removed recursively to retain the centerline structure of the yarn. In each iteration, the connectivity constraints are ensured to be met and the topological structure is not destroyed. The skeleton extraction results are morphologically repaired to remove isolated points and small branches, and irrelevant small areas are removed through connected domain analysis to ensure the continuity and uniqueness of the yarn centerline.
[0021] Furthermore, in step 5, a digital camera is used to shoot a training sample digital image, and the method for extracting its RGB value is as follows:
[0022] First, prepare or make training samples. The training samples can be common standard color cards, such as the ColorChecker SG140 color card of X-Rite, or make solid color fabric samples. Since the color part of the training sample directly affects the accuracy of photographic color measurement, the larger the color gamut volume of the solid color fabric sample and the more uniform the sample distribution in the color space, the better its application performance. For specific production methods, please refer to the production method of 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, the training samples should be placed in the effective photographing area of the photographic colorimetry system, and the shooting conditions should be exactly the same as those when shooting the training samples. Otherwise, the inconsistency of the shooting conditions will lead to errors in the reconstruction of the yarn spectrum, which will ultimately affect the accuracy of the color measurement results.
[0025] Finally, the RGB value of each training sample is extracted to construct the spectral reconstruction matrix. For each training sample, the RGB data of all pixels in the central m×m pixel area are extracted, and the RGB data of the m×m pixels are averaged to obtain the RGB data of the sample, as shown in formula (1):
[0026]
[0027] Where i is the i-th color block in the training sample set; j is the j-th pixel in the extraction area; r i,j , g i,j , b i,j are the red, green, and blue channel RGB values of the jth pixel of the i-th pure color sample; d i is the RGB value of the i-th color block in the sample set, which is a 1×3 row vector.
[0028] Furthermore, in step 6, the method of constructing a spectral reconstruction matrix using training samples is as follows:
[0029] First, the RGB values of the training samples are polynomially expanded using a third-order homogeneous polynomial. The expanded form is shown in formula (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 is the extended RGB value vector of a color block. After homogeneous polynomial expansion, the RGB response value expansion matrix of the training sample is shown in formula (3).
[0032] D train,exp = (d train ,exp,1, d train ,exp,2, ... , d train,exp,j ) T (j=1, 2, ... ,P) (3)
[0033] Where, the subscript 'j' indicates the jth training sample, P is the number of training samples, and d train,exp,j is the RGB value expansion vector of the jth training sample, D train,exp is the expanded RGB matrix of the training sample set.
[0034] Then, the spectral matrix and the extended RGB matrix of the training sample are used to solve the spectral reconstruction matrix, and the Tikhonov regularization method is used to constrain the solution process to overcome the influence of the imaging noise signal on the solution accuracy of the spectral reconstruction matrix. The specific solution method is shown in equations (4) to (7): First, the extended RGB matrix D of the training sample is train,exp Perform singular value decomposition, then add a very small number α to the eigenvalue to obtain the constrained eigenvalue to reduce the condition number of the extended RGB matrix, and reconstruct the extended RGB matrix D after regularization constraints. train,exp,rec Finally, the pseudo-inverse algorithm is used to solve the spectrum 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] Where U and V are 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 is the spectral data matrix of the training sample set.
[0040] Furthermore, in step 7, the method of reconstructing the spectrum of each pixel point in the area to be measured using the spectrum reconstruction matrix is as shown in formula (8):
[0041] r=Qd(8)
[0042] Where d is the extended RGB value of the selected area to be measured; Q is the spectral reconstruction matrix calculated by equation (7); and r is the reconstructed spectral data.
[0043] Furthermore, in step 8, the color data corresponding to the spectrum reconstruction is calculated according to the principle of colorimetry, and the method for obtaining the yarn color data is as follows:
[0044] First, according to the colorimetric theory, the CIEXYZ tristimulus value data of the yarn is calculated from the final weighted sum spectrum. The calculation method is shown in equations (9) to (12):
[0045]
[0046] in,
[0047]
[0048] Where x(λ), y(λ) and z(λ) are the 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 value data of the yarn respectively.
[0049] Then, the corresponding CIELab color data is calculated. According to the colorimetric theory, the method of calculating the corresponding CIELab color data from the tristimulus value CIEXYZ data is shown in equations (11) to (12).
[0050]
[0051] in,
[0052]
[0053] Where L, a and b are the brightness, red, green and yellow-blue color values of the yarn in the CIELab color space, respectively; X, Y and Z are the tristimulus color data of the yarn, respectively; X n , Yn and Z n are the tristimulus color data of the reference light source, respectively. In formula (12), H and H n Represent the CIEXYZ tristimulus values of yarn and 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 brightness value (L i ), and normalized it to normalized_L i , as shown in formula (13),
[0056]
[0057] Where L min and L max are the minimum and maximum brightness values of the center line pixels, respectively. i is the i-th pixel in the measurement area, L i is 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 corrected brightness value weighted_L, as shown in formula (14):
[0059]
[0060] Where normalized_L is the normalized lightness value calculated in equation (13), and eps is a small constant to avoid the denominator being 0. Thus, the yarn photographic color measurement based on weighted correction of texture features is completed.
[0061] The present invention also provides a yarn photographic colorimetric system based on texture feature weighted correction, comprising:
[0062] A processor and a memory, the memory is used to store program instructions, and the processor is used to call the stored instructions in the memory to execute a yarn photographic colorimetry method based on texture feature weighted correction as described in the above technical solution.
[0063] In view of the defects of current spectrophotometers in the application of yarn color measurement and the limitations of existing photographic colorimetry methods in measuring yarn texture color, the present invention 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 field of textile production. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 is a flow chart of an embodiment of the present invention.
[0065] Figure 2 A physical picture of a photographic colorimetry system constructed for an embodiment of the present invention.
[0066] Figure 3 This is a binary image of the yarn and background segmentation result using the K-means algorithm in an embodiment of the present 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 Lab values of six yarn colors tested for embodiments of the present invention and their color differences with spectrophotometry.
[0069] Figure 6 The average score of 20 testers for different methods for a single yarn tested for the embodiments of the present invention.
[0070] Figure 7 This is the average result of the evaluation results of six different yarn colors tested in the embodiment of the present invention. DETAILED DESCRIPTION
[0071] When the technical solution of the present invention is specifically implemented, it can be operated by those skilled in the art using computer software technology.
[0072] Combined with Figure 1 The embodiment of the present invention proposes a yarn photographic colorimetry method based on texture feature weighted correction, which specifically includes the following steps:
[0073] Step 1, build a photographic colorimetry system;
[0074] Step 2, using a digital camera to take a yarn image and extract an image of the area to be measured;
[0075] Step 3, using K-means clustering algorithm to segment the yarn and background;
[0076] Step 4, using the Skeletonization algorithm to extract the yarn centerline;
[0077] Step 5, using a digital camera to shoot a training sample digital image and extract its RGB value;
[0078] Step 6, constructing a spectral reconstruction matrix based on the training samples;
[0079] Step 7, reconstructing the spectrum of each pixel point in the area to be measured using the spectrum reconstruction matrix;
[0080] Step 8, calculating the color data corresponding to the spectrum data of each pixel point in the area to be measured in the spectrum reconstruction step 7 according to the principle of colorimetry, and obtaining the yarn color data;
[0081] Step 9: Based on the yarn color data in step 8, the yarn color correction measurement data is calculated using a texture weighting method.
[0082] The processing of each step is described in detail below through examples: The method of the present invention is tested based on a self-developed enclosed daylight lighting box, an X-Rite ColorChecker SG140 color card, a Nikon D7200 digital camera, and six different color yarns.
[0083] In step 1, the self-developed enclosed daylight lighting box is used as the basis, and the Nikon D7200 digital camera is used to complete the construction of the photographic color measurement system, as shown in the attached figure. Figure 2 The system satisfies the requirement that the lighting of the system is not affected by natural light, and the lighting is uniform in the effective photographing area, which effectively avoids the problem of camera system deviation. The specific implementation method of the camera color measurement system can be found in Reference 1.
[0084] [1] Liang Jinxing, Hu Xinrong, Peng Tao, et al. A closed daylight lighting box [P]. Hubei Province: CN218585157U, 2023-03-07.
[0085] In step 2, the method of taking the yarn image with a digital camera and extracting the image of the area to be measured is as follows:
[0086] First, prepare yarn samples that are pollution-free, have no obvious color spots, and have uniform colors. In the embodiment of the present invention, six yarn samples of different colors are placed on the shooting platform in turn, and fixed at both ends with magnets to ensure that the yarn is flat and wrinkle-free, and the center position of each yarn must be within the effective shooting range of the camera lens.
[0087] Secondly, set the shooting parameters of the digital camera. In this embodiment, the imaging parameters of the digital camera are focal length 140mm, ISO100, exposure time 1 / 25s, and aperture size f5.6. After the shooting is completed, the image is saved in JPG format, the original shooting resolution is maintained, and it is named according to the yarn color.
[0088] Finally, the image is cropped according to the area where the yarn is located, retaining only the yarn part and avoiding the inclusion of background or other interfering information.
[0089] In step 3, the method of segmenting yarn and background using K-means clustering algorithm is as follows:
[0090] First, the image is preprocessed, including color correction and denoising, to enhance contrast and details to ensure the segmentation accuracy of the clustering algorithm. The image is converted from the RGB color space to a color space more suitable for the segmentation task to improve color differentiation.
[0091] Next, the color features of image pixels are used as input data to construct a K-means clustering model. The 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, a binary segmentation image is generated based on the clustering results, and the pixels are classified into the yarn area or the background area. To improve the segmentation effect, morphological operations (dilation and erosion) are applied to repair the segmentation boundary, eliminate isolated noise points and segmentation errors, and use median filtering to smooth the area to ensure the continuity of the boundary and the integrity of the yarn contour. In the 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 segmentation image binarization result is shown in the attached figure. Figure 3 .
[0093] In step 4, the binary image obtained by K-means segmentation is input into the morphological thinning skeletonization algorithm, and the edge pixels are removed recursively to retain the centerline structure of the yarn. In each iteration, the connectivity constraints are ensured to be met and the topological structure is not destroyed. The skeleton extraction results are morphologically repaired to remove isolated points and small branches, and irrelevant small areas are removed through connected domain analysis to ensure the continuity and uniqueness of the yarn centerline. In the embodiment, a red centerline is generated on the yarn by the skeletonization algorithm. The results are shown in the attached figure. Figure 4 ,The subsequent algorithm is performed on the center line to reduce the interference of texture.
[0094] In step 5, a digital camera is used to shoot a training sample digital image, and the method for extracting its RGB value is as follows:
[0095] First, prepare or make training samples. The training samples can be common standard color cards, such as ColorChecker SG140 of X-Rite, or pure color fabric samples. Since the color part of the training sample directly affects the accuracy of photographic color measurement, the larger the color gamut volume of the pure color fabric sample and the more uniform the sample distribution in the color space, the better its application performance. For specific production methods, please refer to the production method of pure color fabric entity samples in Reference 2. This embodiment uses the X-Rite ColorChecker SG140 color card 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, the training sample is placed in the effective photographing area of the photographic colorimetric system, and the shooting conditions should be completely consistent with those when shooting the yarn sample, otherwise the inconsistency of the shooting conditions will lead to yarn spectrum reconstruction errors, which will ultimately affect the accuracy of the color measurement results. In this embodiment, the imaging parameters of the digital camera are focal length 35mm, ISO100, exposure time 1 / 25s, and aperture size f5.6.
[0098] Finally, the RGB value of each training sample is extracted to construct the spectral reconstruction matrix. For each training sample, the RGB data of all pixels in the central m×m pixel area are extracted, and the RGB data of the m×m pixels are averaged to obtain the RGB data of the sample, as shown in formula (1):
[0099]
[0100] Where i is the i-th color block in the training sample set; j is the j-th pixel in the extraction area; r i,j , g i,j , b i,j are the red, green, and blue channel RGB values of the jth pixel of the i-th pure color sample; d i is the RGB value of the i-th color block in the sample set, which is a 1×3 row vector. In the embodiment, the value of m is 50.
[0101] In step 6, the method of constructing the spectral reconstruction matrix using the training sample X-Rite ColorChecker SG140 color card is as follows:
[0102] First, the raw response value of the training sample is polynomially expanded using a third-order homogeneous polynomial. The expanded form is shown in formula (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 is the extended RGB value vector of a color block, the superscript 'T' represents the transpose, and after homogeneous polynomial expansion, the RGB value expansion matrix of the training sample is shown in formula (3).
[0105] D train,exp = (d train ,exp,1, d train ,exp,2, ... , d train,exp,j ) T (j=1, 2, ... ,P) (3)
[0106] Where, the subscript 'j' indicates the jth training sample, P is the number of training samples, and dtrain,exp,j D is the raw response value expansion vector of the jth training sample, train,exp is the extended RGB matrix of the training sample set. train,exp The dimensions are 140×13.
[0107] Then, the spectral matrix and the extended RGB matrix of the training sample are used to solve the spectral reconstruction matrix, and the Tikhonov regularization method is used to constrain the solution process to overcome the influence of the imaging noise signal on the solution accuracy of the spectral reconstruction matrix. The specific solution method is shown in equations (4) to (7): First, the extended RGB matrix D of the training sample is train,exp Perform singular value decomposition, then add a very small number α to the eigenvalue to obtain the constrained eigenvalue to reduce the condition number of the extended RGB matrix, and reconstruct the extended RGB matrix D after regularization constraints. train,exp,rec Finally, the pseudo-inverse algorithm is used to solve the spectrum 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] Where U and V are 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 is the spectral data matrix of the training sample set. train The spectral data are measured by i1Profiler spectrophotometer, and the dimension of the spectral reconstruction matrix Q is 13×31.
[0113] In step 7, the method of reconstructing the spectrum of each pixel point in the area to be measured using the spectrum reconstruction matrix is as shown in formula (8):
[0114] r=Qd(8)
[0115] Where d is the extended RGB value of the selected area to be measured; Q is the spectral reconstruction matrix calculated by equation (7); and r is the reconstructed spectral data.
[0116] In step 8, the color data corresponding to the spectrum reconstruction is calculated according to the principle of colorimetry, and the method for obtaining the yarn color data is as follows:
[0117] First, according to the colorimetric theory, the CIEXYZ tristimulus value data of the yarn is calculated from the final weighted sum spectrum. The calculation method is shown in equations (9) to (12):
[0118]
[0119] in,
[0120]
[0121] Where x(λ), y(λ) and z(λ) are the 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 value data of the yarn respectively.
[0122] Then, the corresponding CIELab color data is calculated. According to the colorimetric theory, the method of calculating the corresponding CIELab color data from the tristimulus value CIEXYZ data is shown in equations (11) to (12).
[0123]
[0124] in,
[0125]
[0126] Where L, a and b are the brightness, red, green and yellow-blue color values of the yarn in the CIELab color space, respectively; X, Y and Z are the tristimulus color data of the yarn, respectively; X n , Y n and Z n are the tristimulus color data of the reference light source, respectively. In formula (12), H and H n Represent the CIEXYZ tristimulus values of yarn and 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 brightness value (L i ), and normalized it to normalized_L i , as shown in formula (13),
[0129]
[0130] Where L min and L max are the minimum and maximum brightness values of the center line pixels, i is the i-th pixel in the measurement area, Li is 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 corrected brightness value weighted_L, as shown in formula (14):
[0132]
[0133] Where normalized_L is the normalized brightness value calculated in equation (13), and eps is a small constant to avoid the denominator being 0. In this embodiment, eps is set to 0.001. The color data of the six yarns and the color difference between them and the spectrophotometry method are shown in Figure 5 At this point, the yarn photographic color measurement based on texture feature weighted correction is completed.
[0134] Figure 5 It can be explained that the color data measured by the method of the present invention is close to the spectrophotometry method. In addition, the present invention also proves through psychophysical experiments that the method of the present invention is more in line with human visual perception. Psychophysical experiment process: The calibrated display and the standard viewing table are placed in a dark room together, ensuring that the ambient light source is the D65 standard light source to avoid external light interference. The display shows the yarn color images measured by different color measurement methods, and six yarn samples are placed on the standard viewing table to ensure that the display and the yarn samples are under the same observation conditions. 20 experimenters were selected to participate in the experiment to ensure that the experimenters have passed the color blindness and color weakness tests and can normally distinguish colors. After entering the dark room, the experimenters were given a certain amount of time to adapt to the dark room environment to adapt to the light conditions of the experimental environment. The experimenter observed the yarn color displayed on the display in the dark room and the actual yarn color on the standard viewing table, performed visual comparison, and scored according to the degree of color proximity. The scoring standard is 1-7 points, where 1 point indicates that the color is the least close and 7 points indicates that the color is the closest. In order to ensure the stability and reliability of the experimental results, the scoring experiment of each experimenter needs to be repeated three times. After the experiment, the score data of the three rounds of experiments were analyzed by variance analysis. 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, an embodiment of the present invention further provides a yarn photographic colorimetry system based on texture feature weighted correction, comprising:
[0136] A processor and a memory, the memory is used to store program instructions, and the processor is used to call the stored instructions in the memory to execute a yarn photographic colorimetry method based on texture feature weighted correction as described in the above technical solution.
[0137] The specific embodiments described herein are merely examples of the spirit of the present invention. Those skilled in the art may make various modifications or additions to the specific embodiments described or replace them in similar ways, but they will not deviate from the spirit of the present invention or exceed the scope defined by the appended claims.
Claims
1. A yarn photographic colorimetry method based on texture feature weighted correction, characterized in that: The steps include: Step 1, build a photographic colorimetry system; Step 2, using a photographic colorimetric system to capture a yarn image and extract an image of the area to be measured; Step 3, using K-means clustering algorithm to segment the yarn and background in the image of the area to be measured; Step 4, using the Skeletonization algorithm to extract the yarn centerline; Step 5, using a photographic colorimetric system to capture a training sample digital image and extract its RGB value; Step 6, constructing a spectral reconstruction matrix based on the training samples; Step 7, reconstructing the spectrum of each pixel point in the area to be measured using the spectrum reconstruction matrix; Step 8, calculating the color data corresponding to the spectrum data of each pixel point in the measured area in the spectrum reconstruction step 7 according to the principle of colorimetry, and obtaining the yarn color data; Step 9: Based on the yarn color data in step 8, the yarn color correction measurement data is calculated using a texture weighting method.
2. A yarn photographic colorimetry method based on texture feature weighted correction as claimed in claim 1, characterized in that: The photographic colorimetry system in step 1 includes an enclosed daylight lighting box and a digital camera.
3. A yarn photographic colorimetric method based on texture feature weighted correction as claimed in claim 1, characterized in that: The specific implementation of step 2 is as follows; First, prepare yarn samples: place yarn samples of different colors on the shooting platform in turn, fix them at both ends with magnets, ensure that the yarn is flat and wrinkle-free, and the center of each yarn must be 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 in JPG format, keep the original shooting resolution, and name it according to the yarn color. Finally, the image is cropped according to the area where the yarn is located, retaining only the yarn part and avoiding the inclusion of background or other interfering information.
4. A yarn photographic colorimetric method based on texture feature weighted correction as claimed in claim 1, characterized in that: The method of using K-means clustering algorithm to segment yarn and background in step 3 is as follows: First, the image is preprocessed, including color correction and denoising, contrast enhancement and detail enhancement; and the image is converted from RGB color space to HSV color space; Next, the color features of image pixels are used as input data to construct a K-means clustering model, and the Euclidean distance is selected as the similarity metric between pixels. Clustering is performed based on the geometric distance of pixels in the color space. Finally, the binary image is segmented based on the clustering results, and the pixels are classified into the yarn area or the background area; Morphological operations are applied to repair the segmentation boundaries, eliminate isolated noise points and segmentation errors, and median filtering is used to smooth the area to ensure the continuity of the boundaries and the integrity of the yarn contour.
5. The method for yarn colorimetry based on texture feature weighted correction according to claim 1, characterized in that: The specific implementation of step 5 is as follows; First, prepare or create training samples; Secondly, the training samples were placed in the effective photographing area of the photographic colorimetry system, and the photographing conditions were exactly the same as those for photographing the yarn samples; Finally, the RGB value of each training sample is extracted to construct the spectral reconstruction matrix. For each training sample, the RGB data of all pixels in the central m×m pixel area are extracted, and the RGB data of the m×m pixels are averaged to obtain the RGB data of the sample, as shown in formula (1): Where i is the i-th color block in the training sample set; j is the j-th pixel in the extraction area; r i,j , g i,j , b i,j are the red, green, and blue channel RGB values of the jth pixel of the i-th pure color sample; d i is the RGB value of the i-th color block in the sample set, which is a 1×3 row vector.
6. A yarn photographic colorimetric method based on texture feature weighted correction as claimed in claim 1, characterized in that: The specific implementation of step 6 is as follows; First, the raw response value of the training sample is polynomially expanded using a third-order homogeneous polynomial. The expanded form is shown in formula (2), which contains 13 expansion terms in total: 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 is the extended RGB value vector of a color block, the superscript T represents the transpose, and after homogeneous polynomial expansion, the RGB value expansion matrix of the training sample is shown in formula (3). D train,exp =(d train,exp,1 ,d train,exp,2 ,...,d train,exp,j ) T (j=1,2,...,P) (3) Where, subscript j indicates the jth training sample, P is the number of training samples, and d train,exp,j D is the raw response value expansion vector of the jth training sample, train,exp is the extended RGB matrix of the training sample set; Then, the spectral matrix and the extended RGB matrix of the training sample are used to solve the spectral reconstruction matrix, and the Tikhonov regularization method is used to constrain the solution process to overcome the influence of the imaging noise signal on the solution accuracy of the spectral reconstruction matrix. The specific solution method is shown in equations (4) to (7): First, the extended RGB matrix D of the training sample is train,exp Perform singular value decomposition, then add a very small number α to the eigenvalue to obtain the constrained eigenvalue to reduce the condition number of the extended RGB matrix, and reconstruct the extended RGB matrix D after regularization constraints. train,exp,rec Finally, the pseudo-inverse algorithm is used to solve the spectrum reconstruction matrix Q. D train,exp =USV T (4) P=S+αI (5) D train,exp,rec =UPV T (6) Q=R train ·pinv(D train,exp,rec ) (7) Where U and V are 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 is the spectral data matrix of the training sample set.
7. A yarn photographic colorimetric method based on texture feature weighted correction as claimed in claim 1, characterized in that: In step 7, the specific implementation method of using the spectrum reconstruction matrix to reconstruct the spectrum of each pixel point in the measured area is shown in formula (8): r=Qd (8) Where 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 method for yarn colorimetry based on texture feature weighted correction according to claim 1, characterized in that: The specific implementation of step 8 is as follows; First, according to the colorimetric theory, the CIEXYZ tristimulus value data of the yarn is calculated from the final weighted sum spectrum. The calculation method is shown in equations (9) to (12): in, Where x(λ), y(λ) and z(λ) are the 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 value data of the yarn respectively; Then, the corresponding CIELab color data is calculated; according to the colorimetry theory, the method of calculating the corresponding CIELab color data from the tristimulus value CIEXYZ data is as shown in equations (11) to (12), in, Where L, a and b are the brightness, red, green and yellow-blue color values of the yarn in the CIELab color space, respectively; X, Y and Z are the tristimulus color data of the yarn, respectively; X n , Y n and Z n are the tristimulus color data of the reference light source, respectively. In formula (12), H and H n Represent the CIEXYZ tristimulus values of yarn and reference light source respectively.
9. The method for yarn colorimetry based on texture feature weighted correction according to claim 1, characterized in that: The specific implementation method of calculating the yarn color correction measurement data using the texture weighting method is as follows: First, extract the lightness value L from the area to be measured i , and normalized it to normalized_L i , as shown in formula (13), Where L min and L max are the minimum and maximum brightness values of the center line pixels, i is the i-th pixel in the measurement area, L i is the brightness value of the i-th pixel in the measurement area; Then, texture weighted color correction is performed on the area to be tested to obtain the weighted corrected brightness value weighted_L, as shown in formula (14); Where normalized_L is the normalized brightness value calculated in equation (13), and eps is a small constant to avoid the denominator being zero.
10. A yarn photographic colorimetric system based on texture feature weighted correction, characterized in that: include: A processor and a memory, the memory is used to store program instructions, and the processor is used to call the stored instructions in the memory to execute a yarn photographic colorimetry method based on texture feature weighted correction as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Method for automatically segmenting warp yarn area of yarn dyed fabric
CN105118058A
Multi-angle fabric gloss performance measuring system and method
CN111077149A
Textile fabric photographing and color measuring method and system based on texture feature weighted correction
CN117073842A
Yarn hairiness measuring method and system based on multi-camera system
CN118840339A
3D Imaging and Texture Mapping for Apparel Imagery
US20230046503A1
Cited By
Homochromatic system real-time correction method and device for outdoor instant colorimetric detection
CN121499406A