Image recognition-based fiber assembly linear density measurement method and system
By using image recognition technology to detect the tilt angle of the fiber spindle and perform affine correction, the problem of insufficient real-time online accuracy in measuring the linear density of fiber assemblies in textile production has been solved, and high-precision linear density measurement has been achieved.
Patent Information
- Application Number
- CN202611440390.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-16
- Publication Date
- 2026-11-27
AI Technical Summary
Existing methods for measuring the linear density of fiber assemblies in textile production suffer from slow response, susceptibility to environmental influences, inability to perform real-time online measurements, and insufficient accuracy. In particular, projection errors caused by fiber tilting cannot be effectively corrected.
By using image recognition technology to detect the tilt angle of the fiber main axis, a spatial projection transformation matrix is constructed to perform affine correction on the projected section, eliminating measurement deviations caused by tilt. Combined with edge detection, connected region identification, and abnormal fluctuation processing, the measurement accuracy is improved.
It significantly improves the accuracy and stability of linear density measurement, eliminates cross-sectional measurement errors caused by fiber tilt, ensures the integrity and accuracy of edge contours, and balances measurement accuracy and processing efficiency.
Smart Images

Figure CN123181540A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of image recognition and textile inspection technology, and in particular to a method and system for measuring the linear density of fiber assemblies based on image recognition. Background Technology
[0002] In textile production, the linear density of fiber assemblies (such as slivers, rovings, and strands) is a key indicator for measuring product quality. Traditional linear density measurement methods mainly employ mechanical sensors, such as capacitive sensors and radioisotope sensors, or gravimetric methods. However, mechanical sensors suffer from slow response times, susceptibility to environmental temperature and humidity, and the need for periodic calibration; gravimetric methods are destructive offline detection methods and cannot achieve real-time online measurement during production. In recent years, machine vision-based online detection methods have emerged, which use cameras to capture images of fiber assemblies and calculate the cross-sectional area to estimate linear density. However, in actual production, the fiber assemblies are affected by factors such as guide frame deviation, airflow disturbance, and equipment vibration during transport, causing the main axis direction to deviate from the ideal transport direction and tilt. This results in the projected cross-section captured by the camera not being the true normal cross-section; the projected cross-section width is larger than the actual cross-section width, leading to an overestimation of the linear density value calculated based on the projected area and a decrease in measurement accuracy. Existing methods fail to effectively correct the projection error caused by fiber tilt, resulting in insufficient accuracy in online linear density measurement. Summary of the Invention
[0003] To address the aforementioned technical problems, this application provides a method and system for measuring the linear density of fiber assemblies based on image recognition. By detecting the real-time tilt angle of the fiber principal axis and constructing a spatial projection transformation matrix accordingly, the projected cross section is affinely corrected, restoring the tilted projected cross section to the true normal cross section, thereby eliminating the measurement deviation caused by tilt.
[0004] In a first aspect, this application provides a method for measuring the linear density of fiber assemblies based on image recognition, the method comprising: An image acquisition device captures a first image sequence containing a fiber assembly; edge detection is performed on the first image sequence to obtain edge contour data of the fiber assembly; The fiber principal axis direction vector is fitted based on the edge contour data, and the spatial angle between the fiber principal axis direction vector and the reference direction perpendicular to the fiber transport direction in the imaging plane is calculated to determine the real-time tilt angle. The projected cross section of the fiber assembly is extracted from the first image sequence. When it is determined that the fiber assembly is tilted, a spatial projection transformation matrix is constructed according to the real-time tilt angle, and an affine transformation is performed on the projected cross section to restore the projected cross section to the real normal cross section, thereby obtaining a corrected second image sequence. When it is determined that the fiber assembly is not tilted, the first image sequence is used as the second image sequence. Connectivity region identification is performed on the second image sequence to obtain the total number of pixels in the target connected region of the fiber assembly; The normal cross-sectional area is determined based on the total number of pixels and the equivalent physical area of the pixels. The normal cross-sectional area is multiplied by the fiber volume density parameter and the unit conversion factor to obtain the line density value corresponding to each image frame, and the values are arranged to obtain the initial line density distribution sequence. The abnormal fluctuation data in the initial line density distribution sequence is smoothed to obtain the true line density distribution.
[0005] Secondly, this application provides a fiber assembly linear density measurement system based on image recognition, the system comprising: An image acquisition module is used to capture a first image sequence containing a fiber assembly by an image acquisition device; and to perform edge detection on the first image sequence to obtain edge contour data of the fiber assembly. The main axis fitting module is used to fit the fiber main axis direction vector according to the edge contour data, and calculate the spatial angle between the fiber main axis direction vector and the reference direction perpendicular to the fiber transport direction in the imaging plane, so as to determine the real-time tilt angle. The projection transformation module is used to extract the projection cross-section of the fiber assembly from the first image sequence. When it is determined that the fiber assembly is tilted, a spatial projection transformation matrix is constructed according to the real-time tilt angle and an affine transformation is performed on the projection cross-section to restore the projection cross-section to the real normal cross-section, thereby obtaining a corrected second image sequence. When it is determined that the fiber assembly is not tilted, the first image sequence is used as the second image sequence. A connected component identification module is used to identify connected components in the second image sequence to obtain the total number of pixels in the target connected component of the fiber assembly. The line density calculation module is used to determine the normal cross-sectional area based on the total number of pixels and the equivalent physical area of the pixels, multiply the normal cross-sectional area by the fiber volume density parameter and the unit conversion factor to obtain the line density value corresponding to each image frame and arrange them to obtain an initial line density distribution sequence; and smooth the abnormal fluctuation data in the initial line density distribution sequence to obtain the true line density distribution.
[0006] Compared with the prior art, the beneficial effects of this application are at least as follows: First, edge detection is used to acquire the edge contour data of the fiber assembly. Based on this, the principal axis direction vector is fitted and the real-time tilt angle is calculated. Then, an affine transformation is performed on the projected section using a spatial projection transformation matrix to restore the inflated projected section caused by tilt to the true normal section. This eliminates the measurement error of the section caused by fiber tilt at its source and significantly improves the accuracy of linear density measurement. Next, fracture contour detection and morphological closing operation repair overcome the contour gap problem caused by uneven illumination and feather occlusion, ensuring the continuity and integrity of the edge contour. Laplacian double threshold nonmaximum suppression is used for edge detection to improve the accuracy and robustness of edge extraction. Then, weighted least squares fitting of the principal axis direction with gradient magnitude as the weight allows strong edge points to dominate the fitting result, effectively suppressing the interference of weak edges and noise, and improving the accuracy of obtaining the principal axis direction and tilt angle. Kalman filtering is used to smooth the tilt angle temporally, suppressing the angle abrupt change caused by noise in a single frame image and ensuring the stability of projection correction. Finally, through the affine transformation determination mechanism, correction is performed only when the fiber is tilted, and the output is directly performed when there is no tilt, thus balancing measurement accuracy and processing efficiency. Through the differentiated outlier processing mechanism, the tilt angle corresponding to the outlier frame is traced back for attribution, and outliers caused by residual projection distortion are smoothly replaced, while outliers caused by the actual non-uniformity of the fiber are retained, thus suppressing measurement noise while retaining the true quality fluctuation information. Attached Figure Description
[0007] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0008] Figure 1 This is a flowchart of a fiber assembly linear density measurement method based on image recognition, as described in an embodiment of this application. Figure 2 This is a schematic diagram illustrating the implementation scenario of online measurement of the linear density of fiber assemblies in this application embodiment; Figure 3 This is a schematic diagram of the structure of a fiber assembly linear density measurement system based on image recognition in an embodiment of this application. Detailed Implementation
[0009] This application provides a method and system for measuring the linear density of fiber assemblies based on image recognition. The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data used can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" or "having" and any variations thereof are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0010] When implemented on a textile production line, fiber assemblies (including fiber bundles in the form of slivers, rovings, and strands) are conveyed at a uniform speed along the yarn guide. Linear density, i.e., the mass of a fiber bundle per unit length, is measured in tex (tex), where 1 tex equals the number of grams per 1000 meters of fiber bundle. The image acquisition equipment uses an industrial area-array CMOS camera, fixedly mounted directly above the conveyor path, with the lens optical axis vertically downwards and aligned with the fiber assembly conveyor belt. It continuously captures images of the fiber assembly passing through the camera's field of view at a fixed frame rate of 50 frames per second, outputting RGB color images frame by frame. These consecutive frames constitute the first image sequence. In each frame, the fiber assembly appears as a strip-shaped area of a certain width, with the width direction perpendicular to the fiber conveying direction.
[0011] The imaging plane refers to the physical plane where the camera sensor is located; in this embodiment, the imaging plane is horizontal. The reference direction perpendicular to the fiber transport direction within the imaging plane refers to the axial direction perpendicular to the fiber assembly transport direction within the image coordinate system. If the fiber transport direction is the x-axis of the image (horizontal), then the reference direction is the y-axis of the image (vertical). Ideally, the main axis of the fiber assembly is parallel to the transport direction (x-axis). However, due to factors such as vibration during transport and guide frame deviation, the main axis of the fiber assembly may deviate from the x-axis; this deviation is the real-time tilt angle.
[0012] For ease of understanding, the specific process of the embodiments of this application is described below. Please refer to [link / reference]. Figure 1 and Figure 2 An embodiment of this application provides a method for measuring the linear density of fiber assemblies based on image recognition, comprising: Step S1: The image acquisition device captures a first image sequence containing the fiber assembly; edge detection is performed on the first image sequence to obtain the edge contour data of the fiber assembly.
[0013] Furthermore, when capturing the first image sequence containing the fiber assembly, a fracture contour detection and repair step is also included: The first image sequence is converted to grayscale to obtain a first grayscale image. The initial contour line of the fiber assembly is determined by an edge detection algorithm. The closed region is calculated based on the initial contour line to obtain the first connected region. The number of pixels in the first connected region is obtained to determine the first area value. If the first area value is greater than a preset fracture threshold, the contour fracture is determined to exist and marked as the first abnormal region. Morphological closing operation is performed on the first abnormal region. The morphological closing operation includes first performing a dilation operation to bridge the fracture, and then performing an erosion operation to restore the contour width, and reconnecting the separated contour fragments into a continuous contour.
[0014] Further, edge detection is performed on the first image sequence, including: A filter is used to smooth and denoise the first grayscale image to obtain a smooth image sequence. The Laplacian edge detection algorithm is used to calculate the gradient magnitude of each pixel in the smooth image sequence to obtain an initial gradient image sequence. A global gradient statistical histogram is constructed based on the gradient magnitude distribution in the initial gradient image sequence. A high threshold is determined based on the cumulative distribution position in the preset high gradient interval of the histogram, and a low threshold is determined based on the cumulative distribution position in the preset low gradient interval. Double threshold hysteresis detection is performed using the high and low thresholds to obtain a candidate edge image sequence. Then, the edge contour data is obtained by extracting connected components using a contour extraction algorithm, while retaining the gradient magnitude of each pixel in the initial gradient image sequence.
[0015] Specifically, the first image sequence output by the image acquisition device is an RGB color image, which needs to be converted into a grayscale image for subsequent processing. The grayscale conversion uses a weighted average method, which sums the R, G, and B channel values of each pixel according to weights of 0.299, 0.587, and 0.114, respectively, to obtain the grayscale value of that pixel, with a value range of 0 to 255. The image after pixel-by-pixel processing is the first grayscale image.
[0016] Sobel edge detection is performed on the first grayscale image to obtain the initial contour line of the fiber assembly. A 3×3 Sobel operator is used to convolve the grayscale image along both the horizontal and vertical directions. The horizontal gradient component Gx and the vertical gradient component Gy at each pixel are calculated. The square root of the sum of their squares is the Sobel gradient value for that pixel, which is then normalized to the range of 0 to 255. Pixels with Sobel gradient values greater than a preset gradient threshold are marked as edge points. In this embodiment, the preset gradient threshold is 50. The line connecting all edge points forms the initial contour line. The Sobel gradient value is only used for coarse extraction of the initial contour line and is different from the gradient magnitude obtained by subsequent Laplacian edge detection.
[0017] The initial contour line should form a closed annular region as the outer boundary of the fiber assembly. However, due to uneven lighting or fiber fuzz occlusion, gaps may appear in some locations on the initial contour line. When the seed filling algorithm fills the internal region of the fiber, it overflows into the external background region through these gaps, causing the connected region to contain a large number of background pixels, resulting in an abnormally large area of the closed region. The closed region enclosed by the initial contour line is called the first connected region, and the total number of pixels in the first connected region is taken as the first area value. The preset breakage threshold is set in units of pixels and is obtained by manual input or by counting the median number of connected region pixels in the initial few frames during the system startup phase. In this embodiment, it is taken as twice the number of normal connected region pixels. When the first area value is greater than the breakage threshold, it indicates that the closed region is much larger than the normal fiber cross-section, that is, there is a gap in the contour causing the background region to be incorrectly included. This region is marked as the first abnormal region.
[0018] The Sobel detection results are converted into a binary edge map, with foreground pixels set to 255 grayscale values and background pixels set to 0 grayscale values. Morphological closing operations are performed on the binary edge map of the first anomaly region to repair the broken contour. The morphological closing operation consists of two sub-steps: dilation and erosion, with dilation preceding erosion. The dilation operation uses a 3×3 square structuring element, traversing each pixel in the binary edge map. When at least one foreground pixel with a grayscale value of 255 exists within the structuring element's coverage area, the current pixel is set as a foreground pixel (grayscale value set to 255). This operation causes the two contour endpoints at the break to expand outwards, bridging them when the expansion is large enough. Subsequently, the erosion operation is performed using the same 3×3 structuring element. When at least one background pixel with a grayscale value of 0 exists within the structuring element's coverage area, the current pixel is set as a background pixel (grayscale value set to 0). This operation shrinks the width of the bridged contour back to its pre-dilation size. After dilation followed by erosion, the contour endpoints at the break are reconnected into a continuous contour, while maintaining the original contour width unchanged.
[0019] The region defined by the continuous contours after morphological restoration is cropped from the first grayscale image and used as the input image for subsequent Gaussian filtering and Laplacian edge detection.
[0020] Based on the local grayscale region defined by the continuous contour after morphological restoration, a Gaussian filter is used for smoothing and denoising. The Gaussian filter kernel size is 5×5, and the standard deviation σ is 1.4. The Gaussian kernel is convolved with the grayscale image, and the output value of each pixel is the weighted average of the Gaussian kernel weight and the grayscale values of all pixels in its coverage area. The output image is a smooth image sequence, thereby eliminating high-frequency random noise in the image.
[0021] Subsequently, the Laplacian edge detection algorithm is used to calculate the second derivative response value of each pixel in the smoothed image sequence. The Laplacian operator is a 3×3 kernel, with a weight of 1 for the four neighboring positions and a weight of -4 for the center position. The Laplacian kernel is convolved with the smoothed image to obtain the second derivative value of each pixel, and its absolute value is taken as the Laplacian response value of that pixel. Since the maximum possible value of the Laplacian response value is 1020, i.e., 4×255, the response value is linearly normalized to the range of 0 to 255, that is, each response value is multiplied by 255 / 1020. The normalized Laplacian response values of all pixels constitute the initial gradient image sequence. The Laplacian operator responds strongly to gray-level abrupt changes, with a larger response value at the fiber contour edge and a response value close to zero in the background region. Among them, except for the Sobel gradient value used in the initial Sobel contour extraction in step S1, the gradient magnitude in each subsequent step refers to the normalized Laplacian response value, which is used for the weighted calculation of the principal axis direction fitting.
[0022] A gradient histogram of the contour region is constructed based on the initial gradient image sequence. The gradient magnitude range of 0 to 255 is divided into 256 equally wide intervals, with each gray level representing one interval. The number of pixels in the initial gradient image sequence whose gradient magnitude falls into each interval is counted. A histogram is plotted with gradient magnitude on the horizontal axis and the number of pixels on the vertical axis. The high threshold is determined by the gradient magnitude corresponding to the 30th percentile of the cumulative pixel count percentage after arranging the gradient magnitudes in the histogram from largest to smallest, and the low threshold is determined by the gradient magnitude corresponding to the 80th percentile of the cumulative pixel count percentage.
[0023] Each pixel in the initial gradient image sequence is traversed, and double-threshold hysteresis detection is used to classify the pixels. Double-threshold hysteresis detection is an edge tracking step used after non-maximum suppression (NMS) to connect real edges and suppress false edges, which is different from NMS that compares local maxima along the gradient direction. Specifically, double-threshold hysteresis detection works as follows: when the gradient magnitude of a pixel is greater than the high threshold, it is directly identified as a strong edge and retained; when the gradient magnitude is less than the low threshold, it is identified as a non-edge and discarded; when the gradient magnitude is between the high and low thresholds, it is identified as a weak edge, and it is only retained if there is at least one strong edge in its 8-neighborhood; otherwise, it is discarded. The set of retained edge points after processing constitutes a candidate edge image sequence.
[0024] Connected components are extracted from the candidate edge image sequence using a contour extraction algorithm. An unvisited edge pixel is randomly selected from the candidate edge image sequence as a seed point, and an 8-neighborhood seed filling algorithm is used to expand to adjacent edge pixels until no new edge pixels can be added, forming a closed connected component. This process is repeated for all edge pixels to obtain one or more connected components. The set of boundary pixel coordinates for each connected component constitutes the edge contour data of the fiber assembly. Simultaneously, the gradient magnitudes of each pixel in the initial gradient image sequence are not discarded.
[0025] Step S2: Fit the fiber principal axis direction vector based on the edge contour data, and calculate the spatial angle between the fiber principal axis direction vector and the reference direction perpendicular to the fiber transport direction in the imaging plane to determine the real-time tilt angle.
[0026] Furthermore, the fiber principal axis direction vector is fitted based on the edge contour data, including: The edge contour data is analyzed to obtain the coordinate set of the first contour point. Based on the coordinates of each contour point in the first contour point coordinate set, the gradient magnitude at the corresponding position is retrieved from the initial gradient image sequence. The gradient magnitude of each contour point is used as the fitting weight to construct a weighted least squares objective function, where contour points with larger gradient magnitudes correspond to higher weights and contour points with smaller gradient magnitudes correspond to lower weights. The weighted least squares objective function is solved to obtain a weighted fitting line as the first fiber principal axis. The fiber principal axis direction vector is extracted from the first fiber principal axis. Based on the fiber principal axis direction vector and the reference direction perpendicular to the fiber transport direction in the pre-established imaging plane, the first spatial angle value is calculated by spatial vector dot product operation, and the real-time tilt angle is determined by geometric angle supplement operation.
[0027] Furthermore, after determining the real-time tilt angle, a time-series smoothing step is also included: The real-time tilt angles of the previous N consecutive frames are obtained to form a historical tilt angle sequence, where N is the preset time window length. The historical tilt angle sequence is used as the observation input of the Kalman filter, and combined with the real-time tilt angle of the current frame as the current observation value, the optimal estimate of the real-time tilt angle of the current frame is calculated by the Kalman filter. The optimal estimate is used as the final real-time tilt angle output of the current frame for projection correction to suppress the sudden changes in tilt angle caused by noise in a single frame image.
[0028] Specifically, after acquiring the edge contour data, coordinate analysis is performed to fit the fiber principal axis direction. The row and column coordinates of each edge pixel are extracted from the edge contour data to form the first set of contour point coordinates, denoted as... , where I is the total number of contour points. For each contour point in the set, the gradient magnitude at the same location is retrieved from the initial gradient image sequence based on its coordinates. The query method involves directly reading the pixel values at the corresponding row and column positions in the initial gradient image sequence. The gradient magnitude of each contour point is used as the query method. As the fitting weight at this point ,Right now Construct a weighted residual sum of squares objective function Here, k is the slope of the line to be determined, and b is the intercept. Contour points with large gradient magnitudes correspond to high weights, contributing more to the sum of squared residuals and causing the fitted line to be more biased towards strong edge points; contour points with small gradient magnitudes correspond to low weights, suppressing the influence of weak edge points on the fitted line. Taking the partial derivatives of the objective function with respect to k and b respectively and setting them to zero yields a system of two linear equations. Solving this system of equations gives the values of k and b, and the equation of the line determined by k and b is then obtained. This is the first fiber principal axis. The principal axis direction vector is extracted from this line equation. The direction vector of the line is (1, k), which, after normalization to a unit vector, yields the principal axis direction vector. ,in , , where ax and ay are the components of a on the x-axis and y-axis of the image, respectively.
[0029] Then, the spatial angle between the principal axis direction vector and the reference direction r=(0,1,0) perpendicular to the fiber delivery direction in the imaging plane is calculated. Because the principal axis direction vector Normalized to unit vectors and with the reference direction r = (0, 1, 0) also being a unit vector, the dot product of the two vectors is... , , When the fiber is not tilted, the main axis direction is parallel to the x-axis, ay=0, and the included angle is 90 degrees; when the fiber is tilted, the main axis direction deviates from the x-axis, ay≠0, and the included angle deviates from 90 degrees. The real-time tilt angle θ is uniformly determined by the first spatial included angle value. Determined through geometric supplementary angle calculation, i.e., θ = 90° - This relationship holds for all tilt cases. When the fiber is not tilted, the principal axis is parallel to the x-axis, and ay = 0. =90°, θ=0°; when the fiber is tilted The deviation is 90°, where θ is the deviation angle relative to the conveying direction.
[0030] Because single-frame images may experience abrupt changes in real-time tilt angle between adjacent frames due to illumination fluctuations or noise interference, a temporal smoothing process is performed on the real-time tilt angle. The time window length N is set to 10 frames, and the real-time tilt angles of the 10 consecutive frames preceding the current frame are obtained and arranged chronologically to form a historical tilt angle sequence. This historical tilt angle sequence is used as the observation input to a Kalman filter, combined with the real-time tilt angle of the current frame as the current observation value, and the optimal estimate is calculated using the Kalman filter. The system state variable of the Kalman filter is the tilt angle θ, and the state transition equation is: ,in To account for process noise, the variance Q is set to 0.1 degrees². The real-time tilt angle of the current frame is used as the observation value. The observation equation is Where v is the observation noise and the variance R is taken as 0.1. Q=R, steady-state Kalman gain K≈0.618, balancing smoothness and response speed, with a time constant of approximately 1 frame (20ms), meeting the requirements for real-time measurement at 50fps. Kalman gain ,in Let Variance be the prediction error. The state update equation is: This involves weighted fusion of predicted and observed values. The updated state estimate is... This is the final real-time tilt angle of the current frame, used for projection correction in step S3.
[0031] Step S3: Extract the projection cross section of the fiber assembly from the first image sequence. When it is determined that the fiber assembly is tilted, construct a spatial projection transformation matrix based on the real-time tilt angle and perform an affine transformation on the projection cross section to restore the projection cross section to the real normal cross section, and obtain the corrected second image sequence. When it is determined that the fiber assembly is not tilted, use the first image sequence as the second image sequence.
[0032] Furthermore, a spatial projection transformation matrix is constructed based on the real-time tilt angle, including: When the fiber assembly is determined to be tilted, the real-time tilt angle is orthogonally decomposed according to the fiber principal axis direction vector and the reference direction to obtain the translation amount and scaling factor. The scaling factor is determined based on the cosine value of the real-time tilt angle and is used to compress the projected section to the true normal section size along the direction perpendicular to the fiber principal axis. The real-time tilt angle is the value after time-series smoothing. A spatial projection transformation matrix is constructed based on the scaling factor and translation amount. An affine transformation is performed on the coordinate system of the projected section to map the original pixel coordinates to the target pixel coordinates. If the target pixel coordinates exceed the preset coordinate system range, they are discarded. A bilinear interpolation algorithm is used to resample the gray values corresponding to the valid pixel coordinates to obtain the second image sequence.
[0033] Furthermore, in the step of constructing the spatial projection transformation matrix, it is determined whether an affine transformation needs to be performed: The determination is made based on whether the component of the fiber principal axis direction vector on the coordinate axis perpendicular to the fiber conveying direction is zero. When this component is not zero, the fiber assembly is tilted, and a spatial projection transformation matrix is constructed based on the real-time tilt angle and an affine transformation is performed. When this component is zero, i.e., the principal axis direction is parallel to the fiber conveying direction and there is no tilt, no affine transformation is performed.
[0034] Specifically, after determining the real-time tilt angle, the projected cross-section of the fiber assembly is extracted from the first image sequence. Specifically, in each frame, the upper and lower boundaries of the fiber assembly's strip-shaped region are determined based on the edge contour data obtained in step S1. The geometric center row of this strip-shaped region along the conveying direction is taken as the target row. All pixel segments located inside the fiber assembly are extracted along this target row; these pixel segments are the projected cross-sections. One projected cross-section is extracted for each frame. Due to the tilt of the fiber assembly, the width of this projected cross-section is greater than the width of the true normal cross-section. The projected cross-section is used to determine the reference datum for the affine transformation: the center point of the projected cross-section serves as the fixed end for the scaling operation, and the width direction of the projected cross-section serves as the direction of the scaling operation. Subsequent affine transformations are performed on the entire frame image. After the transformation, the entire frame image is retained as the second image sequence, where the strip-shaped region containing the projected cross-section has been restored to the true normal cross-section size.
[0035] Real-time tilt angle after time-series smoothing Orthogonal decomposition is performed to obtain three transformation parameters: translation tx, ty, and scaling factor s. The scaling factor s is determined based on the cosine value of the real-time tilt angle, i.e. Because the width of the projected section after being tilted and stretched is equal to that of the actual normal section. 1x, set the scaling factor to 1x This allows the projected cross-section width to be compressed back to its true size. The translation amounts tx and ty are the differences in the x and y directions between the coordinates of the center point of the projected cross-section and the coordinates of the center point of the image, respectively, in pixels. These are used to align the scaled cross-section to the center region of the image.
[0036] Determining whether an affine transformation is needed: The y-axis component ay of the principal axis direction vector a is checked for zero. When ay ≠ 0, the fiber assembly is tilted, and an affine transformation is performed. When ay = 0, meaning the principal axis is parallel to the x-axis and there is no tilt, an affine transformation is not performed.
[0037] Based on the above parameters, a 3×3 homogeneous coordinate spatial projection transformation matrix M is constructed, with the specific expression as follows: The scaling operation is applied only along the y-axis (i.e., perpendicular to the fiber transport direction) to compress the width of the tilted projected section to the true normal section size. Matrix M does not include a rotation operation because scaling along the y-axis is sufficient to correct the projection stretching caused by the tilt back to the true size, and not rotating the image helps maintain the directional stability of the fiber assembly in the image, facilitating subsequent connected component identification. For each original pixel coordinate (x, y) within the projected section region, it is transformed into homogeneous coordinates (x, y, 1) and then right-multiplied by the transformation matrix M to obtain the target pixel coordinates (x, y, 1). , When the row and column values of the target pixel coordinates exceed the valid range of the image coordinate system, they are discarded, and the remaining coordinates constitute the set of valid pixel coordinates. After the affine transformation, the target pixel coordinates may be non-integer; therefore, bilinear interpolation is used to estimate the grayscale values at non-integer coordinates. Bilinear interpolation uses a weighted sum of the grayscale values of the four nearest integer pixels surrounding the target coordinates. First, linear interpolation is performed on the upper and lower pairs of pixels in the horizontal direction, and then linear interpolation is performed on the two interpolation results in the vertical direction to obtain the final grayscale value. After performing the above interpolation on all valid pixel coordinates, a corrected second image sequence is obtained, in which the cross-section of the fiber assembly has been restored to its true normal cross-sectional dimensions.
[0038] Step S4: Perform connected region identification on the second image sequence to obtain the total number of pixels in the target connected region of the fiber assembly.
[0039] Specifically, the second image sequence output in step S3 is a complete frame image, in which the strip region containing the projected cross-section of the fiber assembly has been restored to its true normal cross-sectional size through affine transformation. The second image sequence is binarized using the Otsu adaptive thresholding method. The Otsu method iterates through all possible grayscale thresholds (0 to 255), calculates the inter-class variance between the foreground and background classes at each threshold, and selects the grayscale value that maximizes the inter-class variance as the binarization threshold. Pixels with grayscale values greater than this threshold are designated as foreground (grayscale value 255), and pixels with grayscale values less than or equal to this threshold are designated as background (grayscale value 0). An 8-neighborhood seed filling algorithm is used to identify independent connected regions in the binarized image. The number of foreground pixels within each connected region is counted. When the number of pixels exceeds a preset area threshold, it is determined to be a connected region of the target object. In this embodiment, the area threshold is set to 50 pixels to exclude shot noise. The total number of foreground pixels within the connected regions of the target object is counted as the total number of pixels of the fiber assembly in this frame image.
[0040] Step S5: Determine the normal cross-sectional area based on the total number of pixels and the equivalent physical area of the pixels. Multiply the normal cross-sectional area by the fiber volume density parameter and the unit conversion factor to obtain the line density value corresponding to each image frame and arrange them to obtain the initial line density distribution sequence. Smooth the abnormal fluctuation data in the initial line density distribution sequence to obtain the true line density distribution.
[0041] Furthermore, the pixel physical area equivalent is determined in the following way: Under the same imaging conditions as fiber measurement, a calibration image of a standard reference with a known cross-sectional area is acquired, the number of pixels occupied by the standard reference is identified, the known cross-sectional area is divided by the number of pixels to obtain the physical area corresponding to each pixel as the pixel physical area equivalent, and the pixel physical area equivalent is multiplied by the total number of pixels to determine the normal cross-sectional area.
[0042] Furthermore, the abnormal fluctuation data in the initial linear density distribution sequence are smoothed, including: The difference between adjacent data points in the initial line density distribution sequence is calculated to obtain the first difference sequence. A dynamic anomaly threshold is determined based on the statistical distribution characteristics of the first difference sequence. Data points whose absolute difference exceeds the dynamic anomaly threshold are marked as anomalous fluctuation data points. For each anomalous fluctuation data point, the real-time tilt angle of the corresponding image frame is obtained based on the correspondence between image frames and line density values. If the real-time tilt angle exceeds a preset angle threshold, it is determined to be caused by residual projection distortion, marked as a first-type anomaly, and data smoothing replacement is performed. If it does not exceed the threshold, it is determined to be caused by true inhomogeneity of the fiber aggregate, marked as a second-type anomaly, and the original value is retained. The processed data points are merged with the unmarked data points, and the continuity of the merged sequence is checked. Linear interpolation is used to fill in the breakpoints to obtain the true line density distribution.
[0043] Specifically, the pixel physical area equivalent is obtained beforehand through a calibration process. With the image acquisition equipment in the exact same installation position, focal length, and lighting conditions as the fiber measurement, a standard reference object with a known cross-sectional area is placed on a conveyor belt, passing through the camera's field of view, and calibration images are acquired. The standard reference object is a cylindrical metal rod with a diameter of d mm and a cross-sectional area of... Square millimeters. The number of pixels occupied by the standard reference object in the calibration image. Pixel physical area equivalent The unit is square millimeters per pixel.
[0044] The total number of pixels in the target connected region Multiplying by the pixel physical area equivalent e gives the normal cross-sectional area A = ×e. Fiber bulk density parameter This refers to the mass per unit volume of the fiber aggregate, expressed in grams per cubic centimeter (g / cm³). It is preset and input into the system by the operator based on the type of fiber being measured; for example, 1.54 g / cm³ for cotton fiber. Polyester fiber is taken as 1.38 The formula for converting linear density is: Linear density (tex) = A (mm²) × (g / cm³) × 1000, derived as follows: Unit of normal cross-sectional area A To convert to cm², multiply by a factor of 0.01 (1 =0.01 Therefore, the unit of ρ×A is g / cm³×cm²=g / cm, which is the mass per unit length (1cm). The definition of tex is the number of grams per 1000 meters of length, i.e., 1tex=1g / 1000m=1g / 100000cm. Therefore, to convert g / cm to tex, it needs to be multiplied by 100000. The total conversion factor is 0.01×100000=1000, hence the linear density = A×ρ×1000 (tex). The conveying speed v is used to establish the mapping relationship between the linear density value and the actual longitudinal position of the fiber assembly. The unit is meters per second, which is read and input into the system in real time by a rotary encoder installed on the conveying roller. Based on the frame rate f=50fps and the conveying speed v, the distance the fiber assembly moves between two adjacent frames is ΔL=v / f meters, and the longitudinal position of the fiber assembly corresponding to the k-th frame is Lk=k×v / f meters. Based on this, the linear density values of each frame in the initial linear density distribution sequence are mapped to the actual longitudinal position of the fiber assembly.
[0045] Each image frame yields a line density value, which is arranged in chronological order of image frame acquisition to form an initial line density distribution sequence. This initial line density distribution sequence is updated using a sliding window method, with a window length of a preset value F frames. In this embodiment, F = 500 frames, corresponding to 10 seconds of data. When a new frame's line density value is added, the window slides forward one frame, discarding the oldest data point. The real-time tilt angle corresponding to each image frame is also specified. The value is saved after calculation in step S2, and a corresponding frame index relationship is established with the line density value of that frame. It is stored in the system's data cache for backtracking during subsequent anomaly attribution. Subsequent smoothing processing of abnormal fluctuation data is performed in real time on the data subsequence within the current sliding window.
[0046] Abnormal fluctuations in the initial line density distribution sequence are smoothed. Within the current sliding window's line density subsequence, the difference between adjacent data points is first calculated. Let the line density subsequence within the sliding window be {TD1, TD2, ..., TDE}, where TDi is the line density value corresponding to the i-th frame image. E is the window length. Adjacent differences di = |TDi - TD(i-1)|, and all differences constitute the first difference sequence. The dynamic anomaly threshold is determined based on the statistical distribution characteristics of the first difference sequence: the first difference sequence is arranged in ascending order of value; the lower quartile Q1 is the difference at the (E-1)×0.25 position after arrangement, the upper quartile Q3 is the difference at the (E-1)×0.75 position after arrangement, the interquartile range IQR = Q3 - Q1, and the dynamic anomaly threshold Th = Q3 + 1.5 × IQR. Data points in the first difference sequence corresponding to di > Th are marked as abnormal fluctuation data points.
[0047] For each abnormal fluctuation data point, based on the correspondence between image frames and line density values, the real-time tilt angle of the corresponding image frame is read from the data cache using the frame index. The preset angle threshold is 30 degrees. When When the value is >30 degrees, the abnormal fluctuation data point is determined to be caused by residual projection distortion and marked as a first-type anomaly. A smoothing replacement is performed on the line density value of this point, that is, the original value is replaced with the arithmetic mean of the line density values of the two adjacent non-anomaly points. When When the temperature is ≤30 degrees, the abnormal fluctuation data point is determined to be caused by the actual non-uniformity of the fiber assembly, and is marked as a second type of abnormal point. The original linear density value is retained without replacement.
[0048] The processed data points are merged with the unmarked data points, and a continuity check is performed on the merged sequence. The integrity of the W frames within the sliding window is checked; if frame data is missing due to system frame drops or other reasons, the missing location is defined as a breakpoint. Linear interpolation is used to fill in the breakpoints. Let TDa and TDb be the two closest valid data points before and after the breakpoint, with m breakpoints between them. Then the interpolation value for the j-th breakpoint is TDa + (TDb - TDa) × j / (m + 1), where j = 1, 2, ..., m. The sequence after filling in the gaps is the true linear density distribution.
[0049] The above describes a fiber assembly linear density measurement method based on image recognition in an embodiment of this application. The following describes a fiber assembly linear density measurement system based on image recognition in an embodiment of this application. Please refer to [link to relevant documentation]. Figure 3 An image recognition-based fiber assembly linear density measurement system according to an embodiment of this application includes: The image acquisition module is used by the image acquisition device to capture a first image sequence containing the fiber assembly; and to perform edge detection on the first image sequence to obtain the edge contour data of the fiber assembly.
[0050] The main axis fitting module is used to fit the fiber main axis direction vector based on the edge contour data, and calculate the spatial angle between the fiber main axis direction vector and the reference direction perpendicular to the fiber transport direction in the imaging plane, so as to determine the real-time tilt angle.
[0051] The projection transformation module is used to extract the projection cross section of the fiber assembly from the first image sequence. When it is determined that the fiber assembly is tilted, a spatial projection transformation matrix is constructed according to the real-time tilt angle and an affine transformation is performed on the projection cross section to restore the projection cross section to the real normal cross section, thereby obtaining the corrected second image sequence. When it is determined that the fiber assembly is not tilted, the first image sequence is used as the second image sequence.
[0052] The connected component identification module is used to identify connected regions in the second image sequence to obtain the total number of pixels in the target connected region of the fiber assembly.
[0053] The line density calculation module is used to determine the normal cross-sectional area based on the total number of pixels and the equivalent physical area of the pixels. The normal cross-sectional area is multiplied by the fiber volume density parameter and the unit conversion factor to obtain the line density value corresponding to each image frame and arrange them to obtain the initial line density distribution sequence. The abnormal fluctuation data in the initial line density distribution sequence is smoothed to obtain the true line density distribution.
[0054] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0055] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0056] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for measuring the linear density of fiber assemblies based on image recognition, characterized in that, The method includes: An image acquisition device captures a first image sequence containing a fiber assembly; edge detection is performed on the first image sequence to obtain edge contour data of the fiber assembly; The fiber principal axis direction vector is fitted based on the edge contour data, and the spatial angle between the fiber principal axis direction vector and the reference direction perpendicular to the fiber transport direction in the imaging plane is calculated to determine the real-time tilt angle. The projected cross section of the fiber assembly is extracted from the first image sequence. When it is determined that the fiber assembly is tilted, a spatial projection transformation matrix is constructed according to the real-time tilt angle, and an affine transformation is performed on the projected cross section to restore the projected cross section to the real normal cross section, thereby obtaining a corrected second image sequence. When it is determined that the fiber assembly is not tilted, the first image sequence is used as the second image sequence. Connectivity region identification is performed on the second image sequence to obtain the total number of pixels in the target connected region of the fiber assembly; The normal cross-sectional area is determined based on the total number of pixels and the equivalent physical area of the pixels. The normal cross-sectional area is multiplied by the fiber volume density parameter and the unit conversion factor to obtain the line density value corresponding to each image frame, and the values are arranged to obtain the initial line density distribution sequence. The abnormal fluctuation data in the initial line density distribution sequence is smoothed to obtain the true line density distribution.
2. The method for measuring the linear density of fiber assemblies based on image recognition according to claim 1, characterized in that, When capturing the first image sequence containing the fiber assembly, a fracture contour detection and repair step is also included: The first image sequence is converted to grayscale to obtain a first grayscale image. An edge detection algorithm is used to determine the initial contour line of the fiber assembly. A closed region is calculated based on the initial contour line to obtain a first connected region. The number of pixels in the first connected region is obtained as the first area value. If the first area value is greater than the preset fracture threshold, it is determined that there is a contour fracture and marked as the first abnormal area. A morphological closing operation is performed on the first abnormal region. The morphological closing operation includes first performing an expansion operation to bridge the fracture, and then performing an erosion operation to restore the contour width, thereby reconnecting the separated contour fragments into a continuous contour.
3. The method for measuring the linear density of fiber assemblies based on image recognition according to claim 2, characterized in that, Edge detection is performed on the first image sequence, including: A filter is used to smooth and denoise the first grayscale image to obtain a smooth image sequence; The Laplacian edge detection algorithm is used to calculate the gradient magnitude of each pixel in the smoothed image sequence to obtain the initial gradient image sequence. A global gradient statistical histogram is constructed based on the gradient magnitude distribution in the initial gradient image sequence. A high threshold is determined based on the cumulative distribution position in the preset high gradient interval of the histogram, and a low threshold is determined based on the cumulative distribution position in the preset low gradient interval. The high threshold and the low threshold are used to perform dual threshold hysteresis detection processing to obtain a candidate edge image sequence. Then, the edge contour data is obtained by extracting connected components through a contour extraction algorithm, and the gradient magnitude of each pixel in the initial gradient image sequence is retained.
4. The method for measuring the linear density of fiber assemblies based on image recognition according to claim 3, characterized in that, Fitting the fiber principal axis direction vector based on the edge contour data includes: The edge contour data is parsed to obtain a first set of contour point coordinates. Based on the coordinates of each contour point in the first set of contour point coordinates, the gradient magnitude at the corresponding position is queried from the initial gradient image sequence. Using the gradient magnitude of each contour point as the fitting weight, a weighted least squares objective function is constructed, where contour points with larger gradient magnitudes correspond to higher weights, and contour points with smaller gradient magnitudes correspond to lower weights. The weighted least squares objective function is solved to obtain a weighted fitted line as the first fiber principal axis, and the fiber principal axis direction vector is extracted from the first fiber principal axis. Based on the fiber main axis direction vector and the reference direction perpendicular to the fiber transport direction in the pre-established imaging plane, the first spatial angle value is calculated by spatial vector dot product operation, and the real-time tilt angle is determined by geometric supplementary angle operation.
5. The method for measuring the linear density of fiber assemblies based on image recognition according to claim 4, characterized in that, After determining the real-time tilt angle, a time-series smoothing step is also included: Obtain the real-time tilt angles of the N consecutive frames preceding the current frame image to form a historical tilt angle sequence, where N is the preset time window length; The historical tilt angle sequence is used as the observation input of the Kalman filter, and the real-time tilt angle of the current frame is used as the current observation value. The optimal estimate of the real-time tilt angle of the current frame is calculated by the Kalman filter. The optimal estimate is used as the final real-time tilt angle output for the current frame for projection correction.
6. The method for measuring the linear density of fiber assemblies based on image recognition according to claim 5, characterized in that, Constructing a spatial projection transformation matrix based on the real-time tilt angle includes: When it is determined that the fiber assembly is tilted, the real-time tilt angle is orthogonally decomposed according to the fiber principal axis direction vector and the reference direction to obtain the translation amount and scaling factor. The scaling factor is determined according to the cosine value of the real-time tilt angle, which is a value after time-series smoothing. The spatial projection transformation matrix is constructed based on the scaling factor and the translation amount, and an affine transformation is performed on the coordinate system of the projection section to map the original pixel coordinates to the target pixel coordinates. If the coordinates of the target pixel point are outside the preset coordinate system range, they are discarded. The gray values corresponding to the valid pixel point coordinates are resampled using a bilinear interpolation algorithm to obtain the second image sequence.
7. The method for measuring the linear density of fiber assemblies based on image recognition according to claim 6, characterized in that, The step of constructing the spatial projection transformation matrix also includes a step of determining whether to perform an affine transformation: The determination is made based on whether the component of the fiber principal axis direction vector on the coordinate axis perpendicular to the fiber conveying direction is zero; if the component is not zero, it is determined that the fiber assembly is tilted, and a spatial projection transformation matrix is constructed based on the real-time tilt angle and an affine transformation is performed; if the component is zero, it is determined that the fiber assembly is not tilted, and no affine transformation is performed.
8. The method for measuring the linear density of fiber assemblies based on image recognition according to claim 1, characterized in that, The equivalent physical area of the pixel is determined in the following way: Under the same imaging conditions as fiber measurement, a calibration image of a standard reference with a known cross-sectional area is acquired, the number of pixels occupied by the standard reference is identified, and the physical area corresponding to each pixel is obtained by dividing the known cross-sectional area by the number of pixels as the pixel physical area equivalent. The normal cross-sectional area is determined by multiplying the physical area equivalent of the pixel by the total number of pixels.
9. The method for measuring the linear density of fiber assemblies based on image recognition according to claim 1, characterized in that, Smoothing of anomalous fluctuation data in the initial linear density distribution sequence includes: The difference between adjacent data points in the initial linear density distribution sequence is calculated to obtain a first difference sequence. A dynamic anomaly threshold is determined based on the statistical distribution characteristics of the first difference sequence. Data points whose absolute difference value exceeds the dynamic anomaly threshold are marked as abnormal fluctuation data points. For each abnormal fluctuation data point, based on the correspondence between image frames and line density values, the real-time tilt angle of the image frame corresponding to the abnormal fluctuation data point is obtained. If the real-time tilt angle exceeds a preset angle threshold, it is determined to be caused by residual projection distortion, marked as a first-type abnormal point, and data smoothing replacement is performed; if it does not exceed the threshold, it is determined to be caused by the true non-uniformity of the fiber assembly, marked as a second-type abnormal point, and the original value is retained. The processed data points are merged with the unmarked data points, the merged sequence is checked for continuity, and the breakpoints are filled by linear interpolation to obtain the true linear density distribution.
10. A fiber assembly linear density measurement system based on image recognition, used to implement the fiber assembly linear density measurement method based on image recognition as described in any one of claims 1-9, characterized in that, The system includes: An image acquisition module is used to capture a first image sequence containing a fiber assembly by an image acquisition device; and to perform edge detection on the first image sequence to obtain edge contour data of the fiber assembly. The main axis fitting module is used to fit the fiber main axis direction vector according to the edge contour data, and calculate the spatial angle between the fiber main axis direction vector and the reference direction perpendicular to the fiber transport direction in the imaging plane, so as to determine the real-time tilt angle. The projection transformation module is used to extract the projection cross-section of the fiber assembly from the first image sequence. When it is determined that the fiber assembly is tilted, a spatial projection transformation matrix is constructed according to the real-time tilt angle and an affine transformation is performed on the projection cross-section to restore the projection cross-section to the real normal cross-section, thereby obtaining a corrected second image sequence. When it is determined that the fiber assembly is not tilted, the first image sequence is used as the second image sequence. A connected component identification module is used to identify connected components in the second image sequence to obtain the total number of pixels in the target connected component of the fiber assembly. The line density calculation module is used to determine the normal cross-sectional area based on the total number of pixels and the equivalent physical area of the pixels, multiply the normal cross-sectional area by the fiber volume density parameter and the unit conversion factor to obtain the line density value corresponding to each image frame and arrange them to obtain an initial line density distribution sequence; and smooth the abnormal fluctuation data in the initial line density distribution sequence to obtain the true line density distribution.
