Textile texture defect detection system and detection method based on machine vision
Through the textile defect detection method based on machine vision, and the matrix light source and image difference analysis technology, the accuracy and stability of textile defect detection in the prior art are solved, and efficient defect identification and detection are achieved.
Patent Information
- Application Number
- CN202411786124.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-11
AI Technical Summary
The prior art is difficult to accurately detect textile texture defects in textile defect detection, especially under light changes and complex texture conditions, which are prone to false detection and missed detection.
Using machine vision-based detection method, through multi-angle irradiation of matrix light sources and image difference analysis, the main texture direction and texture offset of textiles are extracted, the candidate areas of defects are marked, and the location of defects is determined through differential threshold screening and image matching technology.
It improves the accuracy and stability of textile defect detection, reduces the possibility of false detection and missed detection, and can effectively identify defects under different fabric types and complex texture conditions.
Smart Images

Figure CN119595660A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer vision, and in particular to a textile texture defect detection system and a detection method based on machine vision. Background Art
[0002] With the development of image processing technology, more and more applications involve the detection, identification, and tracking of a certain target. By extracting and tracking the target in the scene, the shape of the target can be recorded, and through computer processing, the analysis results of the target can be further obtained. In the use of digital image acquisition in automated defect detection, industrial cameras or integrated single-chip sensor micro lenses are mainly used for photoelectric conversion. Due to the influence of light and the fabric of the textile itself, defects are easily covered or misjudged, and defects are difficult to detect accurately. Summary of the invention
[0003] The present invention overcomes the deficiencies of the prior art and provides a textile texture defect detection system and a detection method based on machine vision.
[0004] To achieve the above object, the technical solution adopted by the present invention is: a method for detecting textile texture defects based on machine vision, comprising the following steps:
[0005] Step S1, a matrix light source is located on one side of the textile detection area;
[0006] Step S2, acquiring an image of the detection area, detecting texture changes of textiles in the detection area, and marking defect candidate areas;
[0007] Step S3, adjusting the angle change of the matrix light source and the brightness change of the defect candidate area, and generating an image;
[0008] Step S4, extracting multiple sets of image information, comparing the multiple sets of image information, and determining the defect locations of the textiles;
[0009] Step S5: Mark the detected defects in the image and output defect feature information.
[0010] In a preferred embodiment of the present invention, in step S1, the matrix light source L is located on one side of the textile to form an overall light source matrix covering the detection area, and the matrix size is n×m, specifically,
[0011]
[0012] In a preferred embodiment of the present invention, step S2 includes the following sub-steps:
[0013] Step S21, capturing an image of the entire detection area under standard lighting conditions to obtain basic texture information of the textile surface;
[0014] Step S22, extracting the directional information of the textile surface texture through filtering and directional gradient calculation, determining the main texture direction, and dividing the image into several regions;
[0015] Step S23, calculate the main texture direction of each area, compare it with the main texture direction of the entire image, calculate the texture offset of each area in the image, and if the offset of a certain area exceeds a preset threshold, mark the area as a defect candidate area.
[0016] In a preferred embodiment of the present invention, in step S21, the basic texture information includes: fabric structure type, texture spacing, and warp and weft density.
[0017] In a preferred embodiment of the present invention, in step S22, the direction information of the texture includes: the directions of the longitude and latitude lines, and the tilt angle of the texture.
[0018] In a preferred embodiment of the present invention, in step S23, the setting of the preset threshold is specifically as follows: a sample of a defect-free textile image is collected, the main texture direction θ of the entire inspection area of the textile is calculated, the image is divided into a plurality of grid areas, and the main texture direction θi of each grid is calculated, for each grid, its offset Δθ=|θi-θ| from the overall main texture direction is calculated, the offset of each grid area is collected, and an offset data set {Δθ1, Δθ2, ..., Δθ n}, calculate the mean μ and standard deviation σ of the offset in the sample, and set the threshold Δθ t is: μ+2σ.
[0019] In a preferred embodiment of the present invention, in step S3, specifically, the light sources corresponding to the defect candidate areas in each row of the matrix light source are controlled to illuminate in sequence, thereby forming multi-angle incidence, constituting light and dark changes, and generating images in sequence.
[0020] In a preferred embodiment of the present invention, in step S4, determining whether there are defects in the textile comprises the following steps:
[0021] Step S41, performing difference calculation on multiple groups of images to obtain difference images;
[0022] Step S42: setting a difference threshold based on the difference image, screening out areas with a value greater than the difference threshold, and marking them as defect areas;
[0023] Step S43: using image matching technology to compare the difference area, texture offset and light and dark changes of the image to calculate and determine the specific location of the defect.
[0024] A textile texture defect detection system based on machine vision, comprising: a light source control module, an image acquisition module, an image preprocessing module, a candidate area marking module, a preset threshold generation module, an image difference analysis module and a defect detection result module;
[0025] The light source control module is used to control the adjustment of the matrix light source so that the light sources corresponding to the defect areas in each row of the matrix light source sequentially illuminate the textiles, thereby forming multi-angle incidence and light and dark changes;
[0026] The image acquisition module is used to obtain textile images under different lighting conditions;
[0027] The image preprocessing module is used to filter and calculate the directional gradient of the collected image, extract the texture direction information, and segment the textile mesh area;
[0028] The candidate region marking module obtains the defect candidate region of the textile texture change based on the texture direction information obtained in the image preprocessing module and marks it;
[0029] The preset threshold generation module sets the benchmark threshold for defect detection by analyzing the texture deviation of defect-free samples;
[0030] The image difference analysis module is used to calculate the difference between multiple groups of images, analyze the texture and brightness differences of the images, and determine the defect area;
[0031] The defect detection result module is used to mark the detected defect area in the image.
[0032] In a preferred embodiment of the present invention, the preset threshold generation module includes: a sample collection unit, a sample analysis unit, an offset statistics unit and a threshold setting unit;
[0033] The sample collection unit is used for collecting defect-free textile image samples;
[0034] The sample analysis unit is used to analyze the overall main texture direction and each grid offset of the sample image;
[0035] The offset statistics unit is used to calculate the mean and standard deviation of the offset;
[0036] The threshold setting unit sets a reference threshold based on the mean and standard deviation of the offset for marking the defect candidate area.
[0037] The present invention solves the defects existing in the background technology and has the following beneficial effects:
[0038] (1) The present invention provides a method for detecting textile texture defects based on machine vision. The method extracts the main texture direction of the textile and divides it into several regions. The directional offset of each region from the overall main texture is calculated to obtain the texture change of the textile. The candidate defect region is preliminarily determined. A matrix light source is used to correspond to the defect region at different irradiation angles, thereby enhancing the texture contrast of the textile surface in different directions. The slight offset of the weft defect is more clearly displayed in the image. The position of the defect is further determined, which helps to improve the accuracy of defect detection.
[0039] (2) The present invention uses a matrix light source to illuminate the defect candidate areas at different angles in sequence. The light source illuminates the defect area of the textile at different levels and at different angles. The defect position forms different reflection effects, thereby forming a rich light and dark contrast in the defect area, enhancing the clarity of the defects in the image, allowing the weft defects to be accurately presented, helping to clearly identify the boundaries of the defects, improving the recognition accuracy, and thereby improving the accuracy of defect detection.
[0040] (3) The present invention calculates the difference of multiple groups of images and eliminates slight changes in normal texture, thereby further highlighting the defect feature area. By setting the difference threshold, the area with abnormal difference can be accurately screened out to reduce the possibility of false detection and missed detection. At the same time, combined with the texture offset and brightness characteristics of the difference area, the specific location of the defect can be accurately determined to ensure the accuracy of the detection result, so that defects can still be effectively identified under different fabric types and complex texture conditions. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] 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 are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work.
[0042] Figure 1 is a flow chart of a method for detecting textile texture defects based on machine vision according to a preferred embodiment of the present invention;
[0043] Figure 2 is a schematic diagram of a framework of a textile texture defect detection system based on machine vision according to a preferred embodiment of the present invention;
[0044] Figure 3 It is a schematic diagram of the framework of the preset threshold generation module of the preferred embodiment of the present invention. DETAILED DESCRIPTION
[0045] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0046] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.
[0047] Application Overview:
[0048] As mentioned above, in the field of computer vision technology, the effectiveness of using images for detection will affect the correctness and effectiveness of making decisions based on images.
[0049] Taking textile defect detection as an example, machine vision is used to generate images to detect defects in textile fabrics. In specific applications, textile fabrics are photographed by a camera machine to obtain images, and image processing techniques such as image filtering, edge detection, and threshold segmentation are used to identify the obvious geometric features of defects in the image, but it is difficult to deal with complex textures and subtle flaws. For example, for textiles with more complex textures, it is difficult to distinguish the difference between the natural changes of normal textures and defects using image processing methods, resulting in a high rate of false detection and missed detection. In addition, the technology of generating images to detect textile defects is more sensitive to changes in ambient lighting, and a slight change in light angle or brightness may affect the detection results.
[0050] Textile fabrics can be photographed in combination with lighting to generate images. However, when taking images of textile fabrics under a single lighting condition, the image can only present one side of the textile surface, which is prone to local shadows and reflection interference. Especially when there are wrinkles, bends or reflective materials on the textile surface, defects are easily covered or misjudged, resulting in the inability to accurately detect defects.
[0051] Therefore, in response to the above technical problems, an embodiment of the present invention provides a textile texture defect detection system and detection method based on machine vision. By calculating the main texture direction of the textile in each area and the main texture direction of the entire textile, the candidate defect area is preliminarily determined, and the position of the defect is further determined by coordinating the matrix light source with different illumination angles corresponding to the defect area.
[0052] like Figure 1 As shown, a method for detecting textile texture defects based on machine vision comprises the following steps:
[0053] Step S1, a matrix light source is located on one side of the textile detection area;
[0054] Step S2, acquiring an image of the detection area, detecting texture changes of textiles in the detection area, and marking defect candidate areas;
[0055] Step S3, adjusting the angle change of the matrix light source and the brightness change of the defect candidate area, and generating an image;
[0056] Step S4, extracting multiple sets of image information, comparing the multiple sets of image information, and determining the defect locations of the textiles;
[0057] Step S5: Mark the detected defects in the image and output defect feature information.
[0058] In the present invention, in step S1, the matrix light source L is placed on one side of the textile to form an overall light source matrix covering the detection area, and the matrix size is n×m, specifically,
[0059] The light sources have fixed positions in the matrix, which are represented by coordinates (rows, columns). Each light source can automatically adjust its angle, which varies according to the determination of the defect candidate area.
[0060] Among them, the arrangement of the matrix light source is as follows: 11 , l 12 , l 13 ,…,l 1m , l 11 , l 21 , l 31 ,…,l n1 , l n1 , l n1 , l n3 ,…,l nm , l 1m , l 2m , l 3m ,…,l nm , using matrix light sources to ensure uniform illumination of the inspection area from all angles and directions, reducing the impact of ambient light changes and improving the stability of defect detection.
[0061] In the present invention, step S2 includes the following sub-steps:
[0062] Step S21, capturing an image of the entire detection area under standard lighting conditions to obtain basic texture information of the textile surface, wherein the basic texture information includes: fabric structure type, texture spacing, and warp and weft density;
[0063] Step S22, extracting the directional information of the textile surface texture by filtering and directional gradient calculation, determining the main texture direction, and dividing the image into several regions, wherein the directional information of the texture includes: the direction of the warp and weft lines, and the inclination angle of the texture;
[0064] Step S23, calculating the main texture direction of each area, comparing it with the main texture direction of the entire image, calculating the texture offset of each area in the image, and if the offset of a certain area exceeds a preset threshold, marking the area as a defect candidate area;
[0065] The preset threshold is set as follows: specifically, a sample of defect-free textile image is collected, the main texture direction θ of the entire inspection area of the textile is calculated, the image is divided into several grid areas, and the main texture direction θi of each grid is calculated. For each grid, its offset Δθ=|θi-θ| from the overall main texture direction is calculated, and the offset of each grid area is collected to obtain the offset data set {Δθ1, Δθ2, …, Δθ n}, calculate the mean μ and standard deviation σ of the offset in the sample, and set the threshold Δθ t is: μ+2σ.
[0066] It should be noted that the color temperature of the light source under standard lighting conditions is between 5000K and 6500K. The control of standard lighting conditions is to eliminate image deviation caused by light source changes, ensure that all textile images are taken under the same lighting conditions, and reduce errors caused by natural light or environmental factors;
[0067] In step S22, in order to remove noise in the image, a Gaussian filter is used to smooth the image, reduce the influence of high-frequency noise, and improve the accuracy of subsequent texture extraction, a Sobel operator is used to perform a convolution operation on the image, and the gradient of each pixel in the image in the horizontal and vertical directions is calculated;
[0068] After calculating the gradient direction of each pixel, a direction histogram is generated according to the direction information. The direction histogram groups the gradient directions of all pixels according to a specific angle range. For example, the gradient direction is divided into several intervals. Taking 0-180° as an example, the gradient direction from 0° to 180° is divided into several small angle intervals, and the number of pixels appearing in each angle range is counted to obtain a global texture direction distribution. In the obtained direction histogram, the angle at which the largest peak value is located is the main texture direction of the image, corresponding to the gradient direction that frequently appears in the image, representing the dominant direction of the surface texture of the textile, that is, the main texture direction of the textile;
[0069] At the same time, in order to accurately analyze the image, the image will be divided into several areas (e.g., grid areas), each of which will be analyzed independently to detect whether there are any local texture anomalies or offsets. The grid areas are divided according to a fixed grid size or based on the texture pattern in the image.
[0070] In step S23, by comparing the regional and overall texture directions, the texture offset of each region can be accurately calculated, and possible texture anomalies can be accurately identified. By setting the offset threshold, the defect candidate area is automatically marked, which greatly improves the efficiency and accuracy of defect detection.
[0071] In the present invention, in step S3, specifically, the light sources corresponding to the defect candidate areas in each row of the matrix light source are controlled to illuminate in sequence, thereby forming multi-angle incidence, constituting light and dark changes, and generating images in sequence.
[0072] After determining the position of the defect candidate area, in order to further verify whether there is a latitude oblique defect in the defect candidate area, the present invention controls the light sources corresponding to the defect candidate area in each row of the matrix light source to illuminate in sequence. Due to structural abnormalities or surface defects, the defects will show different reflection characteristics or light and dark changes under different illumination angles. The light sources in different rows illuminate the defect candidate area at different angles. The contrast of these areas can be enhanced by illumination at different angles, making them more distinguishable from normal textures. Among them, the light and dark changes of the latitude oblique defect will appear as different reflection effects in the image, which helps to highlight the defect position in the image.
[0073] When the light source shines on the area with weft defects, the originally parallel texture may become tilted and produce shadows or bright spots, which will show different light and dark effects under different lighting angles, which can help determine whether there are weft defects and improve the accuracy of defect detection.
[0074] In the present invention, in step S4, judging whether there are defects in the textile comprises the following steps:
[0075] Step S41, performing difference calculation on multiple groups of images to obtain difference images;
[0076] Step S42: setting a difference threshold based on the difference image, screening out areas with a value greater than the difference threshold, and marking them as defect areas;
[0077] Step S43: using image matching technology to compare the difference area, texture offset and light and dark changes of the image to calculate and determine the specific location of the defect.
[0078] To calculate the difference between multiple sets of images, it is necessary to align the multiple sets of images. i The values in multiple groups of images are I i(p), the value of each pixel in multiple groups of images I i (p) is compared with the value I(p) of each pixel of the defect-free textile image sample, and the pixel value of the difference image is I = |I(p)-I i (p)|, wherein the difference threshold is determined by experts through multiple experimental experiences.
[0079] like Figure 2 As shown, a textile texture defect detection system based on machine vision includes: a light source control module, an image acquisition module, an image preprocessing module, a candidate area marking module, a preset threshold generation module, an image difference analysis module and a defect detection result module;
[0080] The light source control module is used to control the adjustment of the matrix light source so that the light sources corresponding to the defect areas in each row of the matrix light source sequentially illuminate the textiles, thereby forming multi-angle incidence and light and dark changes;
[0081] The image acquisition module is used to obtain textile images under different lighting conditions;
[0082] The image preprocessing module is used to filter and calculate the directional gradient of the collected image, extract the texture direction information, and segment the textile mesh area;
[0083] The candidate region marking module obtains the defect candidate region of the textile texture change based on the texture direction information obtained in the image preprocessing module and marks it;
[0084] The preset threshold generation module sets the benchmark threshold for defect detection by analyzing the texture deviation of defect-free samples;
[0085] The image difference analysis module is used to calculate the difference between multiple groups of images, analyze the texture and brightness differences of the images, and determine the defect area;
[0086] The defect detection result module is used to mark the detected defect area in the image.
[0087] like Figure 3 As shown, in a preferred embodiment of the present invention, the preset threshold generation module includes: a sample collection unit, a sample analysis unit, an offset statistics unit and a threshold setting unit;
[0088] The sample collection unit is used for collecting defect-free textile image samples;
[0089] The sample analysis unit is used to analyze the overall main texture direction and each grid offset of the sample image;
[0090] The offset statistics unit is used to calculate the mean and standard deviation of the offset;
[0091] The threshold setting unit sets a reference threshold based on the mean and standard deviation of the offset for marking the defect candidate area.
[0092] The above is based on the ideal embodiment of the present invention. Through the above description, relevant personnel can make various changes and modifications without departing from the technical concept of the present invention. The technical scope of the present invention is not limited to the content in the specification, and the technical scope must be determined according to the scope of the claims.
Claims
1. A method for detecting textile texture defects based on machine vision, characterized in that: The following steps are involved: Step S1, a matrix light source is located on one side of the textile detection area; Step S2, acquiring an image of the detection area, detecting texture changes of textiles in the detection area, and marking defect candidate areas; Step S3, adjusting the angle change of the matrix light source and the brightness change of the defect candidate area, and generating an image; Step S4, extracting multiple sets of image information, comparing the multiple sets of image information, and determining the defect locations of the textiles; Step S5: Mark the detected defects in the image and output defect feature information.
2. The method for detecting textile texture defects based on machine vision according to claim 1, characterized in that: In step S1, the matrix light source L is located on one side of the textile to form an overall light source matrix covering the detection area, and the matrix size is n×m, specifically, 3. The method for detecting textile texture defects based on machine vision according to claim 1, characterized in that: In the step S2, the following sub-steps are included: Step S21, capturing an image of the entire detection area under standard lighting conditions to obtain basic texture information of the textile surface; Step S22, extracting the directional information of the textile surface texture through filtering and directional gradient calculation, determining the main texture direction, and dividing the image into several regions; Step S23, calculate the main texture direction of each area, compare it with the main texture direction of the entire image, calculate the texture offset of each area in the image, and if the offset of a certain area exceeds a preset threshold, mark the area as a defect candidate area.
4. A method for detecting textile texture defects based on machine vision according to claim 3, characterized in that: In step S21, the basic texture information includes: fabric structure type, texture spacing, and warp and weft density.
5. The method for detecting textile texture defects based on machine vision according to claim 3, characterized in that: In the step S22, the direction information of the texture includes: the directions of the longitude and latitude, and the tilt angle of the texture.
6. The method for detecting textile texture defects based on machine vision according to claim 3, characterized in that: In step S23, the setting of the preset threshold is specifically to collect a sample of a defect-free textile image, calculate the main texture direction θ of the entire inspection area of the textile, divide the image into a number of grid areas, and calculate the main texture direction θi of each grid, and for each grid, calculate its offset Δθ=|θi-θ| from the overall main texture direction, collect the offsets of each grid area, and obtain the offset data set {Δθ1, Δθ2, ..., Δθ n }, calculate the mean μ and standard deviation σ of the offset in the sample, and set the threshold Δθ t is: μ+2σ.
7. The method for detecting textile texture defects based on machine vision according to claim 1, characterized in that: In the step S3, specifically, the light sources corresponding to the defect candidate areas in each row of the matrix light source are controlled to illuminate in sequence, thereby forming multi-angle incidence, constituting light and dark changes, and generating images in sequence.
8. The method for detecting textile texture defects based on machine vision according to claim 1, characterized in that: In step S4, judging whether there are defects in the textile includes the following steps: Step S41, performing difference calculation on multiple groups of images to obtain difference images; Step S42: setting a difference threshold based on the difference image, screening out areas with a value greater than the difference threshold, and marking them as defect areas; Step S43: using image matching technology to compare the difference area, texture offset and light and dark changes of the image to calculate and determine the specific location of the defect.
9. A textile texture defect detection system based on machine vision, comprising: Light source control module, image acquisition module, image preprocessing module, candidate area marking module, preset threshold generation module, image difference analysis module and defect detection result module; characterized in that, The light source control module is used to control the adjustment of the matrix light source so that the light sources corresponding to the defect areas in each row of the matrix light source sequentially illuminate the textile, thereby forming multi-angle incidence and forming light and dark changes; The image acquisition module is used to acquire images of textiles under different lighting conditions; The image preprocessing module is used to filter and calculate the directional gradient of the collected image, extract the texture direction information, and segment the textile mesh area; The candidate region marking module obtains the defect candidate region of the textile texture change based on the texture direction information obtained in the image preprocessing module and marks it; The preset threshold generation module sets a reference threshold for defect detection by analyzing the texture deviation of defect-free samples; The image difference analysis module is used to perform difference calculation on multiple groups of images, analyze the texture and brightness differences of the images, and determine the defect area; The defect detection result module is used to mark the detected defect area in the image.
10. The textile texture defect detection system based on machine vision according to claim 9, characterized in that: The preset threshold generation module includes: a sample collection unit, a sample analysis unit, an offset statistics unit and a threshold setting unit; The sample collection unit is used to collect defect-free textile image samples; The sample analysis unit is used to analyze the overall main texture direction and each grid offset of the sample image; The offset statistics unit is used to calculate the mean and standard deviation of the offset; The threshold setting unit sets a reference threshold based on the mean and standard deviation of the offset for marking the defect candidate area.
Citation Information
Cited By
Braid defect detection method and system based on machine vision
CN120064300A
Warp deviation detection method for scutching woven fabric based on industrial vision
CN121329974A
Defective cloth detection light source control method and defective cloth detection system
CN121347517A
Industrial vision online fusion detection method for texture and defects of superfine fiber coral fleece
CN122150257A