Titanium ingot production quality inspection method and system based on image processing

Through preprocessing and eigenvalue calculation of titanium ingot surface images, pores and stains are distinguished, which solves the problem of high misjudgment rate in the existing technology and achieves high-accuracy detection of pores on the surface of titanium ingots.

CN118334029BActive Publication Date: 2024-09-10BAOJI TENGYUAN NEW METAL MATERIAL CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The existing technology has a high misjudgment rate in detecting pores and stains on the surface of titanium ingots, making it difficult to distinguish the characteristics of pores and stains, affecting detection accuracy.

Method used

By obtaining the image of the titanium ingot surface for preprocessing, calculating the defect characteristic value and variance value within the bounding box, constructing a rectangular coordinate system for cluster analysis, distinguishing pores and stains, reducing the impact of stains on edge detection, and improving detection accuracy .

Benefits of technology

It can effectively distinguish pores and stains, reduce the misjudgment rate, improve the accuracy of pore detection on the surface of titanium ingots and the adaptability and robustness of the detection system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118334029B
    Figure CN118334029B
Patent Text Reader

Abstract

The present invention relates to the field of image data processing, and more specifically, to a titanium ingot production quality detection method and system based on image processing, the method comprising: obtaining a surface image of a titanium ingot during production, and performing edge detection, screening out defective areas, obtaining bounding boxes of each defective area, calculating defective characteristic values ​​and variance values, and constructing a rectangular coordinate system, classifying the defective areas by a clustering algorithm, obtaining clusters, and completing clustering; respectively calculating the mean of the defective characteristic values ​​in two clusters, and in response to the mean being greater than or equal to a defect threshold, judging that the cluster corresponding to the mean is a pore cluster, and in response to the presence of a pore cluster in the surface image of the titanium ingot, judging that the titanium ingot production quality is unqualified. The present invention improves the accuracy of pore detection on the surface of titanium ingots by improving the detection method of pores and stains.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image data processing, and more specifically, to a titanium ingot production quality detection method and system based on image processing. Background Art

[0002] In the production process of titanium ingots, pores, as a common casting defect, will affect the mechanical properties of titanium ingots. Pores can act as stress concentration points, reduce the strength and durability of the material, and cause the titanium ingot to break. Therefore, in order to ensure the quality and safety of products and improve production efficiency and economic benefits, pores must be detected and controlled.

[0003] However, during the production process of titanium ingots, it is difficult to avoid stains on the surface of titanium ingots, such as dust, oil or other impurities attached to the surface of titanium ingots. Such defects generally do not penetrate into the material and will not affect the mechanical properties of the titanium ingots. Therefore, when inspecting the surface quality of titanium ingots, the main focus is on the detection and judgment of pores, without considering the impact of stains.

[0004] The existing Chinese patent application document with publication number CN116309570A discloses a titanium alloy bar quality inspection method and system. The method uses the adaptive standard deviation of pixel points to complete the corresponding Gaussian filtering to obtain a denoised image, and performs quality inspection based on the denoised image. The above method only denoises the image to be inspected, thereby improving the accuracy of quality inspection. However, it is still necessary to extract features of the defects on the surface of the titanium ingot for the denoised image after Gaussian filtering, and determine whether it is a pore defect based on the feature extraction results. Since pores and stains have similar morphological features, the existing edge detection algorithm is often affected by the stain edge when detecting the pore edge, and cannot distinguish between the two, with a high misjudgment rate. Summary of the invention

[0005] In order to solve the problem that it is difficult to distinguish between pores and stains when performing pore detection on the quality of titanium ingots due to the similar characteristics of pores and stains, the present invention provides solutions in the following aspects.

[0006] In a first aspect, a titanium ingot production quality inspection method based on image processing comprises: obtaining a surface image of a titanium ingot during production, preprocessing the surface image, obtaining a defective area suspected of being a pore; obtaining a bounding box of the defective area, dividing the bounding box into parts, and calculating a defect characteristic value of the bounding box according to the divided upper, middle, and lower parts; , Indicates The defect feature value of the bounding box, represents the square root function, Represents the mean value of the pixel values ​​in the central area, Represents the mean value of the pixel values ​​in the upper area, Represents the mean of the pixel values ​​of the pixels in the lower area, and calculates the variance of the pixels in the bounding box; constructs a rectangular coordinate system with the variance value as the horizontal coordinate and the defect feature value as the vertical coordinate, classifies the defect areas corresponding to the points in the rectangular coordinate system, obtains clusters, and calculates the mean of the defect feature values ​​in the clusters; in response to the mean being greater than or equal to the defect threshold, the cluster corresponding to the mean is a pore cluster, otherwise, the cluster corresponding to the mean is a stain cluster.

[0007] In the titanium ingot production process, images of the titanium ingot surface are collected and preprocessed, such as denoising, grayscale processing, size standardization, etc., to improve the effect of subsequent processing. By obtaining the bounding box to calculate the eigenvalue and variance, the shape, size, density and other features of the defect can be effectively extracted, providing a basis for subsequent quality assessment. According to the edge detection results, in order to obtain the edge information of the titanium ingot surface, the detection method of pores and stains is improved, the influence of stains in the edge detection process is reduced, the accuracy of pore detection on the titanium ingot surface is improved, and the effective distinction between pores and stains is achieved, the possibility of misjudgment is reduced, and the adaptability and robustness of the detection system are enhanced. Due to the characteristic differences of pores and stains, this scheme can adapt to different types of pores and stains, and improve the versatility and applicability of the detection system.

[0008] In one embodiment, the preprocessing of the surface image to obtain the defect area suspected to be a pore comprises the steps of:

[0009] Grayscale the surface image and perform edge detection to obtain edge detection results. Traverse all edge detection results. Each edge constitutes a connected domain. Use the depth-first algorithm to traverse all pixel points in the connected domain to determine whether the connected domain is closed.

[0010] In response to the connected domain being closed, the connected domain is a defective region suspected to be a pore, and in response to the connected domain being not closed, the connected domain is removed.

[0011] The detection accuracy of pore defect areas and the filtering effect of noise points are improved. By traversing all edge detection results and traversing the connected domains formed by each edge using a depth-first algorithm, closed connected domains can be effectively identified. Since closed connected domains usually represent pore areas or stain areas, they can be retained as defective areas suspected of pores. On the contrary, unclosed connected domains usually represent noise points or incomplete edges, so they can be removed, thereby reducing interference with subsequent processing steps and improving overall detection efficiency and accuracy.

[0012] In one embodiment, the step of obtaining the bounding box of each defect area and dividing the bounding box into parts comprises the steps of:

[0013] Taking the circumscribed rectangle of the defect area as a bounding box;

[0014] The bounding box is divided into three parts: upper, middle and lower parts according to proportion.

[0015] By dividing the bounding box into parts and analyzing the distribution of pixel values ​​at different positions reflected by the local features of the upper, middle and lower parts, it is helpful to extract the information of global defects from the local features.

[0016] In one embodiment, classifying the defect areas corresponding to the points in the rectangular coordinate system to obtain clusters includes the steps of:

[0017] Get two points in the rectangular coordinate system as anchor points, and get the initial clusters corresponding to each anchor point;

[0018] Any point except the two anchor points is taken as the target point, and the distance between the target point and the two anchor points is calculated respectively, and the difference between the two distances is calculated. In response to the difference being less than or equal to the distance threshold, the target point is taken as a fuzzy sample point and added to the two initial clusters at the same time; in response to the difference being greater than the distance threshold, the target point is added to the initial cluster where the anchor point corresponding to the minimum distance is located, and finally two preliminary divided clusters are obtained.

[0019] In one embodiment, the process of acquiring the anchor point is as follows:

[0020] Get the point corresponding to the median of all point coordinates in the rectangular coordinate system as the initial cluster center;

[0021] Calculate the distance between the initial cluster center and all other points, sort the distance values, and select the point with the largest distance value as the first anchor point;

[0022] According to the order of the distance values, the angle between the point corresponding to each distance value and the first anchor point with the initial cluster center as the vertex is calculated, and in response to the angle belonging to the preset angle range, the point is selected as the second anchor point.

[0023] The anchor points are selected by distance and angle, which ensures that the selected anchor points are representative and can effectively cluster the defect areas.

[0024] In one embodiment, the step of modifying the two initially divided clusters to obtain a cluster is further included, specifically:

[0025] Obtain all fuzzy sample points, and delete all fuzzy sample points from the two initially divided clusters, and calculate the initial class centers of the two clusters after deletion;

[0026] Take any fuzzy sample point as the target fuzzy point, calculate the inter-class distances between the class centers of the two deleted clusters after adding the target fuzzy point and the initial class centers; add the target fuzzy point to the cluster with the largest inter-class distance; and obtain the current two clusters;

[0027] The significant inter-class distance between the current two clusters is calculated. In response to the significant inter-class distance being less than the inter-class threshold, the two clusters are merged, otherwise they are not merged; and a cluster is obtained.

[0028] In the clustering process, in order to deal with fuzzy sample points, they are added to two clusters respectively, and the inter-class distance of each cluster is calculated to ensure that the inter-class distance of the clusters is as far as possible. Thus, by judging the inter-class distance of the clusters, it is determined that the clustering is completed, and the pore clusters and stain clusters are obtained, which is conducive to effectively classifying the defective areas according to their characteristics, and improving the processing ability of fuzzy samples and the accuracy of clustering.

[0029] In one embodiment, the significant inter-class distance is: obtaining class centers of two of the clusters, and calculating the distance between the class centers of the two clusters.

[0030] Through significant inter-class distance, we can avoid over-merging or over-subdividing clusters and maintain the rationality and stability of clustering.

[0031] In the second aspect, a titanium ingot production quality inspection system based on image processing includes: a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned titanium ingot production quality inspection method based on image processing is implemented.

[0032] The present invention has the following effects:

[0033] 1. The present invention constructs a coordinate system for defect characteristic values ​​and variance values ​​and performs cluster analysis on the data, which is beneficial to obtaining clusters with similar characteristics. The average value of the defect characteristic values ​​within the cluster is used to improve the accuracy of pore detection on the surface of the titanium ingot and achieve effective distinction between pores and stains.

[0034] 2. The present invention performs edge detection on the surface image and obtains the edges of the connected domain as closed edges according to the edge detection results, thereby reducing interference from features that are not defective areas and improving the accuracy of identifying features of defective areas.

[0035] 3. The present invention sets a bounding box for the defect area to limit the scope of the defect area and appropriately reduce the feature information of the background area, which is conducive to obtaining accurate defect feature values ​​according to the change differences of the defect area and further analyzing the information differences of the defect area. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] 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:

[0037] Figure 1 It is a method flow chart of steps S1 to S4 in the titanium ingot production quality detection method based on image processing in an embodiment of the present invention.

[0038] Figure 2 It is a method flow chart of step S10-step S11 in the titanium ingot production quality detection method based on image processing in an embodiment of the present invention.

[0039] Figure 3 It is a method flow chart of steps S20 to S22 in the titanium ingot production quality detection method based on image processing in an embodiment of the present invention.

[0040] Figure 4 It is a schematic diagram of the rectangular coordinate system of variance and defect characteristics in the titanium ingot production quality detection method based on image processing in an embodiment of the present invention.

[0041] Figure 5 It is a method flow chart of step S30-step S31 in the titanium ingot production quality detection method based on image processing in an embodiment of the present invention. DETAILED DESCRIPTION

[0042] 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.

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

[0044] Reference Figure 1 The titanium ingot production quality detection method based on image processing includes steps S1 to S4, which are as follows:

[0045] The corresponding production scenes in this embodiment are as follows: the surface quality inspection scene during the production of titanium ingots mainly detects whether there are pore defects on the surface of the titanium ingots to eliminate the influence of stains. Since pores are sensitive to the direction of light, and stains diffusely reflect light from any direction. Therefore, a fixed light source is used for oblique illumination. The light source is placed below the camera, with the angle between the light beam and the horizontal plane at 45°. The camera is placed above the same side of the light source to shoot the surface of the titanium ingot to eliminate the influence of the background of the production scene.

[0046] S1: Obtain the surface image of the titanium ingot during the production process, pre-process the surface image, and obtain the defect area suspected to be pores.

[0047] Reference Figure 2 , including step S10-step S11:

[0048] S10: grayscale the surface image and perform edge detection to obtain edge detection results, traverse all edge detection results, each edge constitutes a connected domain, and use a depth-first algorithm to traverse all pixel points in the connected domain to determine whether the connected domain is closed;

[0049] S11: In response to the connected domain being closed, the connected domain is a defective region suspected to be a pore; in response to the connected domain being not closed, the connected domain is removed.

[0050] To further explain, in this embodiment, the surface image is grayed out and the canny edge detection algorithm is used to perform edge detection on the grayscale image. Since pores and stains have similar edge features, the edge detection at this time will simultaneously detect the edges of the pores and the edges of the stains on the surface of the titanium ingot, and obtain all defective areas suspected of being pores.

[0051] It should be noted that the edges of both pores and stains are continuous closed curves, while the edge images obtained contain some discontinuous and unclosed edges. These edges do not belong to pore defects, so their influence needs to be eliminated to reduce the false positive rate. All detected edges are judged to be closed. If they are closed, they are retained, otherwise they are discarded.

[0052] S2: Obtain the bounding box of each defect area, divide the bounding box into parts, calculate the defect feature value of the bounding box according to the divided upper, middle and lower parts, and calculate the variance value of the pixel points in the bounding box.

[0053] Further explanation: according to the defect characteristics of pores and stains, there is a significant difference between the inside of the pore and the surrounding environment, and the existence of pores will also increase the difference between the upper and lower environments of the pores. In contrast, the stains only cover the surface of the titanium ingot, which produces diffuse reflection of the light source and does not produce obvious reflective characteristics. The upper and lower environments do not change much. Combined with the environmental characteristics, the bounding box of the defect area is obtained to extract the pixel points of the current defect and its surrounding environment for subsequent feature processing and numerical calculation.

[0054] Reference Figure 3 , including steps S20 to S22:

[0055] S20: Traverse the defect area in order from top to bottom and from left to right to obtain the position information of the defect area, obtain the circumscribed rectangle of the defect area, and obtain the bounding box;

[0056] The circumscribed rectangle in this embodiment is determined by the maximum x value, the minimum x value, the maximum y value and the minimum y value of the defect edge points in the defect area, and the defect area is traversed, wherein the purpose of the traversal is to index the position information of each edge pixel point of the defect area in the surface image, that is, the x-axis and y-axis of the edge pixel point of the defect area, obtain the maximum and minimum values ​​of the x-axis and the maximum and minimum values ​​of the y-axis in the position information, and connect the two position coordinates with vertical lines in the horizontal direction and the vertical direction to obtain a circumscribed rectangle;

[0057] Further explanation: the traversal order can be changed. For example, if the traversal order is set to S-type, the defect areas are numbered in the S-type traversal order. The traversal order is set to obtain the order of the defect areas for subsequent analysis. A specific defect area corresponds to a bounding box.

[0058] In addition, in another embodiment, the enclosing frame may be expanded outward by a preset number of pixels to obtain a rectangular enclosing frame. In this case, the rectangular enclosing frame can obtain environmental information of the defect edge image of the pore.

[0059] Through the above embodiment, a small amount of background information is obtained by expanding the pixels, and based on the difference between the small amount of background information and the defective area, the characteristic information of the defective area is better obtained.

[0060] Further explanation: the rectangular bounding box is expanded outward by 10 pixels. The number of pixels can be preset to 10 and can be adjusted according to the actual situation to obtain the environmental information around the defect. ( , is the number of rectangular bounding boxes).

[0061] As other implementations, the bounding box can also be set to a circle, a polygon, or an artificially set value, for example: a circular bounding box with a radius of 5, or a polygonal bounding box obtained according to the shape of the defect area, or the bounding box size is artificially set to 10×10, etc.

[0062] The bounding box obtained through the above step S20 can accurately select all defective areas and reduce the interference of background information. On the contrary, the manual setting, circle or polygon, is too rigid, so that the defective area may not be selected, the circular selection may completely overlap with the defective area, and the polygon selection has uncertain factors, and the selection range cannot be determined.

[0063] S21: Divide the bounding box into three parts: upper, middle and lower parts according to proportion;

[0064] Further explanation: A bounding box is divided into three parts: upper, middle and lower according to a certain ratio. In this embodiment, the empirical value of the proportion of the upper, middle and lower parts is 1:3:1.

[0065] In another embodiment, the divided parts within the enclosing frame may also be divided in equal proportions, for example, the proportion is artificially set to 1:1:1.

[0066] By setting the bounding box method in step S21 above, combined with the production scenario, the bounding box uses a ratio of 1:3:1, which is conducive to better extraction of defective areas of pores. On the contrary, if a fixed ratio is used, the change information of the difference between the upper and lower environments cannot be well extracted.

[0067] S22: Calculate the defect feature value according to each part of the bounding box.

[0068] Specifically, the defect characteristic value satisfies the following relationship:

[0069] ,

[0070] In the formula, Indicates The defect feature value of the bounding box, represents the square root function, Represents the mean value of the pixel values ​​in the middle. Represents the mean value of the pixel values ​​in the upper part, Represents the mean value of the pixel values ​​in the lower interior.

[0071] Further explanation: Indicates the relationship between the internal defect and the upper edge environment at the reaction site, Indicates the relationship between the defect interior and the lower edge environment. This means that the greater the difference between the upper and lower edge environments of the rectangular bounding box and the defect interior, the more likely the defect is a pore; on the contrary, if The smaller the defect feature value of the largest rectangular bounding box is, the smaller the upper and lower environments of the largest rectangular bounding box are, indicating that the defect is more likely to be a stain.

[0072] S3: A rectangular coordinate system is constructed with the variance value as the horizontal coordinate and the defect characteristic value as the vertical coordinate, the defect areas corresponding to the points in the rectangular coordinate system are classified to obtain clusters, and the mean of the defect characteristic values ​​in the clusters is calculated.

[0073] Reference Figure 5 , including step S30-step S31:

[0074] S30: Obtain two points in a rectangular coordinate system as anchor points respectively, and obtain initial clusters corresponding to the anchor points, wherein the anchor points are always used as classification references in subsequent classification.

[0075] Specifically, the process of obtaining the anchor point is as follows:

[0076] Get the point corresponding to the median of all point coordinates in the rectangular coordinate system as the initial cluster center;

[0077] Calculate the distance between the initial cluster center and all other points, sort the distance values, and select the one with the largest distance value as the first anchor point;

[0078] Specifically, the distance satisfies the following polynomial:

[0079] ,

[0080] In the formula, Indicates The distance from a point to the cluster center, represents the square root function, Indicates Points, Represents the initial cluster center coordinates.

[0081] According to the order of the distance values, the angle between the point corresponding to each distance value and the first anchor point with the initial cluster center as the vertex is calculated, and in response to the angle belonging to the preset angle range, the point is selected as the second anchor point.

[0082] Further explanation: After the defect eigenvalue and variance are normalized, a rectangular coordinate system is constructed and linearly transformed to Within the range, preset angle , refer to Figure 4 , in the figure represents the variance, Represents the defect characteristic value, and then obtains the rectangular coordinate system, Point is the initial cluster center in the rectangular coordinate system, are points in the rectangular coordinate system, and each point is calculated separately. The distance values ​​of the points are sorted and the sorting is: , That is Click to The distance between the points, the largest distance value As the first anchor point, traverse in order of distance values, for example, calculate Point, with Point as Vertex The degree, obviously If the degree does not belong to the preset angle range, continue to traverse and calculate Point, with Point as Vertex If the degree of is within the preset angle range, select The second anchor point.

[0083] By calculating the anchor points, the redundant calculation caused by randomly selecting the initial points is reduced. In addition, the anchor points are used to ensure that the distance between clusters based on this can reach the maximum, reducing the existence of fuzzy points in the aggregation process.

[0084] S31: Take any point except the two anchor points as the target point, calculate the distance between the target point and the two anchor points respectively, and calculate the difference between the two distances. In response to the difference being less than or equal to the distance threshold, take the target point as a fuzzy sample point and add it to the two initial clusters at the same time; in response to the difference being greater than the distance threshold, add the target point to the initial cluster where the anchor point corresponding to the minimum distance is located, and obtain the preliminarily divided cluster clusters.

[0085] Further explanation, in this embodiment, the distance threshold is 0.1, and the distance threshold is used to determine whether the distance from each point to the anchor point is consistent with the cluster where the corresponding anchor point is located.

[0086] To further illustrate, the fuzzy sample points are further divided:

[0087] Obtain all fuzzy sample points, and delete all fuzzy sample points from the two initially divided clusters, and calculate the initial class centers of the two clusters after deletion;

[0088] Take any fuzzy sample point as the target fuzzy point, calculate the inter-class distances between the class centers of the two deleted clusters after adding the target fuzzy point and the initial class centers; add the target fuzzy point to the cluster with the largest inter-class distance; and obtain the current two clusters;

[0089] The significant inter-class distance between the current two clusters is calculated. In response to the significant inter-class distance being less than the inter-class threshold, the two clusters are merged, otherwise they are not merged; and a cluster is obtained.

[0090] By using soft clustering for the fuzzy sample points that are difficult to distinguish, further division is carried out so that the distance between classes reaches the maximum value.

[0091] It should be noted that, considering that there are no pores in the surface image of the titanium ingot itself, the above process will still be divided into two categories, so an inter-class threshold is set to merge the same clusters.

[0092] To further illustrate, in this embodiment, the inter-class threshold is 0.1.

[0093] S4: In response to the mean being greater than or equal to the defect threshold, the cluster corresponding to the mean is a pore cluster, otherwise, the cluster corresponding to the mean is a stain cluster.

[0094] It should be noted that, based on the mean and the preset defect threshold, it is determined whether the cluster is a stain cluster to obtain the clustering result, and the production quality of the titanium ingot is judged based on the clustering result. In response to the presence of pore clusters in the surface image of the titanium ingot, it is determined that the production quality of the titanium ingot is unqualified.

[0095] Further explanation, in this embodiment, the defect threshold is 0.5. The larger the mean value is, the more likely it is a pore. On the contrary, the smaller the mean value is, the more likely it is a stain.

[0096] The system includes 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 ingot production quality detection method based on image processing according to the first aspect of the present invention is implemented.

[0097] The system also includes other components familiar to those skilled in the art, such as a communication bus and a communication interface. The configuration and functions of these components are known in the art and will not be described in detail here.

[0098] In the present invention, the aforementioned memory may be any tangible medium containing or storing a program, which may 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.

[0099] 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.

[0100] 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 ingot production quality detection method based on image processing, characterized in that: include: Acquire the surface image of the titanium ingot during the production process, pre-process the surface image, and obtain the defect area suspected of pores, including: graying the surface image, performing edge detection, obtaining edge detection results, traversing all edge detection results, each edge constitutes a connected domain, and using a depth-first algorithm to traverse all pixel points in the connected domain to determine whether the connected domain is closed; when the connected domain is closed, the connected domain is a defect area suspected of pores, and when the connected domain is not closed, the connected domain is eliminated; Obtain the bounding box of each defect area, divide the bounding box into three parts: upper, middle and lower, and calculate the defect feature value of the bounding box according to the divided upper, middle and lower parts. , Indicates The defect feature value of the bounding box, represents the square root function, Represents the mean value of the pixel values ​​in the central area, Represents the mean value of the pixel values ​​in the upper area, represents the mean value of the pixel values ​​in the lower area, and calculates the variance value of the pixel values ​​in the bounding box; A rectangular coordinate system is constructed with the variance value as the horizontal coordinate and the defect feature value as the vertical coordinate, and the defect areas corresponding to the points in the rectangular coordinate system are classified to obtain cluster clusters, including: obtaining two points in the rectangular coordinate system as anchor points respectively, and the acquisition process is: obtaining the point corresponding to the median of the coordinates of all points in the rectangular coordinate system as the initial cluster center; calculating the distance value between the initial cluster center and all other points, sorting the distance values, and selecting the point with the largest distance value as the first anchor point; according to the order of the distance values, calculating the distance between the point corresponding to each distance value and the first anchor point with the initial cluster center as the vertex The angle of the angle, in response to the angle belonging to the preset angle range, the point is selected as the second anchor point; the initial clusters corresponding to each anchor point are obtained; any point other than the two anchor points is taken as the target point, the distance between the target point and the two anchor points is calculated respectively, and the difference between the two distances is calculated, and in response to the difference being less than or equal to the distance threshold, the target point is taken as a fuzzy sample point and added to the two initial clusters at the same time; in response to the difference being greater than the distance threshold, the target point is added to the initial cluster where the anchor point corresponding to the minimum distance is located, and finally two clusters are obtained that are preliminarily divided; the mean of the defect feature values ​​in the clusters is calculated; In response to the mean being greater than or equal to the defect threshold, the cluster corresponding to the mean is a pore cluster; otherwise, the cluster corresponding to the mean is a stain cluster.

2. The titanium ingot production quality detection method based on image processing according to claim 1 is characterized in that: The step of obtaining the bounding box of each defect area and dividing the bounding box into three parts: upper, middle and lower parts comprises the following steps: Taking the circumscribed rectangle of the defect area as a bounding box; The bounding box is divided into three parts: upper, middle and lower parts according to proportion.

3. The titanium ingot production quality detection method based on image processing according to claim 1 is characterized in that: The step of correcting the two initially divided clusters to obtain a cluster is also included, specifically: Obtain all fuzzy sample points, and delete all fuzzy sample points from the two initially divided clusters, and calculate the initial class centers of the two clusters after deletion; Take any fuzzy sample point as the target fuzzy point, calculate the inter-class distances between the class centers of the two clusters after adding the target fuzzy point and the initial class centers respectively; add the target fuzzy point to the cluster with the largest inter-class distance; Get the current two clusters; The significant inter-class distance between the current two clusters is calculated. In response to the significant inter-class distance being less than the inter-class threshold, the two clusters are merged, otherwise they are not merged; and a cluster is obtained.

4. The titanium ingot production quality detection method based on image processing according to claim 3 is characterized in that: The significant inter-class distance is: obtaining the class centers of the two clusters, and calculating the distance between the class centers of the two clusters.

5. Titanium ingot production quality inspection system based on image processing, characterized in that: include: 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 ingot production quality detection method based on image processing according to any one of claims 1 to 4 is implemented.