Textile color difference detection method based on image detection

By constructing noise-free ideal reference images and theoretically damaged simulation images, and combining ray tracing algorithms and a color difference mechanism database, accurate identification and real-time production control of color differences in textiles were achieved, solving the shortcomings of existing technologies in detection accuracy and production control.

CN121453792BActive Publication Date: 2026-03-24BAOJI DADI TEXTILE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-05
Publication Date
2026-03-24

Smart Images

  • Figure CN121453792B_ABST
    Figure CN121453792B_ABST
Patent Text Reader

Abstract

The present application relates to the field of textile printing and dyeing quality detection and industrial automation control technology, specifically to a textile color difference detection method based on image detection, comprising: obtaining the fabric design file and yarn spectrum data of the textile to be detected, and constructing a noise-free ideal reference image; generating a theoretical damaged simulation image containing preset defect features; constructing a real observation and theoretical deduction residual matrix; comparing the structural similarity value with the preset decision threshold value; when the structural similarity value is greater than the preset decision threshold value, it is determined that the textile has real color difference, and the corresponding production control instruction data is generated; otherwise, it is determined that the difference is caused by environmental noise, a defect-free confirmation signal is generated and a detection log is recorded; the present application solves the reference deviation caused by the dependence of traditional technology on physical sample cloth, eliminates the influence of possible weaving defects, stains or warp and weft density fluctuations of the sample cloth itself on the detection result, and ensures the purity and objectivity of the detection reference.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of textile printing and dyeing quality inspection and industrial automation control technology, specifically to a method for detecting color difference in textiles based on image detection. Background Technology

[0002] In the current textile production quality inspection environment, using industrial image processing technology for online color difference monitoring is an important means to ensure product quality. Existing testing solutions generally rely on acquiring images of physical standard sample fabrics as the testing benchmark and comparing and analyzing them with real-time acquired images of the fabric to be tested at the pixel level.

[0003] While this solution possesses certain detection capabilities under normal conditions, the physical sample fabric inevitably contains weaving defects, surface stains, or fluctuations in warp and weft density, introducing reference noise at the source. Simultaneously, in industrial production scenarios, uneven ambient lighting, physical wrinkles on the fabric surface, and sensor noise generate a large amount of unstructured interference data. Existing algorithms often struggle to effectively distinguish between genuine mechanistic color differences and random environmental noise, resulting in a low balance between system detection rate and false alarm rate, making it difficult to accurately identify subtle color differences. Furthermore, the detection system often lacks deep mechanistic coupling with the production execution mechanism, hindering real-time closed-loop correction of dyeing process parameters based on detection results. Therefore, eliminating noise interference from the physical reference source and accurately identifying structured color difference features from complex backgrounds to improve detection accuracy and production control response speed have become urgent technical problems to be solved. Summary of the Invention

[0004] To address the aforementioned technical problems, this invention provides a method for detecting color difference in textiles based on image detection. Specifically, the technical solution of this invention includes:

[0005] S1. Obtain the fabric design file and yarn spectral data of the textile to be tested, and construct a noise-free ideal reference image using a ray tracing algorithm through an image processor;

[0006] S2. Call the preset color difference mechanism database, select the parameterized interference function corresponding to the specific color difference type, map the parameterized interference function to the data space of the ideal reference image, and generate a theoretical damage simulation image containing preset defect features.

[0007] S3. Control the industrial camera to acquire real-time images of textiles, calculate the difference between the real-time acquired images and the ideal reference image, and construct the real observation residual matrix; at the same time, calculate the difference between the theoretical damage simulation image and the ideal reference image, and construct the theoretical deduction residual matrix.

[0008] S4. Calculate the structural similarity between the observed residual matrix and the theoretically derived residual matrix in the vector space;

[0009] S5. Compare the structural similarity value with the preset judgment threshold: When the structural similarity value is greater than the preset judgment threshold, it is determined that there is a real color difference in the textile and the corresponding production control instruction data is generated; when the structural similarity value is less than or equal to the preset judgment threshold, it is determined that the difference is due to environmental noise, a defect-free confirmation signal is generated and the detection log is recorded.

[0010] Preferably, the specific sub-steps for constructing the noise-free ideal reference image in step S1 are as follows:

[0011] S11. Analyze the design data in the fabric design file, extract the interlacing coordinates of warp and weft yarns, and construct a three-dimensional micro-geometric model that includes yarn twist and hairiness characteristics.

[0012] S12. Call the bidirectional reflectance distribution function to assign the spectral power distribution data of the preset standard light source and the reflectance curve data of the standard dye to the three-dimensional micro-geometric model and define the virtual optical properties of the model.

[0013] S13. Apply the Monte Carlo ray tracing algorithm to render the assigned 3D microscopic geometric model and generate an ideal reference image whose pixel values ​​represent the brightness of the illumination radiation.

[0014] Preferably, the specific sub-steps for generating the theoretically damaged simulation image in step S2 are as follows:

[0015] S21. Read the preset mathematical definition model from the color difference mechanism database. The model includes a time axis linear decay function or a spatial parabolic function.

[0016] S22. The read function is used as a pixel gain factor and multiplied with the pixel value at the corresponding coordinate in the ideal reference image to simulate the change in dye uptake rate or abnormal yarn mixing. The calculation result constitutes the theoretically damaged simulation image.

[0017] Preferably, the specific sub-steps for constructing the actual observation residual matrix in step S3 are as follows:

[0018] S31. Receive the real-time acquired image transmitted by the industrial camera, and use the feature point matching algorithm to calculate the displacement vector of the real-time acquired image relative to the ideal reference image.

[0019] S32. Perform geometric transformation on the real-time acquired image based on the displacement vector to align the pixel coordinates with the ideal reference image at sub-pixel accuracy.

[0020] S33. If alignment fails, a re-acquisition command is triggered; if alignment succeeds, the pixel grayscale value of the real-time acquired image after alignment is subtracted from the pixel grayscale value of the corresponding coordinate of the ideal reference image, and the resulting differential data set is the actual observation residual matrix.

[0021] Preferably, the specific sub-steps for constructing the theoretical derivation residual matrix in step S3 are as follows:

[0022] S34. Subtract the pixel gray value of the corresponding coordinate of the ideal reference image generated in step S1 from the pixel gray value of the theoretically damaged simulation image generated in step S2. The resulting difference data set is the theoretical derivation residual matrix.

[0023] S35. Perform normalization processing on the actual observation residual matrix and the theoretical derivation residual matrix respectively, and map all values ​​in the matrix to a closed interval between zero and one.

[0024] Preferably, the structural similarity value in step S4 is calculated using the cosine similarity algorithm, and the specific calculation logic is as follows:

[0025] The normalized observation residual matrix is ​​expanded into the first eigenvector, and the normalized theoretical deduction residual matrix is ​​expanded into the second eigenvector.

[0026] Calculate the dot product of the first eigenvector and the second eigenvector to obtain the vector dot product value;

[0027] Calculate the product of the Euclidean norm of the first eigenvector and the Euclidean norm of the second eigenvector to obtain the product value of the modulus.

[0028] The quotient obtained by dividing the inner product of the vectors by the product of their magnitudes is the structural similarity value.

[0029] Preferably, in step S5, when it is determined that there is a true color difference in the textile, the corresponding production control instruction data generated includes:

[0030] S51. Identify the currently selected color difference type;

[0031] S52. If the color difference type is identified as front and back color difference, query the preset process compensation table, calculate the temperature gradient adjustment amount of the dyeing tank according to the size of the structural similarity value, and generate temperature control command data containing the adjustment amount.

[0032] S53. If the color difference type is identified as edge-to-center color difference, query the preset pressure balance model, calculate the adjustment amount of the left and right pressure difference of the rolling mill according to the size of the structural similarity value, and generate pressure control command data containing the adjustment amount.

[0033] Preferably, step S6 is also included:

[0034] In response to production control command data, the data is sent to the programmable logic controller of the dyeing machine via the industrial fieldbus, and the programmable logic controller performs the corresponding physical parameter adjustment.

[0035] In response to the defect-free confirmation signal, the current production process parameters are kept unchanged, and the inspection pass count in the quality management database is updated.

[0036] Compared with the prior art, the present invention has the following beneficial effects:

[0037] 1. This invention analyzes fabric design files and combines physical optics principles to construct a noise-free ideal reference image using a ray tracing algorithm. This method solves the reference deviation caused by the reliance on physical sample fabric in traditional technology, eliminates the influence of weaving defects, stains or warp and weft density fluctuations that may exist in the sample fabric on the test results, and ensures the purity and objectivity of the test reference.

[0038] 2. This invention transforms the experience and knowledge of textile experts into a calculable theoretical damage simulation image by calling a color difference mechanism database and introducing a parameterized interference function. By utilizing the structured characteristics of the mechanism color difference and the weak correlation between environmental random noise in mathematical space, the system can effectively remove interference such as shadows, wrinkles and sensor noise, just like a filter, which greatly improves the detection rate and reduces the false alarm rate in complex industrial environments.

[0039] 3. This invention uses a structural similarity algorithm to replace the traditional pixel amplitude comparison, and combines it with normalization processing, so that the system pays more attention to the morphological consistency of differences in spatial distribution rather than absolute intensity. This verification method based on vector space directionality enhances the robustness of the detection system to changes in ambient light intensity, can accurately capture weak but mechanistic color difference signals, and ensures the stability of detection results.

[0040] 4. This invention establishes a linkage mechanism between the detection results and the production execution mechanism; the system can not only identify the type of color difference, but also deduce the adjustment amount of process parameters such as temperature gradient or pressure difference in real time according to the severity of the color difference, and realize automatic feedback control through industrial bus; this closed-loop correction mode realizes the leap from simple detection to intelligent control, significantly reduces the generation of waste products, and improves the level of intelligence of textile printing and dyeing production. Attached Figure Description

[0041] The present invention will be further explained below with reference to the accompanying drawings and embodiments:

[0042] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation

[0043] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments.

[0044] Example 1:

[0045] Please see Figure 1 A method for detecting color difference in textiles based on image detection, executed by a detection system equipped with an image processor, includes the following steps:

[0046] S1. Obtain the fabric design file and yarn spectral data of the textile to be tested, and construct a noise-free ideal reference image using a ray tracing algorithm through an image processor;

[0047] S2. Call the preset color difference mechanism database, select the parameterized interference function corresponding to the specific color difference type, map the parameterized interference function to the data space of the ideal reference image, and generate a theoretical damage simulation image containing preset defect features.

[0048] S3. Control the industrial camera to acquire real-time images of textiles, calculate the difference between the real-time acquired images and the ideal reference image, and construct the real observation residual matrix; at the same time, calculate the difference between the theoretical damage simulation image and the ideal reference image, and construct the theoretical deduction residual matrix.

[0049] S4. Calculate the structural similarity between the observed residual matrix and the theoretically derived residual matrix in the vector space;

[0050] S5. Compare the structural similarity value with the preset judgment threshold: When the structural similarity value is greater than the preset judgment threshold, it is determined that there is a real color difference in the textile and the corresponding production control instruction data is generated; when the structural similarity value is less than or equal to the preset judgment threshold, it is determined that the difference is due to environmental noise, a defect-free confirmation signal is generated and the detection log is recorded.

[0051] This embodiment discloses an image detection-based method for detecting color difference in textiles, which is executed by a detection system equipped with an image processor; the system includes, but is not limited to, a high-resolution industrial camera, a light source controller, and an edge computing terminal with high computing power;

[0052] Step S1: Construct a noise-free ideal reference image

[0053] An ideal benchmark image refers to a visual representation of a fabric in an absolutely perfect state, generated by rendering in a computer virtual environment based on CAD fabric design files and physical optics principles.

[0054] In this step, the system acquires the fabric design file and yarn spectral data of the textile to be tested, and uses the image processor to construct a noise-free ideal reference image using a ray tracing algorithm.

[0055] This step establishes the absolute truth value of the test; unlike traditional techniques that use standard sample fabric photographs as a benchmark, this embodiment avoids the weaving defects, stains or warp and weft density fluctuations that may exist in the physical sample fabric itself through digital reconstruction, thereby eliminating noise interference from the benchmark source.

[0056] Step S2: Generate theoretically damaged simulation images

[0057] Theoretically damaged simulation images refer to images generated by artificially superimposing mathematical interference models that conform to specific color difference mechanisms, such as uneven dyeing or yarn mixing errors, on an ideal reference image.

[0058] The system calls the preset color difference mechanism database, selects the parameterized interference function corresponding to the specific color difference type, maps the parameterized interference function to the data space of the ideal reference image, and generates a theoretical damage simulation image containing preset defect features.

[0059] This step employs a synthetic analysis method; the system does not passively identify defects, but actively simulates what form the image should take if a certain color difference occurs, transforming the textile experts' mechanistic knowledge into calculable mathematical features, providing clear topological targets for subsequent comparisons.

[0060] Step S3: Construct the dual residual matrix

[0061] The real-world observation residual matrix refers to the set of difference data between the real image captured by the industrial camera and the ideal reference image; the theoretical derivation residual matrix refers to the set of difference data between the theoretically damaged simulated image and the ideal reference image.

[0062] The system controls an industrial camera to acquire real-time images of textiles, calculates the difference between the real-time acquired images and the ideal reference image, and constructs a real-world observation residual matrix; at the same time, it calculates the difference between the theoretically damaged simulation image and the ideal reference image and constructs a theoretical deduction residual matrix.

[0063] By constructing a residual matrix with two parallel dimensions, this embodiment transforms the complex image recognition problem into a difference morphology matching problem. The real-world observation residual matrix contains true color difference, environmental noise, and sensor noise, while the theoretically derived residual matrix contains only pure color difference signals. This provides a data foundation for subsequently removing real defects from the noise.

[0064] Step S4: Calculate structural similarity

[0065] The system calculates the structural similarity values ​​between the observed residual matrix and the theoretically derived residual matrix in the vector space.

[0066] This step essentially constructs a matched filter; the system does not care about the absolute magnitude of the difference, which may be affected by the light intensity, but focuses on whether the shape of the difference in spatial distribution is consistent; the structural similarity mentioned here specifically refers to the measure that reflects the topological orientation consistency of the residual data in the multidimensional vector space, quantified by the cosine similarity algorithm, in order to distinguish it from the SSIM index in traditional image quality assessment.

[0067] Step S5: Decision and Response

[0068] The system compares the structural similarity scores with a preset decision threshold:

[0069] When the structural similarity value is greater than the preset judgment threshold, it is determined that the difference in reality conforms to the color difference characteristics deduced by theory, that is, it is determined that there is a real color difference in the textile and the corresponding production control instruction data is generated.

[0070] When the structural similarity value is less than or equal to the preset decision threshold, the difference is determined to be due to environmental noise, such as shadows or wrinkles, and a defect-free confirmation signal is generated and the detection log is recorded.

[0071] The preset decision threshold is a confidence threshold set based on historical statistical data. In this embodiment, it is recommended to take a value of 0.85. This value comes from the ROC curve analysis of 1000 typical color difference samples, and aims to balance the detection rate and the false alarm rate.

[0072] Overall, this method uses theoretical simulation as a filter to effectively eliminate unstructured environmental noise. Because environmental noise, such as the residual morphology caused by uneven illumination, is mathematically orthogonal or weakly correlated with the color difference residual morphology caused by the dyeing and finishing mechanism, the false alarm rate is greatly reduced.

[0073] Example 2:

[0074] The specific sub-steps for constructing the noise-free ideal reference image in step S1 are as follows:

[0075] S11. Analyze the design data in the fabric design file, extract the interlacing coordinates of warp and weft yarns, and construct a three-dimensional micro-geometric model that includes yarn twist and hairiness characteristics.

[0076] S12. Call the bidirectional reflectance distribution function to assign the spectral power distribution data of the preset standard light source and the reflectance curve data of the standard dye to the three-dimensional micro-geometric model and define the virtual optical properties of the model.

[0077] S13. Apply the Monte Carlo ray tracing algorithm to render the assigned 3D microscopic geometric model and generate an ideal reference image whose pixel values ​​represent the brightness of the illumination radiation.

[0078] This embodiment is a further specification of the construction of a noise-free ideal reference image in step S1;

[0079] Step S11: Microscopic geometric modeling

[0080] The system analyzes the design data in the fabric design file and extracts the interlacing coordinates of the warp and weft yarns; based on this, a three-dimensional micro-geometric model including yarn twist and hairiness characteristics is constructed.

[0081] Design diagram data refers to matrix data that describes the structure of a fabric, where 1 represents warp floating points and 0 represents weft floating points.

[0082] Implementation details: The system not only generates a macroscopic warp and weft interlacing structure based on the design drawing, but also introduces microscopic details; for example, the cylinder diameter is set according to the yarn count, and a spiral texture is mapped on the cylinder surface according to the yarn twist parameter, such as 800 twists / meter. At the same time, micron-level fiber protrusions are randomly generated on the model surface to simulate hairiness.

[0083] By introducing twist and hairiness features, the constructed model is closer to the light reflection characteristics of real fabrics, avoiding plastic-like artifacts caused by an overly smooth model and improving the physical realism of the reference image.

[0084] Step S12: Virtual optical property definition

[0085] The system calls the Bidirectional Reflectance Distribution Function (BRDF) to assign the spectral power distribution data of the preset standard light source and the reflectance curve data of the standard dye to the three-dimensional microscopic geometric model, defining the virtual optical properties of the model. Specifically, the Cook-Torrance model is used as the BRDF model, and the wavelength... exist to Spectral power of light sources within the range With dye reflectance Perform convolution integrals to calculate the CIE tristimulus values. And use it as the diffuse reflection coefficient in the BRDF model. ;in, The calculation formula is:

[0086]

[0087] in, For standard observer color matching functions; The normalization coefficient is calculated as follows: ; For standard observer color matching functions; and The calculation method and Similarly, you only need to add the formula to... Replace with the corresponding or ;

[0088] The bidirectional reflectance distribution function (BRDF) describes a mathematical model of how light is reflected on an opaque surface.

[0089] Implementation details: The standard light source adopts the spectral data of the CIE-recommended D65 light source; the standard dye reflectance curve is derived from spectrophotometer data measured in the dyeing factory laboratory;

[0090] Step S13: Ray Tracing Rendering

[0091] The system uses the Monte Carlo ray tracing algorithm to render the assigned 3D micro-geometric model and generate an ideal reference image whose pixel values ​​represent the brightness of the illumination radiation.

[0092] Through physically-grade ray tracing rendering, the generated baseline image not only contains accurate color information, but also complex microscopic aerodynamic effects such as shadows between yarns and highlights on fiber surfaces.

[0093] Example 3:

[0094] The specific sub-steps for generating the theoretically damaged simulation image in step S2 are as follows:

[0095] S21. Read the preset mathematical definition model from the color difference mechanism database. The model includes a time axis linear decay function or a spatial parabolic function.

[0096] S22. The read function is used as a pixel gain factor and multiplied with the pixel value at the corresponding coordinate in the ideal reference image to simulate the change in dye uptake rate or abnormal yarn mixing. The calculation result constitutes the theoretically damaged simulation image.

[0097] This embodiment is a further specification of the generation of theoretically damaged simulation images in step S2, with the focus on how to transform expert knowledge into mathematical operators;

[0098] Step S21: Read the mathematical definition model

[0099] A preset mathematical model is read from the color difference mechanism database. The model is configured to output a dimensionless gain coefficient, specifically including a time-axis linear decay function or a spatial parabolic function.

[0100] The time-axis linear decay function is used to simulate the color difference before and after, and its calculation formula is as follows:

[0101]

[0102] in, For normalized time axis coordinates, the value range is... This represents the relative position from the beginning to the end of the fabric roll; This is a dimensionless attenuation slope coefficient used to control the intensity of color difference gradation; its value range is set to... This range is determined by the statistical distribution of the natural loss rate of dye liquor concentration in the dyeing process; The fundamental gain constant is dimensionless and typically takes a value close to 1.0; in this embodiment, it is set to... To simulate the initial dyeing state;

[0103] The spatial parabolic function is used to simulate color difference in the middle of an edge, and its calculation formula is as follows:

[0104]

[0105] in, The normalized width direction coordinates have a range of values. Define the center line of the fabric left edge right edge ; It is a dimensionless curvature coefficient used to define the degree of curvature of color difference spreading from the center to the edge; The central gain constant is dimensionless;

[0106] By introducing normalized coordinates, the above formula ensures that the input variables and output results are consistent in terms of dimensions, thus guaranteeing the pixel gain factor. and It is always a dimensionless pure scalar, so it can directly participate in subsequent pixel multiplication operations;

[0107] Step S22: Interference Injection Calculation

[0108] The read function is used as a pixel gain factor and multiplied with the pixel value at the corresponding coordinate in the ideal reference image. The result of the operation constitutes the theoretically damaged simulation image.

[0109] Implementation details: Assuming the ideal reference image is in coordinates The pixel value at that location is The selected interference function is The theoretically damaged simulation image The calculation is as follows:

[0110]

[0111] The simulated changes in dye uptake or abnormal yarn mixing are manifested as Numerical fluctuations;

[0112] This multiplicative injection method successfully simulates the gradual change in chemical properties caused by the gradual change in physical parameters during the dyeing and finishing process at the mathematical level, giving the simulation image a strong domain-specific characteristic.

[0113] Example 4:

[0114] The specific sub-steps for constructing the actual observation residual matrix in step S3 are as follows:

[0115] S31. Receive the real-time acquired image transmitted by the industrial camera, and use the feature point matching algorithm to calculate the displacement vector of the real-time acquired image relative to the ideal reference image.

[0116] S32. Perform geometric transformation on the real-time acquired image based on the displacement vector to align the pixel coordinates with the ideal reference image at sub-pixel accuracy.

[0117] S33. If alignment fails, a re-acquisition command is triggered; if alignment succeeds, the pixel grayscale value of the real-time acquired image after alignment is subtracted from the pixel grayscale value of the corresponding coordinate of the ideal reference image, and the resulting differential data set is the actual observation residual matrix.

[0118] This embodiment is a further specification of the construction of the real observation residual matrix in step S3, aiming to solve the spatial alignment problem between the real image and the ideal image;

[0119] Step S31: Displacement Vector Calculation

[0120] It receives real-time acquired images transmitted from industrial cameras and uses feature point matching algorithms, such as SIFT or ORB, to calculate the displacement vector of the real-time acquired image relative to an ideal reference image.

[0121] Step S32: Subpixel-level geometric transformation

[0122] Geometric transformations, such as affine or perspective transformations, are performed on real-time acquired images based on displacement vectors to align pixel coordinates with an ideal reference image at sub-pixel accuracy.

[0123] Subpixel precision refers to alignment errors smaller than the size of a physical pixel, which is usually achieved through bilinear interpolation or bicubic interpolation.

[0124] High-precision alignment is a prerequisite for calculating effective residuals; subpixel alignment ensures that subsequent subtraction operations are comparisons of the same fabric texture points, avoiding misalignment and false differences caused by mechanical jitter or changes in fabric tension.

[0125] Step S33: Generation of Differential Data

[0126] If alignment is successful, the pixel grayscale values ​​of the aligned real-time acquired image are subtracted from the pixel grayscale values ​​of the corresponding coordinates of the ideal reference image, and the resulting difference data set is the actual observation residual matrix. If alignment fails, a re-acquisition command is triggered. The criterion for determining alignment failure is the number of feature point matching pairs. Or the root mean square value of the reprojection error after geometric transformation Pixel;

[0127] By performing a subtraction operation, the normal fabric texture signal that serves as the background is eliminated, highlighting all anomalous components, including color difference signals and noise signals.

[0128] Example 5:

[0129] The specific sub-steps for constructing the theoretical derivation residual matrix in step S3 are as follows:

[0130] S34. Subtract the pixel gray value of the corresponding coordinate of the ideal reference image generated in step S1 from the pixel gray value of the theoretically damaged simulation image generated in step S2. The resulting difference data set is the theoretical derivation residual matrix.

[0131] S35. Perform normalization processing on the actual observation residual matrix and the theoretical derivation residual matrix respectively, and map all values ​​in the matrix to a closed interval between zero and one.

[0132] This embodiment is a further concretization and data standardization process for constructing the theoretical derivation residual matrix in step S3;

[0133] Step S34: Calculation of theoretical residuals

[0134] Subtract the pixel gray value of the corresponding coordinate of the ideal reference image generated in step S1 from the pixel gray value of the theoretically damaged simulation image generated in step S2, and the resulting difference data set is the theoretical derivation residual matrix.

[0135] The matrix obtained in this step represents the spatial distribution of pure color difference;

[0136] Step S35: Normalization

[0137] Normalization is performed on both the observed residual matrix and the theoretically derived residual matrix, mapping all values ​​within the matrix to a closed interval between zero and one. To avoid algorithm crashes caused by a zero denominator, a smoothing factor is introduced when calculating the normalization formula. The calculation formula is revised as follows:

[0138]

[0139] in, The normalized matrix, For the original matrix, and These are the maximum and minimum values ​​within the matrix;

[0140] Normalization eliminates the influence of absolute light intensity, allowing subsequent similarity calculations to focus only on the relative distribution of residual data, thus enhancing the system's robustness to changes in ambient light intensity.

[0141] Example 6:

[0142] In step S4, the structural similarity value is calculated using the cosine similarity algorithm. The specific calculation logic is as follows:

[0143] The normalized observation residual matrix is ​​expanded into the first eigenvector, and the normalized theoretical deduction residual matrix is ​​expanded into the second eigenvector.

[0144] Calculate the dot product of the first eigenvector and the second eigenvector to obtain the vector dot product value;

[0145] Calculate the product of the Euclidean norm of the first eigenvector and the Euclidean norm of the second eigenvector to obtain the product value of the modulus.

[0146] The quotient obtained by dividing the inner product of the vectors by the product of their magnitudes is the structural similarity value.

[0147] This embodiment is a concretization of the structural similarity numerical calculation logic in step S4, clarifying how to quantify the similarity of the two matrix forms;

[0148] Step S4: Specific calculation logic:

[0149] The cosine similarity algorithm is used to calculate the structural similarity value as a measure of vector orientation consistency, so as to characterize the structural orientation consistency of two residual matrices in the expanded high-dimensional vector space.

[0150] Vector expansion: The normalized residual matrix of actual observations has dimensions of... Expand into the first eigenvector , dimension The normalized theoretical derivation residual matrix is ​​expanded into a second eigenvector. ;

[0151] Dot product calculation: Calculate the dot product of the first eigenvector and the second eigenvector to obtain the dot product value;

[0152]

[0153] Modulus product calculation: Calculate the product of the Euclidean norm of the first eigenvector and the Euclidean norm of the second eigenvector to obtain the modulus product value;

[0154]

[0155] Similarity is calculated by dividing the dot product of the vectors by the product of their magnitudes; the quotient is the structural similarity value. ; Set a protected branch in the program logic execution: if the product value of the modulus is... A value of zero indicates that the observed image is completely identical to the ideal reference image, with no color difference signal. Therefore, the structural similarity value can be directly determined. This indicates that the actual residual and the theoretical color difference feature are completely orthogonal in the vector space, which means that it is determined to be without color difference;

[0156]

[0157] Cosine similarity essentially calculates the cosine of the angle between two vectors in a multidimensional space;

[0158] If the feature shape contained in the actual residual closely matches the theoretical color difference, and the vector directions of the two tend to be consistent with each other, with an angle close to 0 degrees, Approaching 1;

[0159] If the actual residual is mainly composed of random environmental noise, according to the principle that random vectors in high-dimensional space are approximately orthogonal, the vector directions of the two are nearly perpendicular. Approaching 0;

[0160] Therefore, this method successfully transforms color difference detection into signal directionality verification, thereby mathematically shielding interference signals that are inconsistent with the direction of color difference.

[0161] Example 7:

[0162] In step S5, when it is determined that there is a true color difference in the textile, the corresponding production control instruction data generated includes:

[0163] S51. Identify the currently selected color difference type;

[0164] S52. If the color difference type is identified as front and back color difference, query the preset process compensation table, calculate the temperature gradient adjustment amount of the dyeing tank according to the size of the structural similarity value, and generate temperature control command data containing the adjustment amount.

[0165] S53. If the color difference type is identified as edge-to-center color difference, query the preset pressure balance model, calculate the adjustment amount of the left and right pressure difference of the rolling mill according to the size of the structural similarity value, and generate pressure control command data containing the adjustment amount.

[0166] This embodiment is a concretization of the production control instruction data generated in step S5, and demonstrates the closed-loop control logic.

[0167] Step S51: Identify color difference type

[0168] Identify the currently selected color difference type, that is, the specific type used to generate the simulation in step S2;

[0169] Step S52: Temperature control adjustment of color difference between front and back

[0170] If the color difference type is identified as front-to-back color difference, it is usually caused by the change of dyeing rate over time. The system queries the preset process compensation table.

[0171] The process compensation table is a lookup table that records the structural similarity values, representing the correspondence between the severity of color difference and the temperature correction value of the dyeing bath;

[0172] The temperature gradient adjustment amount of the dyeing bath is calculated based on the structural similarity value, and temperature control command data containing this adjustment amount is generated; the specific mapping calculation formula is as follows:

[0173]

[0174] in, This represents the structural similarity score. The preset temperature control sensitivity coefficient has a value range of [value range missing]. to For example, if a lighter color is detected in the latter part, corresponding to a specific similarity value, the instruction is to increase the heating rate.

[0175] Step S53: Pressure adjustment of edge-to-center color difference

[0176] If the color difference type is identified as edge-to-center color difference, it is usually caused by uneven rolling mill pressure. The system queries the preset pressure balance model.

[0177] The adjustment amount of the left and right pressure difference of the rolling mill is calculated based on the magnitude of the structural similarity value, and pressure control command data containing this adjustment amount is generated; the specific calculation formula is as follows:

[0178]

[0179] in, To compensate for the maximum pressure of the rolling mill, To be based on the interference function In the width direction curvature coefficient The positive and negative values ​​of the pressure regulation direction factor: if If it is characterized by darker edges and lighter middle, then... ;like If it is characterized by shallow edges and deep middle, then... For example, if a deep edge is detected, the command will be issued to increase hydraulic compensation in the middle of the rolling mill.

[0180] This embodiment not only detected color difference, but also derived corrective measures directly based on the physical mechanism of color difference through simulation model confirmation, thus achieving a leap from quality detection to process control.

[0181] Example 8:

[0182] Step S6:

[0183] In response to production control command data, the data is sent to the programmable logic controller of the dyeing machine via the industrial fieldbus, and the programmable logic controller performs the corresponding physical parameter adjustment.

[0184] In response to the defect-free confirmation signal, the current production process parameters are kept unchanged, and the inspection pass count in the quality management database is updated.

[0185] This embodiment is a supplement to the execution level of the detection results;

[0186] The specific execution of step S6:

[0187] Closed-loop control: In response to production control command data, the data is sent to the programmable logic controller (PLC) of the dyeing machine via an industrial fieldbus, such as Profibus or Modbus; the PLC then performs corresponding physical parameter adjustments, such as adjusting valve opening and hydraulic pump power, thereby correcting production deviations online and reducing scrap rate;

[0188] Release record: In response to the defect-free confirmation signal, the current production process parameters remain unchanged, and the inspection pass count in the quality management database is updated to provide data support for subsequent quality traceability;

[0189] It has achieved fully automated, unattended detection and control, which has greatly improved the production efficiency and yield of textile printing and dyeing processes.

[0190] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims

1. A method for detecting color difference in textiles based on image detection, characterized in that, The process is performed by a detection system equipped with an image processor, and the specific steps include: S1. Obtain the fabric design file and yarn spectral data of the textile to be tested, and construct a noise-free ideal reference image using a ray tracing algorithm through an image processor; S2. Call the preset color difference mechanism database, select the parameterized interference function corresponding to the specific color difference type, map the parameterized interference function to the data space of the ideal reference image, and generate a theoretical damage simulation image containing preset defect features. S3. Control the industrial camera to acquire real-time images of textiles, calculate the difference between the real-time acquired images and the ideal reference image, and construct the real observation residual matrix; at the same time, calculate the difference between the theoretical damage simulation image and the ideal reference image, and construct the theoretical deduction residual matrix. S4. Calculate the structural similarity between the observed residual matrix and the theoretically derived residual matrix in the vector space; S5. Compare the structural similarity value with the preset judgment threshold: When the structural similarity value is greater than the preset judgment threshold, it is determined that there is a real color difference in the textile and the corresponding production control instruction data is generated; when the structural similarity value is less than or equal to the preset judgment threshold, it is determined that the difference is due to environmental noise, a defect-free confirmation signal is generated and the detection log is recorded. In step S4, the structural similarity value is calculated using the cosine similarity algorithm. The specific calculation logic is as follows: The normalized observation residual matrix is ​​expanded into the first eigenvector, and the normalized theoretical deduction residual matrix is ​​expanded into the second eigenvector. Calculate the dot product of the first eigenvector and the second eigenvector to obtain the vector dot product value; Calculate the product of the Euclidean norm of the first eigenvector and the Euclidean norm of the second eigenvector to obtain the product value of the modulus. The quotient obtained by dividing the inner product of the vectors by the product of their magnitudes is the structural similarity value.

2. The method for detecting color difference in textiles based on image detection according to claim 1, characterized in that, The specific sub-steps for constructing the noise-free ideal reference image in step S1 are as follows: S11. Analyze the design data in the fabric design file, extract the interlacing coordinates of warp and weft yarns, and construct a three-dimensional micro-geometric model that includes yarn twist and hairiness characteristics. S12. Call the bidirectional reflectance distribution function to assign the spectral power distribution data of the preset standard light source and the reflectance curve data of the standard dye to the three-dimensional micro-geometric model and define the virtual optical properties of the model. S13. Apply the Monte Carlo ray tracing algorithm to render the assigned 3D microscopic geometric model and generate an ideal reference image whose pixel values ​​represent the brightness of the illumination radiation.

3. The method for detecting color difference in textiles based on image detection according to claim 1, characterized in that, The specific sub-steps for generating the theoretically damaged simulation image in step S2 are as follows: S21. Read the preset mathematical definition model from the color difference mechanism database. The model includes a time axis linear decay function or a spatial parabolic function. S22. The read function is used as a pixel gain factor and multiplied with the pixel value at the corresponding coordinate in the ideal reference image to simulate the change in dye uptake rate or abnormal yarn mixing. The calculation result constitutes the theoretically damaged simulation image.

4. The method for detecting color difference in textiles based on image detection according to claim 1, characterized in that, The specific sub-steps for constructing the actual observation residual matrix in step S3 are as follows: S31. Receive the real-time acquired image transmitted by the industrial camera, and use the feature point matching algorithm to calculate the displacement vector of the real-time acquired image relative to the ideal reference image. S32. Perform geometric transformation on the real-time acquired image based on the displacement vector to align the pixel coordinates with the ideal reference image at sub-pixel accuracy. S33. If alignment fails, a re-acquisition command is triggered. If the alignment is successful, the pixel grayscale value of the real-time acquired image after alignment is subtracted from the pixel grayscale value of the corresponding coordinate of the ideal reference image, and the resulting differential data set is the actual observation residual matrix.

5. The method for detecting color difference in textiles based on image detection according to claim 4, characterized in that, The specific sub-steps for constructing the theoretical derivation residual matrix in step S3 are as follows: S34. Subtract the pixel gray value of the corresponding coordinate of the ideal reference image generated in step S1 from the pixel gray value of the theoretically damaged simulation image generated in step S2. The resulting difference data set is the theoretical derivation residual matrix. S35. Perform normalization processing on the actual observation residual matrix and the theoretical derivation residual matrix respectively, and map all values ​​in the matrix to a closed interval between zero and one.

6. The method for detecting color difference in textiles based on image detection according to claim 1, characterized in that, In step S5, when it is determined that there is a true color difference in the textile, the corresponding production control instruction data generated includes: S51. Identify the currently selected color difference type; S52. If the color difference type is identified as front and back color difference, query the preset process compensation table, calculate the temperature gradient adjustment amount of the dyeing tank according to the size of the structural similarity value, and generate temperature control command data containing the adjustment amount. S53. If the color difference type is identified as edge-to-center color difference, query the preset pressure balance model, calculate the adjustment amount of the left and right pressure difference of the rolling mill according to the size of the structural similarity value, and generate pressure control command data containing the adjustment amount.

7. The method for detecting color difference in textiles based on image detection according to claim 1, characterized in that, It also includes step S6: In response to production control command data, the data is sent to the programmable logic controller of the dyeing machine via the industrial fieldbus, and the programmable logic controller performs the corresponding physical parameter adjustment. In response to the defect-free confirmation signal, the current production process parameters are kept unchanged, and the inspection pass count in the quality management database is updated.

Citation Information

Patent Citations

  • Detection method for color difference and stain defects of color texture fabric

    CN114119502A

  • Textile color difference detection method based on image data

    CN117372334A