Method, system and device for detecting effective breadth of cloth based on machine vision
By combining machine vision technology with edge detection and pinhole recognition algorithms, the problems of low efficiency, unstable accuracy, and high cost in effective width measurement in textile fabric production have been solved, achieving efficient and accurate online inspection and improving production efficiency and quality control.
Patent Information
- Application Number
- CN202511683419.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-17
- Publication Date
- 2026-02-06
AI Technical Summary
In existing textile fabric production, the methods for measuring effective width suffer from problems such as low efficiency, unstable accuracy, interference from fabric characteristics, and complex and costly models, making it difficult to achieve efficient and accurate online detection.
A machine vision-based approach is adopted, which uses image preprocessing, edge detection, and pinhole recognition algorithms to obtain the fabric edge contour and pinhole location, calculate the effective width and full width, and integrate them into a unified algorithm framework to achieve continuous online measurement.
It enables continuous online real-time accurate measurement of the effective width of fabric, reducing costs, improving production efficiency and quality control, and possesses good functional expandability and anti-interference capabilities.
Smart Images

Figure CN121482407A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical fields of "intelligent manufacturing" and "high-end testing instruments and equipment", and relates to a method, system and device for detecting the effective width of fabric based on machine vision. Background Technology
[0002] In the textile fabric production process, the effective width (i.e., the usable width between the selvage holes on both sides of the fabric) is a crucial process parameter. It directly affects the fabric utilization rate, the adaptability to subsequent processing, and the specifications and quality of the final product, and is one of the key indicators for measuring fabric quality. Therefore, achieving real-time, online, and accurate measurement and recording of the effective width on a continuous production line is of great significance for ensuring product quality, improving production efficiency, and realizing the automation of process control.
[0003] Currently, the main methods for measuring width in industrial production fall into the following categories:
[0004] (1) Manual measurement method: This method relies on operators to manually measure the fabric in operation using physical measuring tapes. Its disadvantages are obvious: it is difficult to achieve real-time online measurement and continuous recording, and the measurement behavior is intermittent; when the fabric width is wide, two people are required to cooperate, which is inefficient; and the measurement accuracy is affected by human factors such as operator experience, perspective, and fatigue, resulting in poor stability.
[0005] (2) Infrared detection method: For example, the "fabric width measurement system" proposed by Wang Jihua et al. uses the principle of infrared beam transmission to estimate the width by the number of beams blocked by the fabric. Although this method achieves non-contact measurement, its measurement results are easily affected by the characteristics of the fabric itself (such as color depth and uneven thickness), leading to systematic errors. More importantly, this method cannot distinguish between the "full width" and "effective width" of the fabric, while the latter is precisely the net width parameter that is more important in process control.
[0006] To overcome the shortcomings of traditional methods, machine vision-based detection schemes have been proposed. However, many challenges remain in the technical path for achieving the effective fabric width (i.e., accurately locating fabric edges and pinholes). These challenges are as follows:
[0007] Option 1: A dual-class detection scheme based on a defect detection model: Treating "fabric edges" and "fabric edge pinholes" as two types of defects for unified detection. Although this scheme achieves model integration, its detection performance requires high stability of the fabric edges and is highly susceptible to interference from complex fabric textures and changes in ambient lighting, leading to false positives and false negatives, and lacking robustness.
[0008] Option 2: A multi-task model based on keypoint detection. This option adds a keypoint detection branch to the defect detection network to simultaneously output the coordinates of the fabric edge and pinholes. This approach offers high accuracy and lightweight joint detection, but its model structure is complex and training is difficult. More challenging is the extremely high cost of labeling a large number of pinholes with keypoints, making it impractical for engineering implementation.
[0009] Option 3: Independent Fabric Edge Detection Solution. This solution completely separates fabric edge detection from pinhole detection, using traditional image processing algorithms or deep learning models to detect the fabric edge separately. This solution is robust and easy to optimize, but it cannot directly obtain the pinhole location information necessary for the effective fabric width. To achieve full functionality, an additional pinhole detection module must be developed, requiring the system to independently train and maintain multiple models, increasing complexity and cost.
[0010] In summary, existing width measurement technologies, whether traditional methods or emerging machine vision solutions, all have varying degrees of shortcomings, such as insufficient accuracy and stability, or excessive cost and complexity. In particular, there is a lack of a comprehensive solution that can efficiently, accurately, robustly, and cost-effectively locate both the fabric edge and the pinhole simultaneously, thereby directly calculating the effective width.
[0011] Therefore, there is an urgent need for an innovative testing method to completely solve the above problems and meet the pressing needs of the modern textile industry for high-quality online testing. Summary of the Invention
[0012] This application provides a machine vision-based method, system, and apparatus for detecting the effective width of fabric, which solves the problems of low efficiency of manual measurement, interference from fabric characteristics and inability to distinguish the effective width of infrared methods, and poor robustness, complex and costly models, and system redundancy in the detection of fabric edges and pinholes in existing machine vision solutions, which make it difficult to accurately measure the effective width in an integrated manner.
[0013] In a first aspect, this application provides a machine vision-based method for detecting the effective width of fabric. The method includes: acquiring several original images of running fabric along a fabric path; preprocessing the original images of the running fabric to obtain preprocessed images of the running fabric; using an edge detection method to detect the images of the running fabric and obtaining a fabric edge contour image and fabric edge coordinates; wherein the fabric edge contour image includes: a first contour image corresponding to the left fabric edge and a second contour image corresponding to the right fabric edge; performing pinhole detection in the fabric edge contour image to identify the pinhole positions and obtain an effective width reference line; obtaining the effective width and full width of the fabric based on the effective width reference line and the fabric edge coordinates, and outputting the measurement results of the effective width and full width; the measurement results are used for real-time display, timestamped storage, and data interaction with the upper-level management system.
[0014] In this application, machine vision technology is used to achieve online real-time accurate measurement of the effective width of fabric, which effectively overcomes the technical limitations of manual measurement, infrared detection method affected by fabric color and thickness, and existing vision solutions with complex models and poor anti-interference.
[0015] In one implementation of the first aspect, preprocessing the original image of the running fabric to obtain a preprocessed image of the running fabric includes: converting the original image of the running fabric to grayscale to obtain a grayscale fabric image; performing histogram equalization on the grayscale fabric image to obtain an enhanced fabric image; and performing spatial domain filtering on the enhanced fabric image to obtain the preprocessed image of the running fabric.
[0016] In this implementation, the acquired image can be preprocessed by grayscale conversion, histogram equalization, noise filtering, etc., to enhance edge and pinhole features.
[0017] In one implementation of the first aspect, the method of detecting the running fabric image using an edge detection method and obtaining the fabric edge contour image and fabric edge coordinates includes: extracting the edge contour of the running fabric image using an edge detection algorithm to generate a fabric edge contour image; identifying the fabric edge pixel points of the fabric edge contour image based on the fabric edge contour image; and determining the fabric edge coordinates of the fabric edge pixel points in the image coordinate system.
[0018] In one implementation of the first aspect, the edge detection algorithm may employ any one of the following algorithms: Sobel, Canny, or deep learning segmentation model algorithm.
[0019] In one implementation of the first aspect, pinhole detection in the fabric edge contour image, identifying the pinhole location, and obtaining an effective width reference line includes: segmenting candidate fabric edge regions from the fabric edge contour image based on the difference in grayscale features between the fabric edge and the fabric body region; identifying a set of pixels in the candidate fabric edge regions that conform to the pinhole morphological features; calculating the pinhole morphological features and geometric center coordinates, and using them as the position coordinates of the pinhole; and determining the effective width reference line of the fabric edge by fitting based on the position coordinates of at least two pinholes.
[0020] In this implementation, machine vision technology is used, combined with specialized edge detection and pinhole recognition algorithms, which effectively avoids the defects of infrared detection method affected by fabric color and thickness, while reducing the interference of fabric texture and lighting changes, ensuring accurate differentiation and measurement accuracy between effective width and full width.
[0021] In one implementation of the first aspect, the effective width reference line includes: the position of the left effective width reference line and the position of the right effective width reference line of the fabric; obtaining the effective width and full width of the fabric based on the effective width reference line includes: obtaining the position of the left effective width reference line and the position of the right effective width reference line of the target fabric to be detected; obtaining the position of the left edge of the fabric and the position of the right edge of the fabric; calculating the effective width of the fabric based on the position of the left effective width reference line and the position of the right effective width reference line; and calculating the full width of the fabric based on the position of the left edge of the fabric and the position of the right edge of the fabric.
[0022] One implementation of the first aspect also includes:
[0023] The effective width of the fabric = the position of the right effective width reference line - the position of the left effective width reference line;
[0024] The full width is equal to the right edge position minus the left edge position.
[0025] Secondly, this application provides a machine vision-based fabric effective width detection system, the system comprising:
[0026] The image acquisition module is used to acquire several original images of the running fabric along the fabric path;
[0027] The preprocessing module is used to preprocess the original image of the running fabric to obtain a preprocessed image of the running fabric.
[0028] The fabric edge detection module is used to detect the running fabric image using an edge detection method and obtain the fabric edge contour image and fabric edge coordinates; wherein, the fabric edge contour image includes: a first contour image corresponding to the left fabric edge and a second contour image corresponding to the right fabric edge;
[0029] The pinhole detection module is used to detect pinholes in the fabric edge contour image, identify the pinhole positions on the fabric edge, and obtain an effective width reference line.
[0030] The result output module is used to obtain the effective width and full width of the fabric based on the effective width reference line and the fabric edge coordinates, and output the measurement results of the effective width and full width; the measurement results are used for real-time display, timestamped storage and data interaction with the upper management system.
[0031] This application features a highly integrated and robust system that significantly reduces costs while ensuring measurement accuracy. It also boasts excellent functional scalability, providing an efficient, stable, and cost-effective automated testing solution for fabric production, thereby significantly improving production efficiency and quality control.
[0032] Thirdly, this application provides a machine vision-based method and apparatus for detecting the effective width of fabric, the apparatus comprising:
[0033] The image acquisition unit is used to install linear or area array industrial cameras above the fabric running path to acquire continuous images of the fabric during its movement.
[0034] An image preprocessing unit is used to preprocess the continuous images of the fabric during its movement to obtain preprocessed continuous images of the fabric during its movement.
[0035] The selvage and pinhole detection unit is used to perform selvage and pinhole detection on continuous images during the fabric's movement, and obtain the selvage outlines and coordinates of the left and right selvages of the fabric, respectively.
[0036] The fabric width calculation and display unit is used to identify the position of the pinhole in a continuous image during the fabric's movement, and to locate the left effective width reference line corresponding to the left edge of the fabric and the right effective width reference line corresponding to the right edge of the fabric; and to calculate the effective width based on the detected positions of the left and right effective width reference lines; at the same time, it calculates the full width based on the coordinates of the left and right edges of the fabric and displays it in real time.
[0037] The data storage and communication unit is used to store the results in the form of timestamps in the database; it can interface with the production management system to realize historical width curve query and out-of-tolerance alarm.
[0038] Fourthly, this application also provides an electronic device, the electronic device comprising: a processor and a memory; the memory for storing a computer program; the processor for executing the computer program stored in the memory to cause the terminal to perform the machine vision-based fabric effective width detection method as described above.
[0039] As described above, the machine vision-based fabric effective width detection method, system, and apparatus of this application have the following beneficial effects:
[0040] (1) The machine vision-based fabric effective width detection method provided in this application overcomes the inefficiency and instability of manual measurement through automated image acquisition and processing, realizing continuous online real-time measurement and data recording of the effective width of fabric, significantly improving production efficiency and quality control level, and achieving online real-time accurate measurement. This application adopts machine vision technology, combined with specialized edge detection and pinhole recognition algorithms, effectively avoiding the defects of infrared detection method affected by fabric color and thickness, while reducing the interference of fabric texture and lighting changes, ensuring accurate differentiation and measurement accuracy between effective width and full width, with strong anti-interference and high measurement accuracy. At the same time, this application integrates fabric edge detection and pinhole recognition into a unified algorithm framework by optimizing the image processing flow, avoiding the excessive dependence on fabric edge stability in Scheme 1, and the problems of complex models and independent training and maintenance required in Scheme 2 and Scheme 3, thus improving the stability and reliability of the system.
[0041] (2) This application does not require complex multi-task models or high-cost labeled data. It reduces hardware and software costs through lightweight algorithm design, and its cost-effectiveness is significant. It is also easy to maintain and expand the system, and is suitable for large-scale industrial applications.
[0042] (3) The system provided in this application can be flexibly extended to fabric defect detection function, realize the integration of width measurement and quality monitoring, provide a comprehensive automation solution for fabric production, enhance practicality and applicability, and has strong scalability. Attached Figure Description
[0043] Figure 1 The diagram shows the hardware structure of the machine vision-based fabric effective width detection method described in this application embodiment.
[0044] Figure 2 The diagram shows the overall flow chart of the machine vision-based fabric effective width detection method described in the embodiments of this application.
[0045] Figure 3 The diagram shown is a schematic diagram of the deployment of the effective width detection image acquisition device in one embodiment of the machine vision-based fabric effective width detection method described in this application.
[0046] Figure 4 The diagram shown illustrates the entire process of processing the original fabric image in one embodiment of the machine vision-based fabric effective width detection method described in this application.
[0047] Figure 5 The diagram shown is a flowchart of step S2 in the machine vision-based fabric effective width detection method described in this application embodiment.
[0048] Figure 6The diagram shown is a flowchart of step S3 in the machine vision-based fabric effective width detection method described in this application embodiment.
[0049] Figure 7 The diagram shown is a flowchart of step S4 in the machine vision-based fabric effective width detection method described in this application embodiment.
[0050] Figure 8 The diagram shown is a flowchart of step S5 in the machine vision-based fabric effective width detection method described in this application embodiment.
[0051] Figure 9 The diagram shown is a schematic diagram of the left edge contour of the fabric in one embodiment of the machine vision-based fabric effective width detection method described in this application.
[0052] Figure 10 The diagram shown is a schematic representation of the right side of the fabric edge contour in one embodiment of the machine vision-based fabric effective width detection method described in this application.
[0053] Figure 11 The diagram shown is a schematic diagram of the left and right edges of a piece of fabric in one embodiment of the machine vision-based fabric effective width detection method described in this application.
[0054] Figure 12 The diagram shown is a schematic representation of the structural principle of the machine vision-based fabric effective width detection system described in this application embodiment.
[0055] Figure 13 The diagram shown is a structural schematic of the electronic device described in an embodiment of this application.
[0056] Component designation explanation
[0057] 1 Machine vision-based fabric effective width detection device 11 Image acquisition unit 12 Image preprocessing unit 13 Fabric edge and pinhole detection unit 14 Width Calculation and Display Unit 15 Data storage and communication unit 100 Position of the effective width reference line on the left 200 Position of the effective width reference line on the right 121 Image acquisition module 122 Preprocessing module 123 Fabric edge detection module 124 Pinhole detection module 125 Result Output Module 130 electronic devices 131 processor 132 memory 133 monitor S1~S5 step Detailed Implementation
[0058] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.
[0059] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. Therefore, the drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0060] Furthermore, the use of terms such as "first" and "second" in this application is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of the various embodiments can be combined with each other, but only on the basis of being achievable by those skilled in the art. If the combination of technical solutions is contradictory or impossible to implement, such a combination of technical solutions should be considered non-existent and not within the scope of protection claimed in this application.
[0061] The following embodiments of this application provide a method, system, and apparatus for detecting the effective width of fabric based on machine vision, including but not limited to an online quality inspection device for textile production lines. The following description will take the online inspection application scenario based on industrial cameras on a fabric production line as an example.
[0062] like Figure 1 As shown, this embodiment provides a hardware application scenario for a machine vision-based fabric effective width detection device, specifically including: an image acquisition unit 11, an image preprocessing unit 12, a fabric edge and pinhole detection unit 13, a width calculation and display unit 14, and a data storage and communication unit 15.
[0063] The image acquisition unit 11 is used to install a linear or area array industrial camera above the fabric's running path to acquire continuous images during the fabric's movement. The camera's field of view covers the entire width of the fabric, including the selvage areas on both sides. The image acquisition can be performed using either a linear or area array camera depending on the fabric speed; the light source can be either a backlight or a side light source to improve edge contrast.
[0064] The image preprocessing unit 12 is used to preprocess the continuous images of the fabric during its movement to obtain preprocessed continuous images of the fabric during its movement, so as to enhance edge and pinhole features.
[0065] The selvage and pinhole detection unit 13 is used to perform selvage and pinhole detection on continuous images during the fabric's movement, and obtain the selvage outlines and coordinates of the left and right sides of the fabric, respectively.
[0066] The width calculation and display unit 14 is used to identify the position of the pinhole in a continuous image during the fabric's movement, and to locate the left effective width reference line corresponding to the left edge of the fabric and the right effective width reference line corresponding to the right edge of the fabric; and to calculate the effective width based on the detected positions of the left and right effective width reference lines; at the same time, to calculate the full width based on the coordinates of the left and right edges of the fabric and to display it in real time.
[0067] The data storage and communication unit 15 is used to store the results in the form of timestamps in the database; it can interface with the production management system to realize historical width curve query and out-of-tolerance alarm.
[0068] The system hardware configuration includes: an industrial camera array installed on both sides of the production line, a uniform illumination source, an image acquisition card, and an image processing server. The industrial cameras are high-resolution line scan cameras, arranged parallel to each other on both sides of the fabric transport direction to ensure complete capture of the fabric edge area image; the light source uses strip-shaped LED cold light sources, arranged at a specific angle to avoid specular reflection. The image processing server receives the acquired fabric edge images, calculates the effective width in real time using the image processing algorithm proposed in this application, and transmits the result to the production line control system.
[0069] In this application, the implementation method performed by the above-mentioned device can realize continuous, non-contact measurement of the effective width of the fabric. At the same time, the system has good scalability and can integrate fabric defect detection function, providing a complete quality monitoring solution for textile production.
[0070] The technical solutions in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0071] Please see Figure 2 , Figure 3 and Figure 4 The diagrams shown are: a general flowchart of the machine vision-based fabric effective width detection method according to the embodiments of this application; a deployment diagram of the effective width detection image acquisition device in one embodiment of the machine vision-based fabric effective width detection method according to the embodiments of this application; and a full flowchart of the original fabric image processing in one embodiment of the machine vision-based fabric effective width detection method according to the embodiments of this application.
[0072] like Figure 2 , Figure 3 and Figure 4 As shown, this embodiment provides a machine vision-based method for detecting the effective width of fabric, the method comprising the following steps:
[0073] S1, obtain several original images of the running cloth along the cloth path.
[0074] In this embodiment, a linear or area array industrial camera is installed above the conveyor path of the target fabric to be inspected to capture continuous images of the fabric during its movement. The camera's field of view covers the entire width of the fabric, including the selvage areas on both sides.
[0075] Specifically, firstly, a hardware system needs to be deployed: a global shutter industrial camera is selected to avoid motion blur, a dedicated light source is used to eliminate ambient light interference and highlight fabric surface features, and trigger sensors such as rotary encoders are installed to ensure accurate triggering of images according to a fixed fabric travel distance. Secondly, software and control logic need to be configured: the camera is set to hardware trigger mode, an acquisition program is written to continuously capture images at equal intervals based on encoder pulse signals, and the raw images are stored to a high-speed hard drive using an ordered naming rule. Finally, through fine-tuning of focus, illumination uniformity, and trigger delay, it is ensured that a series of high-quality, clear raw images can be stably and completely acquired during fabric movement, providing a reliable basis for subsequent inspection or analysis.
[0076] For example, such as Figure 3 As shown, an industrial camera array is installed above the running path of the fabric to be inspected (including the left and right sides of the fabric) to collect continuous images of the left and right sides of the fabric in real time according to a preset shooting time interval.
[0077] (I) Image Acquisition Section:
[0078] (1) Light source: Use LED linear light source or other stable light source to illuminate the fabric from the back or side, forming a high-contrast light and dark boundary line at the edge of the fabric. This is to ensure that the camera can clearly capture the edge of the fabric in complex factory environments.
[0079] (2) Industrial cameras: Linear CCD cameras are commonly used. Like a scanner, it captures only a very narrow line image at a time. As the fabric moves, the camera scans continuously and eventually "stitches" the images together to form a complete two-dimensional image. Linear cameras are particularly suitable for measuring the width of fast-moving objects.
[0080] Specifically: First, images of the moving fabric are acquired from top to bottom. An industrial camera is positioned directly above the fabric's path, with its lens vertically aimed at the fabric surface below. Second, a dedicated lighting source is installed in conjunction with the camera to provide stable and uniform brightness to the shooting area, eliminating ambient light interference and clearly revealing the fabric's texture details. Third, this optical setup allows for the continuous acquisition of high-quality, distortion-free original images as the fabric moves continuously.
[0081] S2, preprocess the original image of the running fabric to obtain a preprocessed image of the running fabric.
[0082] Please see Figure 5The diagram shows a flowchart of step S2 in the machine vision-based fabric effective width detection method described in this embodiment. Figure 5 As shown, step S2 includes the following steps:
[0083] S21, perform grayscale processing on the original image of the fabric to obtain a grayscale fabric image;
[0084] S22, Histogram equalization is performed on the grayscale fabric image to obtain an enhanced fabric image;
[0085] S23, the enhanced fabric image is subjected to spatial domain filtering to obtain a preprocessed running fabric image.
[0086] In this embodiment, the original image of the fabric being transported is subjected to preprocessing operations such as grayscale conversion, histogram equalization, and noise filtering to obtain a preprocessed image of the fabric being transported, thereby enhancing edge and pinhole features.
[0087] Specifically, firstly, the acquired color image is converted from a multi-color channel space to a single-channel grayscale space to generate a grayscale fabric image. Preferably, a weighted average method can be used for the conversion, with conversion coefficients that satisfy the characteristics of human visual perception. This method of reducing the amount of data used in the process simplifies subsequent computational complexity.
[0088] Then, histogram equalization is performed on the grayscale image to obtain the enhanced fabric image. This process can enhance the contrast of the image as a whole or in local areas. Preferably, a contrast-limited adaptive histogram equalization method is used, which divides the image into sub-blocks and limits contrast amplification to avoid excessive noise enhancement. In other words, this process can transform the grayscale histogram of the image from a potentially concentrated area to a uniform distribution across the entire grayscale range.
[0089] Next, the enhanced grayscale image is spatially filtered to obtain a preprocessed image of the fabric to suppress image noise. Preferably, the filtering algorithm is selected according to the noise type: median filtering is used for noise, Gaussian filtering is used for Gaussian noise, or bilateral filtering is used to preserve edge information. This process removes noise from the image, providing a "clean" image for subsequent image segmentation, feature extraction, and other tasks. The choice of filter can be based on the type of noise.
[0090] Therefore, this application overcomes the inefficiency and instability of manual measurement by automating image acquisition and processing, and realizes continuous online real-time accurate measurement and data recording of the effective width of the fabric, which significantly improves production efficiency and quality control level.
[0091] S3, the edge detection method is used to detect the running fabric image and obtain the fabric edge contour image and fabric edge coordinates. The fabric edge contour image includes: a first contour image corresponding to the left fabric edge and a second contour image corresponding to the right fabric edge.
[0092] Please see Figure 6 The diagram shows a flowchart of step S2 in the machine vision-based fabric effective width detection method described in this embodiment. Figure 6 As shown, step S3 includes the following steps:
[0093] S31, an edge detection algorithm is used to extract the edge contour of the running fabric image to generate a fabric edge contour image; the edge detection algorithm can be any one of Sobel, Canny, or deep learning segmentation model algorithm for edge detection;
[0094] S32, Based on the fabric outline image, perform recognition to obtain the fabric edge pixels of the fabric outline image;
[0095] S33, determine the edge coordinates of the edge pixel in the image coordinate system.
[0096] In this embodiment, the outlines of the left and right sides of the fabric edge are extracted based on edge detection algorithms (such as Sobel, Canny, or deep learning segmentation models). The coordinates of the left and right sides of the fabric edge are obtained by finding the gray-scale abrupt change points at the fabric edge or predicting the segmentation boundary.
[0097] Specifically, firstly, edge detection is performed on the fabric image to obtain an edge pixel set; from the edge pixel set, left edge point sets and right edge point sets corresponding to the left and right fabric edges are selected respectively; based on the left and right edge point sets, continuous left and right fabric edge contour lines are generated. The fabric edge contour image includes a first contour image corresponding to the left fabric edge and a second contour image corresponding to the right fabric edge. That is, the generated left and right fabric edge contour lines are two-dimensional curves with the fabric's forward direction as the abscissa and the lateral deviation as the ordinate. The fabric edge contour image here includes the pinholes.
[0098] Then, a deep learning object detection algorithm can be used to identify the fabric edge contour image, obtain the fabric edge pixels of the fabric edge contour image, and determine the fabric edge coordinates of the fabric edge pixels in the image coordinate system.
[0099] For example, firstly, based on the acquired fabric selvage contour image containing pinhole defects, the locations of pinholes in the fabric selvage contour image are labeled to form a training dataset. Then, a deep learning object detection network is constructed. This deep learning object detection network is a single-stage object detection network. The deep learning object detection network is trained using the training dataset to obtain the pre-trained deep learning object detection model.
[0100] Then, the fabric image is input into a pre-trained deep learning object detection model; the model is configured to identify pinhole defects in the image and output their location information; the model then receives and outputs the location information of the pinhole defects. Here, the output location information is a bounding box.
[0101] Finally, based on the bounding box, an identification box is drawn on the fabric image, and a detection image containing the identification results is generated. That is, the identified fabric edge contour is converted into specific coordinate data. The coordinate set of all pixels on the contour can be directly output; if the fabric edge is a straight line, a better approach is to use the least squares method to fit these pixels into a straight line equation, expressing the fabric edge position in a simpler and more stable mathematical form, and finally outputting the straight line parameters or coordinate points sampled from the straight line as needed.
[0102] Therefore, the design of the fabric edge detection in this step is mainly carried out through three detection schemes (dual-class defect detection, key point detection, and independent segmentation detection).
[0103] It should be noted that edge detection can be performed using Canny edge detection, Hough line detection, or deep learning semantic segmentation (UNet, SegFormer, etc.).
[0104] S4, perform pinhole detection in the fabric edge contour image, identify the pinhole positions on the fabric edge, and obtain the effective width reference line.
[0105] Please see Figure 7 The diagram shows a flowchart of step S2 in the machine vision-based fabric effective width detection method described in this embodiment. Figure 7 As shown, step S4 includes the following steps:
[0106] S41, Based on the difference in grayscale features between the selvage and the fabric body region, candidate selvage regions are segmented from the selvage contour image;
[0107] S42, in the candidate fabric edge region, identify a set of pixels that conform to the pinhole morphological characteristics;
[0108] S43, calculate the morphological features and geometric center coordinates of the pinhole, and use them as the position coordinates of the pinhole on the fabric edge;
[0109] S44, Based on the position coordinates of at least two of the fabric selvage pinholes, determine the effective width reference line of the fabric selvage by fitting.
[0110] In this embodiment, the location of the pinholes in the fabric edge is identified within the fabric edge outline image, and the effective width reference line is located.
[0111] Specifically, for example, the detected pinhole points can first be clustered into left and right groups based on their location, and robust algorithms such as RANSAC can be used to remove outliers in each group. Then, the least squares method is used to fit a straight line to the clean pinhole point set, obtaining precise reference lines for the left and right selvage edges. Based on this, by calculating the center line or equidistant parallel lines between the two selvage lines, the width reference line representing the effective width of the fabric is finally determined. Then, the fitted selvage reference line and the effective width reference line are visualized and overlaid on the original image for intuitive verification. This visualization interface can display width, trend curves, and real-time alarm functions, etc.
[0112] As described in steps S3 and S4 above, this application employs machine vision technology, combined with specialized edge detection and pinhole recognition algorithms, effectively avoiding the shortcomings of infrared detection methods affected by fabric color and thickness. It also reduces interference from fabric texture and lighting changes, ensuring accurate differentiation and measurement precision between the effective width and the full width. Furthermore, by optimizing the image processing workflow, this application integrates fabric edge detection and pinhole recognition into a unified algorithm framework, avoiding the excessive reliance on fabric edge stability in Scheme 1, and the problems of complex models requiring independent training and maintenance in Schemes 2 and 3, thus improving the system's stability and reliability.
[0113] Moreover, the joint model design of pinhole detection in this step and fabric edge detection in step S3 is compatible with the multi-task structure of defect detection tasks.
[0114] It should be noted that pinhole detection can be achieved through traditional image binarization and morphological algorithms, or through deep learning object detection (YOLO, CenterNet, etc.).
[0115] S5. Based on the effective width reference line and the fabric edge coordinates, the effective width and full width of the fabric are obtained respectively, and the measurement results of the effective width and full width are output; the measurement results are used for real-time display, timestamped storage and data interaction with the upper management system.
[0116] Please see Figure 8 The diagram shows a flowchart of step S2 in the machine vision-based fabric effective width detection method described in this embodiment. Figure 8 As shown, step S5 includes the following steps:
[0117] S51, Obtain the position of the left effective width reference line and the position of the right effective width reference line of the target fabric to be inspected;
[0118] S52, obtain the position of the left and right selvage of the fabric;
[0119] S53, Calculate the effective width of the fabric based on the positions of the left and right effective width reference lines;
[0120] S54, Calculate the full width of the fabric based on the left and right selvage positions.
[0121] Please see Figures 9 to 11 .
[0122] In this embodiment, the effective width is calculated based on the detected positions of the left and right effective width reference lines; simultaneously, the full width is calculated based on the coordinates of the left and right selvage edges. Effective width = right reference line position - left reference line position; Full width = right selvage position - left selvage position. The full width and effective width data are displayed in real time, and the results are stored in a database as timestamps. It can interface with a production management system to enable historical width curve queries and out-of-tolerance alarms.
[0123] Specifically, feature analysis is performed on the fabric image obtained in step S4 to identify the left effective width reference line and the right effective width reference line; the positions of the left effective width reference line and the right effective width reference line in the image coordinate system are determined.
[0124] The step of calculating the effective width is achieved by calculating the horizontal pixel distance between the positions of the left and right effective width reference lines, and combining this with pixel equivalent conversion; and / or
[0125] The step of calculating the full width is obtained by calculating the horizontal pixel distance between the left and right edge positions of the fabric and combining it with pixel equivalent conversion.
[0126] Furthermore, as needed, after calculating the effective width and full width, the effective width value and the full width value can be compared with a preset width tolerance range; if either width value exceeds the tolerance range, a width anomaly alarm message is generated.
[0127] Furthermore, in this application, the real-time calculation of the full width and effective width data of the fabric includes: displaying the full width and effective width data in real time on a local human-computer interaction interface;
[0128] The full width and effective width data are associated with timestamps and stored in the database;
[0129] The stored data is provided to the production management system through an interface; wherein, providing the stored data to the production management system through an interface includes: responding to a query request from the production management system, returning historical width data to generate a width-time curve and displaying it.
[0130] In summary, this application achieves online, real-time, and accurate measurement of the effective width of fabrics using machine vision technology. This effectively overcomes the limitations of manual measurement (low efficiency), infrared detection (affected by fabric color and thickness), and existing vision solutions (complex models and poor anti-interference capabilities). The system is highly integrated and robust, significantly reducing costs while ensuring measurement accuracy. It also possesses good functional scalability, providing an efficient, stable, and economical automated inspection solution for fabric production, significantly improving production efficiency and quality control.
[0131] The scope of protection for the machine vision-based fabric effective width detection method described in this application is not limited to the execution order of the steps listed in this embodiment. Any solution implemented by adding, subtracting, or replacing steps in the prior art based on the principles of this application is included within the scope of protection of this application.
[0132] This application also provides a machine vision-based fabric effective width detection system. The machine vision-based fabric effective width detection system can implement the machine vision-based fabric effective width detection method described in this application. However, the implementation device of the machine vision-based fabric effective width detection method described in this application includes, but is not limited to, the structure of the machine vision-based fabric effective width detection system listed in this embodiment. All structural modifications and substitutions of the prior art made according to the principles of this application are included within the protection scope of this application.
[0133] like Figure 12 As shown, this embodiment provides a machine vision-based fabric effective width detection system 12, which includes: an image acquisition module 121, a preprocessing module 122, a fabric edge detection module 123, a pinhole detection module 124, and a result output module 125.
[0134] The image acquisition module 121 is used to acquire several original images of running fabric along the fabric path.
[0135] In this embodiment, a linear or area array industrial camera is installed above the conveyor path of the target fabric to be inspected to capture continuous images of the fabric during its movement. The camera's field of view covers the entire width of the fabric, including the selvage areas on both sides.
[0136] The preprocessing module 122 is used to preprocess the original image of the running fabric to obtain a preprocessed image of the running fabric.
[0137] In this embodiment, the acquired original image of the running fabric undergoes preprocessing operations such as grayscale conversion, histogram equalization, and noise filtering to obtain a preprocessed image of the running fabric, thereby enhancing edge and pinhole features. This includes:
[0138] The original image of the running fabric is converted to grayscale to obtain a grayscale fabric image; the grayscale fabric image is then subjected to histogram equalization to obtain an enhanced fabric image; the enhanced fabric image is then subjected to spatial domain filtering to obtain a preprocessed running fabric image.
[0139] The fabric edge detection module 123 is used to detect the running fabric image using an edge detection method and obtain the fabric edge contour image and fabric edge coordinates; wherein, the fabric edge contour image includes: a first contour image corresponding to the left fabric edge and a second contour image corresponding to the right fabric edge.
[0140] In this embodiment, the outlines of the left and right sides of the fabric edge are extracted based on edge detection algorithms (such as Sobel, Canny, or deep learning segmentation models). The coordinates of the left and right sides of the fabric edge are obtained by finding the gray-scale abrupt change points at the fabric edge or predicting the segmentation boundary.
[0141] Specifically, an edge detection algorithm is used to extract the edge contour of the running fabric image to generate a fabric edge contour image; the edge detection algorithm can be any of the Sobel, Canny, or deep learning segmentation model algorithms for edge detection; based on the fabric edge contour image, the fabric edge pixels of the fabric edge contour image are obtained; and the fabric edge coordinates of the fabric edge pixels in the image coordinate system are determined.
[0142] It should be noted that the selvage detection module can be embedded into the existing fabric defect detection system; or it can be deployed on the production line through a separate camera and industrial control computer unit to achieve plug-and-play functionality.
[0143] The pinhole detection module 124 is used to detect pinholes in the fabric edge contour image, identify the pinhole positions on the fabric edge, and obtain an effective width reference line.
[0144] In this embodiment, the location of the pinholes in the fabric edge is identified within the fabric edge outline image, and the effective width reference line is located.
[0145] Specifically, based on the difference in grayscale features between the selvage and the fabric body, candidate selvage regions are segmented from the selvage contour image; within the candidate selvage regions, a set of pixels conforming to the pinhole morphological features is identified; the pinhole morphological features and geometric center coordinates are calculated and used as the position coordinates of the selvage pinholes; based on the position coordinates of at least two selvage pinholes, an effective width reference line for the selvage is determined by fitting.
[0146] The result output module 125 is used to obtain the effective width and full width of the fabric based on the effective width reference line and the fabric edge coordinates, and output the measurement results of the effective width and full width; the measurement results are used for real-time display, timestamped storage and data interaction with the upper management system.
[0147] In this embodiment, the effective width is calculated based on the detected positions of the left and right effective width reference lines; simultaneously, the full width is calculated based on the coordinates of the left and right selvage edges. Effective width = right reference line position - left reference line position; Full width = right selvage position - left selvage position. The full width and effective width data are displayed in real time, and the results are stored in a database as timestamps. It can interface with a production management system to enable historical width curve queries and out-of-tolerance alarms.
[0148] Specifically, the positions of the left and right effective width reference lines of the target fabric to be inspected are obtained; the positions of the left and right selvage of the fabric are obtained; the effective width of the fabric is calculated based on the positions of the left and right effective width reference lines; and the full width of the fabric is calculated based on the positions of the left and right selvages.
[0149] The structure and principle of the image acquisition module 121, preprocessing module 122, fabric edge detection module 123, pinhole detection module 124 and result output module 125 correspond one-to-one with the steps in the above-mentioned machine vision-based fabric effective width detection method, so they will not be described again here.
[0150] In summary, the system of this application can be flexibly expanded to include fabric defect detection, realizing the integration of width measurement and quality monitoring, providing a comprehensive automation solution for fabric production, and enhancing its practicality and applicability.
[0151] In the embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, or methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules / units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of apparatuses or modules or units may be electrical, mechanical, or other forms.
[0152] The modules / units described as separate components may or may not be physically separate. The components shown as modules / units may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules / units can be selected to achieve the objectives of the embodiments of this application, depending on actual needs. For example, the functional modules / units in the various embodiments of this application may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.
[0153] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0154] This application also provides a computer-readable storage medium. Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing a processor. The program can be stored in a computer-readable storage medium, which is a non-transitory medium, such as random access memory, read-only memory, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof. The storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state drive (SSD)).
[0155] This application also provides an electronic device, which includes a processor and a memory.
[0156] The memory is used to store computer programs.
[0157] The memory includes various media capable of storing program code, such as ROM, RAM, magnetic disk, USB flash drive, memory card, or optical disk.
[0158] The processor is connected to the memory and is used to execute the computer program stored in the memory so that the terminal performs the above-described machine vision-based fabric effective width detection method.
[0159] Preferably, the processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0160] Please see Figure 13 The image shown is a structural schematic diagram of the terminal described in an embodiment of this application. Figure 7 As shown, this embodiment provides a terminal, the terminal 130 including a memory 131 and a processor 132.
[0161] The memory 131 is used to store computer programs; preferably, the memory 131 includes various media that can store program code, such as ROM, RAM, magnetic disk, USB flash drive, memory card or optical disk.
[0162] Specifically, memory 131 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory. Electronic device 130 may further include other removable / non-removable, volatile / non-volatile computer system storage media. Memory 131 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this application. It is understood that memory 131 may be volatile memory or non-volatile memory, or both. Non-volatile memory may be read-only memory (ROM) or programmable read-only memory (PROM), which serves as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM) and synchronous static random access memory (SSRAM). The memories described in the embodiments of the present invention are intended to include, but are not limited to, these and any other suitable categories of memory.
[0163] The processor 132 is connected to the memory 131 and is used to execute the computer program stored in the memory 131 so that the electronic device 130 executes the machine vision-based fabric effective width detection method described in any embodiment of this application.
[0164] Optionally, the processor 132 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0165] Optionally, in this embodiment, the terminal 130 may further include a display 133. The display 133 is communicatively connected to the memory 131 and the processor 132, and is used to display the relevant graphical user interface (GUI) of the machine vision-based fabric effective width detection method described in the embodiments of this application and / or the machine vision-based fabric effective width detection method described in other embodiments of this application.
[0166] In summary, the machine vision-based method, system, and apparatus for detecting the effective width of fabric provided in this application have the following beneficial effects:
[0167] The machine vision-based fabric effective width detection method provided in this application achieves online, real-time, and accurate measurement of fabric effective width through machine vision technology. This effectively overcomes the limitations of manual measurement (low efficiency), infrared detection (affected by fabric color and thickness), and existing vision solutions (complex models and poor anti-interference capabilities). The system is highly integrated and robust, significantly reducing costs while ensuring measurement accuracy, and possesses good functional scalability. It provides an efficient, stable, and economical automated detection solution for fabric production, significantly improving production efficiency and quality control. Furthermore, it has broad applicability.
[0168] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.
[0169] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.
Claims
1. A method for detecting the effective width of fabric based on machine vision, characterized in that, The method includes: Obtain several original images of the running fabric along the fabric path; The original image of the running fabric is preprocessed to obtain a preprocessed image of the running fabric. The running fabric image is detected using an edge detection method, and the fabric edge contour image and fabric edge coordinates are obtained; wherein, the fabric edge contour image includes: a first contour image corresponding to the left fabric edge and a second contour image corresponding to the right fabric edge; Pinhole detection is performed on the fabric edge contour image to identify the pinhole positions and obtain the effective width reference line; The effective width and full width of the fabric are obtained based on the effective width reference line and the fabric edge coordinates, and the measurement results of the effective width and full width are output. The measurement results are used for real-time display, timestamped storage, and data interaction with the upper-level management system.
2. The method for detecting the effective width of fabric based on machine vision according to claim 1, characterized in that, The original image of the running fabric is preprocessed to obtain a preprocessed image of the running fabric, including: The original image of the fabric being processed is converted to grayscale to obtain a grayscale fabric image; The grayscale fabric image is subjected to histogram equalization to obtain an enhanced fabric image; The enhanced fabric image is then subjected to spatial domain filtering to obtain a preprocessed running fabric image.
3. The method for detecting the effective width of fabric based on machine vision according to claim 1, characterized in that, The edge detection method is used to detect the running fabric image and obtain the fabric edge contour image and fabric edge coordinates, including: An edge detection algorithm is used to extract the edge contour of the running fabric image to generate a fabric edge contour image; Based on the fabric edge contour image, the fabric edge pixels of the fabric edge contour image are obtained; Determine the coordinates of the fabric edge pixels in the image coordinate system.
4. The method for detecting the effective width of fabric based on machine vision according to claim 3, characterized in that, The edge detection algorithm can be any one of Sobel, Canny, or deep learning segmentation model algorithms.
5. The method for detecting the effective width of fabric based on machine vision according to claim 1, characterized in that, Pinhole detection is performed on the fabric selvage contour image to identify the pinhole locations and obtain the effective width reference line, including: Candidate fabric edge regions are segmented from the fabric edge contour image based on the difference in grayscale features between the fabric edge and the fabric body region. Within the candidate fabric edge region, a set of pixels conforming to the morphological characteristics of pinholes is identified; Calculate the morphological features and geometric center coordinates of the pinhole, and use them as the position coordinates of the pinhole on the fabric edge; Based on the position coordinates of at least two of the fabric selvage pinholes, a reference line for the effective width of the fabric selvage is determined by fitting.
6. The method for detecting the effective width of fabric based on machine vision according to claim 1, characterized in that, The effective width reference line includes: the position of the left effective width reference line and the position of the right effective width reference line of the fabric; obtaining the effective width and full width of the fabric based on the effective width reference line and the fabric edge coordinates includes: Obtain the positions of the left and right effective width reference lines of the target fabric to be inspected; Obtain the positions of the left and right selvage edges of the fabric. The effective width of the fabric is calculated based on the positions of the left and right effective width reference lines. The full width of the fabric is calculated based on the positions of the left and right selvage edges.
7. The method for detecting the effective width of fabric based on machine vision according to claim 6, characterized in that, Also includes: The effective width of the fabric = the position of the right effective width reference line - the position of the left effective width reference line; The full width is equal to the right edge position minus the left edge position.
8. A machine vision-based fabric effective width detection system, characterized in that, The system includes: The image acquisition module is used to acquire several original images of the running fabric along the fabric path; The preprocessing module is used to preprocess the original image of the running fabric to obtain a preprocessed image of the running fabric. The fabric edge detection module is used to detect the running fabric image using an edge detection method and obtain the fabric edge contour image and fabric edge coordinates; wherein, the fabric edge contour image includes: a first contour image corresponding to the left fabric edge and a second contour image corresponding to the right fabric edge; The pinhole detection module is used to detect pinholes in the fabric edge contour image, identify the pinhole positions on the fabric edge, and obtain an effective width reference line. The result output module is used to obtain the effective width and full width of the fabric based on the effective width reference line and the fabric edge coordinates, and output the measurement results of the effective width and full width; the measurement results are used for real-time display, timestamped storage and data interaction with the upper management system.
9. A machine vision-based fabric effective width detection device, characterized in that, The device includes: The image acquisition unit is used to install linear or area array industrial cameras above the fabric running path to acquire continuous images of the fabric during its movement. An image preprocessing unit is used to preprocess the continuous images of the fabric during its movement to obtain preprocessed continuous images of the fabric during its movement. The selvage and pinhole detection unit is used to perform selvage and pinhole detection on continuous images during the fabric's movement, and obtain the selvage outlines and coordinates of the left and right selvages of the fabric, respectively. The fabric width calculation and display unit is used to identify the position of the pinhole in a continuous image during the fabric's movement, and to locate the left effective width reference line corresponding to the left edge of the fabric and the right effective width reference line corresponding to the right edge of the fabric; and to calculate the effective width based on the detected positions of the left and right effective width reference lines; at the same time, it calculates the full width based on the coordinates of the left and right edges of the fabric and displays it in real time. The data storage and communication unit is used to store the results in the form of timestamps in the database; it can interface with the production management system to realize historical width curve query and out-of-tolerance alarm.
10. An electronic device, characterized in that, The electronic device includes: a processor and a memory; The memory is used to store computer programs; The processor is used to execute the computer program stored in the memory to cause the terminal to perform the machine vision-based fabric effective width detection method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Fabric detection method and device, computer device and computer-readable medium
CN109325940A
Gray fabric breadth measurement method and system, computer equipment and storage medium
CN115760751A