Improved region growing grinding wheel abrasive particle image segmentation method
Through interactive seed point selection and Otsu method threshold calculation combined with region growth algorithm and morphological processing, the problems of inaccurate segmentation and high computing performance in grinding wheel abrasive image segmentation are solved, and the segmentation of high-efficiency grinding wheel abrasive image is achieved.
Patent Information
- Application Number
- CN202411007802.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-12-20
AI Technical Summary
The prior art failed to effectively consider the spatial relationship between the target area and the background area in grinding wheel abrasive image segmentation, resulting in inaccurate segmentation, and the initial seed point selection is too subjective, with high computing performance, making it difficult to improve the abrasive area under noise interference. Segmentation accuracy.
The initial seed point is set using an interactive function, combined with the Otsu method to obtain the global threshold, and the region growth algorithm is used to segment the grinding wheel abrasive image, and the image segmentation results are optimized through morphological processing to reduce noise interference and calculation workload.
The accuracy and operating speed of grinding wheel abrasive image segmentation are improved, the time and space complexity of the image segmentation area is optimized, and efficient grinding wheel abrasive segmentation is achieved under noise interference.
Smart Images

Figure CN119169040A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of digital image segmentation, and in particular relates to an improved method for segmenting regional growth grinding wheel abrasive grain images. Background Art
[0002] Grinding is the main method of precision machining. Grinding wheel is a widely used abrasive tool in the grinding process. It is composed of three parts: abrasive grains, binder and grinding wheel matrix. The abrasive grains distributed discretely on the surface of the grinding wheel remove material from the workpiece at the microscopic level to obtain a higher surface quality of the workpiece. Its surface morphology distribution has a significant impact on the grinding method and machining quality, so the detection of the grinding wheel abrasive grain image is very important.
[0003] At present, the segmentation of grinding wheel abrasive images belongs to the direction of machine vision. Chen Hejun et al. (CN104376551A) proposed to use threshold calculation to determine seed points, which can effectively divide the area for image segmentation, but the selection of threshold does not take into account the spatial relationship between the target area and the background area, and will exclude the part that should be divided in the same area; Liu Guangyu et al. (CN114387247A) combined the FRFCM algorithm with the regional growing method, which improved the problems of low contrast between the image target and the background area and noise interference to a certain extent, but the initial seed point determined by the algorithm is too subjective and not easy to operate; Zhang Xun et al. (CN112396607A) proposed a deformable convolution fusion enhanced image segmentation method based on neural network, but the algorithm needs to be trained on a large number of pictures in advance and has high requirements on the computing performance of the computer. Therefore, in order to obtain the real abrasive area, it is necessary to improve the regional growing algorithm.
[0004] In view of this, the present invention is proposed. Summary of the invention
[0005] The technical problem to be solved by the present invention is to overcome the deficiencies of the prior art and provide an improved method for segmenting abrasive grain images of regional growth grinding wheels. To solve the above technical problems, the basic concept of the technical solution adopted by the present invention is:
[0006] An improved regional growth grinding wheel abrasive grain image segmentation method comprises the following steps:
[0007] Step 1: collect the image of the target area of the grinding wheel, and convert the image of the grinding wheel abrasive grains in the target area into grayscale;
[0008] Step 2: preprocessing the abrasive grain image of the target area of the grinding wheel to obtain a processable abrasive grain image of the target area;
[0009] Step 3: Use the interactive function to set the initial seed point and the number of seed points according to the image size;
[0010] Step 4: Use the Otsu method to obtain the global threshold and determine the optimal segmentation grayscale threshold of the target area;
[0011] Step 5: Using the gray threshold calculated by the Otsu method as the growth criterion of the region growing algorithm, traverse the entire target region image starting from the seed point in the abrasive grain image of the target region to obtain the initial segmentation image of the grinding wheel abrasive grains;
[0012] Step 6: Perform morphological processing on the initial segmentation image of the grinding wheel abrasive grains to obtain an ideal grinding wheel abrasive grain segmentation image.
[0013] Preferably, the acquisition of the image of the target area of the grinding wheel and grayscale conversion of the grinding wheel abrasive grain image of the target area is specifically expressed as: image grayscale conversion, converting the acquired RGB color image into a grayscale image.
[0014] Preferably, the method for preprocessing the abrasive grain image of the target area of the grinding wheel to obtain a processable abrasive grain image of the target area is specifically expressed as:
[0015] Step 2.1: Use the mean filter method to process each pixel in the image row by row and column by column according to the set window template size, and take the weighted average of all pixels in the template as the pixel value of the current pixel. The template size is 3*3, and the algorithm expression of the mean filter is:
[0016]
[0017] Where g(i,j) is the pixel of the filtered image, N is the total number of pixels in the filter template, that is, the template size; M is the set of template pixels centered at pixel (0,0), and f(i,j) is the pixel of the original image;
[0018] Step 2.2: Use an image enhancement method based on the combination of MSRCR and histogram equalization. The algorithm expression is:
[0019] F(i,j)=λImg1(i,j)+(1-λ)Img2(i,j)
[0020] Where λ is the weighting coefficient, which takes the value of [0,1], Img1(i,j) is the image after histogram equalization, and Img2(i,j) is the image after MSRCR processing. The enhancement effect is obtained by adjusting the corresponding parameters.
[0021] Preferably, the specific expression of setting the initial seed point and the number of seed points according to the image size by using the interactive function is:
[0022] Step 3.1: The user can click the left mouse button at different locations in the target area of the image to select different numbers of pixels. The interactive function command returns the coordinates [x, y] of the selected points, and rounds the selected coordinates to convert them into integer coordinates [x0, y0].
[0023] x0=round(x)
[0024] y0=round(y)
[0025] Step 3.2: Use the rounded coordinates [x0, y0] to extract the corresponding coordinate grayscale value from the grayscale image And use this point as the seed point;
[0026]
[0027] Preferably, the specific expression of using Otsu's method to obtain the global threshold and determine the optimal segmentation grayscale threshold of the target area is:
[0028] Step 4.1: Use the Otsu method to calculate the grayscale distribution histogram of the image, calculate the inter-class variance corresponding to all possible grayscale thresholds of the image, and obtain the distribution of the number of pixels at each grayscale level;
[0029] Step A: Divide the image grayscale values into two categories, assuming t is the grayscale threshold. Images with grayscale values lower than t are classified as C0, and images with grayscale values greater than t are classified as C1.
[0030] Step B: Calculate the probability Q0t, Q1t of C0, C1 occupying the entire image;
[0031]
[0032] Q1t=1-Q0t
[0033] Step C: Calculate the grayscale average of C0 and C1;
[0034]
[0035] Step 4.2: Among all possible thresholds, find the optimal segmentation threshold f that maximizes the inter-class variance. t , and this value represents the grayscale threshold corresponding to the region growing method, including the following steps:
[0036] Step A: For each possible gray level (0 to 255) of the image, calculate the inter-class variance when using the gray level as the threshold for segmentation;
[0037]
[0038] in, is a function of the threshold variable t;
[0039] Step B: Take the gray level with the largest inter-class variance as the optimal segmentation threshold;
[0040]
[0041] Where L is the grayscale length, f t is the optimal segmentation threshold.
[0042] Preferably, the grayscale threshold calculated according to the Otsu method is used as the growth criterion of the region growing algorithm, and the entire target region image is traversed from the seed point in the abrasive grain image of the target region to obtain the specific expression of the initial segmentation image of the grinding wheel abrasive grains:
[0043] Step 5.1: The seed points are selected at the left end, center and right end of the target area of the wear particle image, and the number of seed points is set in the range of 1 to 3. The regional growth segmentation images with different seed point positions and numbers are calculated;
[0044] Step 5.2: Based on the region growing criterion, traverse the entire pre-segmented image and determine the difference between the grayscale values of the seed point and its neighboring pixels, where is the gray value of the neighborhood pixel, if Add pixels to the growth area;
[0045] Step 5.3: Repeat sub-step 5.2, continuously add pixels that meet the conditions to the current area, and stop growing pixels that are greater than or equal to the grayscale difference until no new pixels that meet the conditions are found.
[0046] Preferably, the specific expression of performing morphological processing on the initial segmentation image of the grinding wheel abrasive grains to obtain an ideal segmentation image of the grinding wheel abrasive grains is:
[0047] Step 6.1: Refine the edges in the image to avoid bad pixels or uneven pixel blocks;
[0048] Step 6.2: The hole filling method uses the morphological dilation operation to expand the target area in the image. The holes can be filled by dilating the target area with the surrounding background area;
[0049]
[0050] in, is the dilation operator, F is the binary image to be processed, and S is the structural element required in the operation.
[0051] Step 6.3: The method of irrelevant boundary processing is to shrink the target area in the image by using morphological erosion operation, so as to remove the boundary part;
[0052]
[0053] in, is the erosion operator, F is the binary image to be processed, and S is the structural element required in the operation.
[0054] After adopting the above technical scheme, the present invention has the following beneficial effects compared with the prior art.
[0055] The present invention studies the relevant knowledge of image morphology and proposes a simpler and more efficient grinding wheel abrasive image segmentation algorithm, aiming to improve the accuracy of grinding wheel abrasive segmentation without being affected by the noise interference brought by the grinding wheel matrix area and the environment, thereby achieving the optimization of the time and space complexity of the image segmentation area.
[0056] The present invention is based on a regional growing algorithm and uses a human-computer interactive function to make the selection of seed points more flexible, thereby improving the accuracy of grinding wheel abrasive segmentation without being affected by the noise interference brought by the grinding wheel matrix area and the environment, reducing the calculation workload and improving the running speed; in addition, morphology is used to perform pre- and post-processing on the image, and finally the identified complete abrasive shape is extracted from the grinding wheel abrasive sample image, thereby realizing the optimization of the time and space complexity of the image segmentation area.
[0057] The specific implementation modes of the present invention are further described in detail below in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] The accompanying drawings are part of this application and are used to provide a further understanding of the present invention. The illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but do not constitute an improper limitation of the present invention. Obviously, the drawings described below are only some embodiments. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0059] Figure 1 is a flow chart of the method of the present invention;
[0060] Figure 2 is a function image after mean filtering in one embodiment of the present invention;
[0061] Figure 3 An image of a seed point selected for a single abrasive particle in one embodiment of the present invention;
[0062] Figure 4 This is an image of the complete abrasive region extracted in one embodiment of the present invention.
[0063] It should be noted that these drawings and textual descriptions are not intended to limit the conceptual scope of the present invention in any way, but are intended to illustrate the concept of the present invention for those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. The following embodiments are used to illustrate the present invention but are not used to limit the scope of the present invention.
[0065] Example
[0066] like Figure 1 As shown, the improved regional growth grinding wheel abrasive grain image segmentation method described in this embodiment includes the following steps:
[0067] Step 1: Collect the image of the target area of the grinding wheel, and convert the image of the grinding wheel abrasive in the target area into grayscale. Specifically, it is expressed as: image grayscale, converting the collected RGB color image into a grayscale image. The algorithm expression is:
[0068] Gray=0.299R+0.587G+0.114B
[0069] Among them, Gray represents the grayscale value, and R, G, and B represent the values of the red, green, and blue channels respectively.
[0070] Step 2: It is used to pre-process the abrasive grain image of the target area of the grinding wheel to obtain a processable abrasive grain image of the target area, which is specifically expressed as:
[0071] Step 2.1: Use the mean filter method to process each pixel in the image row by row and column by column according to the set window template size, and take the weighted average of all pixels in the template as the pixel value of the current pixel. The template size is 3*3, and the algorithm expression of the mean filter is:
[0072]
[0073] Where g(i,j) is the pixel of the filtered image, N is the total number of pixels in the filter template, that is, the template size; M is the set of template pixels centered at pixel (0,0), and f(i,j) is the pixel of the original image;
[0074] Step 2.2: Using an image enhancement method based on combining MSRCR with histogram equalization to obtain the final enhanced image;
[0075] Step A: Enhance image contrast using histogram equalization;
[0076]
[0077] Img1(i,j)=L×CDF(I O (i,j))
[0078] Where k is the gray level, CDF is the cumulative distribution function, P(t) is the frequency of gray level in the image; L is the total number of gray levels, I O (i, j) is the gray value of the original image at position (i, j), and Img1(i, j) is the image after histogram equalization;
[0079] Step B: Image enhancement based on MSRCR algorithm;
[0080] J s (i,j)=logI s (i,j)-logL s (i,j)
[0081]
[0082] Img2(i,j)=exp(J MSR (i,j))
[0083] Among them, I s (i,j) is an image at scale s, L s (i,j) is the illumination estimate at the corresponding scale, J s (i,j) represents the reflectivity estimate at that scale, w s is the weight of the sth layer, N is the number of scales, and Img2(i,j) represents the image enhanced by the MSRCR algorithm;
[0084] Step C: weighted fusion of the results of histogram equalization and MSRCR processing;
[0085] F(i,j)=λImg1(i,j)+(1-λ)Img2(i,j)
[0086] Where λ is the weighting coefficient, which takes the value of [0,1], Img1(i,j) is the image after histogram equalization, and Img2(i,j) is the image after MSRCR processing. The enhancement effect is obtained by adjusting the corresponding parameters.
[0087] Step 3: Use the interactive function to set the initial seed point and the number of seed points according to the image size. The specific expression is:
[0088] Step 3.1: The user can click the left mouse button at different locations in the target area of the image to select different numbers of pixels. The interactive function command returns the coordinates [x, y] of the selected points, and rounds the selected coordinates to convert them into integer coordinates [x0, y0].
[0089] x0=round(x)
[0090] y0=round(y)
[0091] Step 3.2: Use the rounded coordinates [x0, y0] to extract the corresponding coordinate grayscale value from the grayscale image And use this point as the seed point;
[0092]
[0093] Step 4: Use the Otsu method to obtain the global threshold and determine the optimal segmentation grayscale threshold of the target area, which is specifically expressed as:
[0094] Step 4.1: Use the Otsu method to calculate the grayscale distribution histogram of the image, calculate the inter-class variance corresponding to all possible grayscale thresholds of the image, and obtain the distribution of the number of pixels at each grayscale level;
[0095] Step A: Divide the image grayscale values into two categories. Let t be the grayscale threshold. The image grayscale value lower than t is classified as C0, and the grayscale value greater than t is classified as C1.
[0096] Step B: Calculate the probability Q0(t), Q1(t) of the entire image occupied by C0 and C1;
[0097]
[0098] Q1(t)=1-Q0(t)
[0099] Step C: Calculate the grayscale average of C0 and C1;
[0100]
[0101] Step 4.2: Among all possible thresholds, find the optimal segmentation threshold f that maximizes the inter-class variance. t , and this value represents the grayscale threshold corresponding to the region growing method, including the following steps:
[0102] Step A: For each possible gray level (0 to 255) of the image, calculate the inter-class variance when using the gray level as the threshold for segmentation;
[0103]
[0104] in, is a function of the threshold variable t;
[0105] Step B: Take the gray level with the largest inter-class variance as the optimal segmentation threshold;
[0106]
[0107] Where L is the grayscale length, f t is the optimal segmentation threshold.
[0108] Step 5: Use the gray threshold calculated by the Otsu method as the growth criterion of the region growing algorithm, traverse the entire target area image starting from the seed point in the abrasive grain image of the target area, and obtain the initial segmentation image of the grinding wheel abrasive grains, which is specifically expressed as:
[0109] Step 5.1: The seed points are selected at the left end, center and right end of the target area of the wear particle image, and the number of seed points is set in the range of 1 to 3. The regional growth segmentation images with different seed point positions and numbers are calculated;
[0110] Step 5.2: Based on the region growing criterion, traverse the entire pre-segmented image and determine the difference between the grayscale values of the seed point and its neighboring pixels, where is the gray value of the neighborhood pixel, if Add pixels to the growth area;
[0111] Step 5.3: Repeat sub-step 5.2, continuously add pixels that meet the conditions to the current area, and stop growing pixels that are greater than or equal to the grayscale difference until no new pixels that meet the conditions are found.
[0112] Step 6: Perform morphological processing on the initial segmentation image of the grinding wheel abrasive grains to obtain an ideal grinding wheel abrasive grain segmentation image, which is specifically expressed as follows:
[0113] Step 6.1: Refine the edges in the image to avoid bad pixels or uneven pixel blocks;
[0114] Step 6.2: The hole filling method uses the morphological dilation operation to expand the target area in the image. The holes can be filled by dilating the target area with the surrounding background area;
[0115]
[0116] in, is the dilation operator, F is the binary image to be processed, and S is the structural element required in the operation;
[0117] Step 6.3: The method of processing irrelevant boundaries is to use morphological erosion operations to shrink the target area in the image, thereby removing the boundary part;
[0118]
[0119] in, is the erosion operator, F is the binary image to be processed, and S is the structural element required in the operation.
[0120] The above is only a preferred embodiment of the present invention, and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment, it is not used to limit the present invention. Any technician familiar with this patent can make some changes or modify the technical contents suggested above into equivalent embodiments without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present invention without departing from the content of the technical solution of the present invention still fall within the scope of the solution of the present invention.
Claims
1. An improved method for segmenting abrasive grain images of regional growth grinding wheels, characterized in that: The steps include: Step 1: collect the image of the target area of the grinding wheel, and convert the image of the grinding wheel abrasive grains in the target area into grayscale; Step 2: preprocessing the abrasive grain image of the target area of the grinding wheel to obtain a processable abrasive grain image of the target area; Step 3: Use the interactive function to set the initial seed point and the number of seed points according to the image size; Step 4: Use the Otsu method to obtain the global threshold and determine the optimal segmentation grayscale threshold of the target area; Step 5: Using the gray threshold calculated by the Otsu method as the growth criterion of the region growing algorithm, traverse the entire target region image starting from the seed point in the abrasive grain image of the target region to obtain the initial segmentation image of the grinding wheel abrasive grains; Step 6: Perform morphological processing on the initial segmentation image of the grinding wheel abrasive grains to obtain an ideal grinding wheel abrasive grain segmentation image.
2. The improved method for segmenting abrasive grains of regional growth grinding wheels according to claim 1, characterized in that: In step 1, the collected RGB color image is converted into a grayscale image, and its algorithm expression is: Gray=0.299R+0.587G+0.114B Among them, Gray represents the grayscale value, and R, G, and B represent the values of the red, green, and blue channels respectively.
3. The improved method for segmenting abrasive grain images of regional growth grinding wheels according to claim 1, characterized in that: The step 2 specifically includes: Step 2.1: Use the mean filtering method to process each pixel in the image row by row and column by column according to the set window template size, and take the weighted average of all pixels in the template as the pixel value of the current pixel; the template size is 3*3, and the algorithm expression of the mean filtering is: Where g(i,j) is the pixel of the filtered image, N is the total number of pixels in the filter template, that is, the template size; M is the set of template pixels centered at pixel (0,0), and f(i,j) is the pixel of the original image; Step 2.2: Use an image enhancement method based on the combination of MSRCR and histogram equalization. The algorithm expression is: F(i,j)=λImg1(i,j)+(1-λ)Img2(i,j) Where λ is the weighting coefficient, which takes the value of [0,1], Img1(i,j) is the image after histogram equalization, and Img2(i,j) is the image after MSRCR processing. The enhancement effect is obtained by adjusting the corresponding parameters.
4. The improved method for segmenting abrasive grains of regional growth grinding wheels according to claim 1, characterized in that: The step 3 specifically includes: Step 3.1: The user can click the left mouse button at different locations in the target area of the image to select different numbers of pixels. The interactive function command returns the coordinates [x, y] of the selected points, and rounds the selected coordinates to convert them into integer coordinates [x0, y0]. x0=round(x) y0=round(y) Step 3.2: Use the rounded coordinates [x0, y0] to extract the corresponding coordinate grayscale value from the grayscale image And use this point as the seed point; 5. The improved method for segmenting regional growth grinding wheel abrasive grains according to claim 1, characterized in that: The step 4 specifically includes: Step 4.1: Use the Otsu method to calculate the grayscale distribution histogram of the image, calculate the inter-class variance corresponding to all possible grayscale thresholds of the image, and obtain the distribution of the number of pixels at each grayscale level; Step 4.1.1: Divide the image grayscale values into two categories. Let t be the grayscale threshold. The image grayscale value lower than t is classified as C0, and the grayscale value greater than t is classified as C1. Step 4.1.2: Calculate the probability Q0(t), Q1(t) of C0 and C1 occupying the entire image; Q1(t)=1-Q0(t) Step 4.1.3: Calculate the grayscale average of C0 and C1; Step 4.2: Among all possible thresholds, find the optimal segmentation threshold f that maximizes the inter-class variance. t , and this value represents the grayscale threshold corresponding to the region growing method, including the following steps: Step 4.2.1: For each possible gray level (0 to 255) of the image, calculate the between-class variance when using that gray level as the threshold for segmentation; in, is a function of the threshold variable t; Step 4.2.2: Take the gray level with the largest inter-class variance as the optimal segmentation threshold; Where L is the gray level length, f t is the optimal segmentation threshold.
6. The improved method for segmenting abrasive grain images of regional growth grinding wheels according to claim 1, characterized in that: The step 5 specifically includes: Step 5.1: The seed points are selected at the left end, center and right end of the target area of the wear particle image, and the number of seed points is set in the range of 1 to 3. The regional growth segmentation images with different seed point positions and numbers are calculated; Step 5.2: Based on the region growing criterion, traverse the entire pre-segmented image and determine the difference between the grayscale values of the seed point and its neighboring pixels, where is the gray value of the neighborhood pixel, if Add pixels to the growth area; Step 5.3: Repeat step 5.2, continuously add pixels that meet the conditions to the current area, and stop growing pixels that are greater than or equal to the grayscale difference until no new pixels that meet the conditions are found.
7. The improved method for segmenting regional growth grinding wheel abrasive grains according to claim 1, characterized in that: The step 6 specifically includes: Step 6.1: Refine the edges in the image to avoid bad pixels or uneven pixel blocks; Step 6.2: The hole filling method uses the morphological dilation operation to expand the target area in the image. The holes can be filled by dilating the target area with the surrounding background area; in, is the dilation operator, F is the binary image to be processed, and S is the structural element required in the operation; Step 6.3: The method of processing irrelevant boundaries is to use morphological erosion operations to shrink the target area in the image, thereby removing the boundary part; in, is the erosion operator, F is the binary image to be processed, and S is the structural element required in the operation.
Citation Information
Patent Citations
Color image segmentation method integrating region growth and edge detection
CN104376551A
Deformable convolution fusion enhanced streetscape image semantic segmentation method
CN112396607A
Underwater target detection method based on FRFCM and region growing method
CN114387247A
