Titanium alloy quality detection method and system based on image processing

By combining Canny edge detection and K-Means clustering, a hierarchical processing method is used for internal flaw detection images of titanium alloys. This solves the problems of resource waste and low efficiency in existing detection methods, and enables accurate analysis and efficient detection of internal defects in titanium alloys.

CN121236070BActive Publication Date: 2026-02-24SHAANXI LIBANG SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511792523.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-01
Publication Date
2026-02-24
Estimated Expiration
2045-12-01

AI Technical Summary

Technical Problem

Existing methods for inspecting the production quality of titanium alloys suffer from insufficient clarity, wasted computational resources, and low computational efficiency when dealing with defects with complex internal structures. In particular, it is difficult to accurately analyze defect areas with blurred edges and complex structures.

Method used

The Canny edge detection algorithm and the K-Means clustering algorithm are combined. Through grayscale uniformity and edge sharpness analysis, the internal flaw detection images of titanium alloys are processed in a hierarchical manner. Differential interpolation strategy is used for image reconstruction, and computing resources are allocated according to the importance and complexity of the regions.

Benefits of technology

It enables precise classification and intelligent identification of internal defects in titanium alloys, improves the reconstruction accuracy of key areas, optimizes overall computational efficiency, and enhances the accuracy of titanium alloy production anomaly analysis and the efficiency of the production process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121236070B_ABST
    Figure CN121236070B_ABST
Patent Text Reader

Abstract

The application relates to the field of image processing, in particular to a titanium alloy quality detection method and system based on image processing. The method comprises the following steps: acquiring a titanium alloy internal edge image, performing closed connected domain detection on the titanium alloy internal edge image, calculating the internal gray uniformity of each closed region, determining problem closed regions from the closed regions, calculating the relative clarity degree of each problem closed region, using a K-Means algorithm to cluster the problem closed regions to obtain clustering clusters, determining the image reconstruction precision grade of each clustering cluster, determining the interpolation quantity of each clustering cluster, determining the interpolation quantity of each problem closed region, determining the interpolation position and interpolation pixel point corresponding to each pixel point, and using the interpolation pixel point to perform interpolation on each problem closed region to obtain a titanium alloy internal flaw detection reconstruction image. The application can improve the precision of titanium alloy internal production anomaly type analysis.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of image processing, in particular to a titanium alloy quality detection method and system based on image processing. BACKGROUND

[0002] Titanium alloy is widely used in aerospace, medical equipment and automobile manufacturing fields because of its light weight and corrosion resistance, and is an indispensable material in modern industry. However, due to production process and raw material purity problems, quality abnormalities may occur in the production process of titanium alloy, especially internal production abnormalities of titanium alloy often lead to titanium alloy products unable to be used normally, so it is necessary to detect the production quality of titanium alloy.

[0003] The existing titanium alloy production quality detection method generally uses a flaw detector to obtain X-ray or ultrasonic images to obtain internal image information of the titanium alloy, and then uses image matching or neural network to determine different quality problems in the titanium alloy, and then adjusts the production process or optimizes the titanium alloy raw material selection. However, due to equipment limitations and complex internal structure of titanium alloy, the clarity of the obtained flaw detection image is not enough, and the accuracy is not enough when used for analyzing the types of internal production abnormalities of titanium alloy. When using the existing interpolation method to interpolate the image, a global uniform interpolation strategy is usually used. This 'one-size-fits-all' method has obvious drawbacks: for defect regions with clear edges and simple structures, excessive interpolation not only wastes computing resources but also may introduce artifacts, leading to overfitting; and for key defect regions with fuzzy edges and complex structures, insufficient interpolation cannot effectively restore their true contours, leading to underfitting, which seriously affects the accuracy of subsequent defect quantitative analysis. Thus, the allocation of computing resources is inaccurate, the computing efficiency is low, the economic value is low, and the double-layer cost of production and detection is increased. SUMMARY

[0004] The present application provides a titanium alloy quality detection method and system based on image processing to solve the existing problems.

[0005] The titanium alloy quality detection method based on image processing provided by the present application adopts the following technical scheme:

[0006] One embodiment of the present application provides a titanium alloy quality detection method based on image processing, which comprises the following steps:

[0007] The canny edge detection algorithm is used to detect the internal flaw detection image of the titanium alloy to obtain the internal edge image of the titanium alloy, and the closed connected domain detection is performed on the internal edge image of the titanium alloy to obtain the closed region of the internal edge image of the titanium alloy.

[0008] According to the pixel gray value of the closed region and the non-closed region, the internal gray uniformity of each closed region is calculated, wherein the non-closed region is a region outside the closed region in the titanium alloy internal edge map;

[0009] According to the internal gray uniformity of the closed region, a problem closed region is determined from the closed region, and according to the pixel value of the edge pixel point and the non-edge pixel point in each problem closed region, the relative clarity degree of each problem closed region is calculated;

[0010] The relative clarity degree is determined as the clustering parameter of the K-Means algorithm, the preset cluster number is determined as the cluster center number of the K-Means algorithm, the K-Means algorithm is used to cluster the problem closed region, and a clustering cluster is obtained;

[0011] According to the mean value of the relative clarity degree of the problem closed region in each clustering cluster, the image reconstruction accuracy level of each clustering cluster is determined;

[0012] Based on the preset interpolation density configuration strategy which is positively correlated with the image reconstruction accuracy level, the interpolation number of each clustering cluster is determined;

[0013] Based on the interpolation number of each clustering cluster, the interpolation number of each problem closed region in each clustering cluster is determined, and based on the gray value of each pixel point in each problem closed region, the interpolation position and the interpolation pixel point corresponding to each pixel point are determined;

[0014] The interpolation pixel point is used to interpolate each problem closed region, and a titanium alloy internal flaw reconstruction image is obtained.

[0015] Optionally, according to the pixel gray value of the closed region and the non-closed region, the internal gray uniformity of each closed region is calculated, and specifically includes:

[0016] The pixel gray value mean and the pixel gray value variance of the non-closed region are obtained;

[0017] The pixel gray value mean and the pixel gray value variance of the a-th closed region are obtained;

[0018] The absolute value of the difference between the pixel gray value mean of the non-closed region and the pixel gray value mean of the a-th closed region is taken to obtain the gray value mean difference value of the a-th closed region;

[0019] The ratio of the pixel gray value variance of the non-closed region to the pixel gray value variance of the a-th closed region is determined as the gray value variance ratio of the a-th closed region;

[0020] The product of the gray value mean difference value of the a-th closed region and the gray value variance ratio of the a-th closed region is determined as the internal gray uniformity of the a-th closed region.

[0021] obtaining the internal gray uniformity of each closed region.

[0022] Optionally, the problem closed regions are determined from the closed regions according to the internal gray uniformity of the closed regions, and specifically comprising:

[0023] The closed region with the internal gray uniformity greater than a preset uniformity threshold is determined as a problem closed region.

[0024] Optionally, the relative clarity degree of each problem closed region is calculated according to the pixel values of the edge pixel points and the non-edge pixel points in each problem closed region, and specifically comprising:

[0025] obtaining the edge pixel points in the bth problem closed region, wherein the edge pixel points in the bth problem closed region are the edge pixel points in the bth problem closed region in the internal edge map of the titanium alloy;

[0026] determining the average gray value of the non-edge pixel points in the 8-neighborhood of the cth edge pixel point in the bth problem closed region as the first gray average of the cth edge pixel point in the bth problem closed region, wherein the non-edge pixel points are the pixel points other than the edge pixel points in the bth problem closed region;

[0027] taking the absolute value of the difference between the gray value of the cth edge pixel point in the bth problem closed region and the first gray average of the cth edge pixel point in the bth problem closed region to obtain the edge clarity of the cth edge pixel point in the bth problem closed region;

[0028] obtaining the average of the edge clarities of the edge pixel points in the bth problem closed region;

[0029] obtaining the non-edge pixel points in the bth problem closed region;

[0030] determining the average gray value of the non-edge pixel points in the 8-neighborhood of the dth non-edge pixel point in the bth problem closed region as the second gray average of the dth non-edge pixel point in the bth problem closed region;

[0031] taking the absolute value of the difference between the gray value of the dth non-edge pixel point in the bth problem closed region and the second gray average of the dth non-edge pixel point in the bth problem closed region to obtain the non-edge continuity of the dth non-edge pixel point in the bth problem closed region;

[0032] obtaining the average of the non-edge continuities of the non-edge pixel points in the bth problem closed region;

[0033] The ratio of the mean edge sharpness of edge pixels in the closed region of the b-th problem to the mean non-edge continuity of non-edge pixels in the closed region of the b-th problem is determined as the relative sharpness of the closed region of the b-th problem.

[0034] Obtain the relative clarity of the closed region for each problem.

[0035] Optionally, the preset number of clusters is 3;

[0036] The process of determining the image reconstruction accuracy level for each cluster based on the mean relative sharpness of the closed problem region within each cluster specifically includes:

[0037] The cluster with the highest mean relative clarity is determined as the lowest image reconstruction accuracy level;

[0038] The cluster with the smallest mean relative sharpness is determined as the highest image reconstruction accuracy level;

[0039] The remaining clusters are determined as the intermediate image reconstruction accuracy levels.

[0040] Optionally, based on a preset interpolation density configuration strategy that is positively correlated with the image reconstruction accuracy level, the number of interpolations for each cluster is determined, specifically including:

[0041] Configure a first number of interpolation values ​​for the cluster corresponding to the lowest image reconstruction accuracy level;

[0042] Configure a third number of interpolation values ​​for the cluster corresponding to the highest image reconstruction accuracy level;

[0043] Configure a second number of interpolation values ​​for the clusters corresponding to the intermediate image reconstruction accuracy level;

[0044] Among them, the first quantity is less than the second quantity, and the second quantity is less than the third quantity.

[0045] Optionally, when the closed region of the problem is an element in the cluster corresponding to the lowest image reconstruction accuracy level, the interpolation position and interpolation pixel are determined based on the gray value of each pixel in each closed region of the problem, specifically including:

[0046] Based on the centroid pixel of the closed region of the problem, determine the direction with the largest gray-level gradient in the horizontal and vertical directions, and set the interpolation position on the single direction with the largest gray-level gradient.

[0047] Obtain the grayscale value of the e-th pixel within the closed region of the problem;

[0048] Obtain the grayscale values ​​of the adjacent pixels of the e-th pixel in the interpolation position direction;

[0049] The gray value of the e-th pixel is obtained by averaging the gray values ​​of the e-th pixel and the gray values ​​of the adjacent pixels of the e-th pixel in the interpolation position direction.

[0050] Obtain the grayscale value of the interpolated pixel for each pixel within the closed region of the problem.

[0051] Optionally, when the closed region of the problem is an element in the cluster corresponding to the intermediate image reconstruction accuracy level, the interpolation position and interpolation pixel are determined based on the gray value of each pixel in each closed region of the problem, specifically including:

[0052] Based on the centroid pixel of the closed region of the problem, determine the direction with the largest gray-level gradient in the horizontal leftward and vertical upward directions, and set the interpolation position in the direction with the largest gray-level gradient and the opposite direction of the direction with the largest gray-level gradient.

[0053] Obtain the grayscale value of the f-th pixel within the closed region of the problem;

[0054] The gray values ​​of the adjacent pixels of the f-th pixel in the opposite direction of the direction with the maximum gray-level gradient are determined as the reverse direction pixel values.

[0055] The gray values ​​of the adjacent pixels of the f-th pixel in the direction of maximum gray-level gradient are determined as the main direction pixel values.

[0056] The adjustment pixel value is obtained by averaging the gray values ​​of the two adjacent pixels in the vertical direction of the f-th pixel.

[0057] The average of the grayscale value of the f-th pixel and the pixel value in the opposite direction is determined as the first main pixel value;

[0058] The average of the grayscale value of the f-th pixel and the pixel value in the main direction is determined as the second main pixel value;

[0059] The preset weights are negative numbers plus one to obtain the smoothed weights;

[0060] The product of the adjusted pixel value and the smoothing weight is determined as the smoothed pixel value;

[0061] Add the product of the first main pixel value and the preset weight to the smoothed pixel value to obtain the gray value of the interpolated pixel in the opposite direction of the direction of maximum gray gradient.

[0062] The product of the second main pixel value and the preset weight is added to the smooth pixel value to obtain the gray value of the interpolated pixel in the direction of maximum gray-level gradient.

[0063] Optionally, when the closed region of the problem is an element in the cluster corresponding to the highest image reconstruction accuracy level, the interpolation position and interpolation pixel are determined based on the gray value of each pixel in each closed region of the problem, specifically including:

[0064] Set the interpolation position in the four-neighbor direction of each pixel in the closed region of the problem;

[0065] Obtain the grayscale value of the g-th pixel within the closed region of the problem;

[0066] Obtain the grayscale values ​​of the g-th pixel's adjacent pixels in the horizontal left, horizontal right, vertical up, and vertical down directions, respectively;

[0067] When the interpolated pixel is located in the horizontal left direction of the g-th pixel, the gray value of the g-th pixel is added to the gray value of the g-th pixel's adjacent pixel in the horizontal left direction to obtain the gray sum of the g-th pixel in the horizontal left direction.

[0068] The ratio of the gray value of the g-th pixel to the sum of the gray values ​​of the g-th pixel in the horizontal left direction is determined as the weighting coefficient of the g-th pixel in the horizontal left direction.

[0069] The smoothing coefficient is obtained by taking the negative value of the weighting coefficient of the g-th pixel in the horizontal left direction and adding 1.

[0070] The product of the gray value of the g-th pixel and the weighting coefficient of the g-th pixel in the horizontal left direction is determined as the basic gray value of the g-th pixel in the horizontal left direction.

[0071] The product of the grayscale value of the g-th pixel's adjacent pixels in the horizontal left direction and the smoothing coefficient is determined as the adjusted grayscale value of the g-th pixel in the horizontal left direction.

[0072] The gray value of the g-th pixel in the horizontal left direction is summed with the adjusted gray value of the g-th pixel in the horizontal left direction to obtain the gray value of the interpolated pixel in the horizontal left direction.

[0073] Obtain the grayscale values ​​of the interpolated pixels at the g-th pixel in the horizontal rightward, vertical upward, and vertical downward directions, respectively.

[0074] This invention proposes a titanium alloy quality inspection system based on image processing, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of the titanium alloy quality inspection method based on image processing.

[0075] The beneficial effects of the technical solution of the present invention are:

[0076] In this embodiment of the invention, a multi-level screening and grading mechanism based on 'grayscale uniformity-edge sharpness-K-Means clustering' is used to achieve intelligent identification and accurate classification of defect areas. Furthermore, through a mapping relationship of 'mean sharpness-reconstruction accuracy level-differentiated interpolation strategy', the most reasonable computational resources are allocated to areas of different importance and complexity. This allows limited computing power to be concentrated on complex defects with blurred edges that require the most precise reconstruction, thereby significantly improving the reconstruction accuracy of key areas while also significantly optimizing overall computational efficiency, successfully breaking the traditional dilemma of the incompatibility between 'accuracy' and 'efficiency'. Image enhancement is used to perform sub-pixel enhancement on the collected internal flaw detection data of titanium alloys, followed by titanium alloy quality inspection, to improve the accuracy of analyzing the types of internal production anomalies in titanium alloys and to enhance the efficiency of the production process. Attached Figure Description

[0077] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0078] Figure 1 A flowchart illustrating an image processing-based titanium alloy quality inspection method provided in one embodiment of the present invention;

[0079] Figure 2 This is a structural diagram of an image processing-based titanium alloy quality inspection system provided in one embodiment of the present invention. Detailed Implementation

[0080] To further illustrate the technical means and effects adopted by the present invention to achieve its intended purpose, the following, in conjunction with the accompanying drawings and preferred embodiments, details the specific implementation, structure, features, and effects of an image processing-based titanium alloy quality inspection method proposed according to the present invention. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. Furthermore, specific features, structures, or characteristics in one or more embodiments can be combined in any suitable form.

[0081] Unless otherwise defined, 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 pertains.

[0082] The following description, in conjunction with the accompanying drawings, details a specific scheme for an image processing-based titanium alloy quality inspection method provided by the present invention.

[0083] This invention provides a method and system for quality inspection of titanium alloys based on image processing. Please refer to [link / reference]. Figure 1 The diagram illustrates a flowchart of an image processing-based titanium alloy quality inspection method according to an embodiment of the present invention, which includes the following steps:

[0084] S101. Use the Canny edge detection algorithm to detect the internal flaw image of the titanium alloy to obtain the internal edge map of the titanium alloy. Perform closed connected component detection on the internal edge map of the titanium alloy to obtain the closed region of the internal edge map of the titanium alloy.

[0085] For example, in this embodiment, the first step is to acquire internal flaw detection images of the titanium alloy. In a specific embodiment, the process can be as follows:

[0086] Probe: Align the probe with the area to be inspected and keep the probe perpendicular to the workpiece surface.

[0087] Parameter settings: 60-120kV, X-ray tube, exposure time 0.1-0.5s.

[0088] A / D conversion: converting optical signals into digital matrices.

[0089] Visualization processing: The digital matrix is ​​converted into a 256-color grayscale image to obtain an internal flaw detection image of the titanium alloy.

[0090] In internal flaw inspection images of titanium alloys, when the alloy is internally flawless and of uniform texture, the grayscale values ​​in the image are essentially the same. However, if internal quality issues exist, the grayscale image will exhibit different grayscale distributions depending on the type of quality issue and the degree of damage. Areas without internal flaws do not require attention.

[0091] Therefore, the Canny edge detection algorithm is first used to perform edge detection on the internal flaw inspection image of the titanium alloy to obtain the internal edge map of the titanium alloy, which contains multiple edge pixels. Next, closed connected component detection is performed on the internal edge map of the titanium alloy to obtain the closed regions within the internal edge map of the titanium alloy.

[0092] S102. Calculate the internal grayscale uniformity of each closed region based on the pixel grayscale values ​​of the closed and unclosed regions. The unclosed region is the region outside the closed region in the internal edge map of the titanium alloy.

[0093] In this embodiment, the internal grayscale uniformity of each closed region is calculated based on the pixel grayscale values ​​of closed and unclosed regions, specifically including:

[0094] Obtain the mean and variance of pixel grayscale values ​​in non-closed regions;

[0095] Obtain the mean and variance of the gray values ​​of the pixels in the a-th closed region;

[0096] The absolute value of the difference between the average gray value of pixels in the non-closed region and the average gray value of pixels in the a-th closed region is obtained as the difference in the average gray value of the a-th closed region.

[0097] The ratio of the gray value variance of pixels in the non-closed region to the gray value variance of pixels in the a-th closed region is determined as the gray value variance ratio of the a-th closed region.

[0098] The product of the mean difference of gray values ​​in the a-th closed region and the ratio of the variance of gray values ​​in the a-th closed region is determined as the internal gray uniformity of the a-th closed region.

[0099] Obtain the internal grayscale uniformity of each closed region.

[0100] For example, each closed region is labeled as an independent region, and the gray-level uniformity performance within the region is analyzed. Taking the i-th closed region as an example, the formula for calculating its internal gray-level uniformity can be: ;

[0101] in, Indicates the first The internal grayscale uniformity of a closed region and These represent the mean gray value of pixels in the non-closed region and the mean gray value of pixels in the i-th closed region, respectively, in the internal flaw detection image of titanium alloy. and These represent the variances of pixel grayscale values ​​in non-closed regions of an internal flaw detection image of titanium alloy, respectively, and the variances of the values ​​in the second region. The variance of the grayscale values ​​of pixels in a closed region.

[0102] In the formula, the non-closed region represents the normal region inside the titanium alloy, where the grayscale values ​​are uniformly distributed and approximately the same size. The closed region represents the region with quality problems, which manifest as uneven grayscale distribution, significant variations in the grayscale values ​​of internal pixels (such as uneven material mixing within the titanium alloy), or a relatively uniform grayscale distribution but with a large difference in grayscale values ​​compared to the normal region (such as inclusions within the titanium alloy). Therefore, using... and The ratio is used to quantify the uniformity of internal grayscale distribution; the larger the value, the better the uniformity of the grayscale distribution. The more uniform the grayscale distribution of the closed region compared to the normal region, the better. The difference in grayscale value between a closed region and the mean grayscale value of a normal region is used to quantify the difference in grayscale value; the smaller the value, the greater the difference in grayscale value. The smaller the difference between the grayscale value inside the closed region and the grayscale value of the normal region, the better; therefore, the... The smaller the internal gray-level uniformity of a closed region, the better. The greater the likelihood that a closed region is a non-quality problem area, the more likely it is to be, and vice versa.

[0103] S103. Based on the internal grayscale uniformity of the closed region, determine the problem closed region from the closed region, and calculate the relative clarity of each problem closed region based on the pixel values ​​of the edge pixels and non-edge pixels in each problem closed region.

[0104] In this embodiment, the problem closed region is determined from the closed region based on the internal grayscale uniformity of the closed region, specifically including:

[0105] Closed regions with internal grayscale uniformity greater than a preset uniformity threshold are identified as problem closed regions.

[0106] Based on the pixel values ​​of edge and non-edge pixels within each closed region of a problem, the relative sharpness of each closed region is calculated, specifically including:

[0107] Obtain the edge pixels in the closed region of the b-th problem, where the edge pixels in the closed region of the b-th problem are the edge pixels in the closed region of the b-th problem in the inner edge map of the titanium alloy;

[0108] The average gray value of the non-edge pixels in the 8-neighborhood of the c-th edge pixel in the b-th closed region of the problem is determined as the first average gray value of the c-th edge pixel in the b-th closed region of the problem, where the non-edge pixels are the pixels in the b-th closed region of the problem other than the edge pixels.

[0109] The edge sharpness of the c-th edge pixel in the closed region of the b-th problem is obtained by taking the absolute value of the difference between the gray value of the c-th edge pixel and the first gray mean value of the c-th edge pixel in the closed region of the b-th problem.

[0110] Obtain the mean edge sharpness of edge pixels in the closed region of the b-th problem;

[0111] Obtain the non-edge pixels in the closed region of the b-th problem;

[0112] The average gray value of the non-edge pixels in the 8-neighborhood of the d-th non-edge pixel in the closed region of the b-th problem is determined as the second average gray value of the d-th non-edge pixel in the closed region of the b-th problem.

[0113] The absolute value of the difference between the gray value of the d-th non-edge pixel in the closed region of the b-th problem and the second gray mean value of the d-th non-edge pixel in the closed region of the b-th problem is taken to obtain the non-edge continuity of the d-th non-edge pixel in the closed region of the b-th problem.

[0114] Obtain the mean value of the non-edge continuity of non-edge pixels in the closed region of the b-th problem;

[0115] The ratio of the mean edge sharpness of edge pixels in the closed region of the b-th problem to the mean non-edge continuity of non-edge pixels in the closed region of the b-th problem is determined as the relative sharpness of the closed region of the b-th problem.

[0116] Obtain the relative clarity of the closed region for each problem.

[0117] For example, the internal grayscale uniformity of each closed region is normalized, and a preset uniformity threshold is used to reduce the grayscale values ​​exceeding the threshold. A closed region is identified as the region with quality problems and is denoted as the problem closed region.

[0118] Optionally, the preset uniformity threshold can be obtained manually. Since areas with quality issues during internal flaw detection of titanium alloys differ significantly in morphology from normal areas, manual annotation is simple and provides reliable accuracy. In a preferred embodiment, the preset uniformity threshold can be set to 0.25. Alternatively, the preset uniformity threshold can be set based on historical experience or actual needs; no specific numerical limit is imposed here.

[0119] Thus, the closed regions of each problem can be obtained. Different regions may have different quality problems, which will manifest in the image as differences in grayscale values ​​and sharpness in different directions. Therefore, when interpolating the image of each region, it is necessary to determine the interpolation size and interpolation method according to the different region characteristics to ensure that computational resources and efficiency are optimized to the maximum extent and the image reconstruction accuracy is improved.

[0120] First, based on the different closed problem regions obtained, the relative clarity of each closed problem region is calculated.

[0121] by Within the closed region of the problem, the first Take the closed region of the problem as an example. The formula for calculating the relative clarity of a closed region of a problem can be: ;

[0122] in, Indicates the first The relative clarity of the closed region of the problem Indicates the first Within the closed region of the problem, In the nth edge pixel, the th The grayscale value of each edge pixel; Indicates the first The average grayscale value of non-edge pixels within an 8-neighborhood of an edge pixel; Indicates the first Within the closed region of the problem, In the nth non-edge pixels, the th The grayscale value of each non-edge pixel; Indicates the first Within the closed region of the problem, In the nth non-edge pixels, the th The average grayscale value of all non-edge pixels in the 8-neighborhood of a non-edge pixel. For the first The number of edge pixels in the closed region of the problem. For the first The number of non-edge pixels in the closed region of the problem.

[0123] In the formula, in the internal flaw detection image of titanium alloy, quality problems within the metal result in different structures, with insufficient crystal uniformity compared to normal structures. This inevitably manifests as more edges in the image. Therefore, based on this characteristic of the internal flaw detection image of titanium alloy, and using gradient as the benchmark, the greater the difference in grayscale value between edge pixels and their neighboring non-edge pixels, the clearer the image edges; conversely, the smaller the difference in grayscale value between a non-edge pixel and its corresponding neighboring non-edge pixels, the more continuous the non-edge areas of the image. Therefore, by quantizing the first... The difference between the gray value of each edge pixel within the closed region of the problem and the average gray value of its non-edge pixels in its neighborhood. This is used to quantify the edge sharpness; the larger the value, the sharper the edge at the 1st rank. The clearer the edges within the closed region of the problem, the better; then, by quantifying the first... The difference between all non-edge images in a region and their neighboring non-edge images is used to quantify the continuity of non-edge areas. The smaller the value, the more continuous the image at the non-edge area. Finally, the sharpness of the closed region of the first problem is obtained by combining these two features. The greater the clarity, the better. The clearer the problem area, the better; conversely, the less clear the problem area, the worse.

[0124] Furthermore, this embodiment focuses on the first Within each closed region of a problem, the corresponding closed edge pixels and all non-closed edge pixels within the region are selected. When a closed region contains another closed region, the larger closed region is selected, and the smaller closed region is discarded.

[0125] Therefore, we can obtain The relative clarity of each closed problem area.

[0126] S104. Determine the relative clarity as the clustering parameter of the K-Means algorithm, determine the preset number of clusters as the number of cluster centers of the K-Means algorithm, and use the K-Means algorithm to cluster the closed regions of the problem to obtain clusters.

[0127] In this embodiment, the preset number of clusters is 3.

[0128] For example, due to the distribution factors of image pixels, the interpolation process generally only considers sub-pixel interpolation in the four-neighbor direction. Therefore, based on this, setting the preset number of clusters of the K-Means algorithm to 3 will yield three clusters.

[0129] S105. Determine the image reconstruction accuracy level for each cluster based on the mean relative clarity of the problem closed region within each cluster.

[0130] In this embodiment, the image reconstruction accuracy level of each cluster is determined based on the average relative sharpness of the closed problem region within each cluster. Specifically, this includes:

[0131] The cluster with the highest mean relative clarity is determined as the lowest image reconstruction accuracy level;

[0132] The cluster with the smallest mean relative sharpness is determined as the highest image reconstruction accuracy level;

[0133] The remaining clusters are determined as the intermediate image reconstruction accuracy levels.

[0134] For example, in the cluster with the largest mean relative sharpness, the greater the sharpness, the fewer interpolation pixels are needed during the interpolation process. Therefore, based on the number of clusters and this logic, all closed problem regions within the cluster with the largest mean are designated as subdivision level one, i.e., the lowest image reconstruction accuracy level; all closed problem regions within the cluster with the smallest mean are designated as subdivision level three, i.e., the highest image reconstruction accuracy level; and all closed problem regions within the remaining clusters are designated as subdivision level two, i.e., the intermediate image reconstruction accuracy level.

[0135] S106. Based on a preset interpolation density configuration strategy that is positively correlated with the image reconstruction accuracy level, determine the number of interpolations for each cluster.

[0136] In this embodiment, based on a preset interpolation density configuration strategy that is positively correlated with the image reconstruction accuracy level, the number of interpolations for each cluster is determined, specifically including:

[0137] Configure a first number of interpolation values ​​for the cluster corresponding to the lowest image reconstruction accuracy level;

[0138] Configure a third number of interpolation values ​​for the cluster corresponding to the highest image reconstruction accuracy level;

[0139] Configure a second number of interpolation values ​​for the clusters corresponding to the intermediate image reconstruction accuracy level;

[0140] Among them, the first quantity is less than the second quantity, and the second quantity is less than the third quantity.

[0141] For example, in this embodiment, for regions with a subdivision level of one, only one pixel precision interpolation is used in subsequent processing, that is, only one interpolation is added around each pixel, which is the first quantity; for regions with a subdivision level of two, two pixel precision interpolation is used in subsequent processing, that is, only two interpolation is added around each pixel, which is the second quantity; for regions with a subdivision level of three, four pixel precision interpolation is used in subsequent processing, that is, four interpolation is added around each pixel, which is the third quantity.

[0142] S107. Based on the number of interpolations for each cluster, determine the number of interpolations for each problem closed region in each cluster, and based on the gray value of each pixel in each problem closed region, determine the interpolation position and interpolation pixel corresponding to each pixel.

[0143] In this embodiment, when the closed problem region is an element in the cluster corresponding to the lowest image reconstruction accuracy level, the interpolation position and interpolation pixel are determined based on the gray value of each pixel in each closed problem region, specifically including:

[0144] Based on the centroid pixel of the closed region of the problem, determine the direction with the largest gray-level gradient in the horizontal and vertical directions, and set the interpolation position on the single direction with the largest gray-level gradient.

[0145] Obtain the grayscale value of the e-th pixel within the closed region of the problem;

[0146] Obtain the grayscale values ​​of the adjacent pixels of the e-th pixel in the interpolation position direction;

[0147] The gray value of the e-th pixel is obtained by averaging the gray values ​​of the e-th pixel and the gray values ​​of the adjacent pixels of the e-th pixel in the interpolation position direction.

[0148] Obtain the grayscale value of the interpolated pixel for each pixel within the closed region of the problem.

[0149] When the closed region of the problem is an element in the cluster corresponding to the intermediate image reconstruction accuracy level, the interpolation position and interpolation pixel are determined based on the gray value of each pixel in each closed region of the problem. Specifically, this includes:

[0150] Based on the centroid pixel of the closed region of the problem, determine the direction with the largest gray-level gradient in the horizontal leftward and vertical upward directions, and set the interpolation position in the direction with the largest gray-level gradient and the opposite direction of the direction with the largest gray-level gradient.

[0151] Obtain the grayscale value of the f-th pixel within the closed region of the problem;

[0152] The gray values ​​of the adjacent pixels of the f-th pixel in the opposite direction of the direction with the maximum gray-level gradient are determined as the reverse direction pixel values.

[0153] The gray values ​​of the adjacent pixels of the f-th pixel in the direction of maximum gray-level gradient are determined as the main direction pixel values.

[0154] The adjustment pixel value is obtained by averaging the gray values ​​of the two adjacent pixels in the vertical direction of the f-th pixel.

[0155] The average of the grayscale value of the f-th pixel and the pixel value in the opposite direction is determined as the first main pixel value;

[0156] The average of the grayscale value of the f-th pixel and the pixel value in the main direction is determined as the second main pixel value;

[0157] The preset weights are negative numbers plus one to obtain the smoothed weights;

[0158] The product of the adjusted pixel value and the smoothing weight is determined as the smoothed pixel value;

[0159] Add the product of the first main pixel value and the preset weight to the smoothed pixel value to obtain the gray value of the interpolated pixel in the opposite direction of the direction of maximum gray gradient.

[0160] The product of the second main pixel value and the preset weight is added to the smooth pixel value to obtain the gray value of the interpolated pixel in the direction of maximum gray-level gradient.

[0161] When the closed region of the problem is an element in the cluster corresponding to the highest image reconstruction accuracy level, the interpolation position and interpolation pixel are determined based on the gray value of each pixel in each closed region of the problem. Specifically, this includes:

[0162] Set the interpolation position in the four-neighbor direction of each pixel in the closed region of the problem;

[0163] Obtain the grayscale value of the g-th pixel within the closed region of the problem;

[0164] Obtain the grayscale values ​​of the g-th pixel's adjacent pixels in the horizontal left, horizontal right, vertical up, and vertical down directions, respectively;

[0165] When the interpolated pixel is located in the horizontal left direction of the g-th pixel, the gray value of the g-th pixel is added to the gray value of the g-th pixel's adjacent pixel in the horizontal left direction to obtain the gray sum of the g-th pixel in the horizontal left direction.

[0166] The ratio of the gray value of the g-th pixel to the sum of the gray values ​​of the g-th pixel in the horizontal left direction is determined as the weighting coefficient of the g-th pixel in the horizontal left direction.

[0167] The smoothing coefficient is obtained by taking the negative value of the weighting coefficient of the g-th pixel in the horizontal left direction and adding 1.

[0168] The product of the gray value of the g-th pixel and the weighting coefficient of the g-th pixel in the horizontal left direction is determined as the basic gray value of the g-th pixel in the horizontal left direction.

[0169] The product of the grayscale value of the g-th pixel's adjacent pixels in the horizontal left direction and the smoothing coefficient is determined as the adjusted grayscale value of the g-th pixel in the horizontal left direction.

[0170] The gray value of the g-th pixel in the horizontal left direction is summed with the adjusted gray value of the g-th pixel in the horizontal left direction to obtain the gray value of the interpolated pixel in the horizontal left direction.

[0171] Obtain the grayscale values ​​of the interpolated pixels at the g-th pixel in the horizontal rightward, vertical upward, and vertical downward directions, respectively.

[0172] For example, the number of interpolations for each problem closed region in each cluster is determined based on the number of interpolations for each cluster. That is, the number of interpolations for each cluster is determined as the number of interpolations for each problem closed region in each cluster.

[0173] Next, the grayscale values ​​of the interpolated pixels in the titanium alloy quality problem area at different subdivision levels are obtained. In this embodiment, the grayscale value of the interpolated pixel is recorded as follows: The closed area of ​​each question is subdivided into levels one and two. The closed area of ​​each question is subdivided into two levels. The closed region of the problem is subdivided into three levels. For each subdivision level, the calculation method for the grayscale value of the interpolated pixel is shown in the following example:

[0174] No. The interpolation position and grayscale value of the interpolated pixel in the closed region of the problem are calculated as follows:

[0175] First, obtain the... The direction of grayscale change in the closed region of the first problem: Determine the direction of grayscale change in the first problem. The centroid pixel within the closed region of the problem is used as the origin of the coordinate system to calculate the first x-th ... The gray-level gradients of the closed region of the problem (0°, 90°, 180°, and 270°); the direction of the maximum gray-level gradient change is taken, and this direction is the first... The interpolation direction of the closed region of the problem.

[0176] Due to the The first problem's closed region is a subdivision level one region, requiring only one subpixel interpolation for each pixel within that region. The second... The gradient change is greatest along the interpolation direction of the closed region of the problem, i.e., the gray value change is greatest. The more edges there are, the less uniform the titanium alloy crystal distribution, and therefore, interpolation along this direction is more effective for the first problem. The more pronounced the improvement in image quality is in the closed region of the problem, the more significant the improvement.

[0177] Secondly, with the first The first problem within the closed region Taking a single pixel as an example, the grayscale value of the corresponding interpolated pixel is... The calculation formula can be: ;

[0178] in, For the first The first problem within the closed region The grayscale value of each interpolated pixel. Indicates the first The first problem within the closed region The grayscale value of each pixel Indicates the first The first problem within the closed region The gray values ​​of adjacent pixels in the interpolation direction of each pixel.

[0179] In the formula, the essence of interpolating the image of the problem area of ​​the internal flaw detection of titanium alloy is to enhance the abnormal image of the titanium alloy in that area. However, the image content cannot be significantly modified during the enhancement. Therefore, the image is obtained by weighted summation using the gray values ​​of the first pixel and the neighboring pixels in the interpolation direction.

[0180] Using the above method for the first By interpolating the size of each pixel in the closed region of the problem, the value of the first pixel can be obtained. The grayscale value of each pixel in the closed region of the problem is interpolated.

[0181] No. The interpolation position and grayscale value of the interpolated pixel in the closed region of the problem are calculated as follows:

[0182] First, determine the number The direction of grayscale change in the closed region of the first problem: Determine the direction of grayscale change in the first problem. The centroid pixel within the closed region of the problem is used as the origin of the coordinate system to calculate the first and second centroid pixels in the vertical and horizontal directions. The gray-level gradients (90° and 180°) of the closed region of the problem are taken; the direction of the maximum gray-level gradient change is then determined. The interpolation direction of the closed region of the problem; and the interpolation direction of the first problem. The interpolation logic for the closed region of each problem is the same, but because the first problem... The closed region of this problem is a subdivision level two region. When interpolating the pixels in the region, two interpolations need to be performed at once for each pixel in the left-right or up-down direction. Therefore, only two directions need to be calculated.

[0183] Secondly, with the first The first problem within the closed region Taking a pixel as an example, its corresponding interpolation size and The calculation method is as follows: ;

[0184] in, Indicates the first Within the closed region of the problem, the first... The grayscale value of the interpolated pixel in the inverse interpolation direction; Indicates the first Within the closed region of the problem, the first... The grayscale value of each pixel along the interpolation direction; Indicates the first Within the closed region of the problem, the first... The grayscale value of each pixel; Indicates the first in the inverse interpolation direction Within the closed region of the problem, the first... The grayscale value of each pixel's adjacent pixels, that is, the pixel value in the opposite direction; Represents the first [interpolation direction] along the interpolation direction. Within the closed region of the problem, the first... The grayscale value of each pixel's adjacent pixels, that is, the pixel value in the main direction; and They represent the first Within the closed region of the problem, the first... The grayscale values ​​of two adjacent pixels in two vertical directions. This indicates the preset weights. To adjust pixel values, The first primary pixel value, This is the value of the second primary pixel. To smooth the weights, These are smoothed pixel values.

[0185] Preset weights The calculation method is as follows: obtain the sum of the gray-level gradient in the interpolation direction and the gray-level gradient perpendicular to the interpolation direction to obtain the sum of the gradient magnitudes;

[0186] The ratio of the gray-level gradient in the interpolation direction to the sum of the gradient magnitudes is determined as the preset weight.

[0187] The preset weight settings allow the algorithm to automatically prioritize maintaining contour sharpness in edge regions and suppressing noise in flat areas. This mechanism ensures that while effectively improving the quality of titanium alloy flaw detection images, it can maximize the preservation and enhancement of edge information crucial for quantitative defect analysis, and its computation is lightweight and easy to deploy in industry. It ensures that valuable computational resources (for each interpolation operation) are used to their maximum benefit, rather than being wasted on simple smoothing or ineffective operations on sharp edges.

[0188] In the formula, because the second level of subdivision requires the first level to be subdivided... For each pixel within the closed region of the problem, interpolation is performed on the left and right sides or the top and bottom sides. Since there are many interpolated pixels, in order to prevent poor results after interpolation, the gray values ​​of the interpolated pixels are calculated using the gray values ​​of the pixels in the four neighboring regions of the first pixel, which plays a smoothing role.

[0189] No. The interpolation position and grayscale value of the interpolated pixel in the closed region of the problem are calculated as follows:

[0190] Due to the The problem's closed region is divided into three subdivision levels. Interpolation needs to be performed within the four neighboring regions (top, bottom, left, and right) of each pixel. Therefore, it is unnecessary to obtain the first... The direction of grayscale change in the closed region of the problem.

[0191] With the first The first problem within the closed region Taking one pixel as an example, the interpolation value of its corresponding four interpolated pixels. , , , The calculation method can be as follows: ;

[0192] ;

[0193] ;

[0194] ;

[0195] in, Indicates the first Within the closed region of the problem, the first... The grayscale value of each pixel; , , , They represent the first The first problem within the closed region The interpolation values ​​of the interpolated pixels in the left, right, top, and bottom directions of each pixel; , , , They represent the first The first problem within the closed region The grayscale values ​​of the four neighboring pixels (left, right, top, and bottom) within the four-neighborhood of a pixel; These are the weighting coefficients.

[0196] In the formula, when dealing with the first... When interpolating each pixel within a closed region of the problem, interpolation needs to be performed for the left, right, top, and bottom four neighborhoods of each pixel. Therefore, a weighted summation method is used to determine the interpolation values ​​in the four directions, starting with the left side. For example, after interpolation, at the pixel point and Between, therefore, using weights To the pixel and Adjustments are made to make the subpixel grayscale values ​​smoother after interpolation, so as not to damage the image representation of the abnormal morphology inside the titanium alloy.

[0197] Similarly, the method for obtaining the grayscale values ​​of interpolated pixels in the horizontal right, vertical up, and vertical down directions of the g-th pixel can be referenced from the method for obtaining the grayscale values ​​of interpolated pixels in the horizontal left direction, which will not be elaborated here.

[0198] S108. Interpolate the closed region of each problem using interpolation pixels to obtain the internal flaw detection reconstruction image of the titanium alloy.

[0199] For example, the interpolation values ​​and directions of all pixels in the titanium alloy quality problem area are obtained through the above steps. Now, based on the obtained interpolation values ​​and directions, sub-pixel interpolation is used to interpolate the titanium alloy flaw detection image. By performing sub-pixel processing on the quality problem areas in the titanium alloy internal flaw detection image using interpolation, a reconstructed titanium alloy internal flaw detection image containing high-resolution quality problem areas is obtained.

[0200] After obtaining the reconstructed image of the internal flaws of the titanium alloy, the quality of the titanium alloy is inspected based on the reconstructed image. Specific implementation steps may include:

[0201] First, a lightweight CNN model was selected as the base network and optimized to suit the titanium alloy quality inspection scenario. The neural network model was constructed and trained. The training process can be as follows: Input layer: receives a 224×224×1 gray-level abnormal region sub-image; Feature extraction layer: uses the depthwise separable convolutional structure of MobileNetV3 to extract features of the gray-level abnormal region sub-image; Softmax function is used as the activation function to output common titanium alloy quality abnormality types (internal inclusions, porosity, cracks, material inhomogeneity, shrinkage cavities, etc.) and multiple probability distributions of "normal areas"; The labeled titanium alloy flaw detection image dataset is used as the training set, and the training is performed by dividing the dataset in an 8:2 ratio; The validation set is used to train the network.

[0202] For the reconstructed images of internal flaws in titanium alloys that have been identified For each closed region of an anomaly, a bounding box can be generated using the minimum bounding rectangle algorithm to accurately delineate the location and extent of each anomaly region. The coordinate parameters of the bounding box (top-left x-coordinate, top-left y-coordinate, width, and height) are output to complete the visual localization of the anomaly region. The optimized flaw detection image is cropped according to the bounding box coordinates to obtain independent anomaly region sub-images, which are then uniformly scaled to a size of 224×224 pixels. Furthermore, the detection boxes here need to be subjected to non-maximum suppression (NMS) to remove duplicate boxes.

[0203] The cropped problem area is input into the trained neural network model, which outputs probability values ​​for various anomaly types. The type with the highest probability exceeding the confidence threshold (0.8) is selected as the quality anomaly type for that area. If the highest probability is below 0.8, it is marked as a "suspected anomaly" and requires manual review. The confidence threshold for this process can be set according to the actual situation and is not specifically limited.

[0204] In summary, this invention employs a strategy of customizing different interpolation algorithms for different reconstruction levels. For high-level complex regions, four-way weighted interpolation is used for multiple interpolations; for low-level simple regions, directional single interpolation is used for simple interpolation. This hierarchical differential processing mode ensures that each type of defect receives appropriate enhancement, achieving optimal reconstruction results at the system level.

[0205] This invention also proposes an image processing-based titanium alloy quality inspection system; please refer to [link / reference]. Figure 2 The diagram shows a structural diagram of a titanium alloy quality inspection system based on image processing provided in an embodiment of the present invention. The system includes: a data acquisition module 101, a data processing module 102, and an interpolation and reconstruction module 103.

[0206] The data acquisition module 101 is used to detect the internal flaw detection image of the titanium alloy using the Canny edge detection algorithm to obtain the internal edge map of the titanium alloy, and to perform closed connected component detection on the internal edge map of the titanium alloy to obtain the closed region of the internal edge map of the titanium alloy.

[0207] The data processing module 102 is used to calculate the internal grayscale uniformity of each closed region based on the pixel grayscale values ​​of closed and unclosed regions, where the unclosed region is the area outside the closed region in the titanium alloy internal edge image; determine the problem closed region from the closed region based on the internal grayscale uniformity of the closed region; calculate the relative sharpness of each problem closed region based on the pixel values ​​of edge pixels and non-edge pixels in each problem closed region; determine the relative sharpness as the clustering parameter of the K-Means algorithm, determine the number of cluster centers of the K-Means algorithm based on the preset number of clusters, and use the K-Means algorithm to cluster the problem closed regions to obtain clusters; determine the image reconstruction accuracy level of each cluster based on the mean of the relative sharpness of the problem closed regions in each cluster; determine the number of interpolations for each cluster based on the preset interpolation density configuration strategy that is positively correlated with the image reconstruction accuracy level; determine the number of interpolations for each cluster based on the number of interpolations for each cluster, and determine the interpolation position and interpolation pixel corresponding to each pixel based on the grayscale value of each pixel in each problem closed region;

[0208] The interpolation and reconstruction module 103 is used to interpolate each closed region of the problem using interpolation pixels to obtain a reconstructed image of the internal flaw detection of the titanium alloy.

[0209] It should be noted that the system provided in the above embodiments is only an example of the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. In addition, the titanium alloy quality inspection system based on image processing and the titanium alloy quality inspection method based on image processing provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiment, which will not be repeated here.

[0210] It should be noted that the order of the above embodiments of the present invention is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. The processes depicted in the accompanying drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0211] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

[0212] 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 within the protection scope of the present invention.

Claims

1. A method for quality inspection of titanium alloys based on image processing, characterized in that, include: The Canny edge detection algorithm is used to detect internal flaw images of titanium alloys to obtain internal edge maps of titanium alloys. Closed connected component detection is then performed on the internal edge maps of titanium alloys to obtain closed regions of the internal edge maps of titanium alloys. Based on the pixel grayscale values ​​of closed and unclosed regions, the internal grayscale uniformity of each closed region is calculated. The unclosed region is the region outside the closed region in the internal edge map of the titanium alloy. Based on the internal grayscale uniformity of the closed region, the problem closed region is determined from the closed region; Obtain the edge pixels in the closed region of the b-th problem, where the edge pixels in the closed region of the b-th problem are the edge pixels in the closed region of the b-th problem in the inner edge map of the titanium alloy; The average gray value of the non-edge pixels in the 8-neighborhood of the c-th edge pixel in the b-th closed region of the problem is determined as the first average gray value of the c-th edge pixel in the b-th closed region of the problem, where the non-edge pixels are the pixels in the b-th closed region of the problem other than the edge pixels. The edge sharpness of the c-th edge pixel in the closed region of the b-th problem is obtained by taking the absolute value of the difference between the gray value of the c-th edge pixel and the first gray mean value of the c-th edge pixel in the closed region of the b-th problem. Obtain the mean edge sharpness of edge pixels in the closed region of the b-th problem; Obtain the non-edge pixels in the closed region of the b-th problem; The average gray value of the non-edge pixels in the 8-neighborhood of the d-th non-edge pixel in the closed region of the b-th problem is determined as the second average gray value of the d-th non-edge pixel in the closed region of the b-th problem. The absolute value of the difference between the gray value of the d-th non-edge pixel in the closed region of the b-th problem and the second gray mean value of the d-th non-edge pixel in the closed region of the b-th problem is taken to obtain the non-edge continuity of the d-th non-edge pixel in the closed region of the b-th problem. Obtain the mean value of the non-edge continuity of non-edge pixels in the closed region of the b-th problem; The ratio of the mean edge sharpness of edge pixels in the closed region of the b-th problem to the mean non-edge continuity of non-edge pixels in the closed region of the b-th problem is determined as the relative sharpness of the closed region of the b-th problem. Obtain the relative clarity of the closed region for each problem; The relative clarity is determined as the clustering parameter of the K-Means algorithm, and the preset number of clusters is determined as the number of cluster centers of the K-Means algorithm. The K-Means algorithm is used to cluster the closed regions of the problem to obtain clusters, where the preset number of clusters is 3. The cluster with the highest mean relative clarity is determined as the lowest image reconstruction accuracy level; The cluster with the smallest mean relative sharpness is determined as the highest image reconstruction accuracy level; The remaining clusters are determined as the intermediate image reconstruction accuracy levels; Configure a first number of interpolation values ​​for the cluster corresponding to the lowest image reconstruction accuracy level; Configure a third number of interpolation values ​​for the cluster corresponding to the highest image reconstruction accuracy level; Configure a second number of interpolation values ​​for the clusters corresponding to the intermediate image reconstruction accuracy level; Among them, the first quantity is less than the second quantity, and the second quantity is less than the third quantity; Based on the number of interpolations for each cluster, determine the number of interpolations for each problem closed region in each cluster, and based on the gray value of each pixel in each problem closed region, determine the interpolation position and interpolation pixel corresponding to each pixel. Interpolation pixels are used to interpolate the closed region of each problem to obtain a reconstructed image of the internal flaw detection of the titanium alloy.

2. The titanium alloy quality inspection method based on image processing according to claim 1, characterized in that, The calculation of the internal grayscale uniformity of each closed region based on the pixel grayscale values ​​of closed and unclosed regions specifically includes: Obtain the mean and variance of pixel grayscale values ​​in non-closed regions; Obtain the mean and variance of the gray values ​​of the pixels in the a-th closed region; The absolute value of the difference between the average gray value of pixels in the non-closed region and the average gray value of pixels in the a-th closed region is obtained as the difference in the average gray value of the a-th closed region. The ratio of the gray value variance of pixels in the non-closed region to the gray value variance of pixels in the a-th closed region is determined as the gray value variance ratio of the a-th closed region. The product of the mean difference of gray values ​​in the a-th closed region and the ratio of the variance of gray values ​​in the a-th closed region is determined as the internal gray uniformity of the a-th closed region. Obtain the internal grayscale uniformity of each closed region.

3. The titanium alloy quality inspection method based on image processing according to claim 1, characterized in that, The step of determining the problem closed region from the closed region based on the internal gray-level uniformity of the closed region specifically includes: Closed regions with internal grayscale uniformity greater than a preset uniformity threshold are identified as problem closed regions.

4. The titanium alloy quality inspection method based on image processing according to claim 1, characterized in that, When the closed region of the problem is an element in the cluster corresponding to the lowest image reconstruction accuracy level, the step of determining the interpolation position and interpolation pixel corresponding to each pixel based on the gray value of each pixel in each closed region of the problem specifically includes: Based on the centroid pixel of the closed region of the problem, determine the direction with the largest gray-level gradient in the horizontal and vertical directions, and set the interpolation position on the single direction with the largest gray-level gradient. Obtain the grayscale value of the e-th pixel within the closed region of the problem; Obtain the grayscale values ​​of the adjacent pixels of the e-th pixel in the interpolation position direction; The gray value of the e-th pixel is obtained by averaging the gray values ​​of the e-th pixel and the gray values ​​of the adjacent pixels of the e-th pixel in the interpolation position direction. Obtain the grayscale value of the interpolated pixel for each pixel within the closed region of the problem.

5. The titanium alloy quality inspection method based on image processing according to claim 1, characterized in that, When the closed region of the problem is an element in the cluster corresponding to the intermediate image reconstruction accuracy level, the step of determining the interpolation position and interpolation pixel corresponding to each pixel based on the gray value of each pixel in each closed region of the problem specifically includes: Based on the centroid pixel of the closed region of the problem, determine the direction with the largest gray-level gradient in the horizontal leftward and vertical upward directions, and set the interpolation position in the direction with the largest gray-level gradient and the opposite direction of the direction with the largest gray-level gradient. Obtain the grayscale value of the f-th pixel within the closed region of the problem; The gray values ​​of the adjacent pixels of the f-th pixel in the opposite direction of the direction with the maximum gray-level gradient are determined as the reverse direction pixel values. The gray values ​​of the adjacent pixels of the f-th pixel in the direction of maximum gray-level gradient are determined as the main direction pixel values. The adjustment pixel value is obtained by averaging the gray values ​​of the two adjacent pixels in the vertical direction of the f-th pixel. The average of the grayscale value of the f-th pixel and the pixel value in the opposite direction is determined as the first main pixel value; The average of the grayscale value of the f-th pixel and the pixel value in the main direction is determined as the second main pixel value; The preset weights are negative numbers plus one to obtain the smoothed weights; The product of the adjusted pixel value and the smoothing weight is determined as the smoothed pixel value; Add the product of the first main pixel value and the preset weight to the smoothed pixel value to obtain the gray value of the interpolated pixel in the opposite direction of the direction of maximum gray gradient. The product of the second main pixel value and the preset weight is added to the smooth pixel value to obtain the gray value of the interpolated pixel in the direction of maximum gray-level gradient.

6. The titanium alloy quality inspection method based on image processing according to claim 1, characterized in that, When the closed region of the problem is an element in the cluster corresponding to the highest image reconstruction accuracy level, the step of determining the interpolation position and interpolation pixel corresponding to each pixel based on the gray value of each pixel in each closed region of the problem specifically includes: Set the interpolation position in the four-neighbor direction of each pixel in the closed region of the problem; Obtain the grayscale value of the g-th pixel within the closed region of the problem; Obtain the grayscale values ​​of the g-th pixel's adjacent pixels in the horizontal left, horizontal right, vertical up, and vertical down directions, respectively; When the interpolated pixel is located in the horizontal left direction of the g-th pixel, the gray value of the g-th pixel is added to the gray value of the g-th pixel's adjacent pixel in the horizontal left direction to obtain the gray sum of the g-th pixel in the horizontal left direction. The ratio of the gray value of the g-th pixel to the sum of the gray values ​​of the g-th pixel in the horizontal left direction is determined as the weighting coefficient of the g-th pixel in the horizontal left direction. The smoothing coefficient is obtained by taking the negative value of the weighting coefficient of the g-th pixel in the horizontal left direction and adding 1. The product of the gray value of the g-th pixel and the weighting coefficient of the g-th pixel in the horizontal left direction is determined as the basic gray value of the g-th pixel in the horizontal left direction. The product of the grayscale value of the g-th pixel's adjacent pixels in the horizontal left direction and the smoothing coefficient is determined as the adjusted grayscale value of the g-th pixel in the horizontal left direction. The gray value of the g-th pixel in the horizontal left direction is summed with the adjusted gray value of the g-th pixel in the horizontal left direction to obtain the gray value of the interpolated pixel in the horizontal left direction. Obtain the grayscale values ​​of the interpolated pixels at the g-th pixel in the horizontal rightward, vertical upward, and vertical downward directions, respectively.

7. A titanium alloy quality inspection system based on image processing, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the computer program is executed by the processor, it implements the steps of the image processing-based titanium alloy quality inspection method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Animation real-time capturing and repairing method and system

    CN119863549A

  • Lightweight component surface defect quantitative evaluation method, system and device

    CN120894301A