CN-122023235-A - Flange forging surface defect detection method and system based on image processing
Abstract
The invention relates to the technical field of image data processing, in particular to a flange forging surface defect detection method and system based on image processing, wherein the method comprises the steps of obtaining an original image of a flange forging and performing differential Gaussian band-pass filtering to obtain a preprocessed image; the method comprises the steps of carrying out multi-scale structure tensor analysis on a preprocessed image, determining texture abnormal values according to gradient amplitude values, included angles between gradient directions and local texture directions, extracting background images through morphological reconstruction, calculating geometric suppression weights based on brightness differences, fusing the texture abnormal values and the geometric suppression weights to obtain defect response values, and identifying surface defects through threshold segmentation. According to the invention, through the combination of multi-scale texture analysis and a geometric inhibition mechanism, weak defects can be accurately extracted under a strong texture background, meanwhile, artifacts generated by a flange geometric structure are effectively inhibited, and the accuracy and the robustness of defect detection are improved.
Inventors
- HOU XUFENG
- LIU JINJIANG
- Fan Rongtian
- LIU HAOYU
- YANG JINGJING
- HAN YUHUA
- MAO YAJIE
- KANG JIAO
- WANG JUNYAN
Assignees
- 山西中襄环锻有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20251211
Claims (10)
- 1. The flange forging surface defect detection method based on image processing is characterized by comprising the following steps of: obtaining an original image of a flange forging, and performing differential Gaussian-based band-pass filtering treatment on the original image to obtain a preprocessed image; Carrying out multi-scale structure tensor analysis on the preprocessed image, obtaining the gradient direction and gradient amplitude of each pixel point, and calculating the local texture direction of each pixel point under different scales; Performing morphological reconstruction on the preprocessed image to extract a background image, and calculating geometric inhibition weights of all pixel points based on brightness differences of the preprocessed image and the background image, wherein the geometric inhibition weights are inversely related to the brightness differences; fusing the abnormal texture value of each pixel point with the geometric inhibition weight to obtain a defect response value of each pixel point, and carrying out threshold segmentation on a defect response diagram formed by the defect response values to identify the surface defects of the flange forging.
- 2. The flange forging surface defect detection method based on image processing according to claim 1, wherein the calculating of the local texture direction of each pixel point under different scales comprises: Constructing a multi-scale window, and constructing a structure tensor for each pixel point in the preprocessed image according to each preset scale; calculating a feature vector corresponding to a maximum feature value of a structure tensor of each pixel point under the current scale; The direction of the feature vector is determined as the local texture direction of the corresponding pixel point under the current scale.
- 3. The method for detecting surface defects of flange forgings based on image processing according to claim 2, wherein said constructing a structure tensor for each pixel point in the preprocessed image comprises: calculating gradient components of the preprocessed image in the horizontal direction and gradient components of the preprocessed image in the vertical direction; Calculating a tensor product according to the gradient component in the horizontal direction and the gradient component in the vertical direction; and carrying out convolution smoothing processing on the tensor product by using Gaussian smoothing check, and forming the structure tensor of the pixel point by each component after the smoothing processing.
- 4. The flange forging surface defect detection method based on image processing according to claim 1, wherein the obtaining of the texture outlier of the pixel point comprises: Calculating a local direction deviation value under each scale for each scale; Selecting the maximum value of the local direction deviation values under different scales, and marking the maximum value as a texture abnormal value of the corresponding pixel point; The local direction deviation value satisfies the relation: ; Wherein, the Is a pixel point On the scale of A lower local directional deviation value; Is a pixel point Is a gradient direction angle of (2); Is a pixel point Local texture direction of the neighborhood; Is a pixel point Is a gradient magnitude of (a); Is the gradient maximum in the preprocessed image; is an absolute value symbol.
- 5. The image processing-based flange forging surface defect detection method according to claim 1, wherein the geometric suppression weights satisfy a relation: ; Wherein, the Is a pixel point Is determined by the geometric suppression weights of (2); Is to preprocess the image at pixel points Is a luminance value of (1); Is that the background image is at the pixel point Is a luminance value of (1); Is the standard deviation of the difference between the preprocessed image and the background image; is a preset sensitivity adjustment coefficient; is a natural exponential function.
- 6. The image processing-based flange forging surface defect detection method according to claim 1, wherein the performing morphological reconstruction on the pre-processed image to extract a background image comprises: Carrying out morphological corrosion on the preprocessed image by using structural elements with preset sizes to obtain a marked image; and performing geodesic expansion on the marked image by taking the preprocessed image as a mask until convergence to obtain the background image.
- 7. The flange forging surface defect detection method based on image processing according to claim 1, wherein the fusing the texture outlier of each pixel point with the geometric suppression weight to obtain the defect response value of each pixel point comprises: And multiplying the texture abnormal value of each pixel point with the geometric inhibition weight of the corresponding pixel point to obtain a defect response value of each pixel point.
- 8. The method for detecting surface defects of flange forgings based on image processing according to claim 1, wherein the thresholding of the defect response map composed of the defect response values to identify surface defects of flange forgings comprises: threshold segmentation is carried out on a defect response graph formed by the defect response values to obtain a binary image; performing morphological operation on the binary image, and extracting a connected region to obtain a candidate defect region; and calculating geometric characteristic parameters of the candidate defect areas, and classifying the candidate defect areas according to preset geometric characteristic rules to identify surface defects of the flange forging.
- 9. The flange forging surface defect detection method based on image processing according to claim 1, wherein the performing differential gaussian band-pass filtering processing on the original image to obtain a preprocessed image comprises: Carrying out convolution processing on an original image by using a Gaussian filter with a first standard deviation to obtain a first filtered image, and carrying out convolution processing on the original image by using a Gaussian filter with a second standard deviation to obtain a second filtered image, wherein the first standard deviation is larger than the second standard deviation; Performing pixel level difference operation, and subtracting the pixel value of the first filter image from the pixel value of the second filter image to obtain a difference image; And linearly stretching and mapping the pixel values of the differential image to a preset range to obtain a preprocessed image.
- 10. Image processing-based flange forging surface defect detection system, characterized in that it comprises a processor and a memory, the memory storing computer program instructions which, when executed by the processor, implement the image processing-based flange forging surface defect detection method according to any one of claims 1-9.
Description
Flange forging surface defect detection method and system based on image processing Technical Field The invention relates to the technical field of image data processing, in particular to a flange forging surface defect detection method and system based on image processing. Background The flange forging is used as a key basic connecting part, is often applied to scenes with high safety requirements such as petrochemical industry, aerospace and the like, and is often required to be used under severe working conditions such as high temperature, high pressure, strong corrosion and the like. If the surface defects such as micro cracks and pits are not detected in time, the stress concentration and crack expansion are easy to occur, the service life is shortened, and even equipment failure is caused, so that the method has important industrial value for detecting the defects on the surface of the flange forging. Currently, machine vision has become the mainstream detection means. In the prior art, a traditional image processing algorithm is mostly adopted, namely, gradient amplitude values are calculated by using Canny, sobel and other operators to identify abrupt edges, and linear filtering smooth images are adopted to try to separate the background from the defects and judge by combining fixed thresholds. However, the prior art has limitations in practical inspection of flange forgings in that, on the one hand, the flange forgings surfaces not only contain random noise, but are more densely populated with streamlined textures formed by the forging process, which appear as high-intensity edge features in the image. The existing detection algorithm based on gradient amplitude is difficult to extract weak defect signals under a strong texture background, and when the defect trend is similar to a texture streamline or the defect signals are submerged in texture high-frequency information, the detection algorithm cannot be effectively screened, so that high false alarm rate or omission of fine cracks is caused. On the other hand, the flange forging has a complex geometric topological structure, and macroscopic structures such as inner and outer circular edges, chamfers, mounting holes and the like of the flange forging can generate stronger gradient response in an image. The traditional frequency domain or spatial domain filtering method is difficult to realize precise decoupling of macroscopic geometric background and microscopic defect characteristics, namely if the filtering strength is too large, the real microscopic defects are easily smoothed, and if the filtering strength is insufficient, artifacts generated by geometric edges can be misjudged as defects. Disclosure of Invention In order to solve the technical problems that the traditional image processing algorithm is difficult to accurately extract and screen microscopic defects and is easy to miss detection or false alarm under the interference of the flange forging strong forging texture background and the complex geometric structure, the invention provides a scheme in the following aspects. In a first aspect, the present invention provides a flange forging surface defect detection method based on image processing, the method comprising the steps of: The method comprises the steps of obtaining an original image of a flange forging, carrying out band-pass filtering processing based on difference Gaussian on the original image to obtain a preprocessed image, carrying out multi-scale structure tensor analysis on the preprocessed image, obtaining gradient directions and gradient amplitudes of all pixel points, calculating local texture directions of all pixel points under different scales, determining texture abnormal values of all pixel points according to absolute values of gradient amplitudes, included angle sine values of the gradient directions and the local texture directions, carrying out morphological reconstruction on the preprocessed image to extract a background image, calculating geometric inhibition weights of all pixel points based on brightness differences of the preprocessed image and the background image, carrying out negative correlation on the geometric inhibition weights and the brightness differences, fusing the texture abnormal values of all pixel points with the geometric inhibition weights to obtain defect response values of all pixel points, and carrying out threshold segmentation on a defect response image formed by the defect response values to identify surface defects of the flange forging. According to the invention, the original image of the flange forging is obtained and band-pass filtering processing based on differential Gaussian is carried out, so that the influence of uneven illumination and high-frequency noise on the image quality is reduced. According to the invention, the gradient direction and the local texture direction are obtained by utilizing multi-scale structure tensor analysis, the texture abnormal value is dete