A titanium alloy bar identification method and system based on image analysis

By calculating the target possibility degree and irregularity degree of edge straight lines in titanium alloy bar images, the problem of misjudgment caused by background and reflection in titanium alloy bar image recognition is solved, and a more accurate titanium alloy bar area is achieved. Identify.

CN118365867BActive Publication Date: 2024-09-06BAOJI TALENT HI-TECH TITANIUM IND CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410796411.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-20
Publication Date
2024-09-06
Estimated Expiration
2044-06-20

AI Technical Summary

Technical Problem

In the image recognition of titanium alloy rods, due to factors such as the image background and surface reflection of titanium alloy rods, the edge detection results are inaccurate and the recognition accuracy is low.

Method used

By collecting images of titanium alloy rods and performing grayscale processing, edge straight lines are obtained, and the target possibility degree of each edge straight line is calculated. Combined with the length of the edge straight line and the irregularity of the gray value distribution of pixel points in the neighborhood, screening Detect the true edge straight line of titanium alloy bar to avoid misjudgment.

Benefits of technology

The accuracy and efficiency of area identification of titanium alloy rods are improved, and the edge straight lines of the reflective areas on the surface of titanium alloy rods are effectively filtered out to ensure the accuracy of the identification results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118365867B
    Figure CN118365867B
Patent Text Reader

Abstract

The present invention relates to the field of image processing technology. Specifically, it relates to a titanium alloy bar identification method and system based on image analysis. The method includes: collecting titanium alloy bar images and graying them, thereby obtaining a gray image of the titanium alloy bar; obtaining edge lines in the gray image; calculating the target probability of each edge line, the target probability is used to characterize the probability that the edge line is the actual edge line of the titanium alloy bar; determining the edge line whose target probability is greater than a preset target probability threshold as the actual edge line of the titanium alloy bar; and obtaining the titanium alloy bar area in the image based on the actual edge line. The method of the present invention can more accurately identify the area of ​​the titanium alloy bar in the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and more specifically, to a titanium alloy bar identification method and system based on image analysis. Background Art

[0002] Quality control and defect detection are crucial links in the production and processing of titanium alloy bars. Traditional visual inspection and manual sampling methods have problems such as low efficiency, strong subjectivity, and easy errors. Therefore, the introduction of image analysis technology has become an important solution. Through image analysis technology, the surface quality, size, shape and defects of titanium alloy bars can be automatically and efficiently detected and analyzed. When using image analysis technology to detect the quality of titanium alloy bars, it is first necessary to identify the titanium alloy bar area in the image.

[0003] In the prior art, a method commonly used to identify the area of ​​an object from an image is to first perform edge detection on the grayscale image, and then identify the outline or area of ​​the specific object in the image based on the detected edges. For example, the bill text area detection method disclosed in the Chinese patent application document with application publication number CN111753842A, when detecting the bill text area, first detects the edge of the bill image, and then identifies the bill text area.

[0004] However, in the application scenario of performing edge detection on the image of titanium alloy rods and then identifying the titanium alloy rods, due to the influence of factors such as the image background of the titanium alloy rods and the reflection on the surface of the titanium alloy rods, the detected edges may not be the true edges of the titanium alloy rods, resulting in misjudgment and identifying areas that do not belong to the titanium alloy rods as areas of the titanium alloy rods, resulting in low accuracy of the titanium alloy rod recognition results. Summary of the invention

[0005] In order to solve the technical problem of low accuracy of recognition results when identifying titanium alloy bars based on images of titanium alloy bars, the present invention provides solutions in the following aspects.

[0006] In the first aspect, the present invention provides a titanium alloy rod identification method based on image analysis, comprising: collecting a titanium alloy rod image and graying it to obtain a grayscale image of the titanium alloy rod; obtaining edge lines in the grayscale image; calculating a target possibility degree for each edge line, the target possibility degree is positively correlated with the length of the calculated edge line, and is positively correlated with the irregularity of the grayscale value distribution of pixels in the neighborhood of the edge line; the target possibility degree is used to characterize the probability that the edge line is the actual edge line of the titanium alloy rod; an edge line whose target possibility degree is greater than a preset target possibility degree threshold is determined as the actual edge line of the titanium alloy rod; and a titanium alloy rod area in the image is obtained based on the actual edge line.

[0007] The beneficial effects are as follows: since the surface of titanium alloy rods is often relatively flat, the grayscale values ​​of each pixel on the surface of the titanium alloy rods are similar, the edge straight line of the reflective area on the surface of the rod is located on the rod, and the grayscale values ​​of the pixels in its neighborhood are relatively single; and since the actual edge of the rod is close to the background area, the grayscale values ​​of the pixels in the neighborhood of the edge straight line will be more complex, and the grayscale value distribution of the pixels in the neighborhood of the edge straight line will be more irregular. The titanium alloy bar identification method based on image analysis of the present invention first obtains edge lines in the image when identifying the titanium alloy bar area in the titanium alloy bar image. After obtaining all edge lines, the target possibility degree of the edge line is more accurately determined based on the length of the edge line and the irregularity of the grayscale value distribution of pixels in the neighborhood of the edge line. The target possibility degree of the edge line is then compared with the target possibility degree threshold, thereby more accurately screening out the true edge lines of the titanium alloy bar from all edge lines, filtering out the edge lines in the surface reflective area of ​​the titanium alloy bar, and fully considering the influence of the reflective phenomenon on the surface of the titanium alloy bar on the recognition result when identifying the titanium alloy bar, avoiding misjudgment, and thus more accurately identifying the area of ​​the titanium alloy bar.

[0008] In one embodiment, the obtaining of edge lines in the grayscale image includes: detecting edges in the image using an edge detection algorithm, and then performing Hough line detection on the edges in the edge detection result image, thereby obtaining edge lines in the edge detection result image.

[0009] In one embodiment, the edge detection algorithm adopts the Canny algorithm, and the edge strength threshold is 0.5.

[0010] In one embodiment, the target likelihood threshold is 0.8.

[0011] In one embodiment, the calculation expression of the target possibility degree is:

[0012] ;

[0013] in, Indicates The target probability of the edge straight line, Indicates The number of pixels contained in the edge line, Indicates The irregularity of the grayscale value distribution of pixels in the neighborhood of a straight line. represents the maximum value function, Indicates the number of pixels contained in the nth edge line.

[0014] When calculating the target possibility degree of a certain edge line, first calculate the ratio of the length of the edge line to the length of the longest edge line, and use the product of the ratio and the degree of irregularity of the grayscale value distribution of pixels in the neighborhood of the edge line as the target possibility degree of the edge line. The calculation method is simple and reliable. The calculation expression of the target possibility degree of the invention can accurately and efficiently calculate the target possibility degree of the edge line, thereby further improving the efficiency and accuracy of regional recognition of titanium alloy bars.

[0015] In one embodiment, the method for obtaining the degree of irregularity includes: setting a traversal window, traversing the edge straight line from any end point of the edge straight line, taking each point on the edge straight line as the window center in turn, thereby obtaining all traversal windows; and assigning a sequence value to each traversal window in the traversal order; calculating the window characteristic value of each traversal window, the window characteristic value is used to characterize the degree of difference in the grayscale value of the pixel point in the window; taking the sequence value and the window characteristic value of the traversal window as the horizontal coordinate value and the vertical coordinate value respectively, obtaining the window characteristic coordinate point, and then obtaining the window characteristic curve; calculating the degree of deviation of the window characteristic coordinate point of the edge straight line relative to the window characteristic curve, thereby obtaining the degree of irregularity.

[0016] The method for obtaining the degree of irregularity of the grayscale value distribution of pixels in the neighborhood of the edge straight line of the present invention is used. When obtaining the degree of irregularity of the grayscale value distribution of pixels in the neighborhood of the edge straight line, a traversal window is first set and the traversal window is used to traverse each pixel on the edge straight line to obtain multiple traversal windows. By respectively obtaining the degree of difference in the grayscale values ​​of the pixels in each traversal window, a window characteristic curve is fitted to characterize the change law of the grayscale values ​​of the pixels in the neighborhood of the edge straight line in the extension direction of the edge straight line. Finally, the degree of irregularity of the grayscale value distribution of the pixels in the neighborhood of the edge straight line is obtained based on the discrete degree of the window characteristic coordinate points corresponding to each pixel on the edge straight line relative to the window characteristic curve. Therefore, the method for obtaining the degree of irregularity of the grayscale value distribution of pixels in the neighborhood of the edge straight line of the present invention can more accurately calculate the degree of irregularity of the grayscale value distribution of pixels in the neighborhood of the edge straight line.

[0017] In one embodiment, the calculation expression of the window characteristic value of the traversal window is:

[0018] ;

[0019] in, Indicates The first edge line The window eigenvalues ​​of edge points, Indicates The edge line The average value of the pixel points on one side of the edge line in the traversal window corresponding to the edge points, Indicates The edge line The average value of the pixel points on the other side of the edge line in the traversal window corresponding to the edge points; Indicates The edge line The average gray value of the pixel points on the edge straight line in the traversal window corresponding to the edge points.

[0020] The calculation expression of the window eigenvalue of the present invention is used to calculate the window eigenvalue based on the difference between the grayscale value mean of the edge points in the window and the grayscale value mean of the pixel points on both sides of the edge straight line. The window eigenvalue of each traversed window can be calculated quickly and relatively accurately.

[0021] In one embodiment, the calculation expression of the deviation degree of the window characteristic coordinate point of the edge straight line relative to the window characteristic curve is:

[0022] ;

[0023] In the formula, Indicates The degree of deviation of the window characteristic coordinate point of the straight line relative to the window characteristic curve, Indicates The number of edge pixels contained in the edge line. The sequence number of the window feature coordinate point representing the edge line, Indicates The edge line The window characteristic value of the window characteristic coordinate point, and Respectively represent the slope and intercept of the window characteristic curve; represents the linear normalization function.

[0024] The larger the difference between the window characteristic value of a window and the value of the window characteristic curve at the sequence number of the window, the greater the deviation of the window characteristic coordinate point from the window characteristic curve. Therefore, the deviation of the window characteristic coordinate point from the window characteristic curve can be accurately calculated based on the difference between the window characteristic value of the window and the value of the window characteristic curve at the sequence number of the window; by taking the mean of the sum of the squares of the differences corresponding to each window as the deviation of all the window characteristic coordinate points of the edge straight line from the window characteristic curve, the calculated deviation can be made more accurate.

[0025] In a second aspect, the present invention provides a titanium alloy bar identification system based on image analysis, comprising a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the titanium alloy bar identification method based on image analysis of the present invention is implemented.

[0026] The beneficial effect of the present invention is that the titanium alloy bar identification method based on image analysis of the present invention can more accurately identify the area of ​​the titanium alloy bar. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0028] Figure 1 is a flow chart schematically showing a titanium alloy bar identification method based on image analysis according to an embodiment of the present invention;

[0029] Figure 2 is a grayscale image schematic diagram schematically showing a titanium alloy rod according to an embodiment of the present invention;

[0030] Figure 3 is a schematic diagram schematically showing an edge detection result image of an embodiment of the present invention;

[0031] Figure 4 is a flowchart schematically illustrating a method for obtaining the degree of irregularity of grayscale value distribution of pixels within a neighborhood of an edge line according to an embodiment of the present invention;

[0032] Figure 5 is a schematic diagram schematically showing the distribution of pixels within a traversal window according to an embodiment of the present invention;

[0033] Figure 6 The figure schematically shows the structure of a titanium alloy bar identification system based on image analysis according to an embodiment of the present invention. DETAILED DESCRIPTION

[0034] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

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

[0036] Titanium alloy bar identification method based on image analysis embodiment:

[0037] like Figure 1 As shown, the titanium alloy bar identification method based on image analysis of the present invention comprises:

[0038] S101, collecting an image of a titanium alloy bar and graying it, thereby obtaining a grayscale image of the titanium alloy bar.

[0039] If the titanium alloy bar image is collected from the titanium alloy bar production line, the collected titanium alloy bar image includes multiple titanium alloy bars, conveyor belts, reflected light, and various images of the background area. There are reflective areas on the titanium alloy bars and conveyor belts. The titanium alloy bar image is grayscaled, and the grayscale image of the titanium alloy bar is obtained as follows: Figure 2 shown.

[0040] The three-channel image is converted into a single-channel grayscale image by graying, which not only saves storage space but also facilitates the subsequent image processing process.

[0041] S102: Obtain edge lines in the grayscale image.

[0042] We can first use the edge detection algorithm to detect the edges in the image, and then perform Hough line detection on the edges in the edge detection result image to obtain the edge straight lines in the edge detection result image. The number of edge straight lines in the image is recorded as , will The number of pixels contained in the edge line is recorded as Since the edge of the titanium alloy bar and the reflective area on the surface of the bar appear as straight lines along the direction of the bar in the titanium alloy bar image, it is inevitable that a part of the edge straight lines in the edge detection result image are not actually the edges of the titanium alloy bar.

[0043] Canny algorithm, Sobel algorithm or Prewitt algorithm can be used for edge detection. Preferably, Canny algorithm is used in this embodiment. In addition to the actual edge of the bar, there are many other edges in the image caused by factors such as background and surface gloss of the bar. Therefore, when using Canny algorithm for detection, it is necessary to select a suitable edge strength threshold to perform edge detection on the titanium alloy bar image, so as to ensure that most of all edges in the detection results are actual bar edges; the preset edge strength threshold can be an empirical value of 0.5. In other embodiments, the edge detection strength threshold can be set according to the actual implementation situation.

[0044] The edge detection result image obtained after detection using the Canny algorithm is as follows Figure 3 As shown in the figure, it can be seen that it includes the edge of the titanium alloy rod and other types of edges, and the edge straight lines include the edge straight lines of the titanium alloy rod and the edge straight lines of the reflective area on the surface of the rod.

[0045] S103. Obtaining the target possibility degree of the edge line, specifically: calculating the target possibility degree of each edge line, the target possibility degree is positively correlated with the calculated length of the edge line, and is positively correlated with the irregularity of the grayscale value distribution of pixels in the neighborhood of the edge line; the target possibility degree is used to characterize the probability that the edge line is the actual edge line of the titanium alloy rod.

[0046] Since the edge lines obtained include not only the actual edge of the bar, but also the edge lines of the reflective area on the surface of the bar, which will interfere with the identification of the bar, it is necessary to distinguish the edge lines according to the target possibility of each edge line. Since the surface of the titanium alloy bar is often relatively flat and has similar grayscale values, the edge line of the reflective area on the surface of the bar is located on the bar, and the grayscale value of the pixels in its neighborhood is relatively simple; and since the actual edge of the bar is close to the background area, the grayscale value of the pixels in the neighborhood of the edge line will be more complex, and the grayscale value distribution of the pixels in the neighborhood of the edge line will be more irregular. Therefore, the higher the irregularity of the grayscale value distribution of the pixels in the neighborhood of the edge line, the higher the possibility that the edge line is the actual edge line of the titanium alloy bar.

[0047] Since the actual edge of the rod will be displayed more completely in the result image for easy detection, and the reflective area on the surface of the rod may not be complete due to the influence of light intensity, the longer the edge straight line is, the more likely it is to belong to the actual edge of the rod.

[0048] Therefore, the target possibility degree of each edge line can be calculated more accurately according to the irregularity of the gray value distribution of the pixels in the neighborhood of the edge line and the length of the edge line.

[0049] S104: Determine the edge straight line whose target possibility degree is greater than a preset target possibility degree threshold as the actual edge straight line of the titanium alloy rod.

[0050] The target likelihood threshold may be set to 0.8 or other appropriate values.

[0051] S105, acquiring a titanium alloy bar area in the image according to the actual edge straight line.

[0052] In the bar image, the bar edge mainly appears as a straight line, so the actual bar edge can be screened by detecting the straight lines in the image.

[0053] Since the same titanium alloy rod in the image has two straight edges, if there is only one titanium alloy rod, then there are two actual edge lines obtained, and the area between the two parallel and adjacent straight edges can be determined as the titanium alloy rod area; if there are multiple titanium alloy rods and they are parallel to each other, then each of the actual edge lines obtained is parallel to each other, and starting from the outermost actual edge line, the adjacent actual edge lines can be divided into a group of two, and the area between the two actual edge lines in the same group is the rod area. If there are multiple titanium alloy rods and they are not parallel to each other, all edge line combinations can be searched out first, and the edge line combination consists of two parallel and adjacent actual edge lines, and the area between the two actual edge lines in the edge line combination is determined as the titanium alloy rod area.

[0054] The titanium alloy bar identification method based on image analysis of the present invention first obtains edge lines in the image when identifying the titanium alloy bar area in the titanium alloy bar image. After obtaining all edge lines, the target possibility degree of the edge line is more accurately determined based on the length of the edge line and the irregularity of the grayscale value distribution of pixels in the neighborhood of the edge line. The target possibility degree of the edge line is then compared with the target possibility degree threshold, thereby more accurately screening out the true edge lines of the titanium alloy bar from all edge lines, filtering out the edge lines in the surface reflective area of ​​the titanium alloy bar, and fully considering the influence of the reflective phenomenon on the surface of the titanium alloy bar on the recognition result when identifying the titanium alloy bar, avoiding misjudgment, and thus more accurately identifying the area of ​​the titanium alloy bar.

[0055] It can be seen from the above embodiments that the target possibility degree is positively correlated with the length of the edge line and the irregularity of the grayscale value distribution of pixels in the neighborhood of the edge line. In one embodiment, the calculation expression of the target possibility degree is:

[0056]

[0057] in, Indicates The target probability of the edge straight line, Indicates The number of pixels contained in the edge line, Indicates The irregularity of the grayscale value distribution of pixels in the neighborhood of the edge line. represents the maximum value function, Indicates the number of pixels contained in the nth edge line.

[0058] When calculating the target possibility degree of a certain edge line, the calculation expression of this embodiment first calculates the ratio of the length of the edge line to the length of the longest edge line, and uses the product of the ratio and the irregularity of the grayscale value distribution of pixels in the neighborhood of the edge line as the target possibility degree of the edge line. The calculation method is simple and reliable. The calculation expression of the target possibility degree of this embodiment can accurately and efficiently calculate the target possibility degree of the edge line, thereby further improving the efficiency and accuracy of regional recognition of titanium alloy bars.

[0059] From the above embodiments, it can be seen that the target possibility of the edge line is positively correlated with the irregularity of the gray value distribution of the pixels in the neighborhood of the edge line. Figure 4 As shown, in one embodiment, the method for obtaining the degree of irregularity of the grayscale value distribution of pixels in the neighborhood of the edge straight line includes:

[0060] S201, obtaining all traversal windows, specifically: setting a traversal window, traversing the edge line from any endpoint of the edge line, taking each point on the edge line as the window center in turn, thereby obtaining all traversal windows; and assigning a sequence value to each traversal window according to the traversal order.

[0061] In this embodiment, the size of the traversal window is 3×3. In other embodiments, the traversal window may also be set to other sizes.

[0062] S202, obtaining window characteristic values ​​of the traversal windows, specifically: calculating the window characteristic values ​​of each traversal window, wherein the window characteristic values ​​are used to characterize the degree of difference in the grayscale values ​​of the pixels in the window.

[0063] like Figure 5 As shown, for a certain traversal window, there are nine pixels, among which pixel A, pixel B, and pixel C are pixels on the edge line, i.e., edge points, and other pixels are non-edge points. The edge points are located on the diagonal of the window, thereby dividing the non-edge points in the window into two parts, one of which is located on one side of the edge line, and the other is located on the other side of the edge line; there are three types of pixels in the window, namely edge points, pixels on one side of the edge line, and pixels on the other side of the edge line. The difference in the grayscale values ​​of the pixels in the window can be characterized according to the difference between the grayscale values ​​of the edge point pixels, the grayscale values ​​of the pixels on one side of the edge line, and the grayscale values ​​of the pixels on the other side of the edge line, or according to the difference between the grayscale values ​​of the pixels on one side of the edge line and the grayscale values ​​of the pixels on the other side of the edge line.

[0064] If the difference in the grayscale values ​​of the pixels in the window is characterized by the difference between the grayscale values ​​of the edge point pixels, the grayscale values ​​of the pixels on one side of the edge line, and the grayscale values ​​of the pixels on the other side of the edge line, the grayscale values ​​of the pixels on both sides of the edge line corresponding to the reflective area on the surface of the bar are relatively close, and the difference in the grayscale values ​​of the pixels in the window is small; while for the pixels on both sides of the actual edge line of the bar, due to the interference of the complex background on one side of the actual edge line of the bar, the grayscale values ​​of different pixels on this side are relatively different, which will lead to a large difference in the grayscale values ​​of the pixels in the window. The window eigenvalues ​​of each traversed window are calculated to facilitate subsequent analysis of whether the edge line is the actual edge line of the bar. The difference between the grayscale values ​​of the edge points in the window, the grayscale values ​​of the pixels on one side of the edge line, and the grayscale values ​​of the pixels on the other side of the edge line can be calculated based on the grayscale value mean of the edge points in the window, the grayscale value mean of the pixels on one side of the edge line, and the grayscale value mean of the pixels on the other side of the edge line. Therefore, the grayscale value mean of the edge points in the window, the grayscale value mean of the pixels on one side of the edge line, and the grayscale value mean of the pixels on the other side of the edge line can be calculated first, and then the average of the other two means is subtracted from one of the means to obtain the difference between the three. In other embodiments, other suitable methods can also be used to calculate the difference between the grayscale values ​​of the edge points in the window, the grayscale values ​​of the pixels on one side of the edge line, and the grayscale values ​​of the pixels on the other side of the edge line.

[0065] The degree of difference in the grayscale values ​​of the pixels in the window is characterized by the degree of difference between the grayscale values ​​of the pixels on one side of the edge line and the grayscale values ​​of the pixels on the other side of the edge line. The mean grayscale values ​​of the pixels on one side of the edge line and the mean grayscale values ​​of the pixels on the other side of the edge line can be first calculated, and the difference between the two grayscale value means is taken to obtain the degree of difference in the grayscale values ​​of the pixels in the window.

[0066] S203, obtaining a window characteristic curve, specifically: using the sequence value and the window characteristic value of the traversal window as the horizontal coordinate value and the vertical coordinate value respectively, obtaining the window characteristic coordinate point, and then obtaining the window characteristic curve.

[0067] The window characteristic curve can be obtained by fitting all the window characteristic coordinate points. Linear function fitting or polynomial fitting can be used for fitting. Preferably, linear function fitting is used in this embodiment.

[0068] The expression of the obtained window characteristic curve is , is a straight line, where is the slope of the straight line, is the intercept of the straight line.

[0069] S204, obtaining the irregularity of the grayscale value distribution of pixels in the neighborhood of the edge line, specifically: calculating the deviation of the window feature coordinate point of the edge line relative to the window feature curve, thereby obtaining the irregularity.

[0070] The window characteristic coordinate point refers to the coordinate point corresponding to the window characteristic value of the central pixel point of the window and the corresponding window serial number.

[0071] The degree of deviation of the window characteristic coordinate point of the edge straight line relative to the window characteristic curve is the degree of irregularity of the grayscale value distribution of the pixel points in the neighborhood of the edge straight line.

[0072] The window characteristic curve can represent a change rule of the grayscale value of the pixel points in the neighborhood of the edge line in the extension direction of the edge line. For a certain edge line, the greater the degree to which its corresponding window characteristic coordinate point deviates from the window characteristic curve, the more irregular the distribution of the grayscale value of the pixel points in the neighborhood of the edge line in the extension direction of the edge line.

[0073] When using the method in this embodiment to obtain the irregularity of the grayscale value distribution of pixels in the neighborhood of the edge line, a traversal window is first set and the traversal window is used to traverse each pixel on the edge line to obtain multiple traversal windows. By respectively obtaining the difference between the grayscale values ​​of the edge points in each traversal window, the grayscale values ​​of the pixels on one side of the edge line, and the grayscale values ​​of the pixels on the other side of the edge line, a window characteristic curve is fitted to characterize the change law of the grayscale values ​​of the pixels in the neighborhood of the edge line in the extension direction of the edge line. Finally, the irregularity of the grayscale value distribution of the pixels in the neighborhood of the edge line is obtained based on the discrete degree of the window characteristic coordinate points corresponding to each pixel on the edge line relative to the window characteristic curve. Therefore, the method in this embodiment can more accurately calculate the irregularity of the grayscale value distribution of the pixels in the neighborhood of the edge line.

[0074] In the above embodiments, it is mentioned that the degree of difference in the grayscale values ​​of the pixels in the window can be characterized according to the degree of difference between the grayscale values ​​of the edge point pixels, the grayscale values ​​of the pixels on one side of the edge line, and the grayscale values ​​of the pixels on the other side of the edge line, or according to the degree of difference between the grayscale values ​​of the pixels on one side of the edge line and the grayscale values ​​of the pixels on the other side of the edge line. In one embodiment, the degree of difference in the grayscale values ​​of the pixels in the window refers to the degree of difference between the grayscale values ​​of the edge points, the grayscale values ​​of the pixels on one side of the edge line, and the grayscale values ​​of the pixels on the other side of the edge line. The calculation expression of the window characteristic value of the traversed window is:

[0075]

[0076] in, Indicates The first edge line The window eigenvalues ​​of edge points, Indicates The edge line The average value of the pixel points on one side of the edge line in the traversal window corresponding to the edge points, Indicates The edge line The average value of the pixel points on the other side of the edge line in the traversal window corresponding to the edge points; Indicates The edge line The average gray value of the pixel points on the edge straight line in the traversal window corresponding to the edge points.

[0077] By using the calculation expression of the window eigenvalue in this embodiment, when calculating the window eigenvalue, the difference between the mean grayscale value of the edge points in the window and the mean grayscale value of the pixel points on both sides of the edge straight line is calculated. The window eigenvalue of each traversed window can be calculated quickly and relatively accurately.

[0078] It can be known from the above embodiments that the degree of deviation of the window characteristic coordinate point relative to the window characteristic curve is the degree of irregularity of the grayscale value distribution of the pixel points in the neighborhood of the edge straight line; in one embodiment, the degree of deviation can be calculated based on the difference between the ordinate of the window characteristic coordinate point, i.e., the window characteristic value of the window, and the value of the window characteristic curve at the sequence number of the window, and the greater the difference between the two, the greater the degree of deviation. The horizontal coordinate corresponding to the point on the window characteristic curve is the sequence value of the traversed window, and the vertical coordinate is the window characteristic value of the traversed window. The value of the window characteristic curve at the sequence number of the window refers to the vertical coordinate corresponding to the point on the window characteristic curve whose horizontal coordinate is the sequence number of the window.

[0079] In this embodiment, the calculation expression of the deviation degree of the window characteristic coordinate point of the edge straight line relative to the window characteristic curve is:

[0080]

[0081] In the formula, Indicates The degree of deviation of the window characteristic coordinate point of the straight line relative to the window characteristic curve, Indicates The number of edge pixels contained in the edge line. The sequence number of the window feature coordinate point representing the edge line, Indicates The edge line The window characteristic value of the window characteristic coordinate point, and represent the slope and intercept of the window characteristic curve respectively. represents the linear normalization function.

[0082] The larger the difference between the window characteristic value of a window and the value of the window characteristic curve at the sequence number of the window, the greater the deviation of the window characteristic coordinate point from the window characteristic curve. Therefore, the deviation of the window characteristic coordinate point from the window characteristic curve can be accurately calculated based on the difference between the window characteristic value of the window and the value of the window characteristic curve at the sequence number of the window; by taking the mean of the sum of the squares of the differences corresponding to each window as the deviation of all the window characteristic coordinate points of the edge straight line from the window characteristic curve, the calculated deviation can be made more accurate.

[0083] Titanium alloy bar identification system based on image analysis:

[0084] The present invention also provides a titanium alloy bar identification system based on image analysis. Figure 6 As shown, the titanium alloy bar identification system based on image analysis includes a processor and a memory, and the memory stores computer program instructions. When the computer program instructions are executed by the processor, the titanium alloy bar identification method based on image analysis according to the first aspect of the present invention is implemented.

[0085] The titanium alloy bar identification system based on image analysis also includes other components familiar to those skilled in the art, such as a communication bus and a communication interface, whose settings and functions are known in the art and will not be described in detail here.

[0086] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, apparatus or device. For example, a computer-readable storage medium may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc., or any other medium that can be used to store the required information and can be accessed by an application, a module, or both. Any such computer storage medium may be part of a device or accessible or connectable to a device. Any application or module described in the present invention may be implemented using computer-readable / executable instructions that may be stored or otherwise maintained by such a computer-readable medium.

[0087] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.

[0088] 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 alloy bar identification method based on image analysis, characterized in that: include: Collecting the image of the titanium alloy bar and graying it, thereby obtaining a grayscale image of the titanium alloy bar; Obtaining an edge straight line in the grayscale image; Calculating the target possibility degree of each edge line, wherein the target possibility degree is positively correlated with the calculated length of the edge line and positively correlated with the irregularity of the grayscale value distribution of pixels in the neighborhood of the edge line; The target possibility degree is used to characterize the probability that the edge straight line is the actual edge straight line of the titanium alloy rod; Determine the edge straight line whose target possibility degree is greater than a preset target possibility degree threshold as the actual edge straight line of the titanium alloy rod; Acquire the titanium alloy bar area in the image according to the actual edge straight line; The method for obtaining the irregularity degree includes: A traversal window is set, and the edge straight line is traversed from any end point of the edge straight line, and each point on the edge straight line is used as the window center in turn, so as to obtain all traversal windows; and a sequence value is assigned to each traversal window according to the traversal order; Calculate the window characteristic value of each traversal window, the window characteristic value is used to characterize the degree of difference in the grayscale value of the pixel point in the window; use the sequence value and the window characteristic value of the traversal window as the horizontal coordinate value and the vertical coordinate value respectively, obtain the window characteristic coordinate point, and then obtain the window characteristic curve; Calculating the degree of deviation of the window characteristic coordinate point of the edge straight line relative to the window characteristic curve, thereby obtaining the degree of irregularity; The calculation expression of the window characteristic value of the traversal window is: ; in, Indicates The first edge line The window eigenvalues ​​of edge points, Indicates The edge line The average value of the pixel points on one side of the edge line in the traversal window corresponding to the edge points, Indicates The edge line The average value of the pixel points on the other side of the edge line in the traversal window corresponding to the edge points; Indicates The edge line The average gray value of the pixel points on the edge straight line in the traversal window corresponding to the edge points; The calculation expression of the deviation degree of the window characteristic coordinate point of the edge straight line relative to the window characteristic curve is: ; In the formula, Indicates The degree of deviation of the window characteristic coordinate point of the straight line relative to the window characteristic curve, Indicates The number of edge pixels contained in the edge line. The sequence number of the window feature coordinate point representing the edge line, Indicates The edge line The window characteristic value of the window characteristic coordinate point, and Respectively represent the slope and intercept of the window characteristic curve; represents the linear normalization function.

2. The titanium alloy bar identification method based on image analysis according to claim 1, characterized in that: The obtaining of the edge straight line in the grayscale image comprises: The edge detection algorithm is used to detect the edge in the image, and then the Hough line detection is performed on the edge in the edge detection result image to obtain the edge straight line in the edge detection result image.

3. The titanium alloy bar identification method based on image analysis according to claim 2 is characterized in that: The edge detection algorithm adopts the Canny algorithm, and the edge strength threshold value is 0.

5.

4. The titanium alloy bar identification method based on image analysis according to claim 1, characterized in that: The target possibility degree threshold is set to 0.

8.

5. The titanium alloy bar identification method based on image analysis according to claim 1, characterized in that: The calculation expression of the target possibility degree is: ; in, Indicates The target probability of the edge straight line, Indicates The number of pixels contained in the edge line, Indicates The irregularity of the grayscale value distribution of pixels in the neighborhood of a straight line. represents the maximum value function, Indicates the number of pixels contained in the nth edge line.

6. A titanium alloy bar identification system based on image analysis, comprising a processor and a memory, wherein the memory stores computer program instructions, characterized in that: When the computer program instructions are executed by the processor, the titanium alloy bar identification method based on image analysis described in any one of claims 1 to 5 is implemented.