A fabric flaw intelligent detection method and system based on machine vision
By employing a machine vision-based intelligent fabric defect detection method, utilizing controlled lighting and texture directionality enhancement technology, combined with curvature feature matching, the problem of detection stability under complex textures and lighting fluctuations is solved, achieving efficient and accurate fabric defect detection and reliable defect localization.
Patent Information
- Application Number
- CN202610331455.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-18
- Publication Date
- 2026-06-16
Smart Images

Figure CN122222978A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of fabric inspection technology, and in particular to a machine vision-based intelligent method and system for detecting fabric defects. Background Technology
[0002] In the quality inspection of the apparel and textile industry, there are challenges such as repetitive textures, diverse defect morphologies, and easily changing imaging conditions. Traditional manual visual inspection is not only inefficient, but its accuracy is also significantly affected by the experience and fatigue of the personnel. Although automated visual inspection has applied statistical, spectral (such as Gabor texture analysis) and learning methods (such as CNN / YOLO) methods, it is still often affected by factors such as uneven lighting, motion blur, and lens contamination in actual production lines, resulting in decreased detection stability. At the same time, learning-based methods are highly dependent on labeled data, training and inference computing power, and have high deployment and maintenance costs, making it difficult to achieve low-latency, low-storage continuous online detection and traceability on some devices. Summary of the Invention
[0003] In view of the above technical problems, the present invention provides a machine vision-based intelligent detection method and system for fabric defects, which aims to solve the problems of missed / false detection, difficulty in stable positioning of defect boundaries, and limitations in real-time performance and cost due to reliance on large-scale training data and high computing power in online quality inspection scenarios during continuous fabric production. In this way, reliable judgment and traceable positioning of fabric defects can be achieved.
[0004] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.
[0005] According to one aspect of the present invention, a machine vision-based intelligent detection method for fabric defects is proposed, the method comprising: Acquire an image of the fabric to be inspected under controlled lighting conditions, and perform grayscale conversion and geometric correction on the image of the fabric to be inspected to form a reference image; The reference image is preprocessed, including smoothing and denoising, illumination non-uniformity compensation, and texture directionality enhancement, to obtain a preprocessed image. Edge extraction is performed on the preprocessed image to generate an edge map, and contour tracking is performed on the edge map to obtain a series of contour point sequences. The contour point sequences are composed of contour points arranged in order and satisfy closure constraints. When the contour is truncated at the image boundary, the contour point sequence includes the truncated endpoint. For each of the contour point sequences, according to the point selection strategy of maximizing the coverage area, the preceding contour point and the following contour point are selected from the contour point sequence for the current contour point to be calculated, so as to construct a local point set structure. For each of the local point set structures, calculate the exterior angle at the current contour point, the directionality of the exterior angle, and the radius of curvature determined by the local point set structure. Obtain a signed curvature value from the radius of curvature, and associate the signed curvature value with the pixel coordinates of the current contour point to form a curvature feature set. Based on the relationship between the outer angle and the flat angle threshold, the local point set structure is subjected to concavity and convexity discrimination. At the point where the concavity and convexity change, the current contour point is recorded as a key point. In the section where the concavity and convexity remain consistent, the number of recorded points is reduced according to the preset thinning rule to suppress the abnormal curvature radius caused by the excessive density of adjacent contour points. Anti-aliasing smoothing is performed on the curvature feature set to obtain a continuous defect boundary trajectory. The curvature feature set is matched with a pre-established defect feature interval library, which includes the curvature radius interval, outer angle interval, and concavity / convexity pattern corresponding to each defect type, so as to output the defect judgment result of the fabric image to be detected, and provide defect boundary positioning information based on the matched contour point position.
[0006] Furthermore, during the continuous movement of the fabric, image frames are acquired through continuous sampling, and stitched together based on the overlapping areas between the image frames to form a strip image covering a predetermined field of view; the controlled lighting conditions include pulse width modulation control of the lighting components to achieve rapid switching and brightness adjustment, and a software synchronization mechanism to ensure that the emission timing of the lighting components is consistent with the exposure timing of the imaging device; when outputting the defect boundary positioning information, the physical location of the defect in the fabric length direction and circumferential direction is estimated by combining the time stamp of the image frames and the motion state parameters of the fabric conveying mechanism.
[0007] Furthermore, the texture directionality enhancement processing includes: determining a Gabor kernel parameter set based on the main texture direction and main spatial frequency of the fabric, wherein the Gabor kernel parameter set includes scale parameters, orientation parameters, wavelength parameters, aspect ratio parameters, and phase parameters; generating a two-dimensional Gabor convolution kernel based on the Gabor kernel parameter set, performing convolution on the reference image to obtain a Gabor response map; calculating the energy density in a local region of the Gabor response map to obtain an energy density map; when the energy density meets a preset energy threshold condition, marking the corresponding local region as a candidate defect region, and using the candidate defect region to guide the threshold adjustment of the edge extraction and the region priority setting of the contour tracking.
[0008] Furthermore, the edge extraction employs gradient-based multi-level threshold edge detection, and performs non-maximum suppression and hysteresis thresholding on the preprocessed image before edge extraction to obtain continuous edges; the contour tracking uses a boundary-following topological analysis method to output contour level information, stores each contour point sequence as an ordered vertex array, and divides the ordered vertex array into several sub-contour segments.
[0009] Furthermore, the point selection strategy includes: selecting the preceding contour point and the following contour point in the contour point sequence using an adaptive stepping method. The adaptive stepping is adjusted according to the curvature change of the neighborhood of the current contour point, so that the coverage area of the local geometric structure formed by the preceding contour point, the current contour point, and the following contour point reaches a predetermined lower limit. When the local area is approximately collinear, the stepping is increased to avoid abnormal enlargement of the radius of curvature. At the same time, the shape fidelity of the defect boundary is maintained while reducing the number of contour points involved in the calculation.
[0010] Furthermore, the process of forming the curvature feature set also includes: Calculate the first distance from the preceding contour point to the current contour point, the second distance from the current contour point to the following contour point, and the third distance from the preceding contour point to the following contour point; determine the exterior angle at the current contour point based on the first distance, the second distance, and the third distance; determine the directionality of the exterior angle by the sign of the cross product of the vectors formed by the first distance and the second distance; calculate the radius of curvature according to the functional relationship between the third distance and the sine value of the exterior angle, and obtain the signed curvature value from the reciprocal of the radius of curvature, wherein anti-aliasing filtering is introduced when calculating the sine value of the exterior angle to obtain sub-pixel level boundary sampling.
[0011] Furthermore, the unevenness determination includes: Based on the size relationship between the exterior angle and the flat angle threshold, the local geometric structure is determined to be convex, concave, or approximately straight. Concavity / convexity labels are added to each record in the curvature feature set. At the same time, directional curvature identifiers are generated based on the concavity / convexity labels. The local geometric structure is formed by the previous contour point, the current contour point, and the subsequent contour point. When the direction curvature identifier changes, the curvature radius, exterior angle, and direction curvature identifier corresponding to the current contour point are written into the boundary feature list, so that the boundary feature list prioritizes the retention of contour points with significant geometric changes and suppresses redundant points.
[0012] Furthermore, the defect feature interval library includes multi-dimensional discrimination rules constructed based on the distribution of radius of curvature, the distribution of exterior angles, the concavity and convexity patterns, and the statistics of contour directions. The multi-dimensional discrimination rules are used to distinguish between hole-type defects, oil stain-type defects, broken needle-type defects, elastic yarn abnormality-type defects, and stripe-type defects. While outputting the defect judgment result, a feature list containing contour point coordinates, radius of curvature, exterior angles, and concavity and convexity labels is generated as a compressed representation to replace the storage of the original image for subsequent quality traceability.
[0013] According to another aspect of the present invention, a machine vision-based intelligent fabric defect detection system is provided, comprising: The acquisition module is used to acquire images of the fabric to be inspected under controlled lighting conditions, and to perform grayscale conversion and geometric correction on the images of the fabric to be inspected to form a reference image. The preprocessing module is used to perform preprocessing on the reference image. The preprocessing includes smoothing and denoising, illumination non-uniformity compensation, and texture directionality enhancement to obtain a preprocessed image. The contour tracking module is used to perform edge extraction based on the preprocessed image to generate an edge map, and perform contour tracking on the edge map to obtain a plurality of contour point sequences, wherein the contour point sequences are composed of contour points arranged in order and satisfy closure constraints; when the contour is truncated at the image boundary, the contour point sequence includes the truncated endpoints. The point set construction module is used to select the preceding and following contour points from the contour point sequence for the current contour point to be calculated according to the point selection strategy of maximizing the coverage area for each contour point sequence, so as to construct a local point set structure. The curvature feature construction module is used to calculate the exterior angle at the current contour point, the directionality of the exterior angle, and the radius of curvature determined by the local point set structure for each of the local point set structures, obtain a signed curvature value from the radius of curvature, and associate the signed curvature value with the pixel coordinates of the current contour point to form a curvature feature set; The boundary synthesis module is used to determine the concavity and convexity of the local point set structure based on the relationship between the outer angle and the flat angle threshold. At the point where the concavity and convexity change, the current contour point is recorded as a key point. In the section where the concavity and convexity remain consistent, the number of recorded points is reduced according to a preset thinning rule to suppress the abnormal radius of curvature caused by the excessive density of adjacent contour points. Anti-aliasing smoothing is performed on the curvature feature set to obtain a continuous defect boundary trajectory. The defect comparison module is used to match the curvature feature set with a pre-established defect feature interval library. The defect feature interval library contains the curvature radius interval, outer angle interval, and concavity / convexity pattern corresponding to each defect type, so as to output the defect judgment result of the fabric image to be detected, and provide defect boundary positioning information based on the matched contour point position.
[0014] The technical solution of the present invention has the following beneficial effects: This invention employs a detection method that combines texture enhancement, boundary extraction, contour geometric features, and rule matching to make defect determination more closely reflect the essential differences in the boundary shape of fabric defects. Specifically, the filtering enhancement approach using texture direction can improve the separability of defects from regular textures; the sub-pixel level smooth trajectory construction based on geometric quantities such as curvature / exterior angle of contour points can enhance boundary continuity and improve positioning stability; and the approach of replacing the original image storage with a small number of features such as curvature and angle can significantly reduce the data storage and traceability burden of online operation and accelerate the detection process. Attached Figure Description
[0015] Figure 1 This is a flowchart of a machine vision-based intelligent fabric defect detection method as described in the embodiments of this specification. Figure 2 This is a structural block diagram of a machine vision-based intelligent fabric defect detection system as described in the embodiments of this specification. Figure 3 This is a structural block diagram of a machine vision-based intelligent fabric defect detection device as described in the embodiments of this specification. Figure 4 This specification describes a computer-readable storage medium that stores a machine vision-based intelligent fabric defect detection method in one of its embodiments. Detailed Implementation
[0016] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this disclosure more comprehensive and complete, and to fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more of the specific details omitted, or other methods, components, systems, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this disclosure.
[0017] Furthermore, the accompanying drawings are merely illustrative of this disclosure. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor systems and / or microcontroller systems.
[0018] This invention provides a machine vision-based intelligent detection method for fabric defects. (Refer to...) Figure 1 The diagram shown is a flowchart illustrating a machine vision-based intelligent fabric defect detection method according to an embodiment of the present invention. This method can be applied to electronic devices such as personal computers and servers. The method can be executed by a device, which can be implemented by software and / or hardware. Specifically, the method may include the following steps S101-S107: In step S101, an image of the fabric to be tested is acquired under controlled lighting conditions, and the image of the fabric to be tested is converted to grayscale and geometrically corrected to form a reference image.
[0019] In this process, when acquiring images of the fabric to be inspected, image frames are obtained through continuous sampling during the continuous movement of the fabric. The overlapping areas between the image frames are then stitched together to form a strip image covering a predetermined field of view. The controlled lighting conditions include pulse width modulation control of the lighting components to achieve rapid switching and brightness adjustment, and a software synchronization mechanism to ensure that the emission timing of the lighting components is consistent with the exposure timing of the imaging device. This allows the physical location of the defect in the fabric length and circumferential directions to be estimated by combining the time stamps of the image frames and the motion state parameters of the fabric conveying mechanism when outputting the defect boundary location information.
[0020] As an explanation, the images of the fabric to be inspected originate from the continuously moving fabric conveyor. The imaging stage, as the raw input to the vision system, directly impacts subsequent analysis and decision-making due to the quality of the acquired images. Therefore, clear and calibrated image data is required. In rotating or high-speed motion scenarios, the focus is on addressing blurring caused by speed and changes in illumination. The imaging device needs to adjust its acquisition frequency according to the motion state and adapt to changing lighting conditions to ensure that the visual data relied upon for defect localization is sufficiently accurate and timely. In continuous sampling mode, the imaging device acquires image frames at a fixed frame rate and performs stitching by combining overlapping areas between adjacent frames. This allows the stitched strip image to cover a predetermined field of view and continuously track the fabric surface. In a spiral rotating fabric motion platform, the imaging device can be positioned inside a rotating drum and move up and down with the mechanism to follow the fabric's movement. The rotation speed is controlled, and the imaging device captures images of the vertical area of the fabric. The stitched image is used to track the rotation trajectory of the sample fabric. Defect localization can be determined based on the amount of time elapsed and the rotation speed, thereby marking the defect location. To achieve controlled illumination conditions, the illumination components are custom-designed for imaging requirements under high-speed motion, enhancing specific defects and obtaining high-quality images during high-speed rotation. Illumination control employs pulse-width modulation (PWM) to achieve millisecond-level switching and brightness adjustment, reducing the thermal load from high-power illumination and shortening the duty cycle. Simultaneously, to address potential camera-illumination asynchrony issues introduced by the flicker mechanism, a software synchronization mechanism ensures that the illumination emission sequence matches the imaging device's exposure sequence, minimizing the impact of brightness fluctuations and motion blur on boundary details. When forming the reference image, the image of the fabric to be inspected is grayscaled to unify brightness representation and reduce interference from color differences in subsequent boundary and contour information extraction. Geometric correction normalizes distortions, viewpoint deviations, and scale inconsistencies introduced by the imaging device to a stable coordinate system, ensuring that the stitched strip images maintain a consistent pixel scale and orientation reference in space, thus obtaining a reference image suitable for subsequent processing. Based on this acquisition and synchronization mechanism, each frame of image retains a time stamp, and combined with the motion state parameters of the fabric conveying mechanism (including speed, rotation speed, etc.), the physical position of the defect in the fabric length direction and circumferential direction is estimated when the defect boundary is output. The time elapsed and the motion speed are used to map the image coordinates to the actual position on the fabric motion path, so as to realize the traceable marking of the defect.
[0021] In step S102, preprocessing is performed on the reference image, including smoothing and denoising, illumination non-uniformity compensation, and texture directionality enhancement, to obtain a preprocessed image.
[0022] The texture directionality enhancement process includes: determining a Gabor kernel parameter set based on the main texture direction and main spatial frequency of the fabric, wherein the Gabor kernel parameter set includes scale parameters, orientation parameters, wavelength parameters, aspect ratio parameters, and phase parameters; generating a two-dimensional Gabor convolution kernel based on the Gabor kernel parameter set, performing convolution on the reference image to obtain a Gabor response map; calculating the energy density in a local region of the Gabor response map to obtain an energy density map; when the energy density meets a preset energy threshold condition, marking the corresponding local region as a candidate defect region, and using the candidate defect region to guide the threshold adjustment of the edge extraction and the region priority setting of the contour tracking.
[0023] As an explanation, in step S102, the reference image enters the preprocessing stage. The purpose is to improve the image's analyzability and reduce instability caused by environmental disturbances before boundary correlation operations. Since fabric surface images may be subject to adverse conditions such as strong diffuse illumination, camera noise, and motion blur during actual acquisition, the preprocessing stage uses smoothing denoising and illumination non-uniformity compensation to reduce the impact of random noise and brightness fluctuations on texture and defect responses, making subsequent responses to defect areas more concentrated and distinguishable. Smoothing denoising can be combined with a filter selection mechanism, allowing for image filtering beforehand to provide a more stable input for subsequent convolution and structure extraction. Illumination non-uniformity compensation focuses on grayscale drift caused by illuminance changes and shadows. By equalizing and normalizing the brightness distribution, it makes the spatial response of similar textures more consistent, thereby reducing the probability of misjudging illumination gradients as defect boundaries and providing a more reliable grayscale baseline for subsequent thresholding strategies. Texture directionality enhancement is achieved using two-dimensional Gabor filtering. The regular, repeating texture of the fabric is caused by both the principal spatial frequency and the principal direction. Two-dimensional Gabor filters are suitable for texture image analysis with significant frequency and direction characteristics. Aligning parameter selection with the texture to be detected can improve segmentation and discrimination results. During implementation, the Gabor kernel parameter set is determined based on the fabric's principal texture direction and principal spatial frequency. The parameter set includes kernel size ksize, scale parameter sigma, direction parameter theta, wavelength parameter lambda, aspect ratio parameter gamma, and phase parameter phi. A two-dimensional convolution kernel is then generated based on this, and two-dimensional convolution filtering is performed to obtain the Gabor response map. Energy density is calculated within local regions of the Gabor response map to form an energy density map. The energy density can be obtained by accumulating the pixel responses within a local window. When the energy density reaches a threshold, the corresponding region is determined to have abnormal texture features and can be marked as a candidate defect region. The candidate defect regions guide the threshold adjustment for subsequent edge extraction and the region priority setting for contour tracking, allowing computational resources to be concentrated in high-energy-density regions and reducing invalid searches. Meanwhile, to obtain smoother boundary trajectories, an independent anti-aliasing filter can be introduced in the preprocessing stage to perform sub-pixel-level smooth sampling of the lines and curves to be evaluated, making the boundary trajectory more continuous, reducing local abrupt changes caused by jagged edges and noise, and laying the foundation for subsequent geometric calculations based on contour points.
[0024] In step S103, edge extraction is performed based on the preprocessed image to generate an edge map, and contour tracking is performed on the edge map to obtain a number of contour point sequences. The contour point sequences are composed of contour points arranged in order and satisfy closure constraints. When the contour is truncated at the image boundary, the contour point sequence includes the truncated endpoint.
[0025] The edge extraction employs gradient-based multi-level threshold edge detection, and non-maximum suppression and hysteresis thresholding are performed on the preprocessed image before edge extraction to obtain continuous edges; the contour tracking uses a boundary-following topology analysis method to output contour level information, stores each contour point sequence as an ordered vertex array, and divides the ordered vertex array into several contour segments.
[0026] As an explanation, the preprocessed image enters the edge extraction stage to highlight the boundaries and contour-like structures of the fabric surface. This strengthens the defect boundaries from the regular texture background, forming an edge map that can be used for subsequent contour organization. In fabric defect detection scenarios, edge detection methods such as Canny can be used to highlight the boundaries. The effective edges in the edge map are then used for contour organization and structured representation. Edge extraction employs a gradient-based multi-level thresholding strategy. Edge strength is characterized by the gradient magnitude, and threshold grading is used to distinguish strong and weak edges and suppress background noise. To obtain continuous edges, non-maximum suppression is introduced before threshold determination, suppressing non-peak responses in the gradient direction and retaining only the refined edges at local maxima. Combined with hysteresis thresholding, weak edges connected to strong edges are retained as effective edges, making the edge map present a continuous boundary direction. This facilitates the formation of a stable point sequence for subsequent contour tracking with fewer local breaks.
[0027] Contour tracking performs boundary following and topological analysis based on the edge map, organizing the edges into contours and outputting hierarchical information. The contours are stored as ordered vertex arrays, serving as input for subsequent geometric calculations. This structuring process corresponds to applying contour algorithms to depict and organize the boundaries obtained from edge detection, and saving the resulting contours as arrays for later processing. The contour point sequence consists of sequentially arranged contour points. Closed contours satisfy the closure constraint of being consistent from beginning to end, and can be expressed as a polygon vertex sequence as follows: ; in Representing vertices in planar coordinates, closure constraints ensure the geometric closure of the contour, facilitating the subsequent analysis of the defect boundary as a complete target. When an edge is truncated at the image boundary, the contour point sequence retains the truncated endpoints, allowing the boundary to be fully recorded as endpoints upon reaching the boundary, serving as endpoint constraints for open contours in topological analysis and preventing the erroneous closure of invisible parts. To adapt to the subsequent segmented processing calculation method, the ordered vertex array can be further divided into several sub-contour segments. Valid edges in the edge map participate in subsequent calculations as sub-contours, and the defect boundary is jointly characterized by these contour segments, forming a set of boundary fragments.
[0028] In step S104, for each of the contour point sequences, according to the point selection strategy of maximizing the coverage area, the preceding contour point and the following contour point are selected from the contour point sequence for the current contour point to be calculated, so as to construct a local point set structure.
[0029] The point selection strategy includes: selecting the preceding contour point and the following contour point in the contour point sequence using an adaptive stepping method. The adaptive stepping is adjusted according to the curvature change of the neighborhood of the current contour point, so that the coverage area of the local geometric structure formed by the preceding contour point, the current contour point, and the following contour point reaches a predetermined lower limit. When the local area is approximately collinear, the stepping is increased to avoid abnormal enlargement of the radius of curvature. At the same time, the shape fidelity of the defect boundary is maintained while reducing the number of contour points involved in the calculation.
[0030] Specifically, each contour point sequence participates in the construction of local geometry as an ordered set of vertices. Around the current contour point to be calculated, the preceding contour point and the following contour point are selected from the same sequence to form a three-point structure, so that the local shape at the current point can be approximated by a triangle. The triangle is determined by the preceding contour point, the current contour point, and the following contour point. The three-point structure corresponds to the triangle defined by three points at the vertex to support the calculation basis of curvature-related quantities.
[0031] The point selection adopts a coverage maximization strategy, which is an improvement on the instability caused by sampling adjacent points in a close-to-close order in conventional discrete curvature processing: when points are selected too closely, the radius value is easily too large, resulting in inaccurate angle and radius calculations; the three-point selection method with maximizing coverage increases the coverage area formed by the three-point structure, making the triangle geometry more representative, thereby obtaining more reasonable radius and angle results.
[0032] Adaptive stepping is used to implement the coverage area constraint. It searches for candidate points forward and backward on the contour point sequence with the current contour point as the center. By adjusting the step span, the distance between the previous contour point and the subsequent contour point is controlled so that the coverage area of the three-point structure reaches the predetermined lower limit. When the curvature of the neighborhood changes more significantly, the stepping can be relatively converged to ensure that the local shape follows the boundary details. When the neighborhood is approximately collinear, the stepping is appropriately enlarged to avoid the three-point structure from degenerating into a slender triangle or a near-zero area structure. This suppresses the abnormal enlargement of the radius from the source and improves the numerical stability of the geometric quantities.
[0033] While ensuring shape fidelity, the coverage maximization strategy also reduces the number of contour points used. By reducing the number of points involved in the calculation, the calculation on the contour segment is more compact and the processing speed is faster, while still achieving more accurate and better curvature calculation results.
[0034] In step S105, for each of the local point set structures, the exterior angle at the current contour point, the directionality of the exterior angle, and the radius of curvature determined by the local point set structure are calculated. A signed curvature value is obtained from the radius of curvature, and the signed curvature value is associated with the pixel coordinates of the current contour point to form a curvature feature set.
[0035] Furthermore, when forming the curvature feature set, the method further includes: calculating a first distance from the preceding contour point to the current contour point, a second distance from the current contour point to the following contour point, and a third distance from the preceding contour point to the following contour point; determining the exterior angle at the current contour point based on the first distance, the second distance, and the third distance; determining the directionality of the exterior angle by the cross product sign of the vectors formed by the first distance and the second distance; calculating the radius of curvature according to the functional relationship between the third distance and the sine value of the exterior angle, and obtaining the signed curvature value from the reciprocal of the radius of curvature, wherein anti-aliasing filtering is introduced to obtain sub-pixel level boundary sampling when calculating the sine value of the exterior angle.
[0036] In step S105, the local point set structure consists of the preceding contour points. Current contour point and rear contour points The system constructs a curvature feature set by establishing the relationship between the exterior angle, exterior angle directionality, and radius of curvature around the current contour point and associating the results with the pixel coordinates of the current contour point. Curvature, as a measure of the rate of change of a curve from the tangent direction, can be calculated discretely at the boundary level, resulting in smoother boundary trajectories at sub-pixel resolution. After applying independent anti-aliasing filters to the lines and curves, the trajectories on the boundaries are more continuous, which is beneficial for the stable determination of angles and radii. For any vertex... Three points define a triangle, and the radius of the incircle of this triangle is... The signed curvature is obtained, satisfying: ; Furthermore, in the discrete calculation form, the expression for its exterior angle correlation is: ; in For the boundary at The outer angle formed at that point, Corresponding to the first distance, Corresponding to the second distance, This corresponds to the third distance. The directionality of the exterior angle is determined by the cross product of the vectors formed by the first and second distances. The cross product is expressed in determinant form as: ; The sign of the determinant is used to characterize the directionality of the exterior angle and establishes a correspondence with the sign of the signed curvature. The radius of curvature is obtained from the functional relationship between the third distance and the sine of the exterior angle, and is given after derivation using the law of cosines: ; And by using the property of vector product, we can obtain: ; in and These correspond to the second distance and the first distance, respectively. In the calculation... Anti-aliasing filtering is introduced to achieve sub-pixel level boundary sampling, which reduces the jaggedness error caused by rasterized boundaries and makes the changes in outer angles and radii more smooth as the contour point sequence changes. Finally, the pixel coordinates of each current contour point are... With the corresponding signed curvature , outer corner Together with their directionality, they form a curvature feature set, which is used for subsequent defect boundary analysis and type determination.
[0037] In step S106, the concavity and convexity of the local point set structure are determined based on the relationship between the outer angle and the flat angle threshold. The current contour point is recorded as a key point at the concavity and convexity change point. In the section where the concavity and convexity remain consistent, the number of recorded points is reduced according to a preset thinning rule to suppress the abnormal curvature radius caused by the excessive density of adjacent contour points. Anti-aliasing smoothing is performed on the curvature feature set to obtain a continuous defect boundary trajectory.
[0038] The concavity / convexity discrimination includes: determining whether the local geometric structure is convex, concave, or approximately linear based on the size relationship between the exterior angle and the flat angle threshold; attaching a concavity / convexity label to each record in the curvature feature set; and generating a directional curvature identifier based on the concavity / convexity label. The local geometric structure is formed by the previous contour point, the current contour point, and the subsequent contour point. When the directional curvature identifier changes, the curvature radius, exterior angle, and directional curvature identifier corresponding to the current contour point are written into the boundary feature list so that the boundary feature list preferentially retains contour points with significant geometric changes and suppresses redundant points.
[0039] For each local point set structure, utilize the exterior angle at the current contour point. The concavity / convexity of the curve is determined based on its magnitude relative to the flat angle threshold of 180°, and the determination result is written into the curvature feature set to form a directional curvature identifier that can be used for subsequent filtering and expression: when When the curvature is less than 180°, the directional curvature indicator is recorded as 1. When the curvature is greater than 180, the directional curvature is marked as 2. When the value is 180, the directional curvature indicator is recorded as 3, used to characterize the concavity / convexity and approximate straight-line properties of the local geometry at that point. The directional curvature indicator changes as the point progresses along the contour point sequence. When a change in the directional curvature indicator is detected, the curvature radius corresponding to that point is... , outer corner In addition, directional curvature identifiers are added to the boundary feature list, prioritizing points with more significant geometric changes. This allows for the representation of boundary morphology with fewer points and suppresses redundant points. In sections with consistent concavity and convexity, excessively dense junctions can lead to excessively large radius values. Therefore, a pre-defined thinning rule is used to reduce the number of recorded points, mitigating abnormal radii caused by excessively close adjacent points and significantly reducing the number of processing points to improve computational efficiency. Anti-aliasing smoothing is further applied to the curvature feature set, making the boundary trajectory more continuous at sub-pixel resolution. The intermediate features formed by curvature and direction angle can be considered as mapping features and smoothed using regression properties, resulting in a smoother boundary trajectory. This facilitates stable defect boundary localization based on the boundary feature list.
[0040] In step S107, the curvature feature set is matched with a pre-established defect feature interval library, which includes the curvature radius interval, outer angle interval, and concavity / convexity pattern corresponding to each defect type, so as to output the defect judgment result of the fabric image to be detected, and to give defect boundary positioning information based on the matched contour point position.
[0041] The defect feature interval library includes multi-dimensional discrimination rules constructed based on the distribution of radius of curvature, the distribution of exterior angles, the concavity and convexity patterns, and the statistics of contour direction. The multi-dimensional discrimination rules are used to distinguish between hole-type defects, oil stain-type defects, broken needle-type defects, elastic yarn abnormality-type defects, and stripe-type defects. While outputting the defect judgment result, a feature list containing contour point coordinates, radius of curvature, exterior angles, and concavity and convexity labels is generated as a compressed representation to replace the storage of the original image for subsequent quality traceability.
[0042] Specifically, the curvature feature set includes the pixel coordinates of boundary points and corresponding parameters such as the radius of curvature and exterior angle. These boundary parameters are considered as feature parameters of defects. Defects are identified by utilizing the range of values for the radius of curvature and exterior angle. Boundary segments collectively delineate the defect boundary, thus providing a basis for defect boundary localization. The defect feature interval library is organized using multi-dimensional discrimination rules. These rules are formed by statistical laws such as the distribution of the radius of curvature and the distribution of the exterior angle, and incorporate directional curvature identifiers generated by concavity / convexity patterns, allowing the geometric changes of the same boundary on a point sequence to be expressed in a compact form. In implementation, the boundary feature list can be used as matching input, and records are searched one by one according to the radius of curvature interval and the exterior angle interval. When the boundary feature list meets the preset interval conditions, the corresponding defect type is output. For example, when a record meets... and When the defect is identified as a hole or oil stain, and the record meets the requirements... and The defect is identified as either a horizontal or vertical stripe in the stripe-type defect, and the defect determination result is obtained accordingly. When locating the defect boundary, the pixel coordinate set recorded in the boundary feature list participating in the matching is used to fill the matched contour point positions back into the image coordinate system. Combined with boundary segmentation, the defect boundary is depicted to obtain the defect boundary location information.
[0043] The defect feature interval library covers common physical defect categories such as needle breakage, elastic yarn abnormalities, and oil stains. During matching, the matching logic, based on interval discrimination, further incorporates contour direction statistics and concavity / convexity patterns to stably distinguish differences in boundary direction, angle variations, and radius variations among different defects. For example, in practical operation, the collected defects include needle breakage, elastic yarn abnormalities, and oil stains. These defect types are analyzed separately to evaluate the ability of different methods to identify different defects, providing a basis for type coverage and rule refinement when establishing the interval library. Simultaneously, when outputting defect judgment results, a feature list is generated as a compressed representation. This feature list contains information such as contour point coordinates, exterior angles, and radii of curvature, using a smaller amount of data to replace the original image for quality traceability.
[0044] Based on the same line of thought, such as Figure 2 As shown, a machine vision-based intelligent fabric defect detection system is provided, comprising: The acquisition module 201 is used to acquire an image of the fabric to be tested under controlled lighting conditions, and to perform grayscale conversion and geometric correction on the image of the fabric to be tested to form a reference image. The preprocessing module 202 is used to perform preprocessing on the reference image. The preprocessing includes smoothing and denoising, illumination non-uniformity compensation, and texture directionality enhancement to obtain a preprocessed image. The contour tracking module 203 is used to perform edge extraction based on the preprocessed image to generate an edge map, and perform contour tracking on the edge map to obtain a plurality of contour point sequences, wherein the contour point sequences are composed of contour points arranged in order and satisfy closure constraints; when the contour is truncated at the image boundary, the contour point sequence includes the truncated endpoints. The point set construction module 204 is used to select the preceding and following contour points from the contour point sequence for the current contour point to be calculated according to the point selection strategy of maximizing the coverage area for each contour point sequence, so as to construct a local point set structure. The curvature feature construction module 205 is used to calculate the exterior angle at the current contour point, the directionality of the exterior angle, and the radius of curvature determined by the local point set structure for each of the local point set structures, obtain a signed curvature value from the radius of curvature, and associate the signed curvature value with the pixel coordinates of the current contour point to form a curvature feature set; The boundary synthesis module 206 is used to determine the concavity and convexity of the local point set structure based on the relationship between the outer angle and the flat angle threshold, record the current contour point as a key point at the concavity and convexity change, and reduce the number of recorded points in the section where the concavity and convexity remain consistent according to the preset thinning rule, so as to suppress the abnormal curvature radius caused by the excessive density of adjacent contour points, and perform anti-aliasing smoothing on the curvature feature set to obtain a continuous defect boundary trajectory. The defect comparison module 207 is used to match the curvature feature set with a pre-established defect feature interval library. The defect feature interval library contains the curvature radius interval, outer angle interval and concavity / convexity pattern corresponding to each defect type, so as to output the defect judgment result of the fabric image to be detected, and give the defect boundary positioning information according to the matched contour point position.
[0045] This system employs a detection approach that combines texture enhancement, boundary extraction, contour geometric features, and rule matching to make defect identification more closely resemble the essential differences in the boundary shape of fabric defects. Specifically, the filtering enhancement approach using texture direction can improve the separability of defects from regular textures; the sub-pixel level smooth trajectory construction based on geometric quantities such as curvature / exterior angle of contour points can enhance boundary continuity and improve positioning stability; and the approach of replacing the original image storage with a small number of features such as curvature and angle can significantly reduce the data storage and traceability burden of online operation and accelerate the detection process.
[0046] The specific details of each module / unit in the above system have been described in detail in the implementation method section. For any undisclosed details, please refer to the implementation method section, and therefore will not be repeated here.
[0047] Following the same line of thought, this specification also provides an intelligent fabric defect detection device based on machine vision, such as... Figure 3 As shown.
[0048] The intelligent fabric defect detection device based on machine vision can be the terminal device or server provided in the above embodiments.
[0049] Machine vision-based intelligent fabric defect detection devices can vary significantly in configuration and performance. They may include one or more processors 301, memory 302, and buses. Memory 302 may store one or more application programs or data. Memory 302 may include readable media in the form of volatile storage units, such as random access memory (RAM) and / or cache memory units, such as plug-in hard drives, smart media cards (SMC), secure digital cards (SD cards), flash cards, etc., and may further include read-only memory units. The application programs stored in memory 302 may include one or more program modules (not shown in the figures), including but not limited to: operating systems, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Furthermore, processor 301 may be configured to communicate with memory 302 to execute a series of computer-executable instructions stored in memory 302 on the machine vision-based intelligent fabric defect detection device. The machine vision-based intelligent fabric defect detection device may also include one or more power supplies 303, one or more wired or wireless network interfaces 304, one or more I / O interfaces (input / output interfaces) 305, and one or more external devices 306 (e.g., a keyboard). It may also communicate with one or more devices that enable user interaction with the device, and / or with any device that enables the device to communicate with one or more other computing devices (e.g., a router, network switch, etc.). This communication can be performed through the I / O interface 305. Furthermore, the device can also communicate with one or more networks (e.g., local area networks (LANs)) through the wired or wireless interface 304.
[0050] Figure 3 Only a machine vision-based intelligent fabric defect detection device with components is shown; those skilled in the art will understand that... Figure 3 The structure shown does not constitute a limitation on machine vision-based intelligent fabric defect detection equipment and may include fewer or more parts than shown, or combine certain parts, or have different arrangements of parts.
[0051] Specifically, in this embodiment, the machine vision-based intelligent fabric defect detection device includes a memory and one or more programs, wherein one or more programs are stored in the memory, and one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the machine vision-based intelligent fabric defect detection device, and is configured to be executed by one or more processors. The one or more programs include computer-executable instructions for performing the following: Acquire an image of the fabric to be inspected under controlled lighting conditions, and perform grayscale conversion and geometric correction on the image of the fabric to be inspected to form a reference image; The reference image is preprocessed, including smoothing and denoising, illumination non-uniformity compensation, and texture directionality enhancement, to obtain a preprocessed image. Edge extraction is performed on the preprocessed image to generate an edge map, and contour tracking is performed on the edge map to obtain a series of contour point sequences. The contour point sequences are composed of contour points arranged in order and satisfy closure constraints. When the contour is truncated at the image boundary, the contour point sequence includes the truncated endpoint. For each of the contour point sequences, according to the point selection strategy of maximizing the coverage area, the preceding contour point and the following contour point are selected from the contour point sequence for the current contour point to be calculated, so as to construct a local point set structure. For each of the local point set structures, calculate the exterior angle at the current contour point, the directionality of the exterior angle, and the radius of curvature determined by the local point set structure. Obtain a signed curvature value from the radius of curvature, and associate the signed curvature value with the pixel coordinates of the current contour point to form a curvature feature set. Based on the relationship between the outer angle and the flat angle threshold, the local point set structure is subjected to concavity and convexity discrimination. At the point where the concavity and convexity change, the current contour point is recorded as a key point. In the section where the concavity and convexity remain consistent, the number of recorded points is reduced according to the preset thinning rule to suppress the abnormal curvature radius caused by the excessive density of adjacent contour points. Anti-aliasing smoothing is performed on the curvature feature set to obtain a continuous defect boundary trajectory. The curvature feature set is matched with a pre-established defect feature interval library, which includes the curvature radius interval, outer angle interval, and concavity / convexity pattern corresponding to each defect type, so as to output the defect judgment result of the fabric image to be detected, and provide defect boundary positioning information based on the matched contour point position.
[0052] Based on the same idea, exemplary embodiments of the present invention also provide a computer-readable storage medium having a program product stored thereon capable of implementing the methods described above in this specification. In some possible embodiments, various aspects of this disclosure can also be implemented as a program product including program code, which, when the program product is run on a terminal device, causes the terminal device to perform the steps according to the various exemplary embodiments of this disclosure described in the "Exemplary Methods" section above.
[0053] refer to Figure 4 As shown, a program 400 for implementing the above-described method according to an exemplary embodiment of the present disclosure is described. This program may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, system, or device.
[0054] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections with one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0055] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, system, or device.
[0056] Program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, CSS, and HTML, as well as conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0057] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal system, or network device, etc.) to execute the method according to the exemplary embodiments of this disclosure.
[0058] Furthermore, the above figures are merely illustrative representations of the processes included in the methods according to exemplary embodiments of this disclosure, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0059] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to exemplary embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0060] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.
[0061] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A machine vision-based intelligent detection method for fabric defects, characterized in that, The method includes: Acquire an image of the fabric to be inspected under controlled lighting conditions, and perform grayscale conversion and geometric correction on the image of the fabric to be inspected to form a reference image; The reference image is preprocessed, including smoothing and denoising, illumination non-uniformity compensation, and texture directionality enhancement, to obtain a preprocessed image. Edge extraction is performed on the preprocessed image to generate an edge map, and contour tracking is performed on the edge map to obtain a series of contour point sequences. The contour point sequences are composed of contour points arranged in order and satisfy closure constraints. When the contour is truncated at the image boundary, the contour point sequence includes the truncated endpoint. For each of the contour point sequences, according to the point selection strategy of maximizing the coverage area, the preceding contour point and the following contour point are selected from the contour point sequence for the current contour point to be calculated, so as to construct a local point set structure. For each of the local point set structures, calculate the exterior angle at the current contour point, the directionality of the exterior angle, and the radius of curvature determined by the local point set structure. Obtain a signed curvature value from the radius of curvature, and associate the signed curvature value with the pixel coordinates of the current contour point to form a curvature feature set. Based on the relationship between the outer angle and the flat angle threshold, the local point set structure is subjected to concavity and convexity discrimination. At the point where the concavity and convexity change, the current contour point is recorded as a key point. In the section where the concavity and convexity remain consistent, the number of recorded points is reduced according to the preset thinning rule to suppress the abnormal curvature radius caused by the excessive density of adjacent contour points. Anti-aliasing smoothing is performed on the curvature feature set to obtain a continuous defect boundary trajectory. The curvature feature set is matched with a pre-established defect feature interval library, which includes the curvature radius interval, outer angle interval, and concavity / convexity pattern corresponding to each defect type, so as to output the defect judgment result of the fabric image to be detected, and provide defect boundary positioning information based on the matched contour point position.
2. The intelligent fabric defect detection method based on machine vision according to claim 1, characterized in that, During the continuous movement of the fabric, image frames are acquired by continuous sampling, and the overlapping areas between the image frames are stitched together to form a strip image covering a predetermined field of view; the controlled lighting conditions include performing pulse width modulation control on the lighting components to achieve rapid switching and brightness adjustment, and using a software synchronization mechanism to make the emission timing of the lighting components consistent with the exposure timing of the imaging device. When outputting the defect boundary location information, the physical location of the defect in the fabric length direction and circumferential direction is estimated by combining the time stamp of the image frame and the motion state parameters of the fabric conveying mechanism.
3. The intelligent fabric defect detection method based on machine vision according to claim 1, characterized in that, The texture directionality enhancement process includes: determining a Gabor kernel parameter set based on the main texture direction and main spatial frequency of the fabric, wherein the Gabor kernel parameter set includes scale parameters, orientation parameters, wavelength parameters, aspect ratio parameters, and phase parameters; generating a two-dimensional Gabor convolution kernel based on the Gabor kernel parameter set, performing convolution on the reference image to obtain a Gabor response map; calculating the energy density in a local region of the Gabor response map to obtain an energy density map; when the energy density meets a preset energy threshold condition, marking the corresponding local region as a candidate defect region, and using the candidate defect region to guide the threshold adjustment of the edge extraction and the region priority setting of the contour tracking.
4. The intelligent fabric defect detection method based on machine vision according to claim 1, characterized in that, The edge extraction employs gradient-based multi-level threshold edge detection, and non-maximum suppression and hysteresis thresholding are performed on the preprocessed image before edge extraction to obtain continuous edges; the contour tracking uses a boundary-following topological analysis method to output contour level information, stores each contour point sequence as an ordered vertex array, and divides the ordered vertex array into several contour segments.
5. The intelligent fabric defect detection method based on machine vision according to claim 1, characterized in that, The point selection strategy includes: selecting the preceding contour point and the following contour point in the contour point sequence in an adaptive stepping manner. The adaptive stepping is adjusted according to the curvature change of the neighborhood of the current contour point, so that the coverage area of the local geometric structure formed by the preceding contour point, the current contour point and the following contour point reaches a predetermined lower limit. When the local area is approximately collinear, the stepping is increased to avoid abnormal enlargement of the radius of curvature. At the same time, the shape fidelity of the defect boundary is maintained while reducing the number of contour points involved in the calculation.
6. The intelligent fabric defect detection method based on machine vision according to claim 1, characterized in that, The process of forming the curvature feature set also includes: Calculate the first distance from the preceding contour point to the current contour point, the second distance from the current contour point to the following contour point, and the third distance from the preceding contour point to the following contour point; determine the exterior angle at the current contour point based on the first distance, the second distance, and the third distance; determine the directionality of the exterior angle by the sign of the cross product of the vectors formed by the first distance and the second distance; calculate the radius of curvature according to the functional relationship between the third distance and the sine value of the exterior angle, and obtain the signed curvature value from the reciprocal of the radius of curvature, wherein anti-aliasing filtering is introduced when calculating the sine value of the exterior angle to obtain sub-pixel level boundary sampling.
7. The intelligent fabric defect detection method based on machine vision according to claim 1, characterized in that, The concavity / convexity determination includes: Based on the size relationship between the exterior angle and the flat angle threshold, the local geometric structure is determined to be convex, concave, or approximately straight. Concavity / convexity labels are added to each record in the curvature feature set. At the same time, directional curvature identifiers are generated based on the concavity / convexity labels. The local geometric structure is formed by the previous contour point, the current contour point, and the subsequent contour point. When the direction curvature identifier changes, the curvature radius, exterior angle, and direction curvature identifier corresponding to the current contour point are written into the boundary feature list, so that the boundary feature list prioritizes the retention of contour points with significant geometric changes and suppresses redundant points.
8. The intelligent fabric defect detection method based on machine vision according to claim 1, characterized in that, The defect feature interval library includes multi-dimensional discrimination rules constructed based on the distribution of radius of curvature, the distribution of exterior angles, the concavity and convexity patterns, and the statistics of contour direction. The multi-dimensional discrimination rules are used to distinguish between hole defects, oil stain defects, broken needle defects, elastic yarn abnormality defects, and stripe defects. While outputting the defect judgment result, a feature list containing contour point coordinates, radius of curvature, exterior angles, and concavity and convexity labels is generated as a compressed representation to replace the storage of the original image for subsequent quality traceability.
9. A machine vision-based intelligent fabric defect detection system, characterized in that, include: The acquisition module is used to acquire images of the fabric to be inspected under controlled lighting conditions, and to perform grayscale conversion and geometric correction on the images of the fabric to be inspected to form a reference image. The preprocessing module is used to perform preprocessing on the reference image. The preprocessing includes smoothing and denoising, illumination non-uniformity compensation, and texture directionality enhancement to obtain a preprocessed image. The contour tracking module is used to perform edge extraction based on the preprocessed image to generate an edge map, and perform contour tracking on the edge map to obtain a plurality of contour point sequences, wherein the contour point sequences are composed of contour points arranged in order and satisfy closure constraints; when the contour is truncated at the image boundary, the contour point sequence includes the truncated endpoints. The point set construction module is used to select the preceding and following contour points from the contour point sequence for the current contour point to be calculated according to the point selection strategy of maximizing the coverage area for each contour point sequence, so as to construct a local point set structure. The curvature feature construction module is used to calculate the exterior angle at the current contour point, the directionality of the exterior angle, and the radius of curvature determined by the local point set structure for each of the local point set structures, obtain a signed curvature value from the radius of curvature, and associate the signed curvature value with the pixel coordinates of the current contour point to form a curvature feature set; The boundary synthesis module is used to determine the concavity and convexity of the local point set structure based on the relationship between the outer angle and the flat angle threshold. At the point where the concavity and convexity change, the current contour point is recorded as a key point. In the section where the concavity and convexity remain consistent, the number of recorded points is reduced according to a preset thinning rule to suppress the abnormal radius of curvature caused by the excessive density of adjacent contour points. Anti-aliasing smoothing is performed on the curvature feature set to obtain a continuous defect boundary trajectory. The defect comparison module is used to match the curvature feature set with a pre-established defect feature interval library. The defect feature interval library contains the curvature radius interval, outer angle interval, and concavity / convexity pattern corresponding to each defect type, so as to output the defect judgment result of the fabric image to be detected, and provide defect boundary positioning information based on the matched contour point position.