A fiber length measurement method based on automatic scale recognition

Through automatic recognition of scale bars and image processing technology, the problem of large human error in fiber length measurement is solved, and high-precision and efficient automatic measurement of fiber length is achieved.

CN116503346BActive Publication Date: 2025-09-05ZHEJIANG SCI-TECH UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310435750.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-22
Publication Date
2025-09-05
Estimated Expiration
2043-04-22

AI Technical Summary

Technical Problem

The existing fiber length measurement methods have large artificial errors, complex operations and inaccurate enough. Especially for fibers with complex shapes and high curvature, it is difficult for traditional methods to accurately measure them.

Method used

Using the method of automatically identifying scales, the fit curve length of the fiber is automatically calculated through image processing technology, including HSV color space conversion, Canny edge detection, Hoff transformation, Sobel operator edge detection and skeletonization processing, and the length of the fiber is automatically calculated to reduce manual intervention.

Benefits of technology

Improve the accuracy and efficiency of fiber length measurement, reduce artificial errors, and achieve fast and accurate fiber length measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116503346B_ABST
    Figure CN116503346B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of fiber length measurement, and discloses a fiber length measurement method based on automatic scale recognition. The method captures a fiber image, wherein the captured fiber image includes a red scale with a known actual length L. The actual length of each pixel of the scale on the captured fiber image is calculated, and then the actual length of the fiber is obtained based on the pixel length of a fitting curve of the fiber on the captured fiber image. The present invention combines the automatic recognition of the scale on the image with the calculated pixel length based on the fitting curve of the fiber to obtain the actual length of the fiber, thereby improving the accuracy and efficiency of measuring fiber length. Compared with traditional manual measurement methods, the method eliminates the manual measurement step, thereby reducing human error and improving measurement accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of fiber length measurement, in particular to a fiber length measurement method based on automatic scale recognition. Background Art

[0002] Due to the needs of spinning technology, various forms of fiber length inspection methods and instruments have gradually emerged, such as the pattern method, comb type, thickness measurement type, photoelectric type, airflow type, capacitance type, etc. The length indicators measured by various methods and instruments are not exactly the same. With the development of science, semi-automatic and fully automatic fiber length meters have emerged, developing towards the direction of accurate, fast, and multi-index testing. In the existing technology, manual or semi-automatic methods are often used to measure fibers, which is time-consuming and labor-intensive, and prone to errors. The current fiber measurement method mainly calculates the fiber length based on the length and curvature of the line segment, but for fibers with complex shapes and high curvature, the actual length and the line segment length have a large error, resulting in inaccurate measurement results. In the existing technology, although there are many fiber length inspection methods and instruments, such as the pattern method, comb type, thickness measurement type, photoelectric type, airflow type, capacitance type, etc., they still have some defects. The traditional fiber length detection method requires manual measurement of the scale, which is easily interfered by human factors, resulting in inaccurate measurement results; some automated fiber length instruments can reduce human interference, but require manual adjustment of instrument parameters and operation, which is complicated to operate and requires certain professional knowledge and skills.

[0003] Therefore, there is a need to improve the existing methods for measuring fiber length. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a fiber length measurement method based on automatic scale recognition, which is used to automatically measure the fiber length of a fiber image with a scale of a given length.

[0005] In order to solve the above technical problems, the present invention provides a fiber length measurement method based on automatic scale recognition, comprising: collecting an image of the fiber, the collected fiber image including a red scale with a known actual length L, calculating the actual length of each pixel of the scale on the collected fiber image, and then calculating the actual length of the fiber based on the pixel length of the fitting curve of the fiber on the collected fiber image.

[0006] As an improvement of the fiber length measurement method based on automatic scale recognition of the present invention:

[0007] The actual length of each pixel of the scale bar is:

[0008] (1) converting the fiber image from RGB color space to HSV color space;

[0009] (2) On the image in the HSV color space, set the red pixels to white and the pixels of other colors to black to generate a mask image;

[0010] (3) Perform edge detection on the mask image using the Canny edge detection algorithm to obtain a binary image;

[0011] (4) Use Hough transform to detect the binary image, obtain the coordinates of the endpoints of all line segments in the binary image, and then obtain the longest line segment by calculating the pixel length of all line segments and calculate:

[0012]

[0013] Wherein, Length is the actual length represented by each pixel, (x2, y2) and (x1, y1) are the coordinates of the two endpoints of the longest line segment respectively.

[0014] As a further improvement of the fiber length measurement method based on the automatic recognition scale of the present invention:

[0015] The actual length of the fiber is calculated as follows:

[0016] (1) converting the image format of the fiber image from RGB to BGR, and then converting it into a grayscale image;

[0017] (2) performing edge detection on the grayscale image using the Sobel operator to obtain the edge of the fiber, and then performing binarization processing to convert it into a black and white image;

[0018] (3) Perform a closing operation on the black and white image and then identify the largest connected area to obtain an image including the obvious fiber body;

[0019] (4) Gaussian smoothing is performed on the fiber main body image to obtain a smoother curve main body, and then the smoothed main body is skeletonized to obtain a single pixel axis;

[0020] (5) Fitting the single-pixel axis using a B-spline curve, then evenly spaced points are taken on the smooth curve obtained by fitting, the pixel distance between each two adjacent points is calculated and added to obtain the pixel length of the single-pixel axis; the pixel length of the single-pixel axis is multiplied by the actual length of each pixel to obtain the actual length of the fiber.

[0021] The beneficial effects of the present invention are mainly reflected in:

[0022] The present invention combines automatic recognition of the scale on the image and the calculation of the pixel length based on the fiber fitting curve to automatically calculate the true length of the fiber, thereby improving the accuracy and efficiency of measuring the fiber length. Compared with the traditional manual measurement method, the manual measurement step is omitted, thereby reducing human error and improving the accuracy of the measurement. The measurement method of the present invention can increase the measurement speed so as to process large amounts of data more quickly. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The specific embodiments of the present invention are further described in detail below with reference to the accompanying drawings.

[0024] Figure 1 Schematic diagram of a fiber length measurement method based on automatic scale recognition according to the present invention;

[0025] Figure 2 It is a schematic diagram of the results of the collected original image in each stage of the sobel operator edge detection, closing operation, identification of the maximum connected area, skeletonization processing and curve fitting of the present invention. DETAILED DESCRIPTION

[0026] The present invention is further described below with reference to specific embodiments, but the protection scope of the present invention is not limited thereto:

[0027] Example 1: A fiber length measurement method based on automatic identification scale, such as Figure 1-2 As shown, the scale bar on the image is automatically recognized, and the true length of the fiber is automatically calculated according to the pixel length of the fiber fitting curve, including the following specific steps:

[0028] 1. Collect images

[0029] In this embodiment, a Zeiss electron microscope is used to capture images of the fibers. The captured image format is PNG, and the image size is not limited. During the capture, a red scale bar with a known actual length of 1 mm is set in the image to convert the ratio of the pixels of the captured image to the actual size.

[0030] 2. Image processing

[0031] 2.1 Red line segment measurement based on HSV color space

[0032] 2.1.1 Color Space Conversion

[0033] In a computer, convert the fiber image collected in step 1 from the RGB (Red, Green, Blue) color space to the HSV (Hue, Saturation, Value) color space. In the RGB color space, different brightness or saturation levels of the same color are represented differently, requiring complex calculations when processing colors. The HSV color space, on the other hand, better processes color information and allows for the selection of specific color regions by adjusting the thresholds of the hue, saturation, and value channels. Compared to RGB, the HSV space is more consistent with human visual perception, describing the color of an object using color names, such as "red" or "green," rather than numerical values. In HSV space, hue corresponds to the color name, saturation corresponds to the purity or concentration of the color, and value corresponds to the brightness of the color. This approach of isolating the basic properties of color makes color processing more intuitive and convenient.

[0034] 2.1.2. Define the red range and create a mask

[0035] Define the range of red (i.e., the range of the scale) on the image converted to HSV color space and create a mask to retain only the red area as the color area of ​​interest, in preparation for masking the red scale, specifically:

[0036] (1) Define the red range

[0037] After obtaining the HSV color image, a pixel-by-pixel comparison is performed with the original image. Pixels that fall within the color range are set to white (255), and pixels that do not fall within the color range are set to black (0). A binary mask image is then generated to retain only the color region that is desired to be extracted. By using the binary mask image, the target color can be effectively separated from other colors for better subsequent processing. In addition, generating a binary mask image also helps reduce the interference of noise and stray pixels in the image, improving the accuracy of target color extraction.

[0038] In the HSV color space, red is defined as H channel values ​​between 0-10 and 156-180, and S and V channel values ​​within a certain range. Based on this range, two masks (mask1 and mask2) are created to retain the red areas within these two H channel value ranges. These two masks are then merged into one mask to retain all red areas in the subsequent steps.

[0039] 2.1.3 Edge Recognition

[0040] Perform edge detection on the mask image mask in step 2.1.2 using the Canny edge detection algorithm, extract the edge portion of the scale in the image, and form a binary image edges. The Canny edge detection algorithm can accurately detect the edges in the image, retaining as many edges as possible while removing unnecessary noise as much as possible, thereby improving the accuracy of subsequent processing and detecting straight lines more accurately.

[0041] Canny edge detection is a widely used edge detection algorithm that implements edge detection through the following steps:

[0042] 1) Denoising: Use a Gaussian filter to smooth the image to remove noise.

[0043] 2) Gradient calculation: Calculate the gradient magnitude and direction of each pixel in the image.

[0044] 3) Non-maximum suppression: Non-maximum suppression is performed on the gradient direction of each pixel in the image to retain the edge pixels at the local gradient maximum.

[0045] 4) Double threshold detection: A double threshold detection strategy is used to classify the gradient amplitude into three categories: strong edge, weak edge, and non-edge, and further connect the strong edge pixels to generate a complete edge.

[0046] 2.1.4. Use Hough transform to detect straight lines and calculate the length of the scale bar.

[0047] Use the Hough transform to detect all line segments in the binary image edges obtained after edge detection in step 2.1.3. Convert the line segment representation from (x, y) coordinates in the image space coordinate system to polar coordinates (r, θ). Map the points on the curve onto a curve in polar coordinate space, ensuring a one-to-one correspondence between the curve in polar coordinate space and the points on the curve in the original coordinate system. The line segment parameters in the original coordinate system can be obtained from the points in polar coordinate space, thereby detecting the line segments. The Hough transform can be used to find intersections in the parameter space; these intersections correspond to the line segments in the image. By calculating the distance between the line segment endpoints, the pixel length of the red line segment can be obtained. This method is more accurate than calculating the length of the bounding rectangle in pixels and is suitable for measuring diagonal line segments, excluding horizontal red ruler segments. Both conventional bounding rectangles and minimum bounding rectangles produce significant errors when measuring red line segments. This invention abandons the traditional bounding rectangle method and uses the Hough transform to detect line segment lengths, achieving an error of less than 1 pixel (0.0034 mm). The specific process is:

[0048] (1) Hough transform: By performing Hough transform on the binary image edges obtained after edge detection in step 2.1.3, the coordinates, positions and directions of the endpoints of all line segments in the image are detected.

[0049] (2) Find the longest line segment:

[0050] After using Hough to detect straight lines, the pixel lengths of all line segments are obtained by calculating the Euclidean distance, i.e.:

[0051]

[0052] Among them, the pixel_size value represents the number of pixels in the length direction of the line segment, (x i ,y i ) and (x j ,y j ) are the coordinates of the two endpoints of the line segment respectively;

[0053] Traverse and calculate the length of all line segments. The length of the longest line segment is the pixel length of the red scale preset in step 1. The actual length of the scale preset in step 1 is L (in millimeters). The actual length represented by each pixel can be calculated as:

[0054]

[0055] Among them, (x2, y2) and (x1, y1) are the coordinates of the two endpoints of the longest line segment respectively.

[0056] The advantage of using pixels to measure length in image processing is that it can easily, quickly, and accurately obtain the size information of each object in the image, while avoiding the errors and subjectivity of manual measurement. By calculating the length of the line segment, the pixel length corresponding to the actual length of the red line segment (i.e., the scale preset in step 1) can be obtained on the image, which can then be used for subsequent calculations to convert the pixel length of the fiber length into the actual length. This algorithm is based on the Pythagorean theorem and uses the coordinates of the two endpoints of the line segment to calculate the length of the line segment with high accuracy. By dividing the pixel size by the actual length, the proportional relationship between the pixel and the actual distance can be obtained, which facilitates subsequent actual length measurement.

[0057] 2.2. Processing the fiber part in the image to extract the skeleton

[0058] 2.2.1. Convert the image into RGB format and perform grayscale processing

[0059] In a computer, the image format acquired in step 1 is converted from RGB to BGR, and then to grayscale. When processing an image, if only the color channel is considered, significant information may be lost. For example, when analyzing image shapes and edges, information from the color channel can interfere with and hinder analysis. Grayscale images, however, contain only brightness information, making them simpler. Grayscaling converts the image into a black and white grayscale image, making the fiber outlines clearer and more distinct, facilitating the subsequent extraction of fiber outlines using the fiber length measurement algorithm.

[0060] 2.2.2, Sober detection edge

[0061] Perform edge detection on the grayscale image obtained in step 2.2.1 using the Sobel operator to obtain the image's gradient and, therefore, the fiber edges. The Sobel operator is a common edge detection operator that detects edges by calculating the image's gradients in the horizontal and vertical directions. When capturing fiber images, the images are nearly translucent. In images, edges typically represent large changes in pixel values. Therefore, when the fiber image and background image are close together, the difference in pixel values ​​between the fibers and background is small. Therefore, the Sobel operator can effectively extract fiber outlines and remove background noise, providing better edge detail for textile fiber images.

[0062] 2.2.3. Binarize the gradient image after edge detection by the sober operator and convert it into a black and white image

[0063] Binarization converts the image processed by Sobel edge detection into a binary image with only black and white pixel values, making subsequent connected domain analysis more accurate. By using threshold segmentation to binarize the image, background pixels are set to 0 and fiber pixels are set to 255, facilitating fiber detection and analysis.

[0064] 2.2.4. Perform closing operations (dilation and erosion operations) on the binary-processed black and white image to obtain a complete fiber body without gaps.

[0065] Because the fibers are uneven in width, some thick and some thin, some broken, and are nearly transparent, gaps will be created in the fibers during recognition, affecting the next step of recognition. The closing operation is to dilate a 5*5 square structural element on the fiber main body image in step 2.2.3, and then perform an erosion operation to fill the gaps in the fiber outline and make up for the broken parts, eliminating the impact of fiber breakage, making the fiber more complete, and making it easier to perform the next step.

[0066] Specifically, when performing a closing operation, a dilation operation is first performed to expand the target area by a certain number of pixels, followed by an erosion operation to reduce the target area back to its original size. This fills small holes and breaks within the target area, making the target more complete. Furthermore, the closing operation smoothes the target's boundaries, making the target outline more continuous and facilitating subsequent processing operations.

[0067] 2.2.4. Identify the largest connected region of the image after the closing operation to obtain the fiber main body image

[0068] After edge recognition, there are many noise points (white pixels other than fibers) on the image. It is generally impossible to directly identify the fiber body after the closed operation. It is necessary to compare the size of the connected area and select the fiber connected area (the largest connected area) so that the connected area can be well identified. A connected area (Connected Component) generally refers to an image area (Region, Blob) composed of foreground pixels with the same pixel value and adjacent positions in the image. Connected Component Analysis (Connected Component Labeling) refers to finding and labeling each connected area in the image. Identifying connected domains can be divided into three steps:

[0069] 1. Identify the neighboring pixels of each pixel. If the neighboring pixels are the same pixel, the two pixels are considered to be connected. This step will record the coordinates, width, height, and area of ​​all connected domains to facilitate the next step of identifying the fiber body.

[0070] 2. Traverse the area of ​​each connected region and find the largest connected region.

[0071] 3. Set all pixel values ​​in areas other than the largest connected area to zero, and retain the pixel value of the largest connected area.

[0072] After identifying the connected regions, an image containing the largest connected domain is obtained, that is, an image including an obvious fiber body.

[0073] 2.2.5. Perform Gaussian smoothing and skeletonization on the fiber body to obtain single-pixel axes.

[0074] The fiber main body image obtained in the previous step is subjected to Gaussian smoothing to obtain a smoother curve main body, and then the smoothed main body is subjected to skeletonization to obtain a single-pixel axis.

[0075] Gaussian smoothing is an image smoothing filter that aims to reduce noise and detail in an image by taking a weighted average of each pixel and its surrounding pixels. This smoothes the noise in the image, making it more uniform and natural, while preserving good image detail. The present invention uses Gaussian smoothing to further smooth the line segments in the fiber body image obtained after identifying connected regions, making the single-pixel axis more continuous and smooth. Gaussian smoothing also reduces the impact of noise, thereby improving the robustness of the algorithm.

[0076] Skeletonization is a technique used to convert a binary image into its "skeleton", also commonly known as thinning. Skeletonization uses the Eight-Connected Thinning Algorithm to process the binary image until all edge pixels are removed.

[0077] First, we need to traverse each pixel in the binary image and determine whether it is an edge pixel (also called a skeleton pixel). If so, we perform an eight-neighborhood check to see if the eight surrounding pixels are all background pixels (i.e., black pixels). If so, we delete the pixel; otherwise, we keep it unchanged. This process is repeated until all edge pixels are deleted, resulting in a fiber skeleton image.

[0078] 2.2.6. Perform curve fitting on the skeletonized image and calculate the length of the fitting curve. Save and display the processed image.

[0079] Fit the single-pixel axis in the fiber skeleton image obtained in step 2.2.5 using a B-spline curve to obtain a smooth curve. B-spline curves are a precise curve fitting method that smoothly fits data without overfitting, as is the case with linear fitting. Then, evenly space 6000 points on the fitted smooth curve. Calculate the pixel distance between each two adjacent points and add them together to obtain the pixel length of the single-pixel axis. Finally, convert the pixel length of the single-pixel axis to the actual length using the actual length represented by each pixel obtained in step 2.1.4.

[0080] experiment:

[0081] Comparative experiments were conducted using manual fiber length measurement, traditional imaging methods, and a fiber length measurement method based on automatic scale recognition. Manual measurement involves using a fiber of appropriate length. Tweezers are used to hold both ends of the fiber, straightening it, and measuring it with a ruler. The obtained length serves as the reference length for this experiment. Traditional imaging methods involve drawing line segments along the fiber's direction using a Zeiss electron microscope. The end of each line segment is connected, and the sum of the lengths of these segments is the fiber's pixel length.

[0082] The three methods were used to measure 10 fibers of different lengths. The comparison results are shown in Table 1:

[0083] Table 1. Comparison of fiber lengths measured manually, by conventional imaging, and by the present invention

[0084]

[0085]

[0086] As can be seen from Table 1, the test accuracy of the present invention is significantly lower than that of the fiber length measured by the traditional imaging method. Figure 2 It can also be seen that the single-pixel axis in the fiber skeleton image of the present invention is well fitted using the B-spline curve, and basically perfectly fits the fiber line segment in the original image.

[0087] Finally, it should be noted that the above examples are merely specific embodiments of the present invention. Obviously, the present invention is not limited to the above examples and is subject to numerous variations. All variations that can be directly derived or conceived by a person of ordinary skill in the art from the disclosure of the present invention are considered to be within the scope of protection of the present invention.

Claims

1. A fiber length measurement method based on automatic scale recognition, characterized in that : Acquire an image of the fiber, wherein the acquired fiber image includes a red scale bar with a known actual length L, calculate the actual length of each pixel of the scale bar on the acquired fiber image, and then calculate the actual length of the fiber based on the pixel length of the fitting curve of the fiber on the acquired fiber image; The actual length of each pixel of the scale bar is calculated as follows: (1) converting the fiber image from RGB color space to HSV color space; (2) On the image in the HSV color space, set the red pixels to white and the pixels of other colors to black to generate a mask image; (3) Perform edge detection on the mask image using the Canny edge detection algorithm to obtain a binary image; (4) Use Hough transform to detect the binary image, obtain the coordinates of the endpoints of all line segments in the binary image, and then obtain the longest line segment by calculating the pixel length of all line segments and calculate: Where Length is the actual length represented by each pixel, (x2, y2) and (x1, y1) are the coordinates of the two endpoints of the longest line segment respectively; The actual length of the fiber is calculated as follows: (1) converting the image format of the fiber image from RGB to BGR, and then converting it into a grayscale image; (2) performing edge detection on the grayscale image using the Sobel operator to obtain the edge of the fiber, and then performing binarization processing to convert it into a black and white image; (3) Perform a closing operation on the black and white image and then identify the largest connected area to obtain an image including the obvious fiber body; (4) Gaussian smoothing is performed on the fiber main body image to obtain a smoother curve main body, and then the smoothed main body is skeletonized to obtain a single pixel axis; (5) Fitting the single-pixel axis using a B-spline curve, then evenly spaced points are taken on the smooth curve obtained by fitting, the pixel distance between each two adjacent points is calculated and added to obtain the pixel length of the single-pixel axis; the pixel length of the single-pixel axis is multiplied by the actual length of each pixel to obtain the actual length of the fiber.

Citation Information

Patent Citations

  • Product dimension sub-pixel measurement method under industrial microscale motion blurred imaging condition

    CN106651828A

  • Method of extracting fiber features in fiber reinforced composite material based on image processing

    CN106780597A