A method and system for detecting defects in a garment fabric based on machine vision
By separating the grayscale image of clothing fabric into warp and weft curves, elongation deduction, weft curvature analysis, and yarn quantity statistics are performed, solving the accuracy and efficiency problems of defect detection in existing technologies, and realizing integrated detection and output of multiple types of defects.
Patent Information
- Application Number
- CN202610711450.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Filing Date
- 2026-05-22
- Publication Date
- 2026-07-10
AI Technical Summary
Existing garment fabric defect detection technologies cannot accurately quantify the extension and curvature changes of yarn curves, are easily affected by fabric texture interference leading to misjudgment of defects, and cannot simultaneously complete the integrated identification of multiple types of defects, resulting in insufficient detection efficiency and completeness.
By separating the grayscale image of the garment fabric into warp curves and weft curves, and performing elongation deduction, weft curvature analysis, and yarn quantity statistics respectively, and combining the fracture defect curve, twist defect curve, and density defect area to integrate the defect contour space, standardized detection results are generated.
It enables precise quantification and localization of defects such as warp breakage, weft twisting, and abnormal yarn density, improving the accuracy and comprehensiveness of test results, simplifying the testing process, and meeting the high-efficiency requirements of the garment fabric industry testing.
Smart Images

Figure CN122368039A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine vision technology, and in particular to a method and system for detecting defects in clothing fabrics based on machine vision. Background Technology
[0002] Existing garment fabric defect detection technologies mostly employ traditional machine vision solutions, which lack sufficient precision in analyzing the characteristics of subtle defects such as warp yarn breakage and weft yarn twisting. They cannot accurately quantify the extension and curvature changes of yarn curves, are easily affected by fabric texture interference, leading to misjudgments of defects, and their detection accuracy is difficult to meet industrial inspection requirements.
[0003] Existing detection solutions cannot simultaneously identify multiple types of defects such as yarn breakage, twisting, and density abnormalities. The defect contour space integration process is cumbersome, and the false negative rate is high in scenarios with multiple defects overlapping. Overall, there are obvious technical shortcomings in detection efficiency and completeness. Therefore, how to improve the detection efficiency of garment fabric defects has become an urgent problem to be solved. Summary of the Invention
[0004] This invention provides a machine vision-based method and system for detecting defects in clothing fabrics, in order to solve the problems mentioned in the background art.
[0005] To achieve the above objectives, the present invention provides a machine vision-based method for detecting defects in clothing fabrics, comprising: S01. Based on the yarn direction, separate the grayscale image of the garment fabric into warp curves and weft curves; S02. Perform elongation calculation on the warp curve to obtain the warp curve stretch ratio, and mark the warp curve with the stretch ratio lower than the preset ideal stretch threshold as the breakage defect curve. S03. Perform weft curvature analysis on the weft curve to obtain the bending change rate of the weft curve, and mark the weft curve with non-periodic fluctuations in the bending change rate as a twist defect curve. S04. Perform yarn count on the warp and weft curves, and mark the grayscale images where the warp and weft yarn counts do not match the process parameters as density defect areas. S05. Based on the fracture defect curve, torsion defect curve and density defect region, the grayscale image is spatially integrated to obtain the detection results of the clothing fabric.
[0006] In a preferred embodiment, separating the grayscale image of the garment fabric into warp curves and weft curves based on the yarn direction includes: Texture direction analysis is performed on the grayscale image of the clothing fabric to obtain the local direction angle of the grayscale image; Based on the local orientation angle, consistent path tracing is performed on the grayscale image to obtain the warp and weft curves of the grayscale image.
[0007] In a preferred embodiment, the step of extrapolating the warp curve to obtain the warp curve's stretch ratio, and marking warp curves with stretch ratios lower than a preset ideal stretch threshold as breakage defect curves, includes: Along the warp direction, the warp curve is discretely integraled pixel by pixel to obtain the warp curve stretch ratio distribution; The locations in the stretch ratio distribution that are below the preset ideal stretch threshold are used as candidate areas for breakage of the warp curve; By extending the trend on both sides of the fracture candidate region, the predicted joint deviation of the fracture candidate region is obtained. The predicted bonding deviation is judged to exceed the tolerance range, and the breakage defect curve of the warp curve is obtained.
[0008] In a preferred embodiment, the step of trend extension on both sides of the fracture candidate region to obtain the predicted joint deviation of the fracture candidate region includes: The optimal phase offset of the fracture candidate region is obtained by performing sliding inner product optimization between the upstream and downstream curvatures of the fracture candidate region. Based on the optimal phase offset, the waveform periodic extension and reconstruction of the upstream warp curve of the fracture candidate area is performed to obtain the cross-fracture continuation trajectory of the upstream side curve. The continuity bias is quantified between the end point of the cross-fracture continuation trajectory and the starting point of the warp curve on the downstream side of the fracture candidate area to obtain the predicted joint deviation of the fracture candidate area.
[0009] In a preferred embodiment, the step of performing weft curvature analysis on the weft yarn curve to obtain the bending change rate of the weft yarn curve, and marking the weft yarn curve with non-periodic fluctuations in the bending change rate as a twist defect curve, includes: The extreme point morphology of the curvature sequence of the weft yarn curve is identified to obtain the curvature peak of the curvature sequence; Along the direction of the weft yarn, the spatial position of the curvature peaks is extracted segment by segment to obtain the peak spacing of the weft yarn curve; Based on the preset theoretical organization cycle length, the difference accumulation comparison of the peak spacing is carried out to obtain the cumulative amount of period deviation of the peak spacing. Local weft curves where the cumulative deviation of three or more consecutive cycles exceeds the threshold and the ratios between them are not close to integers are marked as twist defect curves.
[0010] In a preferred embodiment, the step of comparing the cumulative difference in the peak spacing based on a preset theoretical organization cycle length to obtain the cumulative period deviation of the peak spacing includes: The crest spacing is summed to obtain the actual cumulative arc length; Based on the preset theoretical organization cycle length, the crest spacing is projected and mapped to obtain the ideal cumulative arc length of the crest spacing; Based on the actual cumulative arc length and the ideal cumulative arc length, the cumulative period deviation of the wave crest spacing sequence is calculated. The formula for calculating the cumulative period deviation is as follows: ; In the formula, For the cumulative amount of periodic deviation, This represents the total number of spacings in the wave crest spacing. For the index of the crest spacing, It is a natural constant. The imaginary unit, Pi is a constant. For the index of the crest spacing, For the first The value of the distance between the peaks. The preset theoretical organization cycle length.
[0011] In a preferred embodiment, the step of counting the number of warp and weft yarns, and marking images in grayscale images where the number of warp and weft yarns does not match the process parameters as density defect areas, includes: The warp space distance of the warp curve is traversed along the warp advance direction, and the warp space distance is topologically mapped to obtain the warp spacing matrix of the warp distance; The weft yarn spatial distance of the weft yarn curve is traversed along the weft advance direction, and the weft yarn spatial distance is topologically mapped to obtain the weft yarn spacing matrix of the weft yarn spatial distance. Based on the warp and weft spacing matrices, regions within the window where the spacing values continuously increase or decrease and the slope exceeds the process parameters are marked as warp density abnormal stripes and weft density abnormal stripes. The positions in the warp spacing matrix and weft spacing matrix where the spacing of a single point exceeds the multiplication factor of the median of the neighborhood are marked as isolated warp points and isolated weft points, respectively. The continuous spatial range covered by abnormal warp density bands, abnormal weft density bands, isolated warp points, and isolated weft points is output as density defect areas.
[0012] In a preferred embodiment, the step of marking regions within a window whose spacing values continuously increase or decrease and whose slope exceeds the process parameters as warp density aberration bands and weft density aberration bands based on the warp spacing matrix and weft spacing matrix includes: Based on the warp and weft yarn spacing matrices, continuous sequences with the same sign of difference are extracted window by window to obtain monotonic trend segments within each window. The rate of change of direction of the monotonic trend segment is analyzed to obtain the unit slope of the monotonic trend segment; Regions with unit change slopes exceeding the slope threshold of the process parameters are marked as warp density abnormal bands and weft density abnormal bands.
[0013] In a preferred embodiment, the step of performing defect contour spatial integration on the grayscale image based on the fracture defect curve, the torsion defect curve, and the density defect region to obtain the detection result of the clothing fabric includes: Defect categories were marked for the fracture defect curve, torsion defect curve and density defect area respectively, resulting in fracture mark grouping, torsion mark grouping and density anomaly mark grouping for the clothing fabric. By performing coordinate normalization and aggregation on the fracture mark group, the torsion mark group, and the density anomaly mark group, a defect distribution map of the clothing fabric is obtained. The defect locations in the defect distribution map are smoothed to obtain the inspection results of the clothing fabric.
[0014] In a preferred embodiment, to achieve full-dimensional coverage detection of fabric defects, the original detection logic is extended in two directions: For weft yarn breakage defects, the detection logic for warp yarn breakage defects is used, and the weft yarn curve is discretely integraled pixel by pixel along the weft yarn direction to obtain the stretch ratio distribution of the weft yarn curve. Combined with the trend extension of the breakage candidate area and the tolerance judgment of the predicted bonding deviation, the weft yarn breakage defect curve is marked; For warp yarn twisting defects, the detection logic for weft yarn twisting defects is used, and the extreme point morphology of the curvature sequence of the warp yarn curve is identified. Combined with the theoretical weave cycle length, the cumulative deviation of the cycle is calculated to mark the warp yarn twisting defect curve. The extended scheme can cover all types of breakage and twisting defects in the warp / weft directions of woven fabrics, avoid detection blind spots, and improve the completeness and accuracy of detection results.
[0015] To address the aforementioned problems, the present invention also provides a machine vision-based garment fabric defect detection system for executing the machine vision-based garment fabric defect detection method described in the above embodiments. The system includes: The yarn curve separation module is used to separate the grayscale image of the garment fabric into warp curves and weft curves according to the yarn direction. The fracture defect detection module is used to extrapolate the elongation of the warp curve, obtain the elongation ratio of the warp curve, and mark the warp curve with an elongation ratio lower than the preset ideal elongation threshold as a fracture defect curve. The twist defect detection module is used to perform weft curvature analysis on the weft curve, obtain the bending change rate of the weft curve, and mark the weft curve with non-periodic fluctuations in the bending change rate as a twist defect curve. The density defect detection module is used to count the number of yarns on the warp and weft curves and mark the grayscale image where the number of warp and weft yarns does not match the process parameters as a density defect area. The defect integration output module is used to perform spatial integration of defect contours on grayscale images based on fracture defect curves, torsion defect curves, and density defect regions to obtain the detection results of clothing fabrics.
[0016] Compared with the prior art, the present invention has the following beneficial effects: 1. This invention separates the grayscale image of clothing fabric into warp and weft curves according to the yarn direction, and then sequentially performs warp elongation deduction, weft curvature analysis, and yarn quantity statistics. This allows for precise quantitative determination of defects such as warp breakage, weft twisting, and abnormal yarn density, achieving accurate extraction and localization of defect features. It comprehensively covers the core defect types of the fabric, ensuring the accuracy and comprehensiveness of defect detection results. Utilizing techniques such as discrete curvature integral, trend extension, and cumulative period deviation calculation, it can stably and accurately mark defect curves and defect areas, ensuring the reliability of defect detection from a technical perspective.
[0017] 2. This invention integrates defect contours based on fracture defect curves, torsion defect curves, and density defect regions. Through category labeling, coordinate normalization aggregation, and boundary smoothing, it rapidly generates standardized detection results, simplifying the integration and output process of detection data and significantly improving the overall efficiency of garment fabric defect detection. This invention achieves integrated detection and output of multiple types of defects without requiring separate execution of different defect detection processes. It optimizes the detection logic and execution steps, reduces the complexity of the detection process, and can adapt to the high-efficiency and large-scale application requirements of garment fabric industrial testing. Attached Figure Description
[0018] Figure 1 This is a schematic flowchart of a machine vision-based method for detecting defects in clothing fabrics, provided in an embodiment of the present invention. Figure 2 A functional block diagram of a machine vision-based garment fabric defect detection system provided in an embodiment of the present invention; Figure 3 A bar chart comparing the detection rates of different defect types in clothing fabrics; Figure 4 A line graph showing the trend of the slope of the unit change in yarn spacing under different sliding windows.
[0019] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0020] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0021] This application provides a machine vision-based method for detecting defects in clothing fabrics. The execution entity of this machine vision-based method includes, but is not limited to, at least one of the following electronic devices that can be configured to execute the method provided in this application: a server, a terminal, etc. In other words, the machine vision-based method for detecting defects in clothing fabrics can be executed by software or hardware installed on a terminal device or a server device. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cluster of cloud servers. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0022] Reference Figure 1 The diagram shown is a flowchart illustrating a machine vision-based method for detecting defects in clothing fabrics according to an embodiment of the present invention. In this embodiment, the machine vision-based method for detecting defects in clothing fabrics includes: S01. Based on the yarn direction, separate the grayscale image of the garment fabric into warp curves and weft curves; In this embodiment of the invention, separating the grayscale image of the garment fabric into warp curves and weft curves according to the yarn direction includes: Texture direction analysis is performed on the grayscale image of the clothing fabric to obtain the local direction angle of the grayscale image; Based on the local orientation angle, consistent path tracing is performed on the grayscale image to obtain the warp and weft curves of the grayscale image.
[0023] Traverse every pixel in the grayscale image of the clothing fabric, select a fixed range of neighboring pixels centered on a single pixel, extract the grayscale distribution features of all pixels within the neighboring region, determine the texture extension direction of the pixel's location based on the grayscale distribution features, and define this direction as the local orientation angle corresponding to the current pixel.
[0024] Perform the above operation on all pixels in the grayscale image one by one to determine the texture extension direction of all pixels, record the local direction angle corresponding to each pixel, and form a set of local direction angles covering the entire grayscale image, thereby obtaining the local direction angle of the grayscale image.
[0025] Select an initial pixel from the edge of the grayscale image, retrieve the local orientation angle corresponding to the initial pixel, select the next adjacent pixel according to the direction pointed to by the local orientation angle, confirm that the local orientation angle of the next adjacent pixel is consistent with the local orientation angle of the initial pixel, and connect the two pixels to form a path segment.
[0026] Continue selecting subsequent pixels in the above manner. Each time a pixel is selected, check whether the local orientation angle of the current pixel is consistent with that of the previous pixel. Only retain pixels with consistent angles and add them to the path. Continuously extend the path segment until it reaches the boundary of the grayscale image to form a complete continuous path.
[0027] Throughout the entire path extension process, the local orientation angle of each newly added pixel is checked against the overall orientation angle of the formed path. Pixels with mismatched angles are removed to ensure that the orientation of the entire path remains consistent and that there is no directional deviation.
[0028] The entire grayscale image is traversed, and all continuous paths that meet the angle consistency requirements are generated in the same way to ensure that the path corresponding to each texture in the image is completely extracted without any omissions.
[0029] The direction of all generated continuous paths in the grayscale image is distinguished, and all continuous paths extending longitudinally are selected. The shape of each path is then organized and standardized to form the corresponding warp curve.
[0030] All continuous paths extending horizontally are selected, and their shapes are organized and standardized one by one to form the corresponding weft curves.
[0031] A comprehensive check is conducted on all completed warp curves to ensure that each warp curve is made up of pixels connected continuously at the same angle, without any breaks, overlaps, or offsets.
[0032] A comprehensive check was conducted on all the completed weft curves to ensure that each weft curve was made up of pixels connected continuously at the same angle, without any breaks, overlaps or offsets.
[0033] After completing the sorting, classification and verification of all warp and weft curves, all qualified warp and weft curves are integrated and presented, and finally the warp and weft curves in grayscale images are obtained.
[0034] The beneficial effects include pixel-by-pixel analysis of the grayscale image of the fabric to determine local direction angles, enabling precise local direction angle acquisition across the entire image area, providing a reliable directional basis for subsequent path extraction. Through consistent path tracing and rigorous verification of pixel angle matching, continuous paths with uniform direction and no offset are generated, completely extracting all texture paths within the image and avoiding path omissions or breaks. Distinguishing the direction and standardizing the shape of continuous paths allows for precise separation of regular warp and weft curves. A comprehensive verification process ensures no curve breaks or intersections, ultimately achieving stable separation of warp and weft curves. This provides standard and complete basic curve data for subsequent fabric defect detection, improving the accuracy and completeness of curve extraction and ensuring the smooth operation of subsequent inspection processes.
[0035] S02. Perform elongation calculation on the warp curve to obtain the warp curve stretch ratio, and mark the warp curve with the stretch ratio lower than the preset ideal stretch threshold as the breakage defect curve. In this embodiment of the invention, the step of performing elongation deduction on the warp curve to obtain the warp curve stretch ratio, and marking warp curves with stretch ratios lower than a preset ideal stretch threshold as breakage defect curves, includes: Along the warp direction, the warp curve is discretely integraled pixel by pixel to obtain the warp curve stretch ratio distribution; The locations in the stretch ratio distribution that are below the preset ideal stretch threshold are used as candidate areas for breakage of the warp curve; By extending the trend on both sides of the fracture candidate region, the predicted joint deviation of the fracture candidate region is obtained. The predicted bonding deviation is judged to exceed the tolerance range, and the breakage defect curve of the warp curve is obtained.
[0036] The step of trend extension on both sides of the fracture candidate region to obtain the predicted joint deviation of the fracture candidate region includes: The optimal phase offset of the fracture candidate region is obtained by performing sliding inner product optimization between the upstream and downstream curvatures of the fracture candidate region. Based on the optimal phase offset, the waveform periodic extension and reconstruction of the upstream warp curve of the fracture candidate area is performed to obtain the cross-fracture continuation trajectory of the upstream side curve. The continuity bias is quantified between the end point of the cross-fracture continuation trajectory and the starting point of the warp curve on the downstream side of the fracture candidate area to obtain the predicted joint deviation of the fracture candidate area.
[0037] Along the natural extension direction of the warp curve, each pixel on the warp curve is selected as an independent analysis object. Taking the currently analyzed pixel as the core, and combining the spatial positions of the pixels immediately in front of and behind it, the curvature and extension state of the warp curve at that pixel are determined. The curvature and extension state corresponding to all pixels on the warp curve are sequentially and orderly integrated according to the overall direction of the warp, forming a complete state set covering the entire warp curve. This state set is directly used as the extension ratio distribution of the warp curve.
[0038] Examine the specific state of the stretch ratio at each position in the stretch ratio distribution of the warp curve one by one, and accurately filter out all positions in the stretch ratio distribution that have not reached the preset ideal stretch threshold. Delineate these filtered positions into regions, and the delineated regions are the candidate areas for warp curve breakage.
[0039] The side of the candidate fracture region closest to the start of the warp curve is defined as the upstream side. All curvature features of the warp curve within the upstream side region are extracted. The side of the candidate fracture region furthest from the start of the warp curve is defined as the downstream side. All curvature features of the warp curve within the downstream side region are extracted. The curvature features of the upstream side and the curvature features of the downstream side are matched one by one in a step-by-step displacement manner. The positional relationship during the matching process is continuously adjusted until the position state in which the curvature of the upstream side and the curvature of the downstream side are most closely matched is found. The displacement amount corresponding to this position state is the optimal phase offset amount of the candidate fracture region.
[0040] According to the extension law determined by the optimal phase offset, the original waveform characteristics and extension trend of the upstream warp curve in the fracture candidate area are kept unchanged, and the curve shape is continuously extended into the interior space of the fracture candidate area. The extension process always strictly follows the original trend of the upstream warp curve until it extends to the downstream boundary of the fracture candidate area, forming a continuous and complete curve shape. This curve shape is the cross-fracture continuation trajectory of the upstream side curve.
[0041] The pixel at the very end of the fracture continuation trajectory is determined as the terminal point, and the pixel at the first connection of the warp curve downstream of the fracture candidate area is determined as the starting point. The spatial relationship between the terminal point and the starting point in the grayscale image is accurately verified, and the spatial difference between the two points is completely converted into the deviation state of the curve connection. This deviation state is the predicted joining deviation of the fracture candidate area.
[0042] The predicted joining deviation corresponding to the fracture candidate area is compared with the preset tolerance range to directly determine whether the predicted joining deviation is within the range defined by the tolerance range. When the predicted joining deviation is outside the range defined by the tolerance range, the warp curve segment corresponding to the fracture candidate area is marked with a special defect mark. The warp curve segment after the special defect mark is the fracture defect curve of the warp curve.
[0043] The beneficial effects include determining the curve extension state pixel by pixel along the warp direction and forming an extension ratio distribution, which can completely present the overall extension state of the warp curve, accurately lock the candidate area of breakage, and provide a clear analysis range for defect judgment. By matching the curvature features of upstream and downstream to determine the optimal phase offset, the original extension law of the warp curve can be accurately restored, and a cross-breakage continuation trajectory that fits the real trend can be constructed. The connection deviation between the end of the trajectory and the starting point of the downstream can be accurately quantified to obtain an objective prediction of the joining deviation. Combined with the tolerance range judgment, the real breakage defect can be accurately identified, avoiding false and false defects. The entire process relies on the characteristics of the warp curve itself to complete the analysis, reconstruction and judgment, ensuring that the breakage defect curve marking results are true and reliable, providing accurate breakage defect basis for garment fabric defect detection, and improving the stability and accuracy of defect identification.
[0044] S03. Perform weft curvature analysis on the weft curve to obtain the bending change rate of the weft curve, and mark the weft curve with non-periodic fluctuations in the bending change rate as a twist defect curve. In this embodiment of the invention, the step of performing weft curvature analysis on the weft yarn curve to obtain the bending change rate of the weft yarn curve, and marking the weft yarn curve with non-periodic fluctuations in the bending change rate as a twist defect curve, includes: The extreme point morphology of the curvature sequence of the weft yarn curve is identified to obtain the curvature peak of the curvature sequence; Along the direction of the weft yarn, the spatial position of the curvature peaks is extracted segment by segment to obtain the peak spacing of the weft yarn curve; Based on the preset theoretical organization cycle length, the difference accumulation comparison of the peak spacing is carried out to obtain the cumulative amount of period deviation of the peak spacing. Local weft curves where the cumulative deviation of three or more consecutive cycles exceeds the threshold and the ratios between them are not close to integers are marked as twist defect curves.
[0045] The step of comparing the cumulative difference in the peak spacing based on the preset theoretical cycle length to obtain the cumulative period deviation of the peak spacing includes: The crest spacing is summed to obtain the actual cumulative arc length; Based on the preset theoretical organization cycle length, the crest spacing is projected and mapped to obtain the ideal cumulative arc length of the crest spacing; Based on the actual cumulative arc length and the ideal cumulative arc length, the cumulative period deviation of the wave crest spacing sequence is calculated. The formula for calculating the cumulative period deviation is as follows: ; In the formula, For the cumulative amount of periodic deviation, This represents the total number of spacings in the wave crest spacing. For the index of the crest spacing, It is a natural constant. The imaginary unit, Pi is a constant. For the index of the crest spacing, For the first The value of the distance between the peaks. The preset theoretical organization cycle length.
[0046] Along the overall extension direction of the weft curve, all bending changes of the weft curve from the beginning to the end are completely sorted out, and these bending changes are arranged in sequence according to the direction of the weft yarn to form a curvature sequence that completely covers the entire weft curve.
[0047] By comparing the curvature state of each position in the curvature sequence with its immediate and adjacent positions, the curvature variation characteristics of each position are determined. All points with a curvature greater than that of their immediate and adjacent positions are selected. The morphological characteristics of these selected points are confirmed, and points that conform to the peak shape are retained. These confirmed points are the curvature peaks of the curvature sequence.
[0048] Along the fixed direction of the weft curve, determine the specific spatial position of each curvature peak in the grayscale image in turn, and record the spatial positions of all curvature peaks in order of appearance.
[0049] According to the arrangement order of the curvature peaks, the positions of every two adjacent curvature peaks are matched, and the spatial distance between the two adjacent curvature peaks is extracted. All the spatial distances corresponding to the adjacent curvature peaks are sorted in sequence to form a complete distance set. This distance set is the peak spacing of the weft curve.
[0050] Following the extension sequence of the weft curve, starting from the first wave crest spacing, each subsequent wave crest spacing is connected and integrated in turn, so that all wave crest spacings form a continuous length state. This continuous length state is the actual cumulative arc length of the wave crest spacing.
[0051] Using the preset theoretical tissue cycle length as a reference standard, each wave crest spacing is mapped to the standard position of the theoretical tissue cycle length, completing the position projection of all wave crest spacings. All wave crest spacings are then integrated according to the standard relationship after projection to form a continuous length that conforms to the theoretical rules. This continuous length is the ideal cumulative arc length of the wave crest spacing.
[0052] The actual cumulative arc length and the ideal cumulative arc length are matched in position and length throughout the entire process. The degree of matching between the actual and ideal states of each crest spacing is confirmed one by one. All matching differences are integrated in the order of the crest spacing to form a complete difference accumulation result. This result is the period deviation accumulation of the crest spacing sequence.
[0053] Check each item in the cumulative period deviation in turn, filter out three or more consecutive cumulative period deviations that exceed the preset threshold, check the correspondence between these consecutive cumulative period deviations, and confirm that the ratios between them are not close to integers.
[0054] Locate the local area of the weft curve corresponding to the cumulative deviation of these continuous cycles, and mark the defect of the weft curve in the local area. The local weft curve after the mark is the twist defect curve.
[0055] The total number of peak spacings is obtained by counting the number of adjacent curvature peaks in the weft yarn curve. The peak spacing value is obtained by extracting the spatial distance between adjacent curvature peaks in the grayscale image. The preset theoretical weave cycle length is a fixed length related to the fabric weave. The peak spacing index is formed by marking the peak spacings in sequence.
[0056] This formula maps the cumulative position of the crest spacing to the phase space of the theoretical weave cycle, uses complex numbers to represent the phase deviation between the cumulative position of each crest spacing and the theoretical cycle, and then sums up all the phase deviations and takes the modulus to finally obtain the cumulative period deviation, thereby reflecting the periodicity of the crest spacing of the weft curve and the consistency with the theoretical weave cycle.
[0057] When the crest spacing perfectly matches the theoretical tissue cycle length, the phase deviation between the cumulative position of all crest spacings and the theoretical cycle is zero, the magnitude of the summation result is a fixed value, and the calculated cumulative deviation of the cycle is zero. When the crest spacing deviates from the theoretical tissue cycle length, a phase deviation occurs, the magnitude of the summation result changes, and the calculated cumulative deviation of the cycle changes accordingly. The deviation state of the crest spacing corresponds one-to-one with the value of the cumulative deviation of the cycle.
[0058] The beneficial effects include: by analyzing the curvature sequence formed by the bending changes of the weft yarn curve, the bending characteristics of the weft yarn throughout its entire path can be fully presented; the curvature peaks can be accurately identified and the peak spacing extracted, clearly reflecting the arrangement pattern of the weft yarn. Based on the theoretical organization cycle length, the actual and ideal cumulative arc lengths are obtained, objectively generating the cumulative periodic deviation, accurately reflecting the periodic compliance status of the weft yarn bending. Through the compliance determination of the continuous periodic deviation, local areas of the weft yarn with non-periodic fluctuations can be accurately located, completing the precise marking of the twist defect curve. The entire analysis and determination are based on the morphological characteristics of the weft yarn itself, effectively avoiding misjudgment and omission of twist defects, providing a stable and accurate basis for the determination of twist defects in clothing fabrics, and improving the accuracy and reliability of weft yarn defect identification.
[0059] S04. Perform yarn count on the warp and weft curves, and mark the grayscale images where the warp and weft yarn counts do not match the process parameters as density defect areas. In this embodiment of the invention, the step of counting the number of warp and weft yarns, and marking images in grayscale images where the number of warp and weft yarns does not match the process parameters as density defect areas, includes: The warp space distance of the warp curve is traversed along the warp advance direction, and the warp space distance is topologically mapped to obtain the warp spacing matrix of the warp distance; The weft yarn spatial distance of the weft yarn curve is traversed along the weft advance direction, and the weft yarn spatial distance is topologically mapped to obtain the weft yarn spacing matrix of the weft yarn spatial distance. Based on the warp and weft spacing matrices, regions within the window where the spacing values continuously increase or decrease and the slope exceeds the process parameters are marked as warp density abnormal stripes and weft density abnormal stripes. The positions in the warp spacing matrix and weft spacing matrix where the spacing of a single point exceeds the multiplication factor of the median of the neighborhood are marked as isolated warp points and isolated weft points, respectively. The continuous spatial range covered by abnormal warp density bands, abnormal weft density bands, isolated warp points, and isolated weft points is output as density defect areas.
[0060] The method, based on the warp and weft spacing matrices, marks regions within a window where the spacing values continuously increase or decrease and the slope exceeds the process parameters as warp density aberration bands and weft density aberration bands, including: Based on the warp and weft yarn spacing matrices, continuous sequences with the same sign of difference are extracted window by window to obtain monotonic trend segments within each window. The rate of change of direction of the monotonic trend segment is analyzed to obtain the unit slope of the monotonic trend segment; Regions with unit change slopes exceeding the slope threshold of the process parameters are marked as warp density abnormal bands and weft density abnormal bands.
[0061] Along the longitudinal direction of the warp curve, the analysis area of the warp curve is selected sequentially with a fixed movement range. The spatial distance between two adjacent warp curves is accurately extracted in each analysis area. All the extracted warp spatial distances are arranged one by one according to the warp direction and the lateral distribution position. Each warp spatial distance is placed on a dedicated position node to form a complete two-dimensional distance arrangement structure. This two-dimensional distance arrangement structure is the warp spacing matrix of the warp distance.
[0062] Along the lateral advancement direction of the weft curve, the analysis area of the weft curve is selected sequentially with a fixed movement range. The spatial distance between two adjacent weft curves is accurately extracted within each analysis area. All extracted weft spatial distances are arranged in a corresponding manner according to the weft direction and the longitudinal distribution position. Each weft spatial distance is placed on a dedicated position node to form a complete two-dimensional distance arrangement structure. This two-dimensional distance arrangement structure is the weft spacing matrix of the weft spatial distance.
[0063] Using a fixed-size region in the warp spacing matrix as the analysis window, the warp space distances of adjacent positions are read sequentially within the window. The difference is obtained by subtracting the distance state of the previous position from the distance state of the next position. All continuous distance combinations with consistent signs of the differences are retained. This combination is the monotonic trend segment within the window corresponding to the warp spacing matrix.
[0064] Using a fixed-size region in the weft yarn spacing matrix as the analysis window, the spatial distance of the weft yarns at adjacent positions is read sequentially within the window. The difference is obtained by subtracting the distance state of the previous position from the distance state of the next position. All continuous distance combinations with consistent signs of the differences are retained. This combination is the monotonic trend segment within the window corresponding to the weft yarn spacing matrix.
[0065] For monotonic trend segments within the warp spacing matrix, corresponding analysis is performed by combining the overall extension length of the segment with the change range of distance state to determine the change of distance state corresponding to each unit extension length. This change is the unit change slope of the warp monotonic trend segment.
[0066] For monotonic trend segments within the weft yarn spacing matrix, corresponding analysis is performed by combining the overall extension length of the segment with the change range of distance state to determine the change of distance state corresponding to each unit extension length. This change is the unit change slope of the monotonic trend segment of the weft yarn.
[0067] The unit change slope of the warp yarn monotonic trend segment is directly compared with the slope threshold set by the process parameters. The image area corresponding to the monotonic trend segment whose unit change slope exceeds the slope threshold is marked. This marked area is the warp yarn density abnormal strip.
[0068] The unit change slope of the weft yarn monotonic trend segment is directly compared with the slope threshold set by the process parameters. The image area corresponding to the monotonic trend segment whose unit change slope exceeds the slope threshold is marked. This marked area is the weft yarn density abnormal strip.
[0069] In the warp spacing matrix, a single warp space distance is selected as the analysis point. The neighborhood distance state of a fixed range around the point is extracted, and the median value of the neighborhood distance state is determined. The median value is multiplied by a preset multiplication factor to obtain the reference state. The distance state of the analysis point is compared with the reference state. Points whose distance state exceeds the reference state are isolated warp points.
[0070] In the weft spacing matrix, select a single weft spatial distance as the analysis point, extract the neighborhood distance state of a fixed range around the point, determine the median value of the neighborhood distance state, use the median value and a preset multiplication factor to obtain the reference state, compare the distance state of the analysis point with the reference state, and the point whose distance state exceeds the reference state is the isolated weft point.
[0071] By integrating all image positions corresponding to warp density anomaly bands, weft density anomaly bands, isolated warp points, and isolated weft points, the correlation between corresponding parameters in the above-mentioned abnormal data is further analyzed: the unit change slope of the warp monotonic trend segment corresponding to the warp density anomaly band is cross-compared with the unit change slope of the weft monotonic trend segment corresponding to the weft density anomaly band. If the slope signs are opposite in the spatially overlapping area (i.e., one increases and the other decreases) or the absolute value of the slope exceeds the high magnification range of their respective process parameter thresholds, it is determined that there is a bidirectional density compression or stretching anomaly in this area, and the defect area needs to be expanded. The spatial proximity coupling analysis is performed on the distance states corresponding to isolated warp yarn points and isolated weft yarn points. If the distance states between isolated points exceed the upper limit of the neighborhood median multiplier factor and the spatial distance between them is less than the preset proximity threshold, they are identified as continuous isolated defect clusters, and their coverage areas are merged. Simultaneously, the gradient direction of the unit change slope is vector-consistent with the deviation direction of the isolated points. If the slope gradient direction is orthogonal or opposite to the deviation direction of the isolated points, it indicates a combined defect of density abrupt change and local yarn slippage, requiring an extension of at least one yarn cycle buffer zone beyond the original defined area. Based on the above parameter relationship analysis results, the initially defined continuous image space is dynamically adjusted—merging closely related abnormal bands and isolated points, the boundaries of the expansion composite defect region, and eliminating isolated false positive points caused by occasional parameter fluctuations. Finally, the optimized continuous image range is obtained, and this range is output as the density defect region.
[0072] The beneficial effects include: generating warp and weft yarn spacing matrices to fully present the distribution of yarn spacing, providing a clear basis for density anomaly identification; extracting monotonic trend segments and analyzing the unit change slope to accurately locate anomalous bands with continuously changing spacing; and identifying isolated points through neighborhood reference comparison to achieve comprehensive coverage of different types of density anomalies. Integrating various anomaly markers to delineate density defect areas can accurately present the complete range of fabric density anomalies, avoiding the limitations of identifying single defect types, providing a stable and reliable basis for detecting density defects in clothing fabrics, and improving the comprehensiveness and accuracy of density defect identification.
[0073] S05. Based on the fracture defect curve, torsion defect curve and density defect region, the grayscale image is spatially integrated to obtain the detection results of the clothing fabric.
[0074] In this embodiment of the invention, the step of performing defect contour spatial integration on a grayscale image based on fracture defect curves, torsion defect curves, and density defect regions to obtain the detection results of the clothing fabric includes: Defect categories were marked for the fracture defect curve, torsion defect curve and density defect area respectively, resulting in fracture mark grouping, torsion mark grouping and density anomaly mark grouping for the clothing fabric. By performing coordinate normalization and aggregation on the fracture mark group, the torsion mark group, and the density anomaly mark group, a defect distribution map of the clothing fabric is obtained. The defect locations in the defect distribution map are smoothed to obtain the inspection results of the clothing fabric.
[0075] One by one, all the fracture defect curves in the grayscale image are sorted out, and each fracture defect curve is labeled with a unique defect category feature to ensure that each fracture defect curve can be clearly distinguished. All the labeled fracture defect curves are then integrated in the order of their distribution in the grayscale image to form a unique defect group. This defect group is the fracture mark grouping of the clothing fabric.
[0076] One by one, all the distortion defect curves in the grayscale image are sorted out, and each distortion defect curve is labeled with a unique defect category feature to ensure that each distortion defect curve can be clearly distinguished. All the labeled distortion defect curves are then integrated in the order of their distribution in the grayscale image to form a unique defect group. This defect group is the distortion mark grouping of the clothing fabric.
[0077] One by one, all density defect areas in the grayscale image are sorted out, and each density defect area is labeled with a unique defect category feature to ensure that each density defect area can be clearly distinguished. All labeled density defect areas are then grouped together according to their distribution order in the grayscale image to form a unique defect group. This defect group is the density anomaly marker group for clothing fabrics.
[0078] A unified coordinate reference standard is determined for the entire grayscale image. The fixed corners of the grayscale image are used as the coordinate starting points, and the horizontal and vertical directions of the image are used as the coordinate extension directions to construct a coordinate reference system covering the entire image.
[0079] The location information of all defects in the fracture marker group is mapped one by one to the coordinate reference system to complete the standardized transformation of the location information. The location information of all defects in the torsion marker group is mapped one by one to the coordinate reference system to complete the standardized transformation of the location information. The location information of all defects in the density anomaly marker group is mapped one by one to the coordinate reference system to complete the standardized transformation of the location information.
[0080] The fracture marker group, torsion marker group, and density anomaly marker group, which have completed coordinate standardization transformation, are seamlessly superimposed and integrated according to their actual spatial positions in the grayscale image. This allows the morphological characteristics and spatial positions of the three types of defects to be fully presented in the same image space without overlap, occlusion, or positional deviation. The integrated image is the defect distribution map of the clothing fabric.
[0081] Locate the outline edges of all defect locations on the defect distribution map. Starting from the starting point of each defect outline, adjust each connecting point on the outline edge in sequence to keep the connection trajectory between adjacent points continuous and smooth, and remove abrupt connections and sharp edges from the outline edges.
[0082] The same adjustment method is used to process the contour edges of each defect location in the defect distribution map, fully covering all defect contours corresponding to the fracture mark group, twist mark group, and density anomaly mark group, ensuring that the edges of all defect contours are uniformly and smoothly adjusted.
[0083] All defect contours that have undergone edge smoothing adjustments are thoroughly checked one by one to confirm that the edges of each defect contour remain continuous and complete, without any breaks, distorted shapes, or missing contours.
[0084] When obtaining the test results of the clothing fabric, further cross-parameter correlation analysis is performed on the stretch ratio and predicted bonding deviation in the fracture defect curve, the cumulative period deviation in the torsion defect curve, and the unit change slope and isolated point distance in the density defect region: regions with low stretch ratio and cumulative period deviation exceeding the threshold in the spatially overlapping region are marked as "fracture-torsion" composite defects; regions with the gradient direction of the unit change slope consistent with the deviation direction of the isolated point are merged into density anomaly enhancement regions; finally, the test results containing single defect contours and composite defect association labels are output.
[0085] The defect distribution map after boundary smoothing is completely saved, retaining the category characteristics, spatial location and complete outline of all defects. This verified and saved complete result is the inspection result of the clothing fabric.
[0086] The beneficial effects include the separate categorization and grouping of fracture defect curves, distortion defect curves, and density defect regions, clearly distinguishing different defect types and avoiding confusion and misinterpretation of defect information. By integrating the three types of defects into a single image space through coordinate normalization aggregation, the actual spatial location and morphological characteristics of all defects can be fully presented, forming a comprehensive and intuitive defect distribution map. Boundary smoothing of defect locations ensures that the defect outlines remain continuous and regular, fully preserving the category and location information of the defects, ultimately resulting in standardized and clear inspection results. This unified presentation of multiple defect types enhances the completeness and intuitiveness of the inspection results, providing an accurate and reliable basis for judging the quality of garment fabrics.
[0087] like Figure 2 The diagram shown is a functional block diagram of a machine vision-based garment fabric defect detection system according to an embodiment of the present invention, used for performing... Figure 1 The methods described herein are used to achieve the corresponding technical effects.
[0088] The machine vision-based garment fabric defect detection system 10 described in this invention can be installed in an electronic device. Depending on the functions implemented, the machine vision-based garment fabric defect detection system 10 may include a yarn curve separation module 11, a breakage defect detection module 12, a twisting defect detection module 13, a density defect detection module 14, and a defect integration and output module 15. The module described in this invention can also be called a unit, which refers to a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, and is stored in the memory of the electronic device.
[0089] In this embodiment, the functions of each module / unit are as follows: The yarn curve separation module 11 is used to separate the grayscale image of the garment fabric into warp curves and weft curves according to the yarn direction. The fracture defect detection module 12 is used to extrapolate the elongation of the warp curve, obtain the elongation ratio of the warp curve, and mark the warp curve with an elongation ratio lower than the preset ideal elongation threshold as a fracture defect curve. The twist defect detection module 13 is used to perform weft curvature analysis on the weft curve, obtain the bending change rate of the weft curve, and mark the weft curve with non-periodic fluctuations in the bending change rate as a twist defect curve. Density defect detection module 14 is used to count the number of yarns on the warp and weft curves and mark the grayscale image where the number of warp and weft yarns does not match the process parameters as a density defect area. The defect integration output module 15 is used to perform defect contour spatial integration on the grayscale image based on the fracture defect curve, the torsion defect curve and the density defect region to obtain the detection results of the clothing fabric.
[0090] Figure 3 In the chart, the vertical axis represents the detection rate as a percentage, ranging from 60% to 100%; the horizontal axis represents the detected defect types, categorized into three types: breakage, twisting, and density abnormalities. Two sets of comparative data are included in the chart: the blue bars represent the machine vision-based fabric defect detection method for clothing proposed in this patent, and the orange bars represent the traditional static threshold method / manual inspection method.
[0091] Specifically, the data shows that for fracture defects, the detection rate of this patented method is approximately 95%, while that of traditional methods is approximately 88%; for twisting defects, the detection rate of this patented method is approximately 90%, while that of traditional methods is approximately 80%; and for density anomaly defects, the detection rate of this patented method is approximately 88%, while that of traditional methods is approximately 77%. The entire graph clearly demonstrates that this patented method significantly outperforms traditional static threshold methods and manual detection methods in detecting the three core types of fabric defects, with particularly outstanding improvements in detecting twisting and density anomaly defects.
[0092] Figure 4 In the chart, the vertical axis represents the unit change slope, ranging from -1.5 to 0.5; the horizontal axis represents the detection position, ranging from 0 to 60. The chart contains three lines, corresponding to three different sizes of analysis windows: blue line represents window 5, orange line represents window 10, and yellow line represents window 20. A red dashed line represents the slope threshold set for the fabric process parameters, with 0 being the baseline for the unit change slope.
[0093] Within the detection range of 0 to 35, all three lines fluctuate periodically around the 0-value baseline, remaining within the slope threshold range and falling within the normal detection range. After detection position 35, all three lines exhibit a significant and continuous downward trend, with the unit change slope remaining negative for an extended period. The line at window 5 shows the largest fluctuation, dropping to a minimum of approximately -1.2 between positions 45 and 50, significantly exceeding the slope threshold. The downward fluctuation of the line at window 10 is the second largest, while the fluctuation of the line at window 20 is the most gradual, but it also deviates from the slope threshold range. This figure corresponds to the technical logic of the density defect detection process in this patent, visually demonstrating that by extracting monotonic trend segments and analyzing the unit change slope through sliding windows of different sizes, density anomaly areas exceeding the slope threshold of the process parameters can be accurately identified. It also illustrates the impact of the analysis window size on detection sensitivity: the smaller the window size, the more sensitive the capture of abnormal slopes, and the more prominent the defect characteristics.
[0094] In the several embodiments provided by this invention, it should be understood that the disclosed methods and systems can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0095] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0096] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0097] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0098] This application embodiment can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0099] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A machine vision-based method for detecting defects in clothing fabrics, characterized in that, The method includes: S01. Based on the yarn direction, separate the grayscale image of the garment fabric into warp curves and weft curves; S02. Perform elongation calculation on the warp curve to obtain the warp curve stretch ratio, and mark the warp curve with the stretch ratio lower than the preset ideal stretch threshold as the breakage defect curve. S03. Perform weft curvature analysis on the weft curve to obtain the bending change rate of the weft curve, and mark the weft curve with non-periodic fluctuations in the bending change rate as a twist defect curve. S04. Perform yarn count on the warp and weft curves, and mark the grayscale images where the warp and weft yarn counts do not match the process parameters as density defect areas. S05. Based on the fracture defect curve, torsion defect curve and density defect region, the grayscale image is spatially integrated to obtain the detection results of the clothing fabric.
2. The method for detecting defects in clothing fabrics based on machine vision as described in claim 1, characterized in that, The step of separating the grayscale image of the garment fabric into warp curves and weft curves based on the yarn direction includes: Texture direction analysis is performed on the grayscale image of the clothing fabric to obtain the local direction angle of the grayscale image; Based on the local orientation angle, consistent path tracing is performed on the grayscale image to obtain the warp and weft curves of the grayscale image.
3. The method for detecting defects in clothing fabrics based on machine vision as described in claim 1, characterized in that, The process of extrapolating the warp curve to obtain the warp curve's extension ratio, and marking warp curves with extension ratios lower than a preset ideal extension threshold as breakage defect curves, includes: Along the warp direction, the warp curve is discretely integraled pixel by pixel to obtain the warp curve stretch ratio distribution; The locations in the stretch ratio distribution that are below the preset ideal stretch threshold are used as candidate areas for breakage of the warp curve; By extending the trend on both sides of the fracture candidate region, the predicted joint deviation of the fracture candidate region is obtained. The predicted bonding deviation is judged to exceed the tolerance range, and the breakage defect curve of the warp curve is obtained.
4. The method for detecting defects in clothing fabrics based on machine vision as described in claim 3, characterized in that, The step of trend extension on both sides of the fracture candidate region to obtain the predicted joint deviation of the fracture candidate region includes: The optimal phase offset of the fracture candidate region is obtained by performing sliding inner product optimization between the upstream and downstream curvatures of the fracture candidate region. Based on the optimal phase offset, the waveform periodic extension and reconstruction of the upstream warp curve of the fracture candidate area is performed to obtain the cross-fracture continuation trajectory of the upstream side curve. The continuity bias is quantified between the end point of the cross-fracture continuation trajectory and the starting point of the warp curve on the downstream side of the fracture candidate area to obtain the predicted joint deviation of the fracture candidate area.
5. The method for detecting defects in clothing fabrics based on machine vision as described in claim 1, characterized in that, The weft curvature analysis of the weft yarn curve yields the rate of change of the weft yarn curve's bending, and weft yarn curves exhibiting non-periodic fluctuations in their rate of change of bending are marked as twist defect curves, including: The extreme point morphology of the curvature sequence of the weft yarn curve is identified to obtain the curvature peak of the curvature sequence; Along the direction of the weft yarn, the spatial position of the curvature peaks is extracted segment by segment to obtain the peak spacing of the weft yarn curve; Based on the preset theoretical organization cycle length, the difference accumulation comparison of the peak spacing is carried out to obtain the cumulative amount of period deviation of the peak spacing. Local weft curves where the cumulative deviation of three or more consecutive cycles exceeds the threshold and the ratios between them are not close to integers are marked as twist defect curves.
6. The method for detecting defects in clothing fabrics based on machine vision as described in claim 5, characterized in that, The step of comparing the cumulative difference in the peak spacing based on the preset theoretical cycle length to obtain the cumulative period deviation of the peak spacing includes: The crest spacing is summed to obtain the actual cumulative arc length; Based on the preset theoretical organization cycle length, the crest spacing is projected and mapped to obtain the ideal cumulative arc length of the crest spacing; Based on the actual cumulative arc length and the ideal cumulative arc length, the cumulative period deviation of the wave crest spacing sequence is calculated. The formula for calculating the cumulative period deviation is as follows: ; In the formula, For the cumulative amount of periodic deviation, This represents the total number of spacings in the wave crest spacing. For the index of the crest spacing, It is a natural constant. The imaginary unit, Pi is a constant. For the index of the crest spacing, For the first The value of the distance between the peaks. The preset theoretical organization cycle length.
7. The method for detecting defects in clothing fabrics based on machine vision as described in claim 1, characterized in that, The step of counting the number of warp and weft yarns, and marking images in grayscale images where the number of warp and weft yarns does not match the process parameters as density defect areas, includes: The warp space distance of the warp curve is traversed along the warp advance direction, and the warp space distance is topologically mapped to obtain the warp spacing matrix of the warp distance; The weft yarn spatial distance of the weft yarn curve is traversed along the weft advance direction, and the weft yarn spatial distance is topologically mapped to obtain the weft yarn spacing matrix of the weft yarn spatial distance. Based on the warp and weft spacing matrices, regions within the window where the spacing values continuously increase or decrease and the slope exceeds the process parameters are marked as warp density abnormal stripes and weft density abnormal stripes. The positions in the warp spacing matrix and weft spacing matrix where the spacing of a single point exceeds the multiplication factor of the median of the neighborhood are marked as isolated warp points and isolated weft points, respectively. The continuous spatial range covered by abnormal warp density bands, abnormal weft density bands, isolated warp points, and isolated weft points is output as density defect areas.
8. The method for detecting defects in clothing fabrics based on machine vision as described in claim 7, characterized in that, The method, based on the warp and weft spacing matrices, marks regions within a window where the spacing values continuously increase or decrease and the slope exceeds the process parameters as warp density aberration bands and weft density aberration bands, including: Based on the warp and weft yarn spacing matrices, continuous sequences with the same sign of difference are extracted window by window to obtain monotonic trend segments within each window. The rate of change of direction of the monotonic trend segment is analyzed to obtain the unit slope of the monotonic trend segment; Regions with unit change slopes exceeding the slope threshold of the process parameters are marked as warp density abnormal bands and weft density abnormal bands.
9. The method for detecting defects in clothing fabrics based on machine vision as described in claim 1, characterized in that, The method involves spatially integrating the defect contours of the grayscale image based on the fracture defect curve, the torsion defect curve, and the density defect region to obtain the detection results of the clothing fabric, including: Defect categories were marked for the fracture defect curve, torsion defect curve and density defect area respectively, resulting in fracture mark grouping, torsion mark grouping and density anomaly mark grouping for the clothing fabric. By performing coordinate normalization and aggregation on the fracture mark group, the torsion mark group, and the density anomaly mark group, a defect distribution map of the clothing fabric is obtained. The defect locations in the defect distribution map are smoothed to obtain the inspection results of the clothing fabric.
10. A machine vision-based defect detection system for clothing fabrics, characterized in that, The system for implementing the machine vision-based method for detecting defects in clothing fabrics according to any one of claims 1-9 includes: The yarn curve separation module is used to separate the grayscale image of the garment fabric into warp curves and weft curves according to the yarn direction. The fracture defect detection module is used to extrapolate the elongation of the warp curve, obtain the elongation ratio of the warp curve, and mark the warp curve with an elongation ratio lower than the preset ideal elongation threshold as a fracture defect curve. The twist defect detection module is used to perform weft curvature analysis on the weft curve, obtain the bending change rate of the weft curve, and mark the weft curve with non-periodic fluctuations in the bending change rate as a twist defect curve. The density defect detection module is used to count the number of yarns on the warp and weft curves and mark the grayscale image where the number of warp and weft yarns does not match the process parameters as a density defect area. The defect integration output module is used to perform spatial integration of defect contours on grayscale images based on fracture defect curves, torsion defect curves, and density defect regions to obtain the detection results of clothing fabrics.
