A method for detecting surface defects of textiles

Through the translation invariance and sliding window technology of the spectral image, combined with the attention of feature points and the number of categories, the problem of large calculation amount and template matching limitations in textile defect detection is solved, and efficient and accurate textile defect detection is achieved.

CN118196095BInactive Publication Date: 2024-09-10HAI MEN SHI XING WANG WO SHI YONG PIN YOU XIAN ZE REN GONG SI +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410612445.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-17
Publication Date
2024-09-10
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When existing textile defect detection methods deal with textiles with periodic textures, it is difficult to ensure that the image is exactly the same as the standard template, resulting in a large amount of calculation and low efficiency. Moreover, the traditional template matching method requires the image to be exactly the same, which wastes storage space and computing resources. .

Method used

Using the translation invariance characteristics of the spectrum image, by obtaining the spectrum image of the image to be detected and the reference image, the existence of the defect is initially judged, the minimum period range is used to set the sliding window, the abnormality degree of the pixel is calculated, the suspected defect area is obtained, and the feature points are The degree of attention and number of categories are used to determine the initial template area, and standard templates are obtained to improve detection accuracy and efficiency.

Benefits of technology

It effectively avoids unnecessary calculations, flexibly detects defects at different positions of textiles, reduces the calculations, improves the efficiency and accuracy of textile defect detection, avoids the limitations of traditional methods, and only needs to obtain local standard templates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118196095B
    Figure CN118196095B
Patent Text Reader

Abstract

The present invention relates to the field of data recognition, and in particular to a method for detecting surface defects of textiles, comprising: identifying the probability of defect existence according to the spectrum image corresponding to the image to be detected and the reference image; judging whether there is a defect in the image to be identified according to the probability of defect existence; when there is a defect in the image to be detected, obtaining the abnormality of each pixel point according to the single-cycle spectrum reference image and the single-cycle spectrum image to be detected of each pixel point, and then obtaining an abnormality distribution map; obtaining each suspected defect area according to the abnormality distribution map, and then obtaining an area of ​​interest, obtaining each initial template area according to the most concerned feature point in the area of ​​interest, obtaining a standard template according to the standard degree of each initial template area, and then obtaining a final defect area. The present invention can detect textile surface defects more efficiently.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of data recognition, and in particular to a method for detecting surface defects of textiles. Background Art

[0002] Since textiles have diverse styles, existing methods for textile defect detection include threshold segmentation and template comparison. However, the template comparison method is to make a difference between the image to be detected and the standard template to obtain the difference position, which is the defect position. This method requires that the image to be detected is exactly the same as the standard template. However, in the process of rolling up textiles with periodic textures, the movement of the textiles makes it difficult to ensure that the image captured by the camera is exactly the same as the standard template. Collecting standard template images under different conditions will waste a lot of storage space. Therefore, it is difficult to obtain the standard template corresponding to the image captured by the camera.

[0003] Although the existing methods can obtain the standard template corresponding to the image to be detected based on the image feature points, the textile moves gradually during the rolling process, and the image captured by the camera also changes periodically, resulting in the need to re-acquire the standard template for each slight movement of the textile. In addition, the detection and matching process of the feature points will generate a large amount of calculation, affecting the real-time detection efficiency of the textile. Summary of the invention

[0004] The invention provides a textile surface defect detection method to solve the existing problems.

[0005] A textile surface defect detection method of the present invention adopts the following technical solution:

[0006] An embodiment of the present invention provides a method for detecting surface defects of textiles, the method comprising the following steps:

[0007] Obtain the minimum period range, the image to be detected and the reference image; obtain the probability of defect existence according to the spectrum image corresponding to the image to be detected and the reference image; determine whether there is a defect in the image to be detected according to the probability of defect existence, and stop the detection when there is no defect in the image to be detected;

[0008] When there are defects in the image to be detected, a sliding window is set according to the minimum period range, and a single-period spectrum reference image is obtained according to the sliding window and the reference image; a sliding window corresponding to each pixel point in the image to be detected is obtained; a single-period spectrum image to be detected corresponding to each pixel point is obtained according to the sliding window corresponding to each pixel point; the abnormality degree of each pixel point is obtained according to the single-period spectrum reference image and the single-period spectrum image to be detected of each pixel point; the abnormality degree of all pixels points constitutes an abnormality degree distribution map;

[0009] According to the abnormality distribution map, each suspected defect area is obtained; according to each suspected defect area, the region of interest is obtained, and each feature point in the region of interest is obtained, and the feature points with the same descriptor are called feature points of the same category; according to the abnormality of each feature point and the number of feature points contained in the category to which each feature point belongs, the attention of each feature point is obtained; according to the feature point with the highest attention, each initial template area is obtained, and the standard degree of each initial template area is obtained according to the attention degree of each feature point in the region of interest and the descriptor of the pixel points at the corresponding position in each initial template area; according to the standard degree of each initial template area, a standard template is obtained; according to the standard template, the final defect area in the region of interest is obtained.

[0010] Preferably, the expression for obtaining the defect existence probability is:

[0011]

[0012] Where P is the probability of defect existence; Respectively represent the total number of pixels in each row and each column in the spectrum image to be detected; represents the reference weight of the spectrum pixel point on the i-th row and j-th column in the spectrum image to be detected; Represents the grayscale difference of the spectrum pixel point on the i-th row and j-th column in the spectrum image to be detected; Indicates the maximum value of the Euclidean distance between all spectrum pixels in the spectrum image to be detected and the center point of the spectrum image to be detected; Indicates the maximum grayscale value of all spectrum pixels in the spectrum image to be detected.

[0013] Preferably, the method for acquiring the single-cycle spectrum reference image is:

[0014] An area on the reference image that is equal to the minimum period range is obtained as a reference window, wherein each pixel in the reference window is within the reference image, and the spectrum image corresponding to the reference window is called a single-period spectrum reference image.

[0015] Preferably, the expression for obtaining the abnormality degree of each pixel point is:

[0016] For a single pixel, the absolute value of the difference between the grayscale values ​​of each spectrum pixel with the same coordinates in the corresponding single-cycle spectrum image to be detected and the single-cycle spectrum reference image is calculated, and the cumulative sum of all absolute values ​​is taken as the abnormality degree of the single pixel; each pixel in the image to be detected is processed to obtain the abnormality degree of each pixel.

[0017] Preferably, the step of obtaining each suspected defect area includes:

[0018] Use an open operation to remove discrete pixel points whose abnormality values ​​are not 0 in the abnormality distribution map; cluster the coordinates of the pixel points whose abnormality values ​​are not 0 in the abnormality distribution map after removing the discrete points to obtain all clustering results, and use the union of the sliding windows corresponding to all pixel points in each clustering result as the initial defect area corresponding to each clustering result;

[0019] Each clustering result is expanded, and each pixel point obtained by subtracting each clustering result after expansion from each clustering result before expansion is called the target pixel point corresponding to each clustering result, and the sliding window union of all target pixel points corresponding to each clustering result is obtained, and the obtained union is used as the defect expansion area corresponding to each clustering result;

[0020] The intersection of the initial defect area and the defect extension area corresponding to each clustering result is obtained, and the initial defect area is subtracted from the intersection to obtain each suspected defect area.

[0021] Preferably, the expression for obtaining the attention degree of each feature point is:

[0022]

[0023] In the formula, is the attention degree of the jth feature point in the region of interest; is the abnormality degree of the jth feature point in the region of interest; is the number of feature points in the region of interest that belong to the same category as the jth feature point; It is the maximum number of feature points in all categories; It is the minimum number of feature points in all categories; is an exponential function with a natural constant as its base.

[0024] Preferably, the expression for obtaining the standard degree of each initial template area is:

[0025]

[0026] In the formula, represents the standard degree of the kth initial template area, and T represents the total number of feature points contained in the region of interest; Indicates the attention of the jth feature point in the region of interest; Indicates the similarity of the jth feature point in the region of interest; is an exponential function with a natural constant as its base.

[0027] The beneficial effects of the present invention are as follows: according to the characteristic of the frequency spectrum being translation invariant, firstly, a preliminary judgment is made as to whether the image to be detected has defects according to the frequency spectrum images corresponding to the image to be detected and the reference image, thereby avoiding unnecessary calculations; when there are defects in the image to be detected, the sliding window corresponding to each pixel point in the image to be detected and the reference window in the reference image are obtained with the minimum period range as the sliding window, and then the frequency spectrum image of the sliding window corresponding to each pixel point is obtained, and the degree of abnormality of each pixel point is obtained according to the difference between the obtained frequency spectrum image and the frequency spectrum image corresponding to the reference window, that is, the difference between the single-period frequency spectrum image to be detected and the single-period frequency spectrum reference image, so that defect detection can be performed more flexibly on different positions of the textile to obtain suspected defect areas, thereby avoiding the limitation that the traditional template matching method requires the image to be detected to be exactly the same as the reference image;

[0028] Since normal areas may exist in suspected defective areas, the present invention further obtains the attention of each feature point according to the abnormality of each feature point in the area of ​​interest and the number of feature points contained in the category to which each feature point belongs, so that feature points with small abnormality and high reliability have higher attention, and each initial template area is obtained according to the feature point with the highest attention, and the standard template of the area of ​​interest is obtained according to the standard degree of each initial template area, so as to obtain a more accurate final defective area, and only the standard template corresponding to the local area of ​​the image to be detected needs to be obtained, which can greatly reduce the amount of calculation and improve the defect detection efficiency of textiles. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0030] Figure 1 A flowchart of the steps of a textile surface defect detection method of the present invention;

[0031] Figure 2 A schematic diagram of a suspected defect area of ​​a textile surface defect detection method of the present invention. DETAILED DESCRIPTION

[0032] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of a textile surface defect detection method proposed by the present invention, its specific implementation, structure, characteristics and effects, in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0033] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.

[0034] The specific scheme of a textile surface defect detection method provided by the present invention is described in detail below with reference to the accompanying drawings.

[0035] See also Figure 1 , which shows a flowchart of a method for detecting surface defects of textiles provided by an embodiment of the present invention, the method comprising the following steps:

[0036] Step S001: Obtain the minimum period range, the image to be detected and the reference image; obtain the probability of defect existence according to the spectrum image corresponding to the image to be detected and the reference image; and determine whether there is a defect in the image to be detected according to the probability of defect existence.

[0037] First, the minimum period range of the textile with periodic pattern is obtained by manual measurement. The size of the minimum period range is , that is, the minimum period range contains m rows and n columns of pixels; then, during the reeling process after the textile production is completed, the camera is fixed just above the textile surface to collect the unfolded image of the textile to obtain the surface image of the textile to be detected. The surface image is called the image to be detected, and the size of the image to be detected is recorded as , that is, the image to be detected contains M rows and N columns of pixels, and , ,in , is an integer, that is, the image to be detected contains an integer minimum period range;

[0038] A surface image of a qualified textile is obtained, and the surface image is referred to as a reference image. In this embodiment, the reference image and the image to be detected have the same size and the same placement direction of the corresponding textile. The difference between the two is that the starting position of the periodic pattern in the reference image and the image to be detected is inconsistent, that is, the first column of pixels in the reference image and the image to be detected correspond to different positions of the periodic pattern. For example, the first column of pixels in the reference image corresponds to 1 / 2 period of the periodic pattern, while the first column of pixels in the image to be detected corresponds to 1 / 4 period of the periodic pattern.

[0039] The image to be detected and the reference image are converted into the frequency domain respectively to obtain the spectrum image corresponding to the image to be detected. In this embodiment, the spectrum image corresponding to the image to be detected is called the spectrum image to be detected; the spectrum image corresponding to the reference image is called the reference spectrum image. In this embodiment, the pixel points in the image to be detected are called "pixel points"; the pixel points in the spectrum image are called "spectrum pixel points".

[0040] Since the existing method can obtain the standard template corresponding to the image to be detected based on the image feature points, but the textile moves gradually during the rolling process, and the image collected by the camera also changes periodically, resulting in the need to re-acquire the standard template for each slight movement of the textile. At this time, the detection and matching process of the feature points will generate a large amount of calculation, affecting the real-time detection efficiency of the textile; however, the spectrum image has translation invariance, that is, for textiles that change periodically, the spectrum images within the same size range are consistent. Therefore, this embodiment makes a preliminary judgment on the possibility of the existence of defects based on the difference between the spectrum image corresponding to the image to be detected on the surface of the textile and the spectrum image corresponding to the reference area image;

[0041] Since the texture of the textile itself is high-frequency information, when judging whether there are defects in the current textile surface image to be detected, it is more necessary to pay attention to the high-frequency information of the image. Therefore, the probability of defects in the textile surface image to be detected can be expressed as:

[0042]

[0043] Where P is the probability of defect existence; Respectively represent the total number of pixels in each row and each column in the spectrum image to be detected; represents the reference weight of the spectrum pixel point on the i-th row and j-th column in the spectrum image to be detected, which is the Euclidean distance between the spectrum pixel point and the center point of the spectrum image to be detected; Represents the grayscale difference of the spectrum pixel point on the i-th row and j-th column in the spectrum image to be detected, which is the absolute value of the difference between the corresponding grayscale value of the spectrum pixel point on the i-th row and j-th column in the reference spectrum image; Indicates the maximum value of the Euclidean distance between all spectrum pixels in the spectrum image to be detected and the center point of the spectrum image to be detected; Indicates the maximum grayscale value of all spectrum pixels in the spectrum image to be detected.

[0044] The larger the value is, the higher the frequency of the spectrum pixel point is, so it is more necessary to pay attention to the grayscale difference between the spectrum pixel point and the spectrum pixel point at the corresponding position in the reference spectrum image; through the frequency of all pixels in the spectrum image to be analyzed and the corresponding grayscale difference, that is, To indicate the difference between the image to be detected and the reference image.

[0045] Setting the Threshold ,when , it is considered that there is a high probability of defects in the image and defect detection is required; otherwise, it is considered that there are no defects in the current image and the next image captured by the camera is processed.

[0046] Step S002: when there are defects in the image to be detected, the abnormality degree of each pixel is obtained according to the single-cycle spectrum reference image and the single-cycle spectrum image to be detected of each pixel, and then the abnormality degree distribution map is obtained.

[0047] Since the spectrum is translation invariant, under normal circumstances, in a fixed-size sliding window, the textile surface image should have the same spectrum image. In order to more accurately determine the defective area on the textile surface, the present invention expects to set a smaller sliding window to traverse each pixel point in the image, but due to the limitation of the size of the periodic pattern on the textile surface, the sliding window size is difficult to control. When the pattern is small, there may be multiple cycles in the sliding window, and when the pattern is large, there may be less than one cycle in the sliding window, resulting in a difference between the spectrum image corresponding to the area and the reference spectrum image, which in turn leads to inaccurate detection results. Therefore, the sliding window size expected to be set in this embodiment can ensure that the sliding window contains at least one cycle of the pattern.

[0048] Therefore, in this embodiment, the minimum period range is used as the sliding window size, and each pixel point in the image to be detected is used as the upper left corner of the sliding window to obtain the sliding window corresponding to each pixel point. At this time, each pixel point in the image to be detected corresponds to a sliding window; it is necessary to remove the sliding windows for which all pixels are not completely in the image to be detected, so that each sliding window in the subsequent analysis is a complete period; then, an area on the reference image equal to the minimum period range is obtained as a reference window, wherein each pixel point in the reference window is in the reference image; that is, in this embodiment, there is only one reference window, and each pixel point in the image to be detected corresponds to a sliding window;

[0049] Then the spectrum image corresponding to the reference window is called the single-cycle spectrum reference image; the spectrum image of each pixel point of the image to be detected corresponding to the sliding window is called the single-cycle spectrum image to be detected; the absolute value of the difference between the grayscale value of the spectrum pixel points at the corresponding position of each single-cycle spectrum image to be detected and the single-cycle spectrum reference image is calculated, and the cumulative sum of the corresponding absolute values ​​of all spectrum pixel points is taken as the abnormality degree of each pixel point in the image to be detected. Then, for the i-th pixel point in the image to be detected, the abnormality degree of the pixel point is It can be expressed as:

[0050]

[0051] in It is the absolute value of the difference between the grayscale values ​​of the spectrum pixel point in the uth row and the vth column in the single-cycle spectrum to-be-detected image corresponding to the pixel point and the single-cycle spectrum reference image.

[0052] The abnormality levels of all pixels in the image to be detected constitute an abnormality distribution map.

[0053] Step S003: Obtain each suspected defect area according to the abnormality distribution map.

[0054] When there is a defective area in the sliding window corresponding to a pixel point in the image to be detected on the textile surface, due to the loss of texture in the sliding window, there is a difference between the single-cycle spectrum image to be detected and the single-cycle spectrum reference image corresponding to the pixel point, which leads to the abnormality value of the pixel point in the abnormality distribution map being not 0. Therefore, in the abnormality distribution map, there are defective areas in the sliding windows corresponding to the pixels whose abnormality values ​​are not 0. The specific process is as follows:

[0055] First, the open operation is used to remove the discrete pixel points whose abnormality values ​​are not 0 in the abnormality distribution map; the coordinates of the pixel points whose abnormality values ​​are not 0 in the abnormality distribution map after the discrete points are removed are clustered using the DBSCAN clustering algorithm, and multiple clustering results are obtained, and then the union of the sliding windows corresponding to all the pixels in each clustering result is obtained respectively, and the initial defect area corresponding to each clustering result is obtained;

[0056] Since the abnormality of each pixel is determined based on the difference between the sliding window corresponding to each pixel and the spectrum image corresponding to the reference window, a pixel may not be a defective pixel, but due to the presence of a defective pixel in its corresponding sliding window, the abnormality value of the pixel is not 0, which causes the pixel to be mistaken for a defective pixel. That is, not all pixels in the initial defective area are defective pixels, that is, there are still normal areas in the initial defective area. Therefore, in order to determine the specific location of the defective area, the initial defective area needs to be corrected.

[0057] Considering that the sliding windows corresponding to the pixels with the abnormality value of 0 that are closest to each clustering result in the abnormality distribution map must not contain defective areas, that is, the sliding windows of the pixels with the abnormality value of 0 are adjacent to the defective areas, and all the pixels in the sliding windows corresponding to the pixels with the abnormality value of 0 are normal pixels, each clustering result is expanded respectively, and the expanded clustering results are subtracted from the clustering results without expansion to obtain the pixels with the abnormality value of 0 that are closest to each clustering result. These pixels are the target pixels corresponding to each clustering result, and the sliding window union of all the target pixels corresponding to each clustering result is obtained. The obtained union is used as the defective extension area corresponding to each clustering result. At this time, each pixel in the defective extension area is a normal pixel. At this time, the intersection between the initial defective area corresponding to a clustering result and the corresponding defective extension area is the normal pixel in the initial defective area, so that the normal pixels in the initial defective area can be preliminarily eliminated. The suspected defective area corresponding to the b-th clustering result can be expressed as:

[0058]

[0059] in For the The suspected defect area corresponding to the clustering result is For the The initial defect area corresponding to the clustering results is is the defect extension area corresponding to the b-th clustering result.

[0060] The intersection of the initial defect area and the defect extension area corresponding to each clustering result is obtained, and the initial defect area is subtracted from the obtained intersection to obtain each suspected defect area.

[0061] Step S004: Obtain an area of ​​interest based on each suspected defect area, and obtain the attention level of each feature point in the area of ​​interest; obtain each initial template area based on the feature point with the highest attention level, obtain a standard template based on the standard level of each initial template area, and then obtain the final defect area.

[0062] Considering the diversity of textile surface defects and the size limit of the minimum period range, when the defect areas on the textile surface are densely distributed, that is, there are normal areas between the defect areas, but due to the large sliding window, the normal areas between the defect areas will also be considered as defect areas, such as Figure 2 As shown, Figure 2A, B, and C are three defect areas, and 101, 102, and 103 are three sliding windows. At this time, due to the large sliding window, the normal area inside the defect area cannot be extracted separately. In this case, the suspected defect area obtained still has errors, that is, there may still be normal areas in the suspected defect area. Therefore, it is necessary to further analyze the suspected defect area obtained above, that is, to obtain the final defect area by obtaining the standard template corresponding to the suspected defect area. The specific process is as follows:

[0063] First, the minimum bounding boxes of all suspected defect areas are obtained, and the areas within each minimum bounding box are taken as each region of interest. Then, the SIFT operator is used to detect feature points of each region of interest to obtain each feature point in each region of interest.

[0064] Since the feature point with greater abnormality is more likely to be a defect-forming feature point, if the feature point is used to obtain the standard template of the region of interest, a large error may occur. Therefore, the reliability of the feature point with greater abnormality is lower, and the reliability of the feature point with smaller abnormality is higher. In addition, the textile itself has a periodic texture, so there may be multiple minimum period ranges in the region of interest, which also leads to different feature points in the region of interest having similar descriptors. Generally speaking, the more feature points have the same descriptor as a feature point, the greater the probability that the feature point is a feature point in the normal region, and the greater the reliability of the feature point. Conversely, the greater the probability that the feature point is a feature point in the defective region, the lower the reliability of the feature point.

[0065] In this embodiment, all feature points with the same descriptor are called feature points of the same category; therefore, in the process of obtaining the standard template, different feature points need to be set with different attention levels; then for any region of interest, the jth feature point in the region of interest, the attention level of the feature point It can be expressed as:

[0066]

[0067] In the formula, is the attention degree of the jth feature point in the region of interest; is the number of feature points in the region of interest that belong to the same category as the jth feature point; It is the maximum number of feature points of all categories; is the minimum number of feature points of all categories, is an exponential function with a natural constant as its base.

[0068] Similarly, the attention degree of each feature point in the region of interest is obtained; at the same time, since the region of interest may contain multiple minimum period ranges, it is more likely to have a one-to-many phenomenon during the matching process, that is, a feature point in the region of interest can match multiple feature points in the reference image, which will increase the uncertainty of the selection of the standard template. Therefore, it is necessary to further determine the relative positions of each feature point in the region of interest;

[0069] This embodiment first obtains the feature point with the highest attention, and then matches the feature point with each feature point in the reference image to obtain each matching point corresponding to the feature point in the reference image;

[0070] Since the positions of each feature point in the region of interest are fixed relative to the four vertices of the region of interest, and the placement directions of the textiles corresponding to the image to be detected and the reference image in this embodiment are also consistent, each matching point corresponding to the feature point in the reference image will obtain an area equal to the size of the region of interest. In this embodiment, these areas are referred to as initial template areas corresponding to the region of interest. When other feature points in the region of interest and pixel points at the same position in the initial template area are matching points, the initial template area at this time is considered to be a standard template. However, since there are defects in the region of interest, that is, there may not be an initial template area that can completely match the region of interest with each feature point in the initial template area. Therefore, in this embodiment, the standard degree of each initial template area is obtained according to the matching degree between each initial template area and the feature point in the region of interest. For the kth initial template area of ​​any region of interest, the initial template area is the standard degree of the standard template. It can be expressed as:

[0071]

[0072] In the formula, T represents the total number of feature points contained in the region of interest; Indicates the attention of the jth feature point, which is used to avoid interference from feature points formed in the defect area; Indicates the similarity of the jth feature point in the region of interest. This value is the distance between the descriptor of the jth feature point in the region of interest and the pixel point at the corresponding position in the initial template area. The smaller the distance, the more similar the descriptor of the jth feature point and the pixel point at the corresponding position is.

[0073] Repeat the above method to obtain the standard degree of each initial template area, take the initial template area with the largest standard degree as the standard template of the region of interest, and finally perform template matching between the standard template and the region of interest to obtain the final defect area in the region of interest;

[0074] Each region of interest is processed to obtain a final defect area corresponding to each region of interest.

[0075] It should be noted that the exp(-x) model used in this embodiment is only used to indicate that the negative correlation and the result of the constraint model output are in the interval [0,1). In specific implementation, it can be replaced with other models with the same purpose. This embodiment only uses the exp(-x) model as an example for description without making specific limitations, where x refers to the input of the model.

[0076] Through the above steps, the textile surface defect detection is completed.

[0077] According to the characteristic of the frequency spectrum being translation invariant, this embodiment first preliminarily determines whether the image to be detected has defects based on the frequency spectrum images corresponding to the image to be detected and the reference image, thereby avoiding unnecessary calculations; when there are defects in the image to be detected, the minimum period range is used as the sliding window, the sliding window corresponding to each pixel point in the image to be detected and the reference window in the reference image are obtained, and then the frequency spectrum image of the sliding window corresponding to each pixel point is obtained, and the degree of abnormality of each pixel point is obtained based on the difference between the obtained frequency spectrum image and the frequency spectrum image corresponding to the reference window, that is, the difference between the single-period frequency spectrum image to be detected and the single-period frequency spectrum reference image, so that defect detection can be performed more flexibly on different positions of the textile to obtain suspected defect areas, avoiding the limitation of the traditional template matching method requiring the image to be detected and the reference image to be exactly the same;

[0078] Since normal areas may exist in suspected defective areas, this embodiment further obtains the attention of each feature point according to the abnormality of each feature point in the area of ​​interest and the number of feature points contained in the category to which each feature point belongs, so that feature points with small abnormality and high reliability have higher attention, and each initial template area is obtained according to the feature point with the highest attention, and the standard template of the area of ​​interest is obtained according to the standard degree of each initial template area, so as to obtain a more accurate final defective area. And only the standard template corresponding to the local area of ​​the image to be detected needs to be obtained, which can greatly reduce the amount of calculation and improve the defect detection efficiency of textiles.

Claims

1. A method for detecting surface defects of textiles, characterized in that: The method comprises the following steps: Obtain the minimum period range, the image to be detected and the reference image; obtain the probability of defect existence according to the spectrum image corresponding to the image to be detected and the reference image; identify whether there is a defect in the image to be detected according to the probability of defect existence, and stop the detection when there is no defect in the image to be detected; When there are defects in the image to be detected, a sliding window is set according to the minimum period range, and a single-period spectrum reference image is obtained according to the sliding window and the reference image; a sliding window corresponding to each pixel point in the image to be detected is obtained; a single-period spectrum image to be detected corresponding to each pixel point is obtained according to the sliding window corresponding to each pixel point; the abnormality degree of each pixel point is obtained according to the single-period spectrum reference image and the single-period spectrum image to be detected of each pixel point; the abnormality degree of all pixels points constitutes an abnormality degree distribution map; According to the abnormality distribution map, each suspected defect area is obtained; according to each suspected defect area, the region of interest is obtained, and each feature point in the region of interest is obtained, and the feature points with the same descriptor are called feature points of the same category; according to the abnormality of each feature point and the number of feature points contained in the category to which each feature point belongs, the attention of each feature point is obtained; according to the feature point with the highest attention, each initial template area is obtained, and the standard degree of each initial template area is obtained according to the attention degree of each feature point in the region of interest and the descriptor of the pixel points at the corresponding position in each initial template area; according to the standard degree of each initial template area, a standard template is obtained; and the final defect area in the region of interest is identified according to the standard template.

2. A textile surface defect detection method according to claim 1, characterized in that: The expression for obtaining the defect existence probability is: Where P is the probability of defect existence; Respectively represent the total number of pixels in each row and each column in the spectrum image to be detected; represents the reference weight of the spectrum pixel point on the i-th row and j-th column in the spectrum image to be detected; Represents the grayscale difference of the spectrum pixel point on the i-th row and j-th column in the spectrum image to be detected; Indicates the maximum value of the Euclidean distance between all spectrum pixels in the spectrum image to be detected and the center point of the spectrum image to be detected; Indicates the maximum grayscale value of all spectrum pixels in the spectrum image to be detected.

3. A textile surface defect detection method according to claim 1, characterized in that: The method for acquiring the single-cycle spectrum reference image is: An area on the reference image that is equal to the minimum period range is obtained as a reference window, wherein each pixel in the reference window is within the reference image, and the spectrum image corresponding to the reference window is called a single-period spectrum reference image.

4. A textile surface defect detection method according to claim 1, characterized in that: The expression for obtaining the abnormality degree of each pixel is: For a single pixel, the absolute value of the difference between the grayscale values ​​of each spectrum pixel with the same coordinates in the corresponding single-cycle spectrum image to be detected and the single-cycle spectrum reference image is calculated, and the cumulative sum of all absolute values ​​is taken as the abnormality degree of the single pixel; each pixel in the image to be detected is processed to obtain the abnormality degree of each pixel.

5. A textile surface defect detection method according to claim 1, characterized in that: The steps of obtaining each suspected defect area include: Use an open operation to remove discrete pixel points whose abnormality values ​​are not 0 in the abnormality distribution map; cluster the coordinates of the pixel points whose abnormality values ​​are not 0 in the abnormality distribution map after removing the discrete points to obtain all clustering results, and use the union of the sliding windows corresponding to all pixel points in each clustering result as the initial defect area corresponding to each clustering result; Each clustering result is expanded, and each pixel point obtained by subtracting each clustering result after expansion from each clustering result before expansion is called the target pixel point corresponding to each clustering result, and the sliding window union of all target pixel points corresponding to each clustering result is obtained, and the obtained union is used as the defect expansion area corresponding to each clustering result; The intersection of the initial defect area and the defect extension area corresponding to each clustering result is obtained, and the initial defect area is subtracted from the intersection to obtain each suspected defect area.

6. A textile surface defect detection method according to claim 1, characterized in that: The expression for obtaining the attention degree of each feature point is: In the formula, is the attention degree of the jth feature point in the region of interest; is the abnormality degree of the jth feature point in the region of interest; is the number of feature points in the region of interest that belong to the same category as the jth feature point; It is the maximum number of feature points in all categories; is the minimum number of feature points in all categories. is an exponential function with a natural constant as its base.

7. A textile surface defect detection method according to claim 1, characterized in that: The expression for obtaining the standard degree of each initial template area is: In the formula, represents the standard degree of the kth initial template area, and T represents the total number of feature points contained in the region of interest; Indicates the attention of the jth feature point in the region of interest; Indicates the similarity of the jth feature point in the region of interest; is an exponential function with a natural constant as its base.