Titanium rod surface defect detection method
By introducing comprehensive degree of difference as growth criterion in the regional growth algorithm, the problem of inaccurate detection of surface defects of titanium rods caused by single growth criterion in the prior art is solved, and a more accurate defect detection effect is achieved.
Patent Information
- Application Number
- CN202510585940.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-08
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2045-05-08
AI Technical Summary
In the prior art, the growth criteria of regional growth algorithms are single and rely only on the similarity of grayscale values, resulting in inaccurate detection of surface defects of titanium rods.
The comprehensive difference degree is used as the growth criterion of the region growth algorithm. By calculating the texture matrix and structural matrix of pixel points, the comprehensive difference between the two pixel points is obtained, reflecting their differences in grayscale characteristics, texture characteristics and structural characteristics.
Through the comprehensive growth criteria of the degree of difference, the partitioned areas can be divided more reasonably and the accuracy of surface defect detection of titanium rods can be improved.
Smart Images

Figure CN120107259A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing, and in particular to a titanium rod surface defect detection method. Background Art
[0002] Titanium rods are widely used in key components such as aero-engine blades and medical implants due to their excellent properties such as high strength, corrosion resistance and biocompatibility. However, titanium rods are prone to surface defects such as cracks and scratches during forging and rolling, which can significantly reduce their mechanical properties and fatigue life. For example, micron-level cracks may expand into macroscopic fractures under stress, leading to system failure. Therefore, efficient and accurate detection of titanium rod surface defects is a necessary step to ensure product reliability.
[0003] Traditional defect detection methods mainly rely on manual visual inspection, which has the disadvantages of low efficiency and strong subjectivity. With the development of automatic detection technology based on machine vision, high-efficiency and high-accuracy defect detection can be achieved. Among them, the region growing algorithm, as a defect detection algorithm, has the advantages of simple principle and convenient implementation, and is widely used in the field of defect detection of parts. The region growing algorithm is an image segmentation technology based on the similarity between pixels. Its main steps include: selecting some pixels from the image as seed points; merging neighboring pixels with high similarity to the seed points into a growth region according to the growth criterion, where the growth criterion is the gray value difference between the pixels; repeating the previous step with the merged pixel points as new seed points until the new pixel points cannot be merged into the corresponding growth region, and finally obtaining multiple segmented regions. Finally, the defect situation of each region is determined according to the size, shape, gray value and other characteristics of each segmented region.
[0004] However, the region growing algorithm in the prior art has a single growth criterion problem, that is, only the similarity of grayscale values is considered. The titanium rod surface contains many types of defects such as cracks, scratches, impurities, dirt, etc., and only the similarity of grayscale values is used to grow the growth region, which makes the division of each segmented region unreasonable, and thus leads to inaccurate detection of titanium rod surface defects. Summary of the invention
[0005] The present invention provides a titanium rod surface defect detection method, aiming to solve the technical problem that the growth criterion of the region growing algorithm in the prior art is single, resulting in unreasonable division of each segmented region, thereby causing inaccurate detection of titanium rod surface defects.
[0006] The present invention provides a titanium rod surface defect detection method, comprising the following steps: Acquire a grayscale image of the titanium rod; The grayscale image is segmented using the region growing algorithm to obtain multiple segmented regions; Among them, the growth criterion of the region growing algorithm is the comprehensive difference between the pixels of the grayscale image; the comprehensive difference is the normalized value of the sum of the absolute value of the difference between the norms of the texture matrices of the two pixels and the absolute value of the difference between the norms of the structure matrix; the texture matrix is composed of the integrity index between all two preset directions in the local window centered on the corresponding pixel; the integrity index is negatively correlated with the absolute value of the difference in entropy of the grayscale co-occurrence matrix of the integrity of all pixels in the corresponding local window in two preset directions, and positively correlated with the mean of each integrity; the integrity degree represents the degree of integrity of the corresponding pixel in grayscale features; the structure matrix is composed of the frequency of the difference between the pixel in each partition in the corresponding local window and the central pixel of the local window in each interval; the difference is the normalized value of the difference between the mean of the integrity index of the two pixels in all two preset directions; the partition is obtained by dividing the local window into equal parts by rays radiating outward from the corresponding pixel; the interval is obtained by dividing the range from 0 to 1 into equal parts; All segmented regions are input into the support vector machine, and the defect type of each segmented region is output.
[0007] In the above scheme, the comprehensive difference between two pixels is obtained by calculating the texture matrix and structure matrix of the pixel points, which can comprehensively reflect the differences in grayscale features, texture features and structural features of the two pixels, making the growth criterion of the region growing algorithm more reasonable, and then the segmentation region is more reasonable, and the surface defect detection of titanium rods is more accurate.
[0008] Preferably, the degree of completeness is inversely correlated with the absolute value of the difference between the average grayscale values of each neighboring pixel point of the corresponding pixel point and the defect-free pixel point, and is inversely correlated with the absolute value of the difference between the grayscale values of the corresponding pixel point and its neighboring pixel points.
[0009] Preferably, the pixel The degree of completeness for: ; In the formula, Pixel No. The gray value of the neighboring pixels, is the average gray value of non-defective pixels, Pixel The gray value of Pixel The total number of neighborhood pixels, is the first preset parameter, .
[0010] In the above scheme, by comparing the differences between the neighboring pixels of the corresponding pixel and the defect-free pixel, and comparing the differences between the corresponding pixel and its neighboring pixels, various types of defect areas can be fully reflected, making the calculation result more accurate.
[0011] Preferably, the defect-free pixel is a pixel whose grayscale value of all the pixels in the grayscale image is within the grayscale interval with the largest frequency in each grayscale interval; the grayscale interval is obtained by equally dividing the grayscale value range from 0 to 255.
[0012] Preferably, the pixel The corresponding local window The first The complete index between the preset directions for: ; In the formula, Pixel The mean value of the completeness of all pixels in the corresponding local window, and Pixel The completeness of all pixels in the corresponding local window is Directions and The entropy of the gray-level co-occurrence matrix in the direction, is the second preset parameter, .
[0013] In the above scheme, the differences in grayscale features and texture features between pixels can be reflected by the mean value of the completeness of all pixels in the local window and the difference in the gray level co-occurrence matrix of all completeness in different preset directions.
[0014] Preferably, the local window is centered at the corresponding pixel point and has a side length of A square with a length of pixels, where is an integer greater than or equal to 1.
[0015] Preferably, the number of partitions is 8 and the number of intervals is 10.
[0016] In the above scheme, by dividing into multiple partitions and multiple intervals, the distribution of the difference between the pixel points at different positions in the corresponding local window and the central pixel point can be represented.
[0017] Preferably, the preset directions are four directions corresponding to 0°, 45°, 90° and 135° respectively rotated counterclockwise from a ray pointing horizontally to the right with a corresponding pixel point in the grayscale image as an endpoint.
[0018] Preferably, inputting all segmented regions into a support vector machine comprises: Obtaining parameters of all segmented regions, the parameters including the length and width of the minimum circumscribed rectangle of the corresponding segmented region and the average grayscale value of all pixels in the corresponding segmented region; The parameters of each segmented region are input into the trained support vector machine model.
[0019] In the above scheme, various defect types can be identified and determined more conveniently and accurately according to the parameters of the segmented areas.
[0020] Preferably, the grayscale image is acquired by three image acquisition devices evenly distributed along the circumference of the titanium rod and processed into grayscale.
[0021] In the above scheme, three image acquisition devices are used to acquire images, which makes it easier to identify defects in the images. Grayscale processing of images can speed up processing, reduce the amount of calculation, and highlight the structural and texture characteristics of the images, which is convenient for subsequent image segmentation processing.
[0022] The beneficial effects are: The solution of the present invention improves the growth criterion of the region growing algorithm, and uses the texture matrix and structure matrix of the two pixels to obtain the comprehensive difference between the two pixels, which can comprehensively reflect the differences in grayscale features, texture features and structural features of the two pixels. Compared with the prior art that only uses the single feature of grayscale to characterize the growth criterion, it can more reasonably and accurately reflect various defect types, make the segmentation area more reasonable, and thus make the detection of titanium rod surface defects more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A flowchart of the titanium rod surface defect detection method according to an embodiment of the present invention; Figure 2 A flowchart of the steps of obtaining a texture matrix corresponding to a pixel point according to an embodiment of the present invention; Figure 3 The figure is a flow chart of the steps of obtaining a structural matrix corresponding to pixel points according to an embodiment of the present invention. DETAILED DESCRIPTION
[0024] The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, but should not be construed as limiting the present invention.
[0025] like Figure 1 As shown, the present invention provides a titanium rod surface defect detection method, comprising the following steps: S1. Obtain a grayscale image of the titanium rod.
[0026] In this step, since the titanium rod is a cylinder, only 180° of the cylindrical surface of the titanium rod can be photographed when photographing the titanium rod, and the closer to the edge of the titanium rod, the more difficult it is to clearly observe the defects from the photographed image. Therefore, the present invention collects the image of the titanium rod by three image acquisition devices evenly distributed along the circumference of the titanium rod, that is, the interval between two adjacent image acquisition devices is 120°, which makes it easier to identify defects in the image in subsequent steps. The image acquisition device of the present invention is a high-definition camera.
[0027] In order to simplify the image processing process, reduce the amount of calculation, speed up the processing speed, and highlight the structure and texture characteristics of the image, and facilitate the subsequent image segmentation processing, the collected image is grayed to obtain the corresponding grayscale image.
[0028] Since grayscale images are inevitably affected by noise, including vibration of machinery and equipment, electromagnetic interference generated by current, etc., it is necessary to denoise the grayscale image, for example, using the Wiener filter denoising algorithm to denoise the grayscale image, and of course other denoising algorithms can also be used. In addition, due to the strong reflectivity of the titanium rod surface, some defects are not obvious in the grayscale image. Therefore, in order to enhance the significance of the titanium rod surface defects and improve the defect detection efficiency and accuracy in subsequent steps, the present invention uses the AHE adaptive contrast enhancement algorithm to enhance the denoised grayscale image.
[0029] S2. Segment the grayscale image using a region growing algorithm to obtain multiple segmented regions.
[0030] The region growing algorithm belongs to the prior art, and its basic idea is to group pixels with similar properties to form a growing region. The algorithm starts with a set of seed points, and by comparing the grayscale values of these seed points with their neighboring pixels, merges the neighboring pixels with higher similarity into the growing region where the seed points are located, and then uses these newly merged pixels as new seed points to continue region growing until the termination condition is met. Specifically, the region growing algorithm includes the following steps: S21. Select seed points: The selection of seed points is based on image features, such as grayscale values.
[0031] S22, determine the growth criterion: The growth criterion defines the conditions under which the pixel points are merged into the growth region, which is usually based on the difference in grayscale values between the pixels. For example, if the difference in grayscale values between the seed point and its neighboring pixel points is less than a set threshold, the neighboring pixel points are merged into the growth region where the seed point is located.
[0032] S23, region growing: starting from the seed point, merge the neighboring pixels that meet the conditions into the growth region according to the growth criterion, update the seed point, and repeat this step.
[0033] S24, termination condition: The growth process of the growing region needs a termination condition, which may be that the growing region reaches a certain size, pixels that do not meet the condition can be merged, or a preset number of iterations is reached. After the growing region stops growing, the corresponding segmented regions are obtained.
[0034] After obtaining each segmented region of the grayscale image using the region growing algorithm, the defect type of each segmented region is determined based on the characteristics of each segmented region.
[0035] However, in step S22 of the prior art, the region growing algorithm has a single growth criterion problem, that is, the region growing process is controlled only by calculating the difference in grayscale values, without considering the various types of defects on the titanium rod surface. Specifically, the titanium rod surface contains a variety of defect types such as cracks, scratches, impurities, dirt, etc. Only using the single feature of grayscale value cannot reasonably reflect the various types of defects on the titanium rod surface, making the division of each segmented region unreasonable, which in turn leads to inaccurate detection of titanium rod surface defects.
[0036] In view of the single growth criterion problem in the prior art, the growth criterion of the region growing algorithm of the present invention is the comprehensive difference between the pixels of the grayscale image. The comprehensive difference represents the comprehensive difference degree of the pixels in terms of grayscale value, texture and structure, and can accurately reflect the real situation of the pixels of various defect types, making the division of each segmented area more reasonable, and thus the surface defect detection of titanium rods is more accurate.
[0037] Therefore, the present invention improves step S22 in the prior art, and the key lies in obtaining the comprehensive difference between the pixels of the grayscale image. The comprehensive difference is the normalized value of the sum of the absolute value of the difference between the norms of the texture matrices of two pixels and the absolute value of the difference between the norms of the structure matrix. Therefore, obtaining the comprehensive difference includes the following steps: S221, obtaining a texture matrix of each pixel in the grayscale image.
[0038] The texture matrix is composed of all the complete indices between two preset directions in a local window centered on the corresponding pixel point. In the present invention, the local window is centered on the corresponding pixel point and has a side length of A square with a length of pixels, where is an integer greater than or equal to 1. The integrity index is inversely correlated with the absolute value of the difference in entropy of the grayscale co-occurrence matrix of the integrity of all pixels in the corresponding local window in two preset directions, and is positively correlated with the mean of each integrity level. This is because the integrity index characterizes the degree to which the corresponding pixel is free of defects in grayscale features and texture features. The integrity level characterizes the degree to which the corresponding pixel is free of defects in grayscale features, and the integrity level is calculated by grayscale value, which is applicable to surface defects, such as dirt and impurity defects. This is because the grayscale values inside and outside the defect area are quite different, so the integrity level can characterize the degree to which there are no surface defects. For linear defects, such as cracks and scratches, which are defects in a single direction, there is a large difference in the entropy of the grayscale co-occurrence matrix of the integrity of all pixels in the corresponding local window in two preset directions. Therefore, the linear defects can be characterized by comparing the entropy of the grayscale co-occurrence matrix in the two preset directions. The integrity index can comprehensively reflect the degree of integrity of the corresponding pixel in grayscale features and texture features. Therefore, if Figure 2 As shown, step S221 also includes the following steps: S2211. Obtain the completeness of all pixels in the local window corresponding to each pixel.
[0039] The degree of flawlessness is anti-correlated with the absolute value of the difference between the average grayscale values of each neighboring pixel of the corresponding pixel and the defect-free pixel, and is anti-correlated with the absolute value of the difference between the grayscale values of the corresponding pixel and its neighboring pixel. This is because for defects such as cracks, impurities, and dirt, the defect area is relatively obvious, and there will be a large difference in the grayscale value between the corresponding pixel and the defect-free pixel, and the greater the difference, the less likely the pixel is to be located in the defect-free area, that is, the degree of flawlessness of the pixel is smaller. For defect areas of the scratch type, the defect area is relatively unobvious, and the difference in grayscale value between the corresponding pixel and the defect-free pixel is relatively unobvious, but because the scratch defect has a slight texture along a certain direction, it can be distinguished by the difference between the grayscale values of the corresponding pixel and its neighboring pixel, and the greater the difference, the less likely the pixel is to be located in the defect-free area, that is, the degree of flawlessness of the pixel is smaller. In step S2211, the neighborhood pixel is the eight neighborhood pixel of the corresponding pixel, and of course it can also be four neighborhood pixel.
[0040] In the present invention, defect-free pixels are pixels whose grayscale values of all pixels in the grayscale image are located in the grayscale interval with the largest frequency in each grayscale interval. And the lengths of each grayscale interval are equal. Since the grayscale value range is 0 to 255, the grayscale interval is obtained by dividing the grayscale value range of 0 to 255 into equal parts. For example, if the grayscale value range is divided into 16 grayscale intervals, the length of each grayscale interval is 16. Taking each grayscale interval as each group of the histogram, and the frequency of the pixels corresponding to each group as the height of the corresponding group, the pixels in the highest group are regarded as defect-free pixels. This is because the defective part accounts for a small proportion in the grayscale image of the titanium rod, and most of the pixels are defect-free pixels, so the pixels in the group with the highest frequency can be used as defect-free pixels. Of course, defect-free pixels can also be pixels with preset grayscale values.
[0041] In one embodiment, the pixel The degree of completeness for: ; In the formula, Pixel No. The gray value of the neighboring pixels, is the average gray value of non-defective pixels, Pixel The gray value of Pixel The total number of neighborhood pixels, is the first preset parameter, .
[0042] In the formula of this embodiment, the purpose of setting the first preset parameter is to prevent the denominator of the fraction from being 0, which would make the formula unable to be calculated.
[0043] This embodiment is a method for calculating the completeness of a pixel point, and the method for calculating the completeness of all pixels in the corresponding local window is the same, which will not be repeated.
[0044] In step S2211, by comparing the differences between the neighboring pixels of the corresponding pixel point and the defect-free pixel point, the defect area of cracks, impurities and dirt types can be reflected. By comparing the differences between the corresponding pixel point and its neighboring pixels, the defect area of scratch type can be reflected. Therefore, various types of defect areas can be comprehensively reflected, making the calculation result more accurate.
[0045] S2212, obtaining the completeness index between two preset directions in the local window corresponding to each pixel point.
[0046] In one embodiment, the complete index between two preset directions of a pixel point is used for explanation. The corresponding local window The first The complete index between the preset directions for: ; In the formula, Pixel The mean value of the completeness of all pixels in the corresponding local window, and Pixel The completeness of all pixels in the corresponding local window is Directions and The entropy of the gray-level co-occurrence matrix in the direction, is the second preset parameter, .
[0047] In the formula of this embodiment, the purpose of setting the second preset parameter is to prevent the denominator of the fraction from being 0, which would make the formula unable to be calculated.
[0048] This embodiment is a method for calculating the completeness index of a pixel point between two preset directions in a corresponding local window. The method for calculating the completeness index of all pixels points between all two preset directions is the same and will not be repeated here.
[0049] Among them, the grayscale co-occurrence matrix belongs to the prior art, which is a statistical method for image texture analysis. In the present invention, the grayscale co-occurrence matrix is obtained based on the completeness of each pixel in the corresponding local window. Different grayscale co-occurrence matrices correspond to different preset directions in the local window centered on the corresponding pixel. In the present invention, the preset directions are four directions corresponding to 0°, 45°, 90° and 135° of the horizontal right ray with the corresponding pixel in the grayscale image as the endpoint. That is, a grayscale co-occurrence matrix can be obtained for each preset direction. Each element in the grayscale co-occurrence matrix represents the frequency of occurrence of the completeness corresponding to two pixels in the local window in the preset direction. The grayscale co-occurrence matrix in each preset direction represents the distribution of texture features in the preset direction. Therefore, by comparing the entropy of the grayscale co-occurrence matrices of different preset directions, the completeness index of any two preset directions can be obtained. The entropy of the grayscale co-occurrence matrix measures the randomness of the pixel type contained in the grayscale image and shows the complexity of the grayscale image. The calculation of entropy is a prior art and will not be repeated.
[0050] S2213, obtaining the texture matrix of each pixel.
[0051] Therefore, the pixel The texture matrix for: ; In the formula, Pixel The corresponding local window The first The complete index between the preset directions. For example, Pixel The integrity index between the first and second preset directions in the corresponding local window, that is, the integrity index between the two preset directions of 0° and 45°.
[0052] In step S221, the texture matrix is characterized by the integrity index between any two preset directions in a local window centered on the corresponding pixel point, which can comprehensively consider the distribution of the difference degree of the grayscale feature and texture feature of the pixel point in different preset directions.
[0053] S222, obtaining the structure matrix of each pixel.
[0054] The structure matrix consists of the frequencies of the differences between the pixels in each partition of the corresponding local window and the central pixel of the local window in each interval. Figure 3 As shown, step S222 also includes the following steps: S2221. Calculate the difference between the pixel points in each partition and the central pixel point of the local window.
[0055] The difference is the normalized value of the difference between the mean values of the integrity index of two pixels in all two preset directions. The partition is obtained by dividing the local window into equal parts by rays radiating outward from the corresponding pixel. The interval is obtained by dividing the range from 0 to 1 into equal parts.
[0056] In one embodiment, the pixel points in the partition and the center pixel of the local window Difference for: ; In the formula, Pixel With pixels The absolute value of the difference between the means of the perfect indices between all two predefined directions, is the center pixel of each pixel in the partition and the local window The maximum absolute value of the difference between the means of the integrity indices between all two predefined directions.
[0057] In the present invention, there are 8 partitions. For example, the angle between adjacent rays is 45°, that is, the corresponding local window is divided into eight equal parts, and the direction of the ray emitted to the right with the corresponding pixel point as the endpoint is the 0° direction, and the counterclockwise rotation is the positive direction. Then the first partition is the area between the 0° direction and the 45° direction, the second partition is the area between the 45° direction and the 90° direction, and the remaining partitions are similar and will not be repeated.
[0058] The number of intervals is set to 10, and the range from 0 to 1 is divided into 10 equal intervals, and the length of each interval is 0.1. Then the first interval is [0,0.1], the second interval is (0.1,0.2], and the third interval is (0.2,0.3]. The remaining partitions are similar and will not be repeated here.
[0059] S2222. Count the frequencies of the differences between the pixels in each partition of the corresponding local window and the central pixel of the local window in each interval.
[0060] S2223. Obtain the structural matrix of each pixel.
[0061] Therefore, the pixel The structure matrix for: ; In the formula, Pixel The corresponding local window Each pixel in the partition and the pixel The difference is in For example, Pixel The pixel points and pixel points in the second partition of the corresponding local window The difference is in the frequency of the third interval, where the second partition is the area between the 45° direction and the 90° direction, and the third interval is the interval (0.2,0.3].
[0062] In step S222, the structural matrix is characterized by the difference between the pixels in each interval in each partition in the local window corresponding to the pixel point, reflecting the structural characteristics of each pixel point in the local window centered on the corresponding pixel point.
[0063] S223, obtaining the comprehensive difference between the corresponding two pixel points.
[0064] Therefore, the pixel With pixels The comprehensive difference between for: ; In the formula, Pixel The texture matrix The norm of Pixel The texture matrix The norm of Pixel The structure matrix The norm of Pixel The structure matrix The norm of is the standard normalization function.
[0065] Among them, the norm of the matrix is used to measure the overall size of the matrix, which is the square root of the sum of the squares of each element in the matrix.
[0066] In step S223, the comprehensive difference between the two pixels is obtained by calculating the difference between the texture matrices and the structure matrices of the two pixels. The difference between the two pixels can be comprehensively reflected from the grayscale features, texture features and structure features, thereby making the calculation result more accurate.
[0067] The comprehensive difference between the two pixels obtained according to steps S221 to S223 is used as the growth criterion of the regional growing algorithm of the present invention. Specifically, the comprehensive difference between the pixel point as the seed point and its neighborhood pixel point is calculated. If the comprehensive difference is greater than the judgment threshold, it indicates that the two pixels have large differences in grayscale features, texture features and structural features, and the neighborhood pixel point cannot be segmented into the growth region where the seed point is located. If the comprehensive difference is less than or equal to the judgment threshold, it indicates that the two pixels have small differences in grayscale features, texture features and structural features, and the neighborhood pixel point should be segmented into the growth region where the seed point is located, and the neighborhood pixel point should be used as a new seed point to continue growing according to this growth criterion until the termination condition is reached. Among them, the judgment threshold in this embodiment is 0.7, and it can also be selected according to actual conditions.
[0068] S3. Input all segmented regions into a support vector machine and output the defect type of each segmented region.
[0069] Specifically, step S3 includes the following steps: S31 , obtaining parameters of each segmented area, wherein the parameters include the length and width of the minimum circumscribed rectangle of the corresponding segmented area and the average grayscale value of all pixels in the corresponding segmented area.
[0070] The length and width of the minimum circumscribed rectangle of the corresponding segmented area are obtained in this step because the shapes and sizes of the areas of different defect types are different, and the length and width of the minimum circumscribed rectangle of the segmented area corresponding to crack and scratch defects are relatively large, while the length and width of the minimum circumscribed rectangle of the segmented area corresponding to impurities and dirt defects are relatively small, so it is easier to identify and determine the types of various defects. In addition, the grayscale values of the pixels in the segmented areas corresponding to different defect types vary greatly. According to these parameters of the segmented areas, it is more convenient and accurate to identify and determine various defect types.
[0071] S32, inputting the parameters of each segmented region into the trained support vector machine model.
[0072] The trained support vector machine model is obtained by inputting grayscale images of different defect types of titanium rods into the support vector machine model for training. Training the support vector machine model and outputting the defect types of each segmented area are both prior arts and will not be described in detail.
[0073] The present invention obtains three grayscale images of the titanium rod at the same acquisition time, and steps S1 to S3 are described by taking only one grayscale image as an example. In actual calculation, the three grayscale images at the same acquisition time are processed simultaneously, and then the output results of the three grayscale images are combined as the result of the corresponding acquisition time of the titanium rod.
[0074] In the titanium rod surface defect detection method of the present invention, the degree of flawlessness of the pixel point is first calculated to obtain the corresponding flawlessness index, and then the corresponding texture matrix and structure matrix are obtained. Finally, the texture matrix and structure matrix of the two pixel points are used to obtain the comprehensive difference between the two pixel points, and the grayscale image is segmented as a growth criterion. Since the comprehensive difference can comprehensively characterize the degree of difference between the two pixel points from multiple aspects of grayscale features, texture features and structure features, compared with the prior art that only uses the single feature of grayscale to characterize the degree of difference, the segmentation area division is more reasonable, and thus the titanium rod surface defect detection is more accurate.
[0075] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, various alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. A titanium rod surface defect detection method, characterized in that: The steps include: Acquire a grayscale image of the titanium rod; The grayscale image is segmented using the region growing algorithm to obtain multiple segmented regions; Among them, the growth criterion of the region growing algorithm is the comprehensive difference between the pixels of the grayscale image; the comprehensive difference is the normalized value of the sum of the absolute value of the difference between the norms of the texture matrices of the two pixels and the absolute value of the difference between the norms of the structure matrix; the texture matrix is composed of the integrity index between all two preset directions in the local window centered on the corresponding pixel; the integrity index is negatively correlated with the absolute value of the difference in entropy of the grayscale co-occurrence matrix of the integrity of all pixels in the corresponding local window in two preset directions, and positively correlated with the mean of each integrity; the integrity degree represents the degree of integrity of the corresponding pixel in grayscale features; the structure matrix is composed of the frequency of the difference between the pixel in each partition in the corresponding local window and the central pixel of the local window in each interval; the difference is the normalized value of the difference between the mean of the integrity index of the two pixels in all two preset directions; the partition is obtained by dividing the local window into equal parts by rays radiating outward from the corresponding pixel; the interval is obtained by dividing the range from 0 to 1 into equal parts; All segmented regions are input into the support vector machine, and the defect type of each segmented region is output.
2. The titanium rod surface defect detection method according to claim 1, characterized in that: The degree of defect is inversely correlated with the absolute value of the difference between the average grayscale values of each neighboring pixel point of the corresponding pixel point and the defect-free pixel point, and is inversely correlated with the absolute value of the difference between the grayscale values of the corresponding pixel point and its neighboring pixel points.
3. The titanium rod surface defect detection method according to claim 2, characterized in that: Pixels The degree of completeness for: ; In the formula, Pixel No. The gray value of the neighboring pixels, is the average gray value of non-defective pixels, Pixel The gray value of Pixel The total number of neighborhood pixels, is the first preset parameter, .
4. The titanium rod surface defect detection method according to claim 2, characterized in that: The defect-free pixel is a pixel whose grayscale value among all the pixels in the grayscale image is located in the grayscale interval with the largest frequency among all the grayscale intervals; The grayscale interval is obtained by dividing the grayscale value range from 0 to 255 into equal parts.
5. The titanium rod surface defect detection method according to claim 1, characterized in that: Pixels The corresponding local window The first The complete index between the preset directions for: ; In the formula, Pixel The mean value of the completeness of all pixels in the corresponding local window, and Pixel The completeness of all pixels in the corresponding local window is Directions and The entropy of the gray-level co-occurrence matrix in the direction, is the second preset parameter, .
6. The titanium rod surface defect detection method according to claim 1, characterized in that: The local window is centered at the corresponding pixel point and has a side length of A square with a length of pixels, where is an integer greater than or equal to 1.
7. The titanium rod surface defect detection method according to claim 1, characterized in that: The number of partitions is 8 and the number of intervals is 10.
8. The titanium rod surface defect detection method according to claim 1, characterized in that: The preset directions are four directions corresponding to 0°, 45°, 90° and 135° respectively rotated counterclockwise along a ray pointing horizontally to the right with the corresponding pixel point in the grayscale image as the endpoint.
9. The titanium rod surface defect detection method according to claim 1, characterized in that: The step of inputting all segmented regions into the support vector machine comprises: Obtaining parameters of all segmented regions, the parameters including the length and width of the minimum circumscribed rectangle of the corresponding segmented region and the average grayscale value of all pixels in the corresponding segmented region; The parameters of each segmented region are input into the trained support vector machine model.
10. The titanium rod surface defect detection method according to claim 1, characterized in that: The grayscale image is acquired by three image acquisition devices evenly distributed along the circumference of the titanium rod and processed into grayscale.
Citation Information
Patent Citations
Chip surface defect detection method and device
CN114170165A
Industrial product defect detection method and device
CN115272340A
Fabric defect analysis and identification method for textile fabric quality inspection
CN115719344A
Casting surface defect detection method based on computer vision
CN116758061A
Method for detecting surface quality of aluminum material
CN117649412A
Cited By
Turbine assembly surface defect detection method and system for air cycle machine
CN120451137A
Titanium alloy production material selection method and system based on machine vision
CN121213570A