Fiber diameter batch processing method
Through a fiber diameter batch processing method including image preprocessing, morphological processing and fiber region precise positioning, the problems of high time, high cost and measurement result deviation of fiber diameter detection in the prior art are solved, and efficient and accurate fiber diameter measurement is achieved.
Patent Information
- Application Number
- CN202411895054.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-21
- Publication Date
- 2025-05-13
AI Technical Summary
The existing fiber diameter detection methods are cumbersome, time-consuming and inefficient, expensive equipment, high detection costs, and parameter optimization problems in computer vision image processing technology and insufficient image feature extraction capabilities, resulting in deviations in measurement results and the distribution rules of fiber diameter cannot be accurately characterized.
A batch processing method for fiber diameter is proposed, including obtaining fiber sample images and performing grayscale processing, extracting specific grayscale areas, determining the area through median and mean filtering, performing multiple corrosion, expansion and segmentation of the communication domain operations, screening out the fiber area, and calculating its inline circle radius, and finally calculating the actual diameter of the fiber through the width of the scale area and correlation with the inline circle radius.
It realizes efficient and fast acquisition of fiber diameter data in batches, improves processing efficiency and accuracy, reduces the dependence of manual measurement, reduces detection costs, and enhances industry competitiveness.
Smart Images

Figure CN119984068A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of fiber diameter detection, and in particular to a fiber diameter batch processing method. Background Art
[0002] In the early days of fiber diameter detection, the commonly used method was to place the fiber sample under a microscope, observe it with the naked eye, and use tools such as a ruler to measure the fiber diameter. Later, the optical microscope projection method (LM) was derived, that is, the sample was stained and projected onto the table and then measured with a wedge ruler. Later, due to the invention of advanced equipment, the scanning electron microscope method was able to achieve a greater magnification, and the image of the fiber could be obtained through an image acquisition device, and then measured manually by the tester. At present, the optical analyzer method (OFDA) can image fibers that are in the same plane and cut into specific lengths, and automatically analyze the collected fiber images through computer image processing technology, which effectively saves the time of manual calculation, but has relatively high requirements for the use environment. Based on the principle of laser diffraction, the laser scanning method that calculates the fiber diameter by measuring the spacing, intensity and other characteristics of the diffraction fringes is relatively less affected by the irregular shape of the fiber, but is easily disturbed when measuring multiple fiber mixtures.
[0003] In the textile field, there are many methods for measuring fiber diameter, including traditional microscope observation, optical fiber diameter analysis (OFDA), laser scanning analysis, digital image processing technology, etc. Traditional measurement methods are highly empirical, labor-intensive, and manual measurement requires high quality of inspectors. They cannot process images in batches to obtain data, and the measurement process is cumbersome, time-consuming and inefficient. Methods such as OFDA and laser methods are expensive and have high testing costs. Computer vision image processing technology has defects such as parameter optimization problems, insufficient image feature extraction capabilities, and limited data accuracy, which leads to certain deviations in the measurement results and cannot accurately characterize the distribution law of fiber diameter.
[0004] Therefore, it is necessary to design a fiber diameter batch processing method, which not only overcomes the limitations of the above measurement methods such as cumbersome, time-consuming, inefficient, expensive equipment, and high detection costs to the greatest extent, but also can achieve efficient, fast, and batch data acquisition, avoiding the defects of computer vision image processing technology such as parameter optimization problems, insufficient image feature extraction capabilities, and limited data accuracy, which lead to certain deviations in the measurement results and cannot accurately characterize the fiber diameter data. Summary of the invention
[0005] In view of this, the present invention proposes a fiber diameter batch processing method, which aims to solve the limitations of traditional measurement methods such as cumbersome, time-consuming and inefficient, expensive equipment and high detection costs, while being able to achieve efficient, fast and batch data acquisition, and avoid the defects of computer vision image processing technology such as parameter optimization problems, insufficient image feature extraction capabilities and limited data accuracy, which lead to certain deviations in measurement results and make it impossible to accurately measure the fiber diameter relatively accurately.
[0006] In one aspect, the present invention provides a fiber diameter batch processing method, comprising:
[0007] Obtain the fiber sample image and grayscale it, extract the specific grayscale area, segment the connected domain and screen out the qualified scale area and its width;
[0008] Perform median filtering and mean filtering on the grayscale image, determine the dark and bright areas based on the filtering results and obtain their union;
[0009] For the union area, multiple corrosion, expansion, segmentation of connected domains and region selection operations are carried out in sequence to continuously optimize the definition of fiber regions;
[0010] Carry out corrosion treatment on the screened fiber area and accurately calculate the radius of its inscribed circle;
[0011] The actual fiber diameter at the image sampling point is calculated by integrating the ruler area width, the inscribed circle radius and the ruler scale value.
[0012] Furthermore, the obtaining of the fiber sample image and grayscale processing to extract the specific grayscale area includes:
[0013] Get the image size, and use the relevant functions of the image processing library to accurately obtain the width and height of the fiber sample image to be processed. The fiber sample image is recorded as Image, the width is recorded as width, and the height is recorded as height;
[0014] Grayscale processing: The grayscale strategy of weighted average method is used to convert the image into a grayscale image. Different weights are assigned to the red, green and blue channels according to the sensitivity of the human eye to different colors, which are 0.299, 0.587 and 0.114 respectively. The grayscale value is obtained by weighted summation, which effectively compresses the image data volume, highlights the brightness characteristics, and retains the basic structure of the image. The grayscale image is recorded as grayimage;
[0015] Extract specific areas. In grayimage, use threshold selection technology to accurately extract the area with grayscale values in [250,255] as LabelRegion.
[0016] Furthermore, the segmenting of the connected domain and screening out the qualified scale area and its width includes:
[0017] Segment the connected domain, use the depth-first search algorithm to implement 4-connected domain segmentation on LabelRegion to form Aregions, starting from the selected starting pixel, recursively visit the adjacent pixels with the same value and mark them until all connected pixels are traversed to complete a connected domain extraction, and repeat this process until all pixels are processed;
[0018] Filter the ruler area and comprehensively evaluate each area of Aregions according to the predefined area threshold [2500,8000], rectangularity threshold [0.5,1] and width threshold [150,350]. The area threshold is set according to the common size of the ruler to exclude too small and too large parts. The rectangularity measures the fit between the shape of the region and the ideal rectangle. It is calculated with the formula of the ratio of the area of the region to the area of the minimum enclosing rectangle. The ruler is rectangular. The width threshold is further accurately defined. After comprehensive screening, the ruler area ScaleRegion is determined and its width ScaleRegion_Width is accurately calculated.
[0019] Furthermore, the median filtering and mean filtering are performed on the grayscale image, and the dark and bright areas are determined according to the filtering results and their union is obtained, including:
[0020] Median filter operation, construct a circular median filter with a size of 1 to filter grayimage. When filtering, sort the pixels covered by the filter according to the grayscale value, take the median value to update the grayscale of the pixel to obtain medianimage;
[0021] Mean filter operation, create a mean filter of size width×height to process grayimage, accumulate the grayscale values of all pixels in the image and divide it by the total number of pixels to get the mean value meanvalue, and use it to replace the original pixel grayscale to generate meanimage;
[0022] Compare the filtered area, compare the grayscale values of medianimage and meanimage pixel by pixel, if MedianValue(i,j)-MeanValue(i,j)≤5, then classify the (i,j) pixel into the dark area DarkRegion; if MedianValue(i,j)-MeanValue(i,j)≥20, then classify it into the bright area LightRegion, and finally find the union of the two to get UnionRegion.
[0023] Furthermore, for the union region, multiple corrosion, expansion, segmentation of connected domains and region selection operations are sequentially performed to continuously optimize the fiber region definition, including:
[0024] The first erosion and dilation is to use a circular structure element with a radius of 2 to perform an erosion operation on UnionRegion. The center of the structure element traverses the pixels. If all the neighboring pixels are in the region, the central pixel is retained, otherwise it is deleted, and small noise points and isolated areas are eliminated. Then the same structure element is used for dilation to expand the boundary of the eroded region and fill the hollows. After erosion and dilation, OpeningRegion is obtained to regularize the region boundary and simplify the shape.
[0025] First region selection: Apply the connected component marking algorithm to OpeningRegion (split the connected domain to obtain Bregions. The algorithm first scans and marks the preliminary connected domain, then scans and processes the boundary pixels and merges the adjacent connected domains. Then, it traverses the Bregions according to the area size and selects the largest area as Regionmax.
[0026] Secondary expansion and erosion: Use a circular structure element with a radius of 10 to expand Regionmax first, expand the fiber region boundary, reconnect the possible separated fiber branches or connected parts, and then erode to remove the redundant edges and impurities introduced by the expansion, and obtain ClosingRegion after expansion and corrosion.
[0027] Furthermore, the above-mentioned method of sequentially performing multiple corrosion, expansion, segmentation of connected domains and region selection operations on the union region to continuously optimize the fiber region definition also includes:
[0028] Three times of erosion and dilation, using a circular structure element with a radius of 20 to erode and dilate ClosingRegion in turn, erosion reduces small interference and blurred boundary parts, and dilation repairs the optimized shape and enhances continuity to obtain OpeningRegion1, and further refine the shape and size of the fiber region;
[0029] Finally, the difference set is expanded, and the DilationRegion is obtained by dilating the OpeningRegion1 with a circular structure element of radius 1, and the fiber region is expanded to ensure that the fiber is completely covered. The DifferenceRegion is calculated by the difference set of DilationRegion and ClosingRegion, and the non-fiber components of the background and impurities adhering to the fiber are accurately removed;
[0030] Secondary region screening: DifferenceRegion is marked and segmented again to obtain Cregions by connecting components. Cregions are traversed and Dregions are screened out according to the area threshold (>3500), small area noise and irrelevant areas are excluded, and the fiber area is deeply purified.
[0031] Furthermore, the method of performing corrosion treatment on the screened fiber area and accurately calculating the radius of the inscribed circle thereof includes:
[0032] In the final erosion operation, a circular structure element with a radius of 2.5 is used to erode the region set Dregions to obtain ErosionRegions;
[0033] Calculate the radius of the inscribed circle. For each area of ErosionRegions, use the least squares method to fit the circle and calculate the radius Rvalue of the inscribed circle. Construct an error function based on the pixel coordinates of the regional boundary. Iteratively optimize the circle parameters (center coordinates and radius) until the error is minimized. Determine the inscribed circle. Rvalue is used as the key characterization parameter of fiber thickness and the core intermediate quantity for diameter calculation.
[0034] Furthermore, the fusion scale area width, the inscribed circle radius and the scale scale value are used to calculate the actual fiber diameter at the image sampling point, including:
[0035] Calculate the actual diameter and calculate the actual diameter of the fiber at the image sampling point according to the formula 2×Rvalue / ScaleRegion_Width×scale value, where 2×Rvalue approximates the fiber diameter with the inscribed circle diameter, ScaleRegion_Width is used as the proportional conversion scale, and the scale value is the number of pixels corresponding to the actual ruler unit length. Associate Rvalue and ScaleRegion_Width with the actual ruler scale to complete the conversion from pixels to physical size (diameter).
[0036] Compared with the prior art, the beneficial effect of the present invention lies in that a fiber diameter batch processing method of the present invention improves accuracy by accurately determining the scale area in image preprocessing and screening the scale through multiple features; the filtering stage adopts a combination of median and mean filtering, accurately divides the area based on the filtering difference, effectively suppresses noise while retaining key information; multiple corrosion, expansion and screening operations cooperate with each other during morphological processing, gradually refine the fiber area, and accurately peel off the fiber from the complex image background; the radius calculation is performed by least squares method to fit the circle and iterative optimization to ensure the accuracy of the inscribed circle radius; the final diameter calculation unifies pixels and physical dimensions according to a rigorous formula to achieve batch high-precision processing, providing solid data support for fiber property research, quality control, etc., greatly improving processing efficiency and accuracy, and enhancing industry competitiveness. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0038] Figure 1 This is a flow chart of a fiber diameter batch processing method according to an embodiment of the present invention;
[0039] Figure 2 is a grayscale image of the image to be processed in an embodiment of the present invention;
[0040] Figure 3 It is a region map with grayscale value range of [250,255] in the grayscale image;
[0041] Figure 4 is the image after median filtering of the grayscale image;
[0042] Figure 5 is the image after mean filtering;
[0043] Figure 6 is the corrosion operation graph;
[0044] Figure 7 It is the expansion operation graph. DETAILED DESCRIPTION
[0045] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to be able to fully convey the scope of the present invention to those skilled in the art. It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with the implementation regulations.
[0046] Reference Figure 1 As shown, in some embodiments of the present application, a fiber diameter batch processing method comprises:
[0047] Obtain the fiber sample image and grayscale it, extract the specific grayscale area, segment the connected domain and screen out the qualified scale area and its width;
[0048] Perform median filtering and mean filtering on the grayscale image, determine the dark and bright areas based on the filtering results and obtain their union;
[0049] For the union area, multiple corrosion, expansion, segmentation of connected domains and region selection operations are carried out in sequence to continuously optimize the definition of fiber regions;
[0050] Carry out corrosion treatment on the screened fiber area and accurately calculate the radius of its inscribed circle;
[0051] The actual fiber diameter at the image sampling point is calculated by integrating the ruler area width, the inscribed circle radius and the ruler scale value.
[0052] It is understandable that the scale area is accurately determined in image preprocessing, and the accuracy is improved by multi-feature scale screening; the filtering stage adopts a combination of median and mean filtering, and the area is accurately divided based on the filtering difference, which effectively suppresses noise while retaining key information; multiple corrosion, expansion and screening operations cooperate with each other during morphological processing, gradually and accurately determine the fiber area, and accurately peel off the fiber from the complex image background; the radius calculation is strictly compounded and professionally calculated to ensure the accuracy of the inscribed circle radius; the final diameter calculation unifies pixels and physical dimensions according to a rigorous formula to achieve batch high-precision processing, providing solid data support for fiber property research, quality control, etc., greatly improving processing efficiency and accuracy, and enhancing industry competitiveness.
[0053] Specifically, the width and height of the image to be processed are accurately obtained using the relevant functions of the image processing library. This step builds a basic framework for subsequent processing to ensure that the operation is performed within the correct image scale. For example, in Python, the shape attribute of the OpenCV library can be used to obtain image size information. This basic parameter will play a key role in many links such as setting the filter kernel size and defining the region screening range.
[0054] Specifically, refer to Figure 2 , the image is converted into a gray image using grayscale strategies such as weighted average method, maximum value method or average value method. Taking the weighted average method as an example, it assigns different weights to the red, green and blue channels (such as the common 0.299, 0.587 and 0.114) according to the sensitivity of the human eye to different colors, and obtains the gray value by weighted summation, which effectively compresses the image data volume, highlights the brightness characteristics, and retains the basic structure of the image, which facilitates the subsequent feature extraction.
[0055] Specifically, refer to Figure 3 In grayimage, the area with grayscale value [250,255] is accurately extracted as LabelRegion by using threshold selection technology. Considering the light color and high grayscale characteristics of the ruler, this range can effectively capture the possible ruler part. In actual operation, the extraction can be achieved by traversing the image pixels and comparing the grayscale value with the threshold, anchoring the target area for subsequent processing, narrowing the processing range and enhancing the pertinence.
[0056] Specifically, the depth-first search (DFS) or breadth-first search (BFS) algorithm is used to implement 4-connected domain segmentation on LabelRegion to form Aregions. Taking DFS as an example, starting from the selected starting pixel, recursively visit and mark the adjacent pixels with the same value until all connected pixels are traversed and a connected domain extraction is completed. This process is repeated until all pixels are processed. The discontinuity of the ruler caused by shooting can be properly handled, laying the foundation for accurate screening of the ruler area.
[0057] Specifically, the Aregions were comprehensively evaluated based on the predefined area thresholds [2500, 8000], rectangularity thresholds [0.5, 1], and width thresholds [150, 350]. The area threshold was set according to the common size of the ruler to exclude parts that were too small (possibly noise) or too large (perhaps misjudged areas); the rectangularity measured the fit between the shape of the region and the ideal rectangle, and was calculated with the help of a formula (such as the ratio of the area of the region to the area of the minimum circumscribed rectangle). The ruler was mostly rectangular; the width threshold was further precisely defined. After comprehensive screening, the ruler region ScaleRegion was determined and its width ScaleRegion_Width was accurately calculated, providing a key ratio reference for subsequent fiber diameter conversion.
[0058] Specifically, refer to Figure 4 , a circular median filter with a size of 1 is constructed to filter grayimage. When filtering, the pixels covered by the filter are sorted by grayscale value, and the median is taken to update the grayscale of the pixel to obtain medianimage. For example, if the grayscale value of the 3×3 neighborhood pixel is [30,40,50,45,60,70,55,65,75], the median 55 replaces the original pixel value after sorting. This filter can effectively eliminate salt and pepper noise, because the grayscale value of the noise point is often very different from the surrounding area, and the median replacement can weaken its influence. At the same time, it better retains the edge details of the image and avoids blur, laying the foundation for the subsequent accurate distinction between fiber and background areas.
[0059] Specifically, refer to Figure 5 , create a mean filter of size width×height to process grayimage. The mean value meanvalue is obtained by accumulating the grayscale values of all pixels in the image and dividing it by the total number of pixels, and the original pixel grayscale is replaced with it to generate meanimage. This filter smoothes the image and reduces random noise based on statistical principles, but it will cause edge blurring because it does not distinguish the importance of pixels and treats edge and detail pixels equally. However, it provides assistance to highlight the grayscale difference between fibers and background, and enhances the recognition of regional screening.
[0060] Specifically, the grayscale values of medianimage and meanimage are compared pixel by pixel. If MedianValue(i,j)-MeanValue(i,j)≤5, the pixel (i,j) is classified as the dark region DarkRegion; if MedianValue(i,j)-MeanValue(i,j)≥20, it is classified as the bright region LightRegion, and finally the union of the two is obtained to obtain UnionRegion. Based on the filtering effect screening strategy, the grayscale difference generated by median filtering to preserve the edge and mean filtering to flatten the noise is cleverly used to accurately outline the fiber and background contours, accurately lock the fiber area range for subsequent morphological processing, and improve processing accuracy and efficiency.
[0061] Specifically, refer to Figure 6 and Figure 7 , a circular structure element with a radius of 2 is used to perform an erosion operation on UnionRegion. The center of the structure element traverses the pixels. If all the neighboring pixels are in the region, the central pixel is retained, otherwise it is deleted, and small noise points and isolated areas are eliminated. Then the same structure element is used for expansion to expand the boundary of the eroded region and fill the hollow depressions. After erosion and expansion (opening operation), OpeningRegion is obtained, the region boundary is regularized and the shape is simplified, which is prepared for the segmentation of connected domains and the initial positioning of fiber regions; the connected component marking algorithm (such as the two-pass scanning method) is used to segment the connected domains of OpeningRegion to obtain Bregions. The algorithm first scans and marks the preliminary connected domain, and then scans the boundary pixels and merges the adjacent connected domains. Then, Bregions are traversed according to the size of the area, and the area with the largest area is selected as Regionmax. Since the main body of the fiber usually occupies a large area, the fiber core area is initially locked in this way, small-area background or noise interference is screened out, the processing scope is narrowed, and the efficiency is improved; the circular structure element with a radius of 10 is used to expand Regionmax first, expand the fiber region boundary, reconnect the fiber branches or connected parts that may be separated, and then erode to remove the redundant edges and impurities introduced by the expansion. After expansion and corrosion (closing operation), ClosingRegion is obtained, which effectively fills the small holes inside the fiber, optimizes the boundary smoothness, improves the regional integrity and accuracy, and makes the fiber region more consistent with the actual shape; the circular structure element with a radius of 20 is used to corrode and expand ClosingRegion in turn, erosion reduces small interference and boundary fuzzy parts, and expansion repairs the optimized shape and enhances continuity to obtain OpeningRegion1, and further refines the shape and size of the fiber region to provide key links for subsequent accurate extraction of the fiber region and enhance processing stability and reliability; the circular structure element with a radius of 1 is used to expand OpeningRegion1 to obtain DilationRegion, and the fiber region is expanded to ensure that the fiber is fully covered. The DifferenceRegion is obtained by calculating the difference between DilationRegion and ClosingRegion, and non-fiber components such as background and impurities adhered to the fibers are accurately removed. The fiber region is further purified by using the characteristics of expansion and difference operations, laying a precise regional foundation for accurately calculating the fiber diameter.
[0062] Specifically, the connected components of DifferenceRegion are marked and segmented again to obtain Cregions, and Cregions are traversed to filter out Dregions according to the area threshold (>3500), small area noise or irrelevant areas are excluded, and the fiber area is deeply purified. After multiple rounds of screening and processing, it is ensured that Dregions are highly consistent with the actual distribution of fibers, providing precise objects for subsequent parameter calculations and ensuring the accuracy of diameter measurement.
[0063] Specifically, a circular structural element with a radius of 2.5 is used to erode the region set Dregions to obtain ErosionRegions, making the fiber region edge tighter. This operation finely processes the fiber region boundary, removes irregular edge pixels left over from the previous processing, ensures the regular shape of the fiber region, avoids edge blur or burrs interfering with subsequent radius calculations, and improves radius measurement accuracy and diameter calculation accuracy.
[0064] Specifically, for each area of ErosionRegions, a geometric algorithm (such as least squares method for fitting circles) is used to calculate the radius Rvalue of the inscribed circle. Taking the least squares method as an example, an error function is constructed based on the pixel coordinates of the region boundary, and the circle parameters (center coordinates and radius) are iteratively optimized to minimize the error, and the inscribed circle is determined. Rvalue is a key parameter for characterizing fiber thickness and a core intermediate quantity for diameter calculation. Its accuracy is directly related to the measurement accuracy of fiber diameter and provides key data support for the final physical size conversion.
[0065] Specifically, the actual fiber diameter at the image sampling point is calculated according to the formula 2×Rvalue / ScaleRegion_Width×scale value. Among them, 2×Rvalue approximates the fiber diameter with the diameter of the inscribed circle, and ScaleRegion_Width is used as the scale conversion scale, which is derived from the pixel width of the scale area accurately measured in the early stage. The scale value is the number of pixels corresponding to the actual unit length of the scale (such as 1mm actually corresponds to n pixels in the image). Through this formula, the image pixel measurement value (Rvalue, ScaleRegion_Width) is associated with the actual scale scale, and the pixel to physical size (diameter) conversion is completed, and the batch fiber diameter is accurately measured, providing key fiber size data for material property research, product quality control, etc., and strongly supporting the development and application of related technologies.
[0066] It should be noted that:
[0067] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known structures and technologies are not shown in detail so as not to obscure the understanding of this description.
[0068] Furthermore, those skilled in the art will appreciate that although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features from different embodiments is meant to be within the scope of the present application and to form different embodiments.
[0069] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A fiber diameter batch processing method, characterized in that: include: Obtain the fiber sample image and grayscale it, extract the specific grayscale area, segment the connected domain and screen out the qualified scale area and its width; Perform median filtering and mean filtering on the grayscale image, determine the dark and bright areas based on the filtering results and obtain their union; For the union area, multiple corrosion, expansion, segmentation of connected domains and region selection operations are carried out in sequence to continuously optimize the definition of fiber regions; Carry out corrosion treatment on the screened fiber area and accurately calculate the radius of its inscribed circle; The actual fiber diameter at the image sampling point is calculated by integrating the ruler area width, the inscribed circle radius and the ruler scale value.
2. A fiber diameter batch processing method according to claim 1, characterized in that: The method of obtaining the fiber sample image and graying it to extract a specific gray area includes: Get the image size, and use the relevant functions of the image processing library to accurately obtain the width and height of the fiber sample image to be processed. The fiber sample image is recorded as Image, the width is recorded as width, and the height is recorded as height; Grayscale processing: The grayscale strategy of weighted average method is used to convert the image into a grayscale image. Different weights are assigned to the red, green and blue channels according to the sensitivity of the human eye to different colors, which are 0.299, 0.587 and 0.114 respectively. The grayscale value is obtained by weighted summation, which effectively compresses the image data volume, highlights the brightness characteristics, and retains the basic structure of the image. The grayscale image is recorded as grayimage; Extract specific areas. In grayimage, use threshold selection technology to accurately extract the area with grayscale values in [250,255] as LabelRegion.
3. A fiber diameter batch processing method according to claim 2, characterized in that: The above-mentioned process of segmenting the connected domain and selecting the qualified scale area and its width includes: Segment the connected domain, use the depth-first search algorithm to implement 4-connected domain segmentation on LabelRegion to form Aregions, starting from the selected starting pixel, recursively visit the adjacent pixels with the same value and mark them until all connected pixels are traversed to complete a connected domain extraction, and repeat this process until all pixels are processed; Filter the ruler area and comprehensively evaluate each area of Aregions according to the predefined area threshold [2500,8000], rectangularity threshold [0.5,1] and width threshold [150,350]. The area threshold is set according to the common size of the ruler to exclude too small and too large parts. The rectangularity measures the fit between the shape of the region and the ideal rectangle. It is calculated with the formula of the ratio of the area of the region to the area of the minimum enclosing rectangle. The ruler is rectangular. The width threshold is further accurately defined. After comprehensive screening, the ruler area ScaleRegion is determined and its width ScaleRegion_Width is accurately calculated.
4. A fiber diameter batch processing method according to claim 3, characterized in that: The above-mentioned median filtering and mean filtering are performed on the grayscale image, and the dark and bright areas are determined according to the filtering results and their union is obtained, including: Median filter operation, construct a circular median filter with a size of 1 to filter grayimage. When filtering, sort the pixels covered by the filter according to the grayscale value, take the median value to update the grayscale of the pixel to obtain medianimage; Mean filter operation, create a mean filter of size width×height to process grayimage, accumulate the grayscale values of all pixels in the image and divide it by the total number of pixels to get the mean value meanvalue, and use it to replace the original pixel grayscale to generate meanimage; Compare the filtered area, compare the grayscale values of medianimage and meanimage pixel by pixel, if MedianValue(i,j)-MeanValue(i,j)≤5, then classify the (i,j) pixel into the dark area DarkRegion; if MedianValue(i,j)-MeanValue(i,j)≥20, then classify it into the bright area LightRegion, and finally find the union of the two to get UnionRegion.
5. A fiber diameter batch processing method according to claim 4, characterized in that: The above-mentioned operations of corrosion, expansion, segmentation of connected domains and region selection are carried out in sequence for the union region to continuously optimize the definition of the fiber region, including: The first erosion and dilation is to use a circular structure element with a radius of 2 to perform an erosion operation on UnionRegion. The center of the structure element traverses the pixels. If all the neighboring pixels are in the region, the central pixel is retained, otherwise it is deleted, and small noise points and isolated areas are eliminated. Then the same structure element is used for dilation to expand the boundary of the eroded region and fill the hollows. After erosion and dilation, OpeningRegion is obtained to regularize the region boundary and simplify the shape. First region selection: Apply the connected component marking algorithm to OpeningRegion (split the connected domain to obtain Bregions. The algorithm first scans and marks the preliminary connected domain, then scans and processes the boundary pixels and merges the adjacent connected domains. Then, it traverses the Bregions according to the area size and selects the largest area as Regionmax. Secondary expansion and erosion: Use a circular structure element with a radius of 10 to expand Regionmax first, expand the fiber region boundary, reconnect the possible separated fiber branches or connected parts, and then erode to remove the redundant edges and impurities introduced by the expansion, and obtain ClosingRegion after expansion and corrosion.
6. A fiber diameter batch processing method according to claim 5, characterized in that: The method of sequentially performing multiple corrosion, expansion, segmentation of connected domains and region selection operations on the union region to continuously optimize the fiber region definition also includes: Three times of erosion and dilation, using a circular structure element with a radius of 20 to erode and dilate ClosingRegion in turn, erosion reduces small interference and blurred boundary parts, and dilation repairs the optimized shape and enhances continuity to obtain OpeningRegion1, and further refine the shape and size of the fiber region; Finally, the difference set is expanded, and the DilationRegion is obtained by dilating the OpeningRegion1 with a circular structure element of radius 1, and the fiber region is expanded to ensure that the fiber is completely covered. The DifferenceRegion is calculated by the difference set of DilationRegion and ClosingRegion, and the non-fiber components of the background and impurities adhering to the fiber are accurately removed; Secondary region screening: DifferenceRegion is marked and segmented again to obtain Cregions by connecting components. Cregions are traversed and Dregions are screened out according to the area threshold (>3500), small area noise and irrelevant areas are excluded, and the fiber area is deeply purified.
7. A fiber diameter batch processing method according to claim 6, characterized in that: The method of performing corrosion treatment on the screened fiber area and accurately calculating the radius of the inscribed circle thereof includes: In the final erosion operation, a circular structure element with a radius of 2.5 is used to erode the region set Dregions to obtain ErosionRegions; Calculate the radius of the inscribed circle. For each area of ErosionRegions, use the least squares method to fit the circle and calculate the radius Rvalue of the inscribed circle. Construct an error function based on the pixel coordinates of the regional boundary. Iteratively optimize the circle parameters (center coordinates and radius) until the error is minimized. Determine the inscribed circle. Rvalue is used as the key characterization parameter of fiber thickness and the core intermediate quantity for diameter calculation.
8. A fiber diameter batch processing method according to claim 7, characterized in that: The fusion ruler area width, the inscribed circle radius and the ruler scale value are used to calculate the actual fiber diameter at the image sampling point, including: Calculate the actual diameter and calculate the actual diameter of the fiber at the image sampling point according to the formula 2×Rvalue / ScaleRegion_Width×scale value, where 2×Rvalue approximates the fiber diameter with the inscribed circle diameter, ScaleRegion_Width is used as the proportional conversion scale, and the scale value is the number of pixels corresponding to the actual ruler unit length. Associate Rvalue and ScaleRegion_Width with the actual ruler scale to complete the conversion from pixels to physical size (diameter).
Citation Information
Cited By
Finance and tax bill classification detection system based on image recognition
CN120148058A
Three-dimensional reconstruction method of pineapple leaf fiber microstructure
CN121170160A