Textile material surface defect detection system based on machine vision

By using Fourier transform and adaptive adjustment of sub-regions of the spectrogram, the dominant frequencies of textile materials are identified, and a normal texture model is constructed. This solves the problem of accuracy in detecting surface defects in textile materials and achieves more efficient defect identification.

CN122066670AInactive Publication Date: 2026-05-19BEIJING INST OF CLOTHING TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610158857.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-04
Publication Date
2026-05-19
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately identify surface defects based on the texture characteristics of textile materials, leading to a decrease in the reliability of test results. This is especially true in cases of complex texture structures and diverse defect types, where traditional methods struggle to distinguish between defects and normal textures.

Method used

The spectrum is obtained by Fourier transform, and the initial sub-regions are divided using a sliding window. Based on the amplitude difference, distribution characteristics and dominant frequency presence index of the frequency components, the sub-regions are adaptively adjusted to identify the dominant frequency, construct a normal texture model, and then identify defective areas.

Benefits of technology

It improves the accuracy and adaptability of surface defect detection in textile materials, enabling better identification of different types of defects and increasing detection efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122066670A_ABST
    Figure CN122066670A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, in particular to a textile material surface defect detection system based on machine vision, the system comprises a processor and a memory, the processor executes a computer program of the memory to realize the following steps: obtaining a spectrogram of a textile material to be detected and the amplitude of each frequency component in the spectrogram, dividing the spectrogram into at least two initial sub-regions, acquiring a peak value prominence degree, an amplitude distribution obvious degree and a dominant frequency existence index of any initial sub-region, and according to the peak value prominence degree, the amplitude distribution obvious degree and the dominant frequency existence index of any initial sub-region, determining the dominant frequency existence index of any initial sub-region; adjusting any initial sub-region to obtain a target sub-region; and obtaining the target sub-region corresponding to each initial sub-region, obtaining the dominant frequency in each target sub-region, constructing the normal texture model, and carrying out surface defect detection on the to-be-woven material, so that the detection result of the surface defect of the textile material is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a machine vision-based system for detecting surface defects in textile materials. Background Technology

[0002] Textile materials are essential raw materials for clothing and other textile products, and their quality directly affects the appearance, quality, and value of the finished product. During the textile weaving process, factors such as the quality of raw materials (yarn), weaving techniques, and equipment condition can lead to defects such as broken yarns, stains, and holes. Therefore, surface defect detection of textile materials is a crucial step in the textile industry. Traditional defect detection methods rely mainly on manual inspection, which is not only inefficient but also prone to accuracy decline due to fatigue, making it difficult to meet the demands of modern high-speed production. Therefore, there is an increasing need to utilize automated defect detection systems to detect surface defects in textile materials.

[0003] Existing technologies typically utilize traditional image processing techniques such as edge detection and threshold segmentation to identify surface defects in textile materials. For example, after obtaining the edges, defects such as holes and oil stains are identified based on the overall gradient magnitude of each edge. However, textile materials often have complex texture structures, and some textile materials with woven patterns inherently exhibit color variations in images. This makes it difficult for traditional defect detection methods to accurately distinguish between defects and normal textures, thus affecting the reliability of the defect detection results.

[0004] Therefore, how to accurately identify surface defects of textile materials based on their texture characteristics and improve the detection results of surface defects of textile materials has become an urgent problem to be solved. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a machine vision-based textile material surface defect detection system to solve the problem of how to accurately identify surface defects of textile materials based on the texture characteristics of textile materials and improve the detection results of surface defects of textile materials.

[0006] This invention provides a machine vision-based surface defect detection system for textile materials, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it performs the following steps: A grayscale image of the textile material to be detected is acquired, and a Fourier transform is performed on the grayscale image to obtain a spectrum. The amplitude of each frequency component in the spectrum is obtained, and the spectrum is divided into at least two initial sub-regions using a sliding window of a preset size. For any initial sub-region, the peak prominence of the initial sub-region is obtained based on the amplitude difference of the frequency components in the initial sub-region, and the amplitude distribution of the initial sub-region is obtained based on the amplitude distribution characteristics of the frequency components in the initial sub-region. The peak amplitude of the frequency component in each initial sub-region is obtained. Based on the distribution characteristics of the peak amplitude of the frequency component in each initial sub-region, the dominant frequency presence index of any initial sub-region is obtained. Based on the peak prominence, amplitude distribution obviousness and dominant frequency presence index of any initial sub-region, the initial sub-region is adjusted to obtain the target sub-region. Obtain the target sub-region corresponding to each initial sub-region, obtain the dominant frequency in each target sub-region, construct a normal texture model using the dominant frequency in each target sub-region, and perform surface defect detection on the textile material to be printed.

[0007] Preferably, obtaining the peak prominence degree of any initial sub-region based on the amplitude difference of the frequency components in any initial sub-region includes: Obtain the peak amplitude of the frequency component in any initial sub-region, and denote the frequency components in any initial sub-region other than the frequency component corresponding to the peak amplitude as other frequency components. Obtain the difference between the peak amplitude and the amplitude of each other frequency component, and obtain the corresponding cumulative amplitude difference value. Normalize the cumulative amplitude difference value to obtain the peak prominence degree of any initial sub-region.

[0008] Preferably, the step of obtaining the degree of significance of the amplitude distribution of any initial sub-region based on the amplitude distribution characteristics of the frequency components in any initial sub-region includes: Cluster the amplitudes of the frequency components in any initial sub-region to obtain at least two clusters, and obtain the average amplitude of each cluster. Calculate the absolute value of the difference between the average amplitudes of every two clusters to obtain the mean average amplitude difference. Normalize the mean average amplitude difference to obtain the significance of the amplitude distribution of any initial sub-region.

[0009] Preferably, obtaining the dominant frequency presence index of any initial sub-region based on the distribution characteristics of the amplitude peak values ​​of the frequency components in each initial sub-region includes: The maximum amplitude of the frequency component in the spectrum is obtained and recorded as the maximum amplitude. The ratio of the peak amplitude of the frequency component in any initial sub-region to the maximum amplitude is obtained to obtain the peak influence degree of any initial sub-region. Obtain the peak influence level of each initial sub-region, and based on the peak influence level of each initial sub-region, obtain the dominant frequency existence index of any initial sub-region.

[0010] Preferably, obtaining the dominant frequency presence index of any initial sub-region based on the peak influence degree of each initial sub-region includes: The frequency component containing the peak amplitude of the frequency component in each initial sub-region is recorded as the target point. The influence degree of the peak in each initial sub-region is used as the weight of the target point in each initial sub-region. The target points in each initial sub-region are weighted and fitted to obtain the fitted curve. Using the fitted curve, the fitted position of the target point in any initial sub-region is obtained. The distance between the target point in any initial sub-region and its fitted position is obtained in the spectrum. The reciprocal of the sum of the distance and a preset constant is normalized to obtain the dominant frequency presence index of any initial sub-region.

[0011] Preferably, adjusting any initial sub-region based on the peak prominence, amplitude distribution obviousness, and dominant frequency presence indices of any initial sub-region to obtain the target sub-region includes: The degree of adjustment of any initial sub-region is obtained based on the peak prominence and dominant frequency presence index of any initial sub-region; Based on the significance and adjustment degree of the amplitude distribution of any initial sub-region, the side length of any initial sub-region is adjusted to obtain an adaptive side length; In the spectrum diagram, taking the upper left corner of any initial sub-region as a fixed point, the side length of any initial sub-region is adjusted to an adaptive side length to obtain the target sub-region.

[0012] Preferably, obtaining the degree of adjustment of any initial sub-region based on the peak prominence and dominant frequency presence index of any initial sub-region includes: The difference between constant 1 and the peak prominence of any initial sub-region is used to obtain the first adjustment degree. The difference between constant 1 and the dominant frequency existence index of any initial sub-region is used to obtain the second adjustment degree. The product of the first adjustment degree and the second adjustment degree is used to obtain the adjustment degree of any initial sub-region.

[0013] Preferably, adjusting the side length of any initial sub-region based on the significance and adjustment degree of the amplitude distribution of any initial sub-region to obtain an adaptive side length includes: The average value of the amplitude distribution significance of each initial sub-region is obtained and denoted as the average amplitude distribution significance. The difference between the amplitude distribution significance of any initial sub-region and the average amplitude distribution significance is obtained and denoted as the first difference. The absolute value of the difference between the amplitude distribution significance of any initial sub-region and the average amplitude distribution significance is obtained and denoted as the second difference. The ratio of the first difference to the second difference is obtained to obtain the adjustment direction index of any initial sub-region. The product of the adjustment direction index and the adjustment degree of any initial sub-region is obtained to obtain the side length adjustment value of any initial sub-region. The constant 1 is added to the side length adjustment value to obtain the side length adjustment coefficient. The product of the side length of any initial sub-region and the side length adjustment coefficient is rounded up to obtain the adaptive side length of any initial sub-region.

[0014] Preferably, obtaining the dominant frequency in each target sub-region includes: For any target sub-region, the peak amplitude of the frequency component in the target sub-region is obtained, and the frequency component corresponding to the peak amplitude of the frequency component in the target sub-region is recorded as the dominant frequency of the target sub-region.

[0015] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows: In this invention, the peak prominence of the initial sub-region is obtained, representing the degree to which the initial sub-region reflects the dominant frequency. The greater the peak prominence, the more likely the frequency component corresponding to the amplitude peak in the initial sub-region is to be the dominant frequency, and the less adjustment is needed for the initial sub-region. The amplitude distribution of the initial sub-region is obtained, reflecting the adjustment direction of the initial sub-region. The dominant frequency presence index of the initial sub-region is obtained, representing the probability that a dominant frequency exists in the initial sub-region. The greater the dominant frequency presence index, the more likely a dominant frequency exists in the initial sub-region, and the less adjustment is needed for the initial sub-region. The initial sub-region is adjusted to obtain the target sub-region, which is used to obtain the dominant frequency of the target sub-region. By identifying the dominant frequency in the target sub-region, a normal texture model of the textile material is constructed, and this model is used to identify defect areas, thereby improving the adaptability of the defect detection system to different defects and improving the accuracy of defect detection. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a flowchart of a method for detecting surface defects in textile materials based on machine vision, provided in Embodiment 1 of the present invention. Detailed Implementation

[0018] Embodiments of this disclosure are described in detail below, with examples of these embodiments illustrated in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this disclosure, and should not be construed as limiting it.

[0019] It should be noted that the terms "first," "second," etc., used in this disclosure and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure.

[0020] To illustrate the technical solution of the present invention, specific embodiments are described below.

[0021] This invention provides a machine vision-based surface defect detection system for textile materials, including a processor and a memory. The processor executes a computer program in the memory to implement a machine vision-based method for detecting surface defects in textile materials. Figure 1 As shown, the method may include: Step S101: Obtain a grayscale image of the textile material to be detected, and perform a Fourier transform on the grayscale image to obtain a spectrum.

[0022] During the textile weaving process, abnormal defects such as yarn breakage, stains, and holes may occur due to factors such as the quality of raw materials (spun yarn), weaving technology, and equipment condition. Therefore, surface defect detection of textile materials is a key link in the textile industry production process.

[0023] In this embodiment, a camera is installed on the conveyor belt of a textile production line to capture images of the textile material for defect detection. The camera must be vertically aligned with the surface of the textile material, and the length and width of the textile material must be consistent with the horizontal and vertical directions of the captured image. The image acquisition frequency is adjusted according to the production rate and the conveyor belt speed to ensure that every position of the textile material is captured. In this embodiment, the image acquisition frequency is set to 100 frames per second, but this is not limited and can be set according to the specific implementation scenario. The defect detection method is the same for each image. In this embodiment, a single image of the textile material is used as an example for subsequent analysis.

[0024] Existing technologies typically utilize traditional image processing techniques such as edge detection and threshold segmentation to identify surface defects in textile materials. For example, after obtaining the edges, defects such as holes and oil stains are identified based on the overall gradient magnitude of each edge. However, textile materials often have complex textures, and some textile materials with woven patterns exhibit color variations in the image itself. This makes it difficult for traditional defect detection methods to accurately distinguish between defects and normal textures, thus affecting the reliability of the defect detection results. Furthermore, textile material surface defects are diverse, and traditional detection methods often focus on detecting single defects. In the production process, it is difficult to achieve good detection results for all defects, leading to missed detections and affecting the quality of textile material production.

[0025] Because the normal texture of textile materials appears periodically in images (i.e., the surface of textile materials usually features solid colors or repeating patterns, such as polka dots, which are periodic), while defects typically appear randomly and with a low frequency, the normal texture image of the textile material can be obtained by extracting the dominant frequencies from the spectrogram and reconstructing the image using these dominant frequencies. This image can then be used for defect detection. During the extraction of dominant frequencies from the spectrogram, since peak values ​​are more likely to be the dominant frequencies of the image, a sliding window is typically used to divide local regions and obtain the peak values ​​of each local region in the spectrogram, thus determining the dominant frequencies of the image. However, the size of the sliding window often has a significant impact on the determination of peak values. A window that is too small may identify too many non-dominant frequencies as peak values ​​(such as noise), while a window that is too large may merge multiple peak values ​​that are close in location, leading to a decrease in texture recognition accuracy.

[0026] Therefore, in this embodiment, based on the texture characteristics of the textile material, a spectrum is obtained by performing a Fourier transform on the image, and the spectrum is divided into initial sub-regions. Based on the amplitude differences and amplitude distribution characteristics of the frequency components in the initial sub-regions, each initial sub-region is adaptively adjusted to identify the dominant frequency. Then, based on the dominant frequency, a normal texture model of the textile material to be detected is obtained, which effectively identifies the surface defects of the textile material and improves the detection results of surface defects of the textile material.

[0027] To facilitate the analysis of the surface texture features of textile materials, the acquired images are converted to grayscale to obtain grayscale images. To identify the periodic features of the textile material surface texture, this embodiment performs a Fourier transform on the grayscale image to obtain a spectrum F(u, v) (where u and v are the frequency domain coordinates of each frequency component in the spectrum, representing the frequency in the x-direction (horizontal direction) and y-direction (vertical direction), respectively). Grayscale conversion and Fourier transform for obtaining the spectrum are existing technologies and will not be elaborated upon here.

[0028] Step S102: Obtain the amplitude of each frequency component in the spectrum, divide the spectrum into at least two initial sub-regions using a sliding window of a preset size, obtain the peak prominence of any initial sub-region based on the amplitude difference of the frequency components in any initial sub-region, and obtain the amplitude distribution obviousness of any initial sub-region based on the amplitude distribution characteristics of the frequency components in any initial sub-region.

[0029] Since the identification of the dominant frequency is mainly based on the amplitude of each frequency component, this embodiment obtains the amplitude of each frequency component in the spectrum after obtaining the spectrum. The acquisition of the amplitude of the spectrum components in the spectrum is a prior art and will not be described in detail here.

[0030] First, a sliding window of a preset size is set. Starting from the top left corner of the spectrogram, the sliding window slides one unit step at a time, from top to bottom and from left to right, until the entire spectrogram is traversed, resulting in at least two initial sub-regions. These initial sub-regions should contain sufficient difference information between different frequency components, but should not be too large, which would lead to insufficient amplitude peak values ​​later. Therefore, in this embodiment, the preset size of the sliding window is set to 7×7. This is not a limitation and can be set according to the specific implementation scenario.

[0031] Since the dominant frequency should have a significantly larger amplitude compared to other frequencies, the absence of a significant amplitude difference in the initial sub-region indicates that the frequency intensities within the initial sub-region are similar. This means the peak amplitudes of the frequency components in the initial sub-region reflect the dominant frequency less accurately. Therefore, it is necessary to adjust the size of the initial sub-region to obtain a peak value that better reflects the dominant frequency. This can be achieved by expanding the initial sub-region to include a significant peak value, or by shrinking the initial sub-region to make local peak values ​​more prominent. Thus, for any given initial sub-region, the peak prominence of that initial sub-region can be determined based on the amplitude differences of the frequency components within it, reflecting the degree to which the initial sub-region reflects the dominant frequency.

[0032] The method for obtaining the peak prominence of any initial sub-region based on the amplitude difference of the frequency components in any initial sub-region is as follows: Obtain the peak amplitude (maximum amplitude) of the frequency component in any initial sub-region. Record the frequency components in any initial sub-region other than the frequency component corresponding to the peak amplitude as other frequency components. Obtain the difference between the peak amplitude and the amplitude of each other frequency component. Obtain the corresponding cumulative amplitude difference value. Normalize the cumulative amplitude difference value to obtain the peak prominence degree of any initial sub-region.

[0033] In one embodiment, taking the w-th initial sub-region in the spectrum as an example, the formula for calculating the peak prominence of the w-th initial sub-region is as follows:

[0034] in, The peak prominence of the w-th initial sub-region; The peak value of the frequency component in the w-th initial sub-region; Let be the amplitude of the i-th other frequency component in the w-th initial sub-region; The number of frequency components in the w-th initial sub-region; This is the normalization function.

[0035] It should be noted that the larger the value, the more significantly the peak amplitude of the frequency component in the w-th initial sub-region is higher than that of other frequency components. The peak amplitude in the w-th initial sub-region is more prominent, and the larger the value, the more likely the peak amplitude of the frequency component in the w-th initial sub-region is to be the dominant frequency in the w-th initial sub-region.

[0036] Because some textile materials have relatively complex weaving patterns, there may be multiple textures with similar frequencies in the image. That is, the same initial sub-region in the spectrum may contain multiple dominant frequencies, which will also lead to a decrease in the prominence of the peak in the initial sub-region.

[0037] Normal textures account for a higher proportion of an image than noise, defects, etc., meaning that the amplitude of the frequency components of normal textures is usually significantly higher than that of the frequency components of abnormal textures. If there are multiple dominant frequencies in the initial sub-region, the difference in average amplitude between the clusters formed by the amplitude of the frequency components of normal textures and the clusters formed by the amplitude of the frequency components of abnormal textures should be large. If the initial sub-region consists entirely of frequency components of noise, defects, or other abnormal textures, the proportion of these abnormal texture frequency components in the spectrum is usually small, and the amplitude difference between the generated clusters is relatively insignificant.

[0038] Therefore, the k-means clustering method is used to cluster the amplitude of the frequency components in any initial sub-region to obtain at least two clusters. The value of k is determined using the elbow method. The k-means clustering method and the elbow method are existing technologies and will not be elaborated here. The average amplitude of each cluster is obtained. Based on the difference between the average amplitudes of each cluster, the degree of significance of the amplitude distribution in any initial sub-region is obtained to distinguish the reasons for the low peak prominence of the initial sub-region.

[0039] The method for obtaining the significance of the amplitude distribution in any initial sub-region is as follows: Calculate the absolute value of the difference between the average amplitudes of every two clusters to obtain the mean average amplitude difference. Normalize the mean average amplitude difference to obtain the significance of the amplitude distribution of any initial sub-region.

[0040] In one embodiment, taking the w-th initial sub-region in the spectrum as an example, the formula for calculating the significance of the amplitude distribution in the w-th initial sub-region is as follows:

[0041] in, The significance of the magnitude distribution in the w-th initial sub-region; Let $\frac{ ... Let be the average magnitude of the q-th cluster corresponding to the w-th initial sub-region; The number of clusters corresponding to the w-th initial sub-region; It is the absolute value symbol; This is the normalization function.

[0042] It should be noted that, The larger the value, the more significant the difference in amplitude of the frequency components within the w-th initial sub-region, meaning that multiple dominant frequencies are more likely to exist within the w-th initial sub-region. The smaller the value, the less significant the difference in amplitude of the frequency components in the w-th initial sub-region, meaning that the w-th initial sub-region is more likely to lack a dominant frequency (the w-th initial sub-region is more likely to contain frequency components that are noise, defects, or other abnormal textures).

[0043] Thus, the peak prominence and amplitude distribution of any initial sub-region are obtained.

[0044] Step S103: Obtain the peak amplitude of the frequency component in each initial sub-region. Based on the distribution characteristics of the peak amplitude of the frequency component in each initial sub-region, obtain the dominant frequency presence index of any initial sub-region. Based on the peak prominence, amplitude distribution obviousness and dominant frequency presence index of any initial sub-region, adjust any initial sub-region to obtain the target sub-region.

[0045] The higher the peak prominence, the less interference the peak detection results in any initial sub-region are, meaning that adjustment is less necessary. Conversely, when the peak prominence is low, if the amplitude distribution is highly distinct, it indicates that multiple dominant frequencies may exist in any initial sub-region. To identify all the different dominant frequencies, the initial sub-region needs to be narrowed. If the amplitude distribution is not highly distinct, it indicates that there may be no dominant frequency in any initial sub-region. To avoid identifying noise and other interference as dominant frequencies, the initial sub-region needs to be expanded.

[0046] When noise has a periodic pattern (such as periodic noise generated by equipment vibration in an image), it may also exhibit local peak characteristics in the initial sub-region. This makes it difficult to distinguish whether the peak is caused by noise or normal texture in a single initial sub-region. The surface texture of textile materials is often arranged along a certain direction, that is, the frequency components of different textures have a high degree of consistency in direction. Therefore, the positional relationship between the frequency components of normal texture should have a strong regularity.

[0047] Therefore, the peak amplitude of the frequency component in each initial sub-region is obtained, and the dominant frequency presence index of any initial sub-region is obtained based on the distribution characteristics of the peak amplitude of the frequency component in each initial sub-region. This index is then used to adjust any initial sub-region in conjunction with the peak prominence and amplitude distribution of any initial sub-region obtained in step S102.

[0048] The method for obtaining the dominant frequency presence index of any initial sub-region based on the distribution characteristics of the amplitude peaks of the frequency components in each initial sub-region is as follows: (1) Obtain the peak influence level of any initial sub-region.

[0049] Specifically, the maximum amplitude of the frequency component in the spectrum is obtained and recorded as the maximum amplitude value. The ratio of the peak amplitude of the frequency component in any initial sub-region to the maximum amplitude value is obtained to obtain the peak influence degree of any initial sub-region.

[0050] In one embodiment, taking the w-th initial sub-region in the spectrum as an example, the formula for calculating the peak influence of the w-th initial sub-region is as follows:

[0051] in, The peak influence level of the w-th initial sub-region; The peak value of the frequency component in the w-th initial sub-region; This is the maximum amplitude value, which is the maximum value of the frequency component amplitude in the spectrum.

[0052] It should be noted that, The larger the value, the more frequently the frequency component appears in the w-th initial sub-region, the more likely it is to be a frequency component corresponding to a normal texture, and the greater its influence on the texture direction in the w-th initial sub-region. The larger it is.

[0053] (2) Obtain the peak influence degree of each initial sub-region, and obtain the dominant frequency existence index of any initial sub-region based on the peak influence degree of each initial sub-region.

[0054] Specifically, the frequency component where the amplitude peak of the frequency component in each initial sub-region is located is recorded as the target point, and the influence degree of the peak in each initial sub-region is used as the weight of the target point in each initial sub-region. The weighted least squares method is used to perform weighted fitting on the target point in each initial sub-region to obtain the fitting curve. The weighted least squares method is an existing technology and will not be elaborated here. Using the fitted curve, the fitted position of the target point in any initial sub-region is obtained. The distance between the target point in any initial sub-region and its fitted position is obtained in the spectrum. The reciprocal of the sum of the distance and a preset constant is normalized to obtain the dominant frequency presence index of any initial sub-region.

[0055] In one embodiment, taking the w-th initial sub-region in the spectrum as an example, the formula for calculating the dominant frequency presence index of the w-th initial sub-region is:

[0056] in, The dominant frequency exists as an index for the w-th initial sub-region; Let be the distance between the target point in the w-th initial sub-region and its fitted position; As a preset constant, this embodiment sets This is used to ensure that the fraction is meaningful. There are no restrictions here, and it can be set according to the specific implementation scenario. This is the normalization function.

[0057] It should be noted that, The smaller the value, the closer the target point in the w-th initial sub-region is to its fitted position. This means the target point in the w-th initial sub-region better matches the distribution pattern of the fitted curve, and the more likely the frequency component corresponding to the target point in the w-th initial sub-region is the same as the frequency component corresponding to the normal texture. The larger it is.

[0058] Furthermore, based on the peak prominence, amplitude distribution obviousness, and dominant frequency presence indicators of any initial sub-region, the initial sub-region is adjusted to obtain the target sub-region. The specific method is as follows: (1) Based on the peak prominence and dominant frequency presence index of any initial sub-region, obtain the adjustment degree of any initial sub-region.

[0059] Specifically, the difference between constant 1 and the peak prominence of any initial sub-region is obtained to obtain the first adjustment degree; the difference between constant 1 and the dominant frequency existence index of any initial sub-region is obtained to obtain the second adjustment degree; and the product between the first adjustment degree and the second adjustment degree is obtained to obtain the adjustment degree of any initial sub-region.

[0060] In one embodiment, taking the w-th initial sub-region in the spectrum as an example, the formula for calculating the adjustment degree of the w-th initial sub-region is as follows:

[0061] in, The degree of adjustment for the w-th initial sub-region; The peak prominence of the w-th initial sub-region; The dominant frequency exists as an indicator for the w-th initial sub-region.

[0062] It should be noted that, The larger the value, the greater the likelihood that a dominant frequency exists within the w-th initial sub-region. Therefore, to preserve this dominant frequency, it is less necessary to adjust the size of the initial sub-region. The smaller it is; The smaller the initial sub-region size, the more necessary it is to adjust the size of the initial sub-region in order to increase the prominence of the dominant frequency in the initial sub-region. The larger it is.

[0063] (2) Adjust the side length of any initial sub-region according to the degree of significance and adjustment of the amplitude distribution of any initial sub-region to obtain an adaptive side length.

[0064] Specifically, the average value of the amplitude distribution significance of each initial sub-region is obtained and denoted as the average amplitude distribution significance. The difference between the amplitude distribution significance of any initial sub-region and the average amplitude distribution significance is obtained and denoted as the first difference. The absolute value of the difference between the amplitude distribution significance of any initial sub-region and the average amplitude distribution significance is obtained and denoted as the second difference. The ratio of the first difference to the second difference is obtained to obtain the adjustment direction index of any initial sub-region. The product of the adjustment direction index and the adjustment degree of any initial sub-region is obtained to obtain the side length adjustment value of any initial sub-region. The constant 1 is added to the side length adjustment value to obtain the side length adjustment coefficient. The product of the side length of any initial sub-region and the side length adjustment coefficient is rounded up to obtain the adaptive side length of any initial sub-region.

[0065] In one embodiment, taking the w-th initial sub-region in the spectrum as an example, the formula for calculating the adaptive side length of the w-th initial sub-region is:

[0066] in, Let w be the adaptive side length of the w-th initial sub-region; Let be the side length of the w-th initial sub-region; M is the mean significance of the amplitude distribution. The significance of the magnitude distribution in the w-th initial sub-region; The degree of adjustment for the w-th initial sub-region; It is the absolute value symbol; This is the floor symbol.

[0067] It should be noted that, Let w be the adjustment direction index for the w-th initial sub-region. When the magnitude distribution of the w-th initial sub-region is significantly higher than the average magnitude distribution, it indicates that the w-th initial sub-region is more likely to have a dominant frequency. If the size of the w-th initial sub-region needs to be adjusted at this time, it means that the w-th initial sub-region may have multiple texture frequencies, so the side length of the w-th initial sub-region needs to be reduced. The smaller the magnitude of the amplitude distribution in the w-th initial sub-region, the less significant the amplitude distribution. When the magnitude of the amplitude distribution in the w-th initial sub-region is lower than the mean magnitude of the amplitude distribution, it indicates that there is more likely no dominant frequency within that w-th initial sub-region. If the size of the w-th initial sub-region needs to be adjusted in this case, its side length should be increased. The larger it is.

[0068] (3) The target sub-region is obtained based on the adaptive side length.

[0069] Specifically, in the spectrum diagram, taking the upper left corner of any initial sub-region as a fixed point, the side length of any initial sub-region is adjusted to an adaptive side length to obtain the target sub-region.

[0070] Thus, the target sub-region of any initial sub-region is obtained.

[0071] Step S104: Obtain the target sub-region corresponding to each initial sub-region, obtain the dominant frequency in each target sub-region, construct a normal texture model using the dominant frequency in each target sub-region, and perform surface defect detection on the textile material to be printed.

[0072] According to the above-described method for obtaining the target sub-region of any initial sub-region, the target sub-region corresponding to each initial sub-region is obtained, and the peak amplitude of the frequency component in each target sub-region is obtained. At this time, the frequency component corresponding to the peak amplitude is the dominant frequency in the target sub-region. That is, for any target sub-region, the frequency component corresponding to the peak amplitude of the frequency component in the target sub-region is recorded as the dominant frequency of the target sub-region.

[0073] Based on the dominant frequency of each target sub-region, the frequency period of the dominant frequency of each target sub-region is obtained. Taking the k-th target sub-region as an example, the formula for calculating the frequency period of the dominant frequency of the k-th target sub-region is as follows: ,in, Let be the period of the dominant frequency of the k-th target sub-region. Let be the coordinates of the dominant frequency of the k-th target sub-region in the spectrum. The calculation of the frequency period is existing technology and will not be elaborated here.

[0074] Furthermore, based on the dominant frequency and frequency period of each target sub-region, the image is reconstructed using inverse Fourier transform to obtain a normal texture model. The residual image is obtained by subtracting the grayscale image from the normal texture model (the absolute value of the difference in grayscale values ​​of corresponding pixels). In the residual image, the grayscale of the normal texture region is smaller, while the grayscale of the defect region is larger. Since yarn is usually not perfectly smooth, the edges of defects in textile materials are relatively blurred, that is, the segmentation between normal regions and boundaries is unclear. Therefore, the Otsu thresholding method is used to perform thresholding segmentation on the residual image, and the segmented region is the defect region on the surface of the textile material.

[0075] It is worth noting that the focus of this invention is to adaptively adjust the initial sub-regions to more accurately obtain the dominant frequency of each target sub-region. The reconstruction of the image using inverse Fourier transform to obtain a normal texture model, the subtraction of the grayscale image and the normal texture model to obtain a residual image, and the thresholding segmentation of the residual image using the Otsu thresholding method are all existing technologies and will not be elaborated here.

[0076] In summary, in this embodiment of the invention, the peak prominence of the initial sub-region is obtained, representing the degree to which the initial sub-region reflects the dominant frequency. The greater the peak prominence, the more likely the frequency component corresponding to the amplitude peak in the initial sub-region is to be the dominant frequency, and the less adjustment is needed for the initial sub-region. The amplitude distribution of the initial sub-region is obtained, reflecting the adjustment direction of the initial sub-region. The dominant frequency presence index of the initial sub-region is obtained, representing the probability that a dominant frequency exists in the initial sub-region. The greater the dominant frequency presence index, the more likely a dominant frequency exists in the initial sub-region, and the less adjustment is needed for the initial sub-region. The initial sub-region is adjusted to obtain the target sub-region, which is used to obtain the dominant frequency of the target sub-region. By identifying the dominant frequency in the target sub-region, a normal texture model of the textile material is constructed, and this model is used to identify defect areas, thereby improving the adaptability of the defect detection system to different defects and improving the accuracy of defect detection.

[0077] 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 the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A machine vision-based surface defect detection system for textile materials, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it performs the following steps: A grayscale image of the textile material to be detected is acquired, and a Fourier transform is performed on the grayscale image to obtain a spectrum. The amplitude of each frequency component in the spectrum is obtained, and the spectrum is divided into at least two initial sub-regions using a sliding window of a preset size. For any initial sub-region, the peak prominence of the initial sub-region is obtained based on the amplitude difference of the frequency components in the initial sub-region, and the amplitude distribution of the initial sub-region is obtained based on the amplitude distribution characteristics of the frequency components in the initial sub-region. The peak amplitude of the frequency component in each initial sub-region is obtained. Based on the distribution characteristics of the peak amplitude of the frequency component in each initial sub-region, the dominant frequency presence index of any initial sub-region is obtained. Based on the peak prominence, amplitude distribution obviousness and dominant frequency presence index of any initial sub-region, the initial sub-region is adjusted to obtain the target sub-region. Obtain the target sub-region corresponding to each initial sub-region, obtain the dominant frequency in each target sub-region, construct a normal texture model using the dominant frequency in each target sub-region, and perform surface defect detection on the textile material to be printed.

2. The machine vision-based surface defect detection system for textile materials according to claim 1, characterized in that, The step of obtaining the peak prominence degree of any initial sub-region based on the amplitude difference of the frequency components in any initial sub-region includes: Obtain the peak amplitude of the frequency component in any initial sub-region, and denote the frequency components in any initial sub-region other than the frequency component corresponding to the peak amplitude as other frequency components. Obtain the difference between the peak amplitude and the amplitude of each other frequency component, and obtain the corresponding cumulative amplitude difference value. Normalize the cumulative amplitude difference value to obtain the peak prominence degree of any initial sub-region.

3. The machine vision-based surface defect detection system for textile materials according to claim 1, characterized in that, The step of obtaining the degree of significance of the amplitude distribution of any initial sub-region based on the amplitude distribution characteristics of the frequency components in any initial sub-region includes: Cluster the amplitudes of the frequency components in any initial sub-region to obtain at least two clusters, and obtain the average amplitude of each cluster. Calculate the absolute value of the difference between the average amplitudes of every two clusters to obtain the mean average amplitude difference. Normalize the mean average amplitude difference to obtain the significance of the amplitude distribution of any initial sub-region.

4. The machine vision-based surface defect detection system for textile materials according to claim 1, characterized in that, The step of obtaining the dominant frequency presence index for any initial sub-region based on the distribution characteristics of the amplitude peak values ​​of the frequency components in each initial sub-region includes: The maximum amplitude of the frequency component in the spectrum is obtained and recorded as the maximum amplitude. The ratio of the peak amplitude of the frequency component in any initial sub-region to the maximum amplitude is obtained to obtain the peak influence degree of any initial sub-region. Obtain the peak influence level of each initial sub-region, and based on the peak influence level of each initial sub-region, obtain the dominant frequency existence index of any initial sub-region.

5. The machine vision-based surface defect detection system for textile materials according to claim 4, characterized in that, The step of obtaining the dominant frequency presence index of any initial sub-region based on the peak influence degree of each initial sub-region includes: The frequency component containing the peak amplitude of the frequency component in each initial sub-region is recorded as the target point. The influence degree of the peak in each initial sub-region is used as the weight of the target point in each initial sub-region. The target points in each initial sub-region are weighted and fitted to obtain the fitted curve. Using the fitted curve, the fitted position of the target point in any initial sub-region is obtained. The distance between the target point in any initial sub-region and its fitted position is obtained in the spectrum. The reciprocal of the sum of the distance and a preset constant is normalized to obtain the dominant frequency presence index of any initial sub-region.

6. The machine vision-based surface defect detection system for textile materials according to claim 1, characterized in that, The step of adjusting any initial sub-region based on the peak prominence, amplitude distribution obviousness, and dominant frequency presence indices of any initial sub-region to obtain the target sub-region includes: The degree of adjustment of any initial sub-region is obtained based on the peak prominence and dominant frequency presence index of any initial sub-region; Based on the significance and adjustment degree of the amplitude distribution of any initial sub-region, the side length of any initial sub-region is adjusted to obtain an adaptive side length; In the spectrum diagram, taking the upper left corner of any initial sub-region as a fixed point, the side length of any initial sub-region is adjusted to an adaptive side length to obtain the target sub-region.

7. The machine vision-based surface defect detection system for textile materials according to claim 6, characterized in that, The step of obtaining the adjustment degree of any initial sub-region based on the peak prominence and dominant frequency presence index of any initial sub-region includes: The difference between constant 1 and the peak prominence of any initial sub-region is used to obtain the first adjustment degree. The difference between constant 1 and the dominant frequency existence index of any initial sub-region is used to obtain the second adjustment degree. The product of the first adjustment degree and the second adjustment degree is used to obtain the adjustment degree of any initial sub-region.

8. A machine vision-based surface defect detection system for textile materials according to claim 6, characterized in that, The step of adjusting the side length of any initial sub-region based on the significance and adjustment degree of the amplitude distribution of any initial sub-region to obtain an adaptive side length includes: The average value of the amplitude distribution significance of each initial sub-region is obtained and denoted as the average amplitude distribution significance. The difference between the amplitude distribution significance of any initial sub-region and the average amplitude distribution significance is obtained and denoted as the first difference. The absolute value of the difference between the amplitude distribution significance of any initial sub-region and the average amplitude distribution significance is obtained and denoted as the second difference. The ratio of the first difference to the second difference is obtained to obtain the adjustment direction index of any initial sub-region. The product of the adjustment direction index and the adjustment degree of any initial sub-region is obtained to obtain the side length adjustment value of any initial sub-region. The constant 1 is added to the side length adjustment value to obtain the side length adjustment coefficient. The product of the side length of any initial sub-region and the side length adjustment coefficient is rounded up to obtain the adaptive side length of any initial sub-region.

9. The machine vision-based surface defect detection system for textile materials according to claim 1, characterized in that, The process of obtaining the dominant frequency in each target sub-region includes: For any target sub-region, the peak amplitude of the frequency component in the target sub-region is obtained, and the frequency component corresponding to the peak amplitude of the frequency component in the target sub-region is recorded as the dominant frequency of the target sub-region.