Textile color difference detection method based on image detection
By constructing a noise-free ideal reference image and a theoretically damaged simulation image, and calculating the structural similarity of the residual matrix, the problem of distinguishing between real color difference and environmental noise in textile color difference detection is solved, achieving efficient closed-loop production control and improving detection accuracy and production efficiency.
Patent Information
- Application Number
- CN202610002781.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-05
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2046-01-05
AI Technical Summary
Existing textile color difference detection technologies struggle to distinguish between true color difference and environmental noise in complex industrial environments, resulting in an imbalance between detection rate and false alarm rate, and lacking deep mechanism coupling to achieve real-time correction.
By constructing a noise-free ideal reference image, a theoretically damaged simulation image is generated using ray tracing algorithms and parameterized interference functions. The structural similarity of the residual matrix is calculated, and images acquired by industrial cameras are combined for accurate identification, generating production control instructions.
It effectively eliminates reference noise interference, improves detection accuracy and response speed, realizes closed-loop correction from detection to production control, and significantly reduces scrap rate.
Smart Images

Figure CN121453792A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of textile printing and dyeing quality detection and industrial automation control technology, in particular to a textile color difference detection method based on image detection. BACKGROUND
[0002] In the current textile production quality detection environment, using industrial image processing technology for color difference online monitoring is an important means to ensure product quality; the existing detection scheme generally relies on collecting the image of a physical standard sample cloth as a detection reference, and comparing and analyzing the real-time collected image of the to-be-detected fabric at the pixel level; Although this scheme has certain detection capability in the conventional environment, the physical sample cloth inevitably has weaving defects, surface stains or weft and warp density fluctuations, which introduces reference noise from the source; at the same time, in the industrial production scene, uneven distribution of environmental light, physical wrinkles on the fabric surface, and sensor noise and other factors will produce a large amount of unstructured interference data; the existing algorithm often cannot effectively distinguish between real mechanism color difference and random environmental noise, resulting in low balance between system detection rate and false alarm rate, and it is difficult to achieve accurate separation of weak color difference; in addition, the detection system and the production execution mechanism often lack deep mechanism coupling, and cannot perform real-time closed-loop correction on the dyeing process parameters according to the detection results; therefore, how to eliminate the noise interference from the physical reference source and accurately identify the structured color difference characteristics from the complex background to improve the detection accuracy and the response speed of production control has become a technical problem to be solved. SUMMARY
[0003] To solve the above technical problems, the present application provides a textile color difference detection method based on image detection, specifically, the technical scheme of the present application comprises: S1, obtaining a fabric design file and yarn spectrum data of a to-be-detected textile, and constructing a noise-free ideal reference image by an image processor using a ray tracing algorithm; S2, calling a preset color difference mechanism database, selecting a parameterized interference function corresponding to a specific color difference type, mapping the parameterized interference function to the data space of the ideal reference image, and generating a theoretical damaged simulation image containing a preset defect feature; S3, controlling an industrial camera to collect a real-time collected image of the textile, calculating the difference between the real-time collected image and the ideal reference image, and constructing a real observation residual matrix; at the same time, calculating the difference between the theoretical damaged simulation image and the ideal reference image, and constructing a theoretical deduction residual matrix; S4, calculating the structural similarity value of the real observation residual matrix and the theoretical deduction residual matrix in the vector space; S5, compare the structural similarity value with a preset decision threshold value: when the structural similarity value is greater than the preset decision threshold value, it is determined that the textile has a real color difference, and a corresponding production control instruction data is generated; when the structural similarity value is less than or equal to the preset decision threshold value, it is determined that the difference is caused by environmental noise, a non-defect confirmation signal is generated and a detection log is recorded.
[0004] Preferably, the specific sub-steps of constructing the ideal reference image without noise points in step S1 are: S11, analyze the design data in the fabric design file, extract the interlacing coordinates of the warp and weft yarns, and construct a three-dimensional micro-geometric model containing the twist and hairiness characteristics of the yarns; S12, call the bidirectional reflectance distribution function, assign the spectral power distribution data of the preset standard light source and the reflectivity 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 three-dimensional micro-geometric model after assignment, and generate an ideal reference image with pixel values representing the luminance of the light radiation.
[0005] Preferably, the specific sub-steps of generating the theoretical damaged simulation image in step S2 are: S21, read the preset mathematical definition model from the color difference mechanism database, the model including a time axis linear decay function or a spatial parabolic function; S22, multiply the read function as a pixel gain factor with the pixel value of the corresponding coordinate in the ideal reference image to simulate the dyeing rate change or the abnormal mixing of yarns, and the operation result constitutes the theoretical damaged simulation image.
[0006] Preferably, the specific sub-steps of constructing the real observation residual matrix in step S3 are: S31, receive the real-time acquisition image transmitted by the industrial camera, and calculate the displacement vector of the real-time acquisition image relative to the ideal reference image using a feature point matching algorithm; S32, perform geometric transformation on the real-time acquisition image based on the displacement vector to align the pixel coordinates with the ideal reference image at sub-pixel accuracy; S33, if the alignment fails, trigger a re-acquisition instruction; if the alignment is successful, subtract the pixel gray value of the corresponding coordinate of the ideal reference image from the pixel gray value of the aligned real-time acquisition image, and the generated difference data set is the real observation residual matrix.
[0007] Preferably, the specific sub-steps of constructing the theoretical deduction residual matrix in step S3 are: 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 theoretical damaged simulation image generated in step S2, and the generated difference data set is the theoretical deduction residual matrix. S35, respectively, the normalized residual matrix and the theoretical residual matrix are executed, and all values in the matrix are mapped to the closed interval of zero to one.
[0008] Preferably, the structure similarity value in step S4 is calculated by using the cosine similarity algorithm, and the specific calculation logic is: The normalized real observation residual matrix is unfolded into a first eigenvector, and the normalized theoretical residual matrix is unfolded into a second eigenvector; The dot product of the first eigenvector and the second eigenvector is calculated to obtain a vector inner product value; The product of the Euclidean norm of the first eigenvector and the Euclidean norm of the second eigenvector is calculated to obtain a modulus product value; The quotient obtained by dividing the vector inner product value by the modulus product value is the structure similarity value.
[0009] Preferably, in step S5, when it is determined that the textile has a real color difference, the corresponding production control instruction data is generated, including: S51, identify the selected color difference type; S52, if the color difference type is identified as front-back color difference, query the preset process compensation table, calculate the dyeing tank temperature gradient adjustment amount according to the size of the structure similarity value, and generate temperature control instruction data containing the adjustment amount; S53, if the color difference type is identified as edge-middle color difference, query the preset pressure balance model, calculate the adjustment amount of the left and right pressure difference of the mangle according to the size of the structure similarity value, and generate pressure control instruction data containing the adjustment amount.
[0010] Preferably, it further includes step S6: In response to the production control instruction data, the data is sent to the programmable logic controller of the dyeing machine through the industrial field bus, and the programmable logic controller executes the corresponding physical parameter adjustment; In response to the defect-free confirmation signal, the current production process parameters are kept unchanged, and the detection pass count in the quality management database is updated.
[0011] Compared with the prior art, the present application has the following advantages: 1. The present application constructs an ideal reference image with no noise points by analyzing the fabric design file and combining physical and optical principles, using a ray tracing algorithm; this method solves the reference deviation caused by the dependence of traditional technology on physical sample cloth, eliminates the influence of weaving defects, stains or warp and weft density fluctuations in the sample cloth itself on the detection result, and ensures the purity and objectivity of the detection reference; 2、The application converts the experience and knowledge of textile experts into calculable theoretical damaged simulation images by calling the color difference mechanism database and introducing the parameterized interference function; by utilizing the weak correlation between the structured features of the mechanism color difference and the environmental random noise in the mathematical space, the system can effectively eliminate interference such as shadows, wrinkles and sensor noise, etc., greatly improving the detection rate and reducing the false alarm rate in complex industrial environments; 3、The application adopts a structural similarity algorithm to replace the traditional pixel amplitude comparison, and combines normalization processing, so that the system pays more attention to the morphological consistency of the difference in the spatial distribution rather than the absolute intensity; this verification method based on the directionality of the vector space enhances the robustness of the detection system to the changes in the intensity of the environmental light, can accurately capture weak but mechanism characteristic color difference signals, and ensures the stability of the detection results; 4、The application establishes a linkage mechanism between the detection results and the production execution mechanism; the system can not only identify the color difference type, but also can deduce the adjustment amount of the process parameters such as temperature gradient or pressure difference according to the color difference severity in real time, and realizes automatic feedback control through the 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 intelligent level of textile printing and dyeing production. BRIEF DESCRIPTION OF DRAWINGS
[0012] The application will be further explained in combination with the drawings and embodiments: Figure 1 is a flowchart of the method of the application. DETAILED DESCRIPTION
[0013] In order to make the purpose, technical scheme and advantages of the application more clear and explicit, the application will be further described in detail in combination with specific embodiments.
[0014] Embodiment 1: Please refer to Figure 1 A textile color difference detection method based on image detection is executed by a detection system configured with an image processor, and the specific steps include: S1, obtaining the fabric design file and yarn spectrum data of the textile to be detected, and constructing a noise-free ideal reference image by using a light ray tracing algorithm through the image processor; S2, calling a preset color difference mechanism database, selecting a parameterized interference function corresponding to a specific color difference type, mapping the parameterized interference function to the data space of the ideal reference image, and generating a theoretical damaged simulation image containing preset defect features; S3, controlling an industrial camera to collect real-time acquisition images of the textile, calculating the difference between the real-time acquisition images and the ideal reference image, and constructing a real observation residual matrix; at the same time, calculating the difference between the theoretical damaged simulation image and the ideal reference image, and constructing a theoretical deduction residual matrix; S4, calculate the structural similarity value of the real observation residual matrix and the theoretically derived residual matrix in the vector space; S5, compare the structural similarity value with the preset decision threshold: when the structural similarity value is greater than the preset decision threshold, it is determined that the textile has real color difference, and the corresponding production control instruction data is generated; when the structural similarity value is less than or equal to the preset decision threshold, it is determined that the difference is caused by environmental noise, and a defect-free confirmation signal is generated and a detection log is recorded.
[0015] The embodiment discloses a textile color difference detection method based on image detection, which is executed by a detection system configured 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; Step S1: constructing an ideal reference image without noise points The ideal reference image refers to a visual representation of the fabric in an absolute perfect state generated by rendering in a computer virtual environment based on the fabric design file CAD and physical optical principles; In this step, the system obtains the fabric design file and yarn spectrum data of the textile to be detected, and constructs an ideal reference image without noise points by using the light ray tracing algorithm through the image processor; This step establishes the absolute true value of the detection; unlike traditional technologies that use standard sample cloth photographs as a reference, this embodiment avoids the weaving defects, stains, or warp and weft density fluctuations that may exist in physical sample cloth through digital reconstruction, thereby eliminating noise interference at the source of the reference; Step S2: generating a theoretically damaged simulation image The theoretically damaged simulation image refers to an image generated by artificially superimposing a mathematical interference model that conforms to a specific color difference mechanism, such as uneven dyeing or yarn mixing errors, on the basis of the ideal reference image; The system calls a preset color difference mechanism database, selects a parameterized interference function corresponding to a specific color difference type, maps the parameterized interference function to the data space of the ideal reference image, and generates a theoretically damaged simulation image containing preset defect characteristics; This step uses a synthetic analysis method; instead of passively identifying defects, the system actively simulates what the image should look like if a certain color difference occurs, converting the mechanism knowledge of textile experts into computable mathematical features, providing a clear topological target for subsequent comparison; Step S3: constructing a double residual matrix The real observation residual matrix refers to the difference data set between the real image collected by the industrial camera and the ideal reference image; the theoretically derived residual matrix refers to the difference data set between the theoretically damaged simulation image and the ideal reference image; The system controls the industrial camera to collect the real-time acquisition image of the textile, calculates the difference between the real-time acquisition image and the ideal reference image, and constructs a real observation residual matrix; meanwhile, the difference between the theoretical damaged simulation image and the ideal reference image is calculated, and a theoretical deduction residual matrix is constructed; By constructing two parallel dimensional residual matrices, the embodiment converts the complex image recognition problem into a difference pattern matching problem; the real observation residual matrix mixes true color difference, environmental noise and sensor noise; while the theoretical deduction residual matrix only contains pure color difference signals; which provides a data basis for subsequent separation of real defects from noise; Step S4: Calculate the structural similarity The system calculates the structural similarity value of the real observation residual matrix and the theoretical deduction residual matrix in the vector space; This step essentially constructs a matching filter; the system does not care about the absolute amplitude of the difference, which may be affected by the intensity of light, but focuses on whether the shape of the difference in the spatial distribution is consistent; the structural similarity described here specifically refers to the measure reflecting the consistency of the topological direction of the residual data in the multi-dimensional vector space quantified by the cosine similarity algorithm, which is used to distinguish from the SSIM index in the traditional image quality evaluation; Step S5: Decision and response The system compares the structural similarity value with the preset decision threshold: When the structural similarity value is greater than the preset decision threshold, it is determined that the difference pattern in reality conforms to the color difference characteristics of the theoretical deduction, that is, 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 decision threshold, it is determined that the difference is caused by environmental noise such as shadow and wrinkle, and a defect-free confirmation signal is generated and a detection log is recorded; The preset decision threshold is a confidence threshold set based on historical statistical data, in this embodiment, the value is recommended to be 0.85, which is derived from the ROC curve analysis of 1000 typical color difference samples, aiming to balance the detection rate and false positive rate; The whole method uses theoretical simulation as a filter to effectively eliminate unstructured environmental noise; because the residual pattern caused by uneven light is orthogonal or weakly correlated with the color difference residual pattern generated by the dyeing and finishing mechanism in mathematics, thereby greatly reducing the false positive rate.
[0016] Embodiment 2: The specific sub-steps for constructing the ideal reference image without noise in step S1 are: S11, analyze the design data of the fabric design file, extract the interlacing coordinates of the warp and weft yarns, and construct a three-dimensional micro-geometric model containing the twist and hairiness characteristics of the yarns; S12, call the bidirectional reflectance distribution function, assign the spectral power distribution data of the preset standard light source and the reflectivity 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 three-dimensional micro-geometric model, and generate an ideal reference image with pixel values representing the luminance of the light radiation.
[0017] This embodiment is a further embodiment of step S1 of constructing a noise-free ideal reference image; Step S11: Micro-geometric modeling The system analyzes the design file of the fabric design data, extracts the interlacing coordinates of the warp and weft yarns, and on this basis, constructs a three-dimensional micro-geometric model containing the twist and hairiness characteristics of the yarns; The design data refers to matrix data describing the fabric structure, where 1 represents a warp float point and 0 represents a weft float point. Implementation details: The system not only generates a macro warp-weft interlacing structure according to the design data, but also introduces micro details; for example, according to the number of yarns, the diameter of the cylinder is set, and according to the twist parameters of the yarns, such as 800 twists per meter, the surface of the cylinder is spirally textured, and at the same time, micron-level fiber protrusions are randomly generated on the model surface to simulate hairiness. The introduction of twist and hairiness characteristics makes the constructed model more similar to the real fabric in terms of light reflection characteristics, avoids the plastic feeling artifacts caused by the excessive smoothness of the model, and improves the physical reality of the reference image; Step S12: Virtual optical property definition The system calls the bidirectional reflectance distribution function BRDF, assigns the spectral power distribution data of the preset standard light source and the reflectivity curve data of the standard dye to the three-dimensional micro-geometric model, and defines the virtual optical properties of the model; the specific process is: using Cook-Torrance as the BRDF model, convoluting and integrating the spectral power of the light source in the wavelength range of with the reflectivity of the dye to calculate the CIE three-stimulus value , and taking it as the diffuse reflection coefficient in the BRDF model; wherein, The calculation formula of is as follows: wherein, is the standard observer color matching function; is the normalization coefficient, and the calculation method is ; is the standard observer color matching function; With the same calculation method as , only replace the in the formula with the corresponding or ; The bidirectional reflectance distribution function BRDF is a mathematical model describing how light is reflected on an opaque surface; Implementation details: the standard light source uses the D65 light source spectral data recommended by CIE; the standard dye reflectivity curve comes from the spectrophotometer data measured in the dye laboratory; Step S13: ray tracing rendering The system applies the Monte Carlo ray tracing algorithm to render the assigned three-dimensional micro-geometric model, generating an ideal reference image with pixel values representing the luminance of the lighting radiation; Through physical-level ray tracing rendering, the generated reference image not only contains accurate color information, but also contains complex micro-optical effects such as yarn gap shadows and fiber surface highlights.
[0018] Embodiment 3: The specific sub-steps for generating a theoretical damaged simulation image in step S2 are: 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, multiply the read function as the pixel gain factor with the pixel value of the corresponding coordinate in the ideal reference image to simulate the dye uptake rate change or the yarn mixing abnormality, and the operation result constitutes the theoretical damaged simulation image.
[0019] This embodiment is a further specification of generating a theoretical damaged simulation image in step S2, focusing on how to convert expert knowledge into mathematical operators; Step S21: read the mathematical definition model Read the preset mathematical definition model from the color difference mechanism database, the model is configured to output a dimensionless gain coefficient, including a time axis linear decay function or a spatial parabolic function; The time axis linear decay function is used to simulate the front and back color difference, and its calculation formula is: Wherein, is the normalized time axis coordinate, the value range is , representing the relative position from the beginning to the end of the fabric roll; is the dimensionless decay slope coefficient, used to control the severity of color difference gradient; its value range is set to , which is determined by the statistical distribution of the natural consumption rate of dye liquor concentration in the printing and dyeing process; is a dimensionless base gain constant, usually close to 1.0; in this embodiment it is set to to simulate initial dyeing state; A spatial parabolic function is used to simulate the edge-to-center color difference, whose formula is: wherein, is the normalized width direction coordinate, whose value range is , the definition of at the center line of the fabric is at the left edge is ; is a dimensionless curvature coefficient, used to define the bending degree of color difference spreading from the center to the edge; is a dimensionless center gain constant; By introducing the normalized coordinate, the above formula ensures the unity of the input variables and the output results in dimension, ensuring that and are always dimensionless vectors, so they can directly participate in subsequent pixel multiplication operations; Step S22: interference injection operation The read function is taken as a pixel gain factor, and multiplied with the pixel value of the corresponding coordinate in the ideal reference image, and the operation result constitutes a theoretical damaged simulation image; Implementation details: assuming that the pixel value of the ideal reference image at coordinate is , the selected interference function is , then the theoretical damaged simulation image is calculated as follows: Simulating the change of dye pick-up rate or the abnormality of yarn mixing is embodied as the numerical fluctuation of ; Through this multiplication injection method, the gradual change of chemical properties caused by the gradual change of physical parameters in the dyeing and finishing process is successfully simulated at the mathematical level, making the simulation image have strong field characteristic.
[0020] Embodiment 4: The specific sub-steps for constructing the real observation residual matrix in step S3 are as follows: S31, receiving the real-time acquisition image transmitted by the industrial camera, and calculating the displacement vector of the real-time acquisition image relative to the ideal reference image by using the feature point matching algorithm; S32, based on the displacement vector, performing geometric transformation on the real-time acquisition image to align the pixel coordinates with the ideal reference image at sub-pixel accuracy; S33, if the alignment fails, a re-acquisition instruction is triggered; if the alignment succeeds, the pixel gray value of the aligned real-time acquisition image is subtracted from the pixel gray value of the corresponding coordinate of the ideal reference image, and the generated difference data set is the real observation residual matrix.
[0021] The embodiment is a further embodiment of constructing the real observation residual matrix in step S3, and aims to solve the spatial alignment problem of the real image and the ideal image. Step S31: displacement vector calculation The real-time acquisition image transmitted by the industrial camera is received, and a feature point matching algorithm such as SIFT or ORB algorithm is used to calculate the displacement vector of the real-time acquisition image relative to the ideal reference image. Step S32: sub-pixel level geometric transformation Based on the displacement vector, the real-time acquisition image is geometrically transformed, such as affine transformation or perspective transformation, so that the pixel coordinates are aligned with the ideal reference image at sub-pixel accuracy. Sub-pixel accuracy means that the alignment error is less than the size of one physical pixel, which is usually achieved by bilinear interpolation or bicubic interpolation. High-precision alignment is a prerequisite for effective residual calculation; sub-pixel alignment ensures that the subsequent subtraction operation is a comparison of the same fabric texture points, avoiding false differences caused by mechanical jitter or changes in fabric tension. Step S33: difference data generation If the alignment is successful, the pixel gray value of the aligned real-time acquisition image is subtracted from the pixel gray value of the corresponding coordinate of the ideal reference image, and the generated difference data set is the real observation residual matrix; if the alignment fails, a re-acquisition instruction is triggered, and the judgment standard for alignment failure is that the number of feature point matching pairs , or the root mean square value of the re-projection error after geometric transformation Pixel; Through the subtraction operation, the normal fabric texture signal as the background is eliminated, and all abnormal components including color difference signals and noise signals are highlighted.
[0022] Embodiment 5: The specific sub-steps for constructing the theoretical deduction residual matrix in step S3 are: S34, the pixel gray value of the theoretical damaged simulation image generated in step S2 is subtracted from the pixel gray value of the corresponding coordinate of the ideal reference image generated in step S1, and the generated difference data set is the theoretical deduction residual matrix. S35, the real observation residual matrix and the theoretical deduction residual matrix are respectively subjected to normalization processing, and all values in the matrix are mapped to the closed interval of zero to one.
[0023] This embodiment is a further embodiment of the theoretical deduction residual matrix constructed in step S3 and data standardization processing; Step S34: theoretical residual calculation Subtract the pixel gray value of the ideal reference image corresponding to the coordinate from the pixel gray value of the theoretical damaged simulation image generated in step S2, and the generated difference data set is the theoretical deduction residual matrix; The matrix obtained in this step represents the distribution pattern of pure color difference in space; Step S35: normalization processing The normalization processing is performed on the real observation residual matrix and the theoretical deduction residual matrix respectively, and all values in the matrix are mapped to the closed interval of zero to one; In order to avoid algorithm collapse caused by zero denominator, a smoothing factor is introduced when calculating the normalization formula The calculation formula is modified as: Among them, is the normalized matrix, is the original matrix, and are the maximum and minimum values in the matrix; Normalization eliminates the influence of absolute light intensity, so that the subsequent similarity calculation only focuses on the relative distribution law of residual data, and enhances the robustness of the system to the change of environment light intensity.
[0024] Embodiment 6: The structure similarity value in step S4 is calculated by using the cosine similarity algorithm, and the specific calculation logic is as follows: The real observation residual matrix after normalization is unfolded as the first feature vector, and the theoretical deduction residual matrix after normalization is unfolded as the second feature vector; The dot product of the first feature vector and the second feature vector is calculated to obtain the vector inner product value; The product of the Euclidean norm of the first feature vector and the Euclidean norm of the second feature vector is calculated to obtain the modulus product value; Divide the vector inner product value by the modulus product value to obtain the quotient, which is the structure similarity value.
[0025] This embodiment is a specific embodiment of the structure similarity value calculation logic in step S4, which clearly quantifies the similarity of the two matrix forms; Step S4 specific calculation logic: The structure similarity value calculated by using the cosine similarity algorithm is used as the vector direction consistency measure; to represent the structural direction consistency of the two residual matrices in the unfolded high-dimensional vector space; Vector unfolding: the real observation residual matrix after normalization has a dimension of unfolding the normalized theoretical deduction residual matrix into a second eigenvector , dimension unfolding the normalized theoretical deduction residual matrix into a second eigenvector ; Dot product calculation: calculate the dot product of the first eigenvector and the second eigenvector to obtain the vector inner product value; 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; Similarity derivation: divide the vector inner product value by the modulus product value to obtain the quotient, which is the structural similarity value ; In the program logic execution, set the protection branch: if the modulus product value is zero, it means that the real observed image and the ideal reference image are completely consistent, and there is no color difference signal, so the structural similarity value is directly determined, which means that the real residual and the theoretical color difference feature are completely orthogonal in the vector space, that is, no color difference is determined; The cosine similarity essentially calculates the cosine value of the angle between two vectors in a multi-dimensional space; If the feature form contained in the real residual is highly consistent with the theoretical color difference, the vector directions of the two tend to be consistent, and the angle approaches 0 degrees, tending to 1; If the real residual is mainly composed of random environmental noise, according to the principle of approximate orthogonality of random vectors in high-dimensional space, the vector directions of the two are close to perpendicular, tending to 0; Therefore, the method successfully converts the color difference detection into signal direction verification, thereby shielding the interference signals inconsistent with the color difference direction in mathematical principles.
[0026] Example 7: In step S5, when it is determined that the textile has a real color difference, generating corresponding production control instruction data includes: S51, identifying the selected color difference type; S52, if the color difference type is identified as front-back color difference, querying the preset process compensation table, calculating the dyeing tank temperature gradient adjustment amount according to the size of the structural similarity value, and generating temperature control instruction data containing the adjustment amount; S53, if the color difference type is identified as edge-center color difference, querying the preset pressure balance model, calculating the adjustment amount of the left and right pressure difference of the milling machine according to the size of the structural similarity value, and generating pressure control instruction data containing the adjustment amount.
[0027] This embodiment is a concretization of the production control instruction data generated in step S5, and demonstrates the closed-loop control logic. Step S51: Identify color difference type Identify the currently selected color difference type, that is, the specific type used to generate the simulation in step S2; Step S52: Temperature control adjustment of color difference between front and back 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. 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; 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: 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. Step S53: Pressure adjustment of edge-to-center color difference 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. 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: in, To maximize the compensation 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. 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.
[0028] Example 8: Step S6: In response to the production control instruction data, the data is sent to the programmable logic controller of the dyeing machine through the industrial field bus, and the corresponding physical parameter adjustment is executed by the programmable logic controller; In response to the no-defect confirmation signal, the current production process parameters are kept unchanged, and the detection pass count in the quality management database is updated.
[0029] This embodiment is a supplement to the detection result execution level; Specific execution of step S6: Closed-loop control: in response to the production control instruction data, the data is sent to the programmable logic controller (PLC) of the dyeing machine through the industrial field bus, such as Profibus or Modbus; the corresponding physical parameter adjustment, such as adjusting the valve opening degree and adjusting the hydraulic pump power, is executed by the PLC, so as to correct the production deviation online and reduce the scrap rate; Release record: in response to the no-defect confirmation signal, the current production process parameters are kept unchanged, and the detection pass count in the quality management database is updated, providing data support for subsequent quality traceability; Full-automatic unattended detection and control are realized, and the production efficiency and good product rate of the textile printing and dyeing link are greatly improved.
[0030] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not limited. Although the present application has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solutions of the present application can be modified or replaced equivalently without departing from the spirit and scope of the technical solutions of the present application.
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.
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 will be 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 5, characterized in that, 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.
7. 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.
8. 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
Textile fabric defect detection method
CN120876494A
Textile color fastness prediction method based on computer assistance
CN120974350A
Cloth dyeing uniformity detection method and system based on image analysis
CN121236022A
Cited By
Intelligent electromagnetic situation awareness system based on multi-sensor data fusion
CN121899503A