Titanium rod production quality inspection method based on image features
By collecting titanium rod images at different light angles and performing image feature analysis, the problem of inaccurate defect identification under the influence of light angle in traditional detection methods is solved, and a more accurate evaluation of titanium rod production quality is achieved.
Patent Information
- Application Number
- CN202411102981.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-08-13
AI Technical Summary
Traditional titanium rod production quality detection methods cannot accurately identify the defects of titanium rods under different light angles, resulting in inaccurate detection results.
Using image features-based detection method, by collecting images from titanium rods at different light angles, performing edge detection and reflective stripe analysis, selecting suspected defect areas, combining grayscale values and contrast, the defect possibility of each pixel point is judged. Comprehensive analysis of defect distribution to evaluate production quality.
Effectively eliminate the influence of light, improve the accuracy and comprehensiveness of defect identification, accurately judge the production quality of titanium rods, reduce misjudgment, and improve the ability to identify transverse cracks.
Smart Images

Figure CN118628493B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing, and in particular to a titanium rod production quality detection method based on image features. Background Art
[0002] Titanium rod refers to a rod-shaped material made of titanium metal. It has the characteristics of light weight, high strength, and corrosion resistance. It is widely used in high-end manufacturing, special industries, etc. The quality of titanium rod production is not only related to the stability and durability of the titanium rod performance, but also to the safety of the titanium rod during use. Therefore, testing the production quality of titanium rods is an indispensable part of the titanium rod production process.
[0003] The traditional method of detecting the production quality of titanium rods is to use image processing technology to identify defects in titanium rod images, but it can usually only identify defects in titanium rod images under a certain lighting angle. Due to the strong reflectivity of the titanium rod surface, some defects cannot be shown under specific lighting angles, resulting in inaccurate results for the production quality inspection of titanium rods. Therefore, it is necessary to obtain titanium rod images at different lighting angles, combine the stripe-like features of the titanium rod reflection in the image, and analyze the defects in the titanium rod image within each stripe range. Combined with the production defects in the titanium rod images at all different lighting angles, it is determined whether there are defects at each position on the titanium rod. Finally, the production quality level of the titanium rod is determined based on the continuity and proportion of all defect positions on the titanium rod. Summary of the invention
[0004] The invention provides a titanium rod production quality detection method based on image features to solve the existing problems.
[0005] The titanium rod production quality detection method based on image features of the present invention adopts the following technical scheme:
[0006] The present invention proposes a titanium rod production quality detection method based on image features, which comprises the following steps:
[0007] Collect images of the titanium rod at different lighting angles at the same position;
[0008] Perform edge detection on each image of the titanium rod to obtain each image after edge detection and several edges; obtain the straightness of each edge and the consistency of each edge with the image length according to the distribution of adjacent pixels in the edge and the distribution position of all pixels, and then obtain the possibility that each edge is a reflective stripe edge; screen and obtain several reflective stripe edges, and obtain several stripe areas of each image after edge detection;
[0009] According to the width of the stripe area and the width of the image after edge detection, the possibility of each stripe area being a transverse crack is obtained, and the suspected transverse crack defect area is screened; the contrast of each stripe area is obtained according to the sum of the grayscale values of the pixels at the same position in different images; the grayscale change of each pixel in each column of each stripe area is obtained according to the grayscale values of adjacent pixels in each stripe area, and the grayscale change of the same pixel in different columns of the same stripe area is analyzed to obtain the possibility of each pixel in each column of each stripe area being a defective pixel;
[0010] According to the contrast of the reflective stripe area where each pixel point in all images of the titanium rod is located and the possibility of being a defective pixel point, the possibility of each pixel point in each reflective stripe area in the image of the titanium rod being defective is obtained; according to the number of pixels contained in a vertical column of the stripe area corresponding to all images of the suspected transverse crack defect area, the possibility of the existence of a transverse crack defect in each suspected transverse crack defect area is obtained; and then all defect positions are obtained;
[0011] All adjacent defect positions are formed into several connected domains, and several defect areas are screened out; according to the number of all pixel points in the defect area in the image of the titanium rod and the number of pixel points in all images of the titanium rod, the proportion of defects in the image of the titanium rod is obtained, and then the production quality of each titanium rod is obtained.
[0012] Furthermore, the straightness of each edge and the consistency of each edge with the image length are obtained according to the distribution of adjacent pixels in the edge and the distribution positions of all pixels, and the specific steps include the following:
[0013] The specific calculation formula corresponding to the straightness of each edge is:
[0014]
[0015]
[0016] in, Indicates On the edge The slope of each pixel; Indicates On the edge The vertical coordinate of the pixel in the image; Indicates On the edge The horizontal coordinate of the pixel in the image; Indicates On the edge The vertical coordinate of the pixel in the image; Indicates On the edge The horizontal coordinate of the pixel in the image; Indicates The straightness of the edges; Indicates The number of pixels in an edge; Indicates On the edge The slope of each pixel; represents the absolute value function;
[0017] The specific calculation formula corresponding to the consistency between each edge and the image length is:
[0018]
[0019] in, Indicates The consistency of the edge and the image length; Indicates The number of pixels in an edge; Indicates the number of pixels contained in a horizontal line in the image; represents the absolute value function.
[0020] Furthermore, the specific calculation formula corresponding to the possibility of obtaining each edge as a reflective stripe edge is:
[0021]
[0022] in, Indicates The possibility that the edge is a reflective stripe edge; Indicates The straightness of the edges; Indicates The consistency of the edge and the image length; Represents the normalization function.
[0023] Furthermore, the possibility of each stripe region being a transverse crack is obtained according to the width of the stripe region and the width of the image after edge detection, and the specific steps include the following:
[0024] Calculate the The ratio of the number of pixels in a vertical column of the stripe area to the number of pixels in a vertical column of the image is subtracted from 1 to get the difference, which is recorded as The possibility that the stripe area belongs to the transverse crack.
[0025] Furthermore, the contrast of each stripe area is obtained according to the grayscale value and contrast of the pixel point at the same position in different images, and the specific steps include the following:
[0026] The gray value of each pixel point in different images of the titanium rod is used as the horizontal coordinate, and the contrast is used as the vertical coordinate to construct a "gray value-contrast" scatter plot of the pixel point at each position;
[0027] The "gray value-contrast" scatter plot corresponding to each pixel point is put into the same statistical graph, and the obtained statistical graph is fitted by the least square method to obtain the fitting curve of gray value and contrast in the image;
[0028] Construct a corresponding grayscale histogram according to the grayscale values of the pixels in each stripe area;
[0029] The peak value in the grayscale histogram of the pixel points in any stripe area is taken as the grayscale value of the stripe area, and the contrast of the stripe area is obtained according to the corresponding position of the grayscale value in the fitting curve.
[0030] Furthermore, the grayscale change amount of each pixel in each column in each stripe area is obtained according to the grayscale values of adjacent pixels in each stripe area, and the specific steps include the following:
[0031] In any stripe area, Ledi The gray value of the pixel point is the same as the gray value of the Ledi The difference in the grayscale value of the pixels is recorded as Ledi The grayscale change of each pixel.
[0032] Furthermore, the specific calculation formula corresponding to the possibility of obtaining each pixel point in each column in each stripe area being a defective pixel point is:
[0033]
[0034] in, Indicates the first Ledi The probability that a pixel is a defective pixel; Indicates the number of columns in the stripe area; Indicates the first Ledi The grayscale change of each pixel; Indicates the first Ledi The grayscale change of each pixel; Indicates the first Ledi The grayscale change of each pixel; Indicates the first Ledi The grayscale change of each pixel; represents the absolute value function; Represents the normalization function.
[0035] Furthermore, according to the contrast of the reflective stripe area where each pixel point in all images of the titanium rod is located and the possibility of being a defective pixel point, the possibility of each pixel point in each reflective stripe area in the image of the titanium rod having a defect is obtained, and the corresponding specific calculation formula is:
[0036]
[0037] in, The composite image of the titanium rod The possibility that each pixel is defective; The number of images representing titanium bars; Indicates In the image The contrast of the reflective stripe area where the pixel is located; Indicated in In the image The probability that a pixel is a defective pixel; Represents the normalization function.
[0038] Furthermore, the possibility of the existence of a transverse crack defect in each suspected transverse crack defect area is obtained according to the number of pixels contained in a vertical column of the stripe area corresponding to all images, and the corresponding specific calculation formula is:
[0039]
[0040] in, Indicates The possibility of transverse crack defects in the suspected transverse crack defect area; The number of images representing titanium bars; Indicates The stripe area is The number of pixels contained in a vertical column of the stripe area in an image; Indicates The stripe area is The number of pixels contained in a vertical column of the stripe area in an image; represents the absolute value function; Represents the normalization function.
[0041] Furthermore, the method of obtaining the proportion of defects in the image of the titanium rod according to the number of all pixels in the defective area in the image of the titanium rod and the number of pixels in all images of the titanium rod comprises the following specific steps:
[0042] The ratio of the number of all pixels in the defective area in all images of the titanium rod to the number of all pixels in all images of the titanium rod is recorded as the proportion of defects in the image of the titanium rod.
[0043] The beneficial effects of the technical solution of the present invention are:
[0044] By capturing images of titanium rods at different lighting angles and performing defect identification, the production defects on the titanium rods are determined by integrating the suspected defects in all images, which can effectively eliminate the impact of titanium rod reflection on defect manifestation, improve the accuracy of defect identification, and more accurately judge the production quality of titanium rods. Specifically, by capturing images of titanium rods at different lighting angles, the problem of certain defects not being visible due to single-angle lighting can be avoided, thereby improving the comprehensiveness and accuracy of detection; edge detection is performed on each image, and by analyzing the straightness of the edge and its consistency with the image length, possible reflective stripe edges are screened out, reducing misjudgments caused by reflections; suspected transverse crack defect areas are screened out based on the width of the stripe area and the width of the image after edge detection, thereby improving the recognition ability of transverse cracks; by analyzing the grayscale value and contrast of the same pixel in different images, the contrast size of each stripe area is obtained, further improving the accuracy of defect identification; based on the change in the grayscale value of adjacent pixels , analyze the grayscale change rules of different columns in the stripe area, judge whether each pixel is a defective pixel, and refine the defect recognition process; according to the contrast of each pixel in all images of the titanium rod and the possibility of defective pixels, calculate the possibility of defects in each pixel in each reflective stripe area, and comprehensively analyze the distribution of defects; by analyzing the number of pixels contained in the vertical column of the corresponding stripe area of all images of the suspected transverse crack defect area, the possibility of transverse crack defects is obtained, which further improves the detection accuracy; through the ratio of the number of pixels in the defective area in all images to the total number of pixels in all images, determine the proportion of defects in the comprehensive image of the titanium rod, and then judge the production quality level of the titanium rod. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1The present invention is a flowchart of the steps of the titanium rod production quality detection method based on image features;
[0047] Figure 2 This is a schematic diagram of the titanium rod, camera and light source angles;
[0048] Figure 3 This is a schematic diagram of the titanium rod taken at any lighting angle;
[0049] Figure 4 Schematic diagram of several edges of a titanium rod after detection;
[0050] Figure 5 A scatter diagram of "gray value-contrast" of pixels at each position;
[0051] Figure 6 Schematic diagram of the fitting curve of gray value and contrast. DETAILED DESCRIPTION
[0052] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the specific implementation method, structure, features and effects of the titanium rod production quality detection method based on image features proposed by the present invention are described in detail below in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0053] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0054] The specific scheme of the titanium rod production quality detection method based on image features provided by the present invention is described in detail below with reference to the accompanying drawings.
[0055] See also Figure 1 , which shows a flowchart of a titanium rod production quality detection method based on image features provided by an embodiment of the present invention, the method comprising the following steps:
[0056] Step S001: Collect images of the titanium rod at different lighting angles at the same position.
[0057] The purpose of this embodiment is to analyze the consistency of the grayscale distribution of pixels in the reflective stripes of the same titanium rod in the longitudinal direction and the defect performance at the same position under different lighting angles, so as to find out all titanium rod defects and evaluate the production quality level of titanium rods. Therefore, it is necessary to shoot the same position of the titanium rod from different lighting angles to obtain an image of the same position of the titanium rod.
[0058] Specifically, the position of the camera is fixed, and the titanium rod to be inspected is photographed at the same position from different lighting angles, such as Figure 2 As shown in Figure 1, several images of the titanium rod at the same position with different illumination angles are obtained, such as Figure 3 As shown, it is an image of the titanium rod at any lighting angle.
[0059] It should be noted that the titanium rod is a smooth cylindrical metal with a strong reflective surface, which easily produces light and dark reflective patterns under light. This characteristic makes the appearance of defects on the titanium rod image different due to different reflections, and some defects may even be hidden by reflections. When using image processing technology to detect the production quality of titanium rods, problems such as inaccurate segmentation and edge detection are often encountered, especially under different lighting conditions, some defects may be obscured by shadows or reflective effects. Therefore, by collecting images under different lighting angles and comparing the defect appearance at the same position, these problems can be effectively solved and the accuracy and reliability of titanium rod defect identification can be improved.
[0060] Step S002: Perform edge detection on each image of the titanium rod to obtain each image after edge detection and several edges; obtain the straightness of each edge and the consistency of each edge with the image length according to the distribution of adjacent pixels in the edge and the distribution position of all pixels, and then obtain the possibility that each edge is a reflective stripe edge; screen and obtain several reflective stripe edges, and obtain several stripe areas of each image after edge detection.
[0061] It should be noted that the reflection of the titanium rod usually presents horizontal lines of different grayscale sizes on the surface. By comparing the similarity of the grayscale distribution of the longitudinal pixels on the titanium rod surface in the same horizontal direction, defects inconsistent with the reflection characteristics can be found. Since the degree of defect appearance is different at different illumination angles, it is necessary to combine the images taken at all illumination angles to determine the existing defects; for the transverse crack defects on the surface of the titanium rod, since they are similar to reflections and extend in the horizontal direction, they cannot be detected by simply comparing the similarities at different positions in the horizontal direction; however, since the reflection of the transverse crack is lower than that of the titanium rod surface, its width at various illumination angles is basically the same, and its grayscale is lower than that of the surrounding pixels; therefore, the presence of transverse cracks can be analyzed by comparing the similarity of the performance of suspected transverse crack pixels in different images.
[0062] Specifically, edge detection is performed on each image of the titanium rod to obtain several edge-detected images of the titanium rod, such as Figure 4 The image shown is an image after edge detection of any image, and a sequence of several edges on each image after edge detection and the position coordinates of each pixel point in the image after edge detection are obtained.
[0063] It should be noted that the edge area in the image that is relatively straight and close to the length of the image after edge detection is the reflective stripe edge; therefore, the straightness of each edge can be obtained according to the slope of each pixel point in each edge, and the slope is calculated for each pixel point in each edge. The calculated slope is the slope of the line connecting each pixel point and its next adjacent pixel point. The last pixel point in each edge is not subject to slope calculation because it is at the end of the sequence.
[0064] Furthermore, the specific calculation formula for the straightness of each edge is:
[0065]
[0066]
[0067] in, Indicates On the edge The slope of each pixel; Indicates On the edge The vertical coordinate of the pixel in the image; Indicates On the edge The horizontal coordinate of the pixel in the image; Indicates On the edge The vertical coordinate of the pixel in the image; Indicates On the edge The horizontal coordinate of the pixel in the image; Indicates The straightness of the edges; Indicates The number of pixels in an edge; Indicates On the edge The slope of each pixel; represents the absolute value function; the denominator of the fraction plus Used to ensure that the denominator is not 0 and make the fraction meaningful.
[0068] It should be noted that It represents the difference in slope between each pixel on the edge and its adjacent pixels. The smaller the value, the straighter the edge.
[0069] It should be noted that the inside of the edge of the reflective stripe may produce some edges similar to the edge of the stripe during edge detection due to the influence of other surrounding shadows. Therefore, it is also necessary to combine the number of pixels of each edge with the difference in the number of pixels contained in the horizontal row of the image after edge detection to calculate the consistency of each edge with the image length.
[0070] Specifically, the specific calculation formula for the consistency between each edge and the image length is:
[0071]
[0072] in, Indicates The consistency of the edge and the image length; Indicates The number of pixels in an edge; Indicates the number of pixels contained in a horizontal line in the image; represents the absolute value function; the denominator of the fraction plus Used to ensure that the denominator is not 0 and make the fraction meaningful.
[0073] Furthermore, according to the straightness of each edge and the consistency of each edge with the image length, the possibility of each edge being a reflective stripe edge is obtained. The specific calculation formula is:
[0074]
[0075] in, Indicates The possibility that the edge is a reflective stripe edge; Indicates The straightness of the edges; Indicates The consistency of the edge and the image length; Represents a linear normalization function, and the normalization object is the possibility that all edges in the image after all edge detection are reflective stripe edges.
[0076] Furthermore, the preset reflection threshold of this embodiment is 0.7, which is used as an example for description. Other implementation modes may be set to other values; an edge whose possibility of being a reflection stripe edge is greater than the reflection threshold is recorded as a reflection stripe edge; for any reflection stripe edge, the leftmost and rightmost pixels of the reflective stripe edge in the horizontal direction of the image after edge detection are obtained, and the two obtained pixels are used as vertices of the stripe area of the reflective stripe edge, and a rectangular edge is formed by combining the horizontal and vertical directions of the image after edge detection to obtain a rectangular stripe area, where the horizontal edge of the stripe area is parallel to the horizontal direction of the image, and the vertical edge is parallel to the vertical direction of the image; and a plurality of stripe areas are obtained for each image after edge detection.
[0077] Step S003: According to the width of the stripe area and the width of the image after edge detection, the possibility of each stripe area belonging to a transverse crack is obtained, and the suspected transverse crack defect area is screened; according to the grayscale value and contrast of the pixel points at the same position in different images, the contrast of each stripe area is obtained; according to the grayscale values of adjacent pixels in each stripe area, the grayscale change of each pixel point in each column of each stripe area is obtained, and the grayscale change of the same pixel points in different columns of the same stripe area is analyzed to obtain the possibility of each pixel point in each column of each stripe area being a defective pixel point.
[0078] It should be noted that when there are transverse cracks on the surface of the titanium rod, the transverse cracks extend horizontally on the surface of the titanium rod. Since the image of the titanium rod is taken of the entire titanium rod, the transverse cracks in the image of the titanium rod are actually shown as longitudinal crack areas, that is, the transverse direction in the image of the titanium rod is the entire titanium rod, and the corresponding transverse cracks are shown as longitudinal crack areas, and the edges of the cracks are also relatively straight, similar to reflective stripes. However, the width of the cracks is usually small, so the possibility of each stripe area belonging to a transverse crack can be calculated based on the width of the stripe relative to the width of the image.
[0079] Specifically, taking any image after edge detection as an example, the specific calculation formula for the possibility that each stripe area belongs to a horizontal crack is:
[0080]
[0081] in, Indicates The possibility that the stripe area belongs to the transverse crack; Indicates The number of pixels contained in a vertical column of a stripe area; Indicates the number of pixels contained in a vertical column in the image.
[0082] It should be noted that Indicates The ratio of the width of a stripe area to the image width. The smaller the ratio, the closer the stripe area width is to the image width, and the greater the possibility that the stripe area is a horizontal crack.
[0083] Furthermore, the first threshold value preset in this embodiment is 0.8, which is used as an example for description, and other values may be set in other implementations; the area where the possibility that the stripe area belongs to the transverse crack is greater than the first threshold value is recorded as a suspected transverse crack defect area.
[0084] It should be noted that the highlight and shadow areas produced by the reflection on the titanium rod surface are both horizontal stripes with straight edges and consistent internal grayscale, while defects such as pits, protrusions, and cracks usually have different heights and reflectivity from the normal surface, which is manifested as inconsistent grayscale, and these defects are not similar to the reflective stripes in the horizontal direction like horizontal cracks, so the similarity of the grayscale of each column of pixels in the same stripe is compared to determine whether there is a defect. Although the production defects on the surface of the titanium rod will show characteristics that do not conform to the normal pixel grayscale distribution law in the vertical direction, due to the inconsistent reflection of the titanium rod surface, the grayscale contrast between the defective pixel and the normal pixel in each reflective stripe is also different. When the defect is in a reflective stripe with a high contrast, the defect is more obvious, and when the light is too strong or too dark, some of the defects may be covered up; therefore, according to the variance of the grayscale value of the pixel in each reflective stripe, the contrast of the pixel in the stripe can be expressed. Since the shooting position of the image remains unchanged and only the lighting angle changes, the pixel points at the same position in different images should also correspond to the same position on the titanium rod. For the same pixel point, the grayscale size and contrast size of its position in different images can be plotted into a statistical graph.
[0085] Specifically, the gray value of the pixel point at each position in different images of the titanium rod is used as the horizontal coordinate, and the contrast is used as the vertical coordinate to construct a "gray value-contrast" scatter plot of the pixel point at each position, such as Figure 5 shown.
[0086] Furthermore, since the grayscale value and contrast of pixels at different positions are basically similar, the "grayscale value-contrast" scatter plot corresponding to each pixel is put into the same statistical graph, and the obtained statistical graph is fitted by the least squares method to obtain the fitting curve of grayscale value and contrast in the image, as shown in Figure 6 As shown in the figure, the corresponding grayscale histogram is constructed according to the grayscale value of the pixels in each stripe area; the peak value in the grayscale histogram of the pixels in any stripe area is taken as the grayscale value of the stripe area, and the contrast of the stripe area is obtained according to the corresponding position of its grayscale value in the fitting curve. The greater the contrast, the greater the degree of defect expression in the stripe area. Since the grayscale changes of pixels in different columns in the longitudinal direction of the image (i.e. the transverse direction of the titanium rod) should be similar, the grayscale change of each pixel in the same stripe area can be obtained, and the specific calculation formula is:
[0087]
[0088] in, In any stripe area, Ledi The grayscale change of each pixel; Indicates the first Ledi The gray value of each pixel; Indicates the first Ledi The gray value of a pixel.
[0089] It should be noted that, in order to determine whether any pixel in the stripe region is a defective pixel, it is necessary to compare the similarity of grayscale changes between the column where the pixel is located and other columns in the same stripe region.
[0090] Specifically, taking any stripe region as an example, the specific calculation formula for the possibility that each pixel in each column in the stripe region is a defective pixel is:
[0091]
[0092] in, Indicates the first Ledi The probability that a pixel is a defective pixel; Indicates the number of columns in the stripe area; Indicates the first Ledi The grayscale change of each pixel; Indicates the first Ledi The grayscale change of each pixel; Indicates the first Ledi The grayscale change of each pixel; Indicates the first Ledi The grayscale change of each pixel; represents the absolute value function; Represents a linear normalization function, and the normalized object is all pixels in all columns in all stripe areas. ; It is specially noted that for the first pixel in a column of the stripe area, it is necessary to compare the similarity of the grayscale change between the two pixels closest to it in the same column and the grayscale change at the same position in other columns. Replace with .
[0093] It should be noted that Indicates the first Column and Column No. The difference in the grayscale change of each pixel; Indicates the first Column and Column No. The difference in the grayscale change of each pixel; by analyzing the difference in the grayscale change of the same pixel in different columns, combined with the difference in the grayscale change of adjacent pixels in different columns, the larger the difference cumulative value, the greater the grayscale difference between the column where the pixel is located and other columns, and the greater the possibility of defective pixels.
[0094] Step S004: According to the contrast of the reflective stripe area where each pixel point in all images of the titanium rod is located and the possibility of being a defective pixel point, the possibility of the existence of a defect in each pixel point in each reflective stripe area in the image of the titanium rod is obtained; according to the number of pixels contained in a vertical column of the stripe area corresponding to all images of the suspected transverse crack defect area, the possibility of the existence of a transverse crack defect in each suspected transverse crack defect area is obtained; and then all defect positions are obtained.
[0095] It should be noted that, for non-transverse crack defects, the contrast between defects at different positions in the image and normal pixels under different illumination angles is different, that is, the degree of defect expression at different positions is different.
[0096] Specifically, according to the possibility that the pixel point at each position in each reflective stripe area in all images of the titanium rod is a defect in different images, and the contrast in different images, the possibility that each pixel point in each reflective stripe area in the image of the titanium rod has a defect is obtained, and the specific calculation formula is:
[0097]
[0098] in, The composite image of the titanium rod The possibility that pixels (pixels in the reflective stripe area) are defective; The number of images representing titanium bars; Indicates In the image The contrast of the reflective stripe area where the pixel is located; Indicated in In the image The probability that a pixel is a defective pixel; represents a linear normalization function, which normalizes the contrast of all reflective fringe areas in all images of the titanium rod.
[0099] It should be noted that for suspected transverse crack defects, in images under different lighting angles, the stripes corresponding to the crack defects should remain basically unchanged in width, while the width of the reflective stripes varies greatly.
[0100] Specifically, for any suspected transverse crack defect area, it corresponds to a stripe area in each image (the suspected transverse crack defect area is also a stripe area, the ordinate of the longitudinal center point of the stripe area in the image is obtained, and the stripe area with the smallest ordinate difference in other images is the corresponding stripe area), then according to the width change of the stripe area corresponding to the suspected transverse crack defect area in all images, the possibility of the existence of a transverse crack defect in the stripe area corresponding to each suspected transverse crack defect is obtained, and the specific calculation formula is:
[0101]
[0102] in, Indicates The possibility of transverse crack defects in the suspected transverse crack defect area; The number of images representing titanium bars; Indicates The stripe area is The number of pixels contained in a vertical column of the stripe area in an image; Indicates The stripe area is The number of pixels contained in a vertical column of the stripe area in an image; represents the absolute value function; represents a linear normalization function, and the normalized object is all suspected transverse crack defect areas .
[0103] Furthermore, the preset defect threshold of this embodiment is 0.5, which is used as an example for description, and other values may be set in other implementation modes; when the possibility that there is a defect in any pixel point in each reflective stripe area in the image of the titanium rod is greater than or equal to the defect threshold, and the reflective stripe area where the pixel point is located is a suspected transverse crack area, and at the same time, the possibility that there is a transverse crack defect in the suspected transverse crack defect area is greater than or equal to the defect threshold, there is a defect at the position corresponding to the pixel point; all defect positions are obtained for all images of the titanium rod.
[0104] Step S005: All adjacent defect positions are formed into several connected domains, and several defect areas are screened out; according to the number of all pixel points in the defect area in the image of the titanium rod and the number of pixel points in all images of the titanium rod, the proportion of the defect area in the image of the titanium rod is obtained, and then the production quality of each titanium rod is obtained.
[0105] It should be noted that when there is noise in the image, it may be mistaken for a defect. Therefore, all adjacent titanium rod defect positions are connected to form a domain. If the number of pixels corresponding to a connected domain in the image is less than 3, it is considered that the titanium rod position corresponding to the connected domain is not a defect but image noise.
[0106] Specifically, the preset noise threshold of this embodiment is 3, which is used as an example for description. Other implementations may be set to other values; all adjacent titanium rod defect positions are formed into a connected domain; the number of pixels in each connected domain is determined, and if it is less than the noise threshold, it is noise and the connected domain is excluded, all connected domains are screened, and the remaining connected domains are used as defect areas.
[0107] Furthermore, according to the number of pixels of the defect in the image of the titanium rod, the proportion of the defect in the image of the titanium rod is obtained, and the corresponding specific calculation formula is:
[0108]
[0109] in, Represents the proportion of defects in the image of the titanium rod; Represents the number of all pixels in the defective area of all images of the titanium rod; Represents the number of all pixels in all images of the titanium rod (the cumulative value of the number of pixels in all images).
[0110] Furthermore, in this embodiment, the second threshold value preset is 0.2 and the third threshold value is 0.5. This is used as an example for description, and other values may be set in other implementation modes; when the proportion of defects in the comprehensive image of the titanium rod is less than the second threshold value, the quality of the titanium rod is judged to be excellent; when the proportion of defects in the comprehensive image of the titanium rod is greater than the second threshold value and less than the third threshold value, the quality of the titanium rod is judged to be average; when the proportion of defects in the comprehensive image of the titanium rod is greater than the third threshold value, the quality of the titanium rod is judged to be poor.
[0111] At this point, this embodiment is completed.
[0112] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A titanium rod production quality detection method based on image features, characterized in that: The method comprises the following steps: Collect images of the titanium rod at different lighting angles at the same position; Perform edge detection on each image of the titanium rod to obtain each image after edge detection and several edges; obtain the straightness of each edge and the consistency of each edge with the image length according to the distribution of adjacent pixel points in the edge and the distribution position of all pixel points in the corresponding image after edge detection, and then obtain the possibility that each edge is a reflective stripe edge; screen and obtain several reflective stripe edges, and obtain several stripe areas of each image after edge detection; According to the width of the stripe area and the width of the image after edge detection, the possibility of each stripe area being a transverse crack is obtained, and the suspected transverse crack defect area is screened; the contrast of each stripe area is obtained according to the grayscale value and contrast of the pixel point at the same position in the image at different illumination angles; the grayscale change of each pixel point in each column of each stripe area is obtained according to the grayscale value of the adjacent pixel points in each stripe area, and the grayscale change of the same pixel points in different columns of the same stripe area is analyzed to obtain the possibility of each pixel point in each column of each stripe area being a defective pixel point; According to the contrast of the reflective stripe area where each pixel point in all images of the titanium rod is located and the possibility of being a defective pixel point, the possibility of each pixel point in each reflective stripe area in the image of the titanium rod being defective is obtained; according to the number of pixels contained in a vertical column of the stripe area corresponding to all images of the suspected transverse crack defect area, the possibility of the existence of a transverse crack defect in each suspected transverse crack defect area is obtained; and then all defect positions are obtained; All adjacent defect positions are formed into several connected domains, and several defect areas are screened out; according to the number of all pixel points in the defect area in the image of the titanium rod and the number of pixel points in all images of the titanium rod, the proportion of the defect area in the image of the titanium rod is obtained, and then the production quality of each titanium rod is obtained; The specific calculation formula for the probability that each stripe area belongs to a transverse crack is: in, Indicates The possibility that the stripe area belongs to the transverse crack; Indicates The number of pixels contained in a vertical column of a stripe area; Indicates the number of pixels contained in a vertical column in the image after edge detection.
2. The titanium rod production quality detection method based on image features according to claim 1 is characterized in that: The method of obtaining the straightness of each edge and the consistency between the length of each edge and the image according to the distribution of adjacent pixels in the edge and the distribution positions of all pixels in the image after the corresponding edge detection comprises the following specific steps: The specific calculation formula corresponding to the straightness of each edge is: in, Indicates On the edge The slope of each pixel; Indicates On the edge The vertical coordinate of the pixel in the image; Indicates On the edge The horizontal coordinate of the pixel in the image; Indicates On the edge The vertical coordinate of the pixel in the image; Indicates On the edge The horizontal coordinate of the pixel in the image; Indicates The straightness of the edges; Indicates The number of pixels in an edge; Indicates On the edge The slope of each pixel; represents the absolute value function; The specific calculation formula corresponding to the consistency between each edge and the image length is: in, Indicates The consistency of the edge and the image length; Indicates The number of pixels in an edge; Indicates the number of pixels contained in a horizontal line in the image after edge detection; represents the absolute value function.
3. The titanium rod production quality detection method based on image features according to claim 1 is characterized in that: The specific calculation formula corresponding to the probability of obtaining each edge being a reflective stripe edge is: in, Indicates The possibility that the edge is a reflective stripe edge; Indicates The straightness of the edges; Indicates The consistency of the edge and the image length; Represents the normalization function.
4. The titanium rod production quality detection method based on image features according to claim 1 is characterized in that: The step of obtaining the contrast of each stripe region according to the grayscale value and contrast of the pixel at the same position in the image at different illumination angles includes the following specific steps: The gray value of each pixel point in the image of the titanium rod at different illumination angles is used as the horizontal coordinate, and the contrast is used as the vertical coordinate to construct a "gray value-contrast" scatter plot of the pixel point at each position; The "gray value-contrast" scatter plot corresponding to each pixel point is placed in the same statistical graph, and the obtained statistical graph is fitted by the least squares method to obtain the fitting curve of gray value and contrast in the image; Construct a corresponding grayscale histogram according to the grayscale values of the pixels in each stripe area; The peak value in the grayscale histogram of the pixel points in any stripe area is taken as the grayscale value of the stripe area, and the contrast of the stripe area is obtained according to the corresponding position of the grayscale value in the fitting curve.
5. The titanium rod production quality detection method based on image features according to claim 1 is characterized in that: The step of obtaining the grayscale variation of each pixel in each column in each stripe region according to the grayscale values of adjacent pixels in each stripe region includes the following specific steps: In any stripe area, Ledi The gray value of the pixel point is the same as the gray value of the Ledi The difference in the grayscale value of the pixels is recorded as Ledi The grayscale change of each pixel.
6. The titanium rod production quality detection method based on image features according to claim 1 is characterized in that: The specific calculation formula for obtaining the possibility that each pixel in each column of each stripe area is a defective pixel is: in, Indicates the first Ledi The probability that a pixel is a defective pixel; Indicates the number of columns in the stripe area; Indicates the first Ledi The grayscale change of each pixel; Indicates the first Ledi The grayscale change of each pixel; Indicates the first Ledi The grayscale change of each pixel; Indicates the first Ledi The grayscale change of each pixel; represents the absolute value function; Represents the normalization function.
7. The titanium rod production quality detection method based on image features according to claim 1 is characterized in that: According to the contrast of the reflective stripe area where each pixel point in all images of the titanium rod is located and the possibility of being a defective pixel point, the possibility of each pixel point in each reflective stripe area in the image of the titanium rod having a defect is obtained, and the corresponding specific calculation formula is: in, The image of the titanium rod shows the first The possibility that each pixel is defective; The number of images representing titanium bars; Indicates In the image The contrast of the reflective stripe area where the pixel is located; Indicated in In the image The probability that a pixel is a defective pixel; Represents the normalization function.
8. The titanium rod production quality detection method based on image features according to claim 1 is characterized in that: According to the number of pixels contained in a vertical column of the stripe regions corresponding to all images in the suspected transverse crack defect region, the possibility of the existence of a transverse crack defect in each suspected transverse crack defect region is obtained, and the corresponding specific calculation formula is: in, Indicates The possibility of transverse crack defects in the suspected transverse crack defect area; The number of images representing titanium bars; Indicates The stripe area is The number of pixels contained in a vertical column of the stripe area in an image; Indicates The stripe area is The number of pixels contained in a vertical column of the stripe area in an image; represents the absolute value function; Represents the normalization function.
9. The titanium rod production quality detection method based on image features according to claim 1 is characterized in that: The method of obtaining the proportion of the defective area in the image of the titanium rod according to the number of all pixels in the defective area in the image of the titanium rod and the number of pixels in all images of the titanium rod comprises the following specific steps: The ratio of the number of all pixels in the defective area in all images of the titanium rod to the number of all pixels in all images of the titanium rod is recorded as the proportion of the defective area in the image of the titanium rod.
Citation Information
Patent Citations
Corrugated paper production quality visual auxiliary detection method
CN116977358A
Titanium metal welding quality detection method and system based on image processing
CN117934467A
Radial forging titanium rod appearance visual inspection method based on machine learning
CN118096796A
Method and system for rapidly detecting glossiness of titanium rod
CN118115498A
Method and system of characterisation of a surface defect of a workpiece
EP2109079A1
