Anti-collision beam weld defect detection method and system based on image processing
Through adaptive local equalization and frequency domain texture smoothing technology, the problem of poor weld image denoising is solved, and efficient identification of anti-collision beam weld defects is achieved.
Patent Information
- Application Number
- CN202511106523.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-08
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-08-08
AI Technical Summary
When performing denoising on images of weld seams of anti-collision beams, existing technologies are prone to under-processing and over-processing, which increases the complexity of the image and affects the accuracy and efficiency of defect recognition by the deep learning model.
The weld image is adaptively divided into blocks using the adaptive local equalization and frequency domain texture smoothing methods. The gradient directional histogram and frequency domain filtering techniques are combined to suppress the periodic texture in the weld image and retain the characteristics of the defect area.
The denoising effect of weld images is improved, the recognition efficiency and accuracy of defect areas are enhanced, and the neural network can effectively identify weld defects.
Smart Images

Figure CN120598960A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to an image processing-based method and system for detecting weld defects in an anti-collision beam. Background Art
[0002] The anti-collision beam is a critical component in the automotive safety system, playing a key role in absorbing and dissipating impact energy during a collision. However, defects in the anti-collision beam welds can significantly reduce the beam's strength and toughness, rendering it ineffective in a collision and potentially endangering the lives of vehicle occupants. Therefore, defect detection of anti-collision beam welds is crucial.
[0003] Existing technologies typically utilize image processing, deep learning, and other related techniques to detect defects in critical areas such as welds during the production and processing of anti-collision beams. This involves training deep learning models to automatically learn the characteristic representations of weld defects from large amounts of weld image data, enabling rapid and accurate assessment of weld quality. Prior to this, preprocessing of weld images, such as denoising and enhancement, is crucial, as it directly impacts the accuracy and efficiency of defect recognition using convolutional neural networks (CNNs).
[0004] Traditional methods generally use histogram equalization to enhance the contrast of weld images and apply various filters to denoise weld images, thereby ensuring image quality and facilitating accurate and efficient defect identification and detection. However, considering that most traditional methods are holistic and use traditional methods to enhance the image of the weld area, under-processing and over-processing are prone to occur. For example, the shape, temperature gradient, and flow state of the molten pool constantly change during welding, which will lead to uneven material crystallization in the weld area, thereby increasing the grayscale complexity of the weld area. If traditional methods are used for image denoising, the denoising effect is poor and a large amount of interference will still exist in the image. At the same time, the weld area generally adopts multi-layer multi-pass welding, spiral welding and other processes, which will cause periodic lines or corrugated texture features to form in the weld area, further exacerbating the image complexity of the weld area. If traditional methods are used for image denoising, important defect features will be lost.
[0005] Therefore, how to improve the denoising effect of weld images before using deep learning models to identify defects in weld images of anti-collision beams has become an urgent problem that needs to be solved. Summary of the Invention
[0006] In view of this, an embodiment of the present invention provides a method and system for detecting weld defects in anti-collision beams based on image processing to solve the problem of how to improve the denoising effect of weld images before using a deep learning model to identify defects in the weld images of anti-collision beams.
[0007] In a first aspect, an embodiment of the present invention provides a method for detecting weld defects in an anti-collision beam based on image processing, the method comprising the following steps: During the production process of the anti-collision beam, an image of the weld area of the produced anti-collision beam is collected to obtain a weld image, and the weld image is pre-processed to obtain a grayscale image; Performing initial block division on the grayscale image to obtain at least two initial sub-blocks, obtaining a local complexity index for each initial sub-block based on the gradient characteristics and grayscale value of each pixel in each initial sub-block, performing adaptive block division on the grayscale image based on the local complexity index of each initial sub-block to obtain at least two adaptive sub-blocks, and performing adaptive local histogram equalization on each adaptive sub-block to obtain a target grayscale image; Performing edge detection on the target grayscale image to obtain at least two edge pixels, constructing a gradient direction histogram based on the gradient direction of each edge pixel, wherein the horizontal axis of the gradient direction histogram represents the angle interval of the gradient direction and the vertical axis represents the frequency of the gradient direction, and performing masking on the target grayscale image based on the gradient direction with the highest frequency in the gradient direction histogram to obtain an image to be converted into the frequency domain; The image to be frequency-domain-converted is subjected to frequency-domain conversion to obtain a frequency-domain image, the frequency-domain image is subjected to filtering processing and time-domain conversion to obtain a denoised image, and defects in the denoised image are identified using a neural network.
[0008] In the second aspect, an embodiment of the present invention provides an anti-collision beam weld defect detection system based on image processing, comprising a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements an anti-collision beam weld defect detection method based on image processing as described in the first aspect.
[0009] Compared with the prior art, the embodiments of the present invention have the following beneficial effects: When the present invention performs adaptive local equalization on the weld image, the initial sub-blocks are split and merged according to the local complexity of each initial sub-block, so that the weld image is adaptively divided into blocks, and then based on the adaptive block division result, adaptive local equalization is completed to obtain a target grayscale image; then, combined with the frequency domain space conversion algorithm, by analyzing the internal welding texture in the target grayscale image, a denoised image is obtained after the welding texture features are effectively suppressed and smoothed by using an effective filter, that is, a weld image with the best denoising effect, and by suppressing the periodic texture in the weld image (that is, including the background), the crack defect area is retained and enhanced, thereby improving the efficiency of defect recognition of the denoised image using a neural network. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0011] Figure 1 This is a method flow chart of a method for detecting weld defects in anti-collision beams based on image processing provided in Example 1 of the present invention. DETAILED DESCRIPTION
[0012] The embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to be used to explain the present disclosure, but should not be understood as limiting the present disclosure.
[0013] It should be noted that the terms "first," "second," and the like in the specification of the present disclosure and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure.
[0014] In order to illustrate the technical solution of the present invention, specific embodiments are provided below.
[0015] See also Figure 1 , is a flow chart of a method for detecting weld defects of anti-collision beams based on image processing provided by the first embodiment of the present invention, such as Figure 1 As shown, the method may include: Step S101 , during the production process of the anti-collision beam, an image of the weld area of the produced anti-collision beam is collected to obtain a weld image, and the weld image is pre-processed to obtain a grayscale image.
[0016] After the production of the anti-collision beam is completed, the welds of the anti-collision beam need to be inspected for defects to prevent quality problems. Therefore, for the already produced anti-collision beam, by setting up inspection equipment, the welds of the anti-collision beam are imaged and acquired. The weld images are then analyzed to identify weld defects in the anti-collision beam.
[0017] The specific settings of the detection equipment are as follows: a. Light source system: Use a ring-shaped LED light source (wavelength 450-650nm, power 10-30W) or a coaxial light source to avoid overexposure caused by reflections on the weld surface.
[0018] Case: For aluminum alloy anti-collision beams (reflectivity > 80%), a polarizer is required to filter out specular reflected light, thereby increasing the grayscale contrast between the weld and the base material by 20%-30%.
[0019] b. Industrial cameras: Parameter requirements: resolution ≥ 5MP (pixel size < 3.45μm), frame rate ≥ 30fps, and support for global shutter to eliminate motion blur.
[0020] c. Lens Configuration: When the height difference of the weld joint is approximately ±2mm, a lens with an aperture of F8-F16 should be selected, combined with a focusing mechanism to achieve depth of field coverage. Use a telecentric lens (distortion <0.1%) or post-processing algorithms to eliminate perspective distortion.
[0021] d. Environmental Control: Capture images in a darkroom with ambient light intensity ≤10 lux to avoid interference from natural light. The device is installed in a sealed enclosure with a vibration amplitude of <0.05mm to prevent image blur. The camera operating temperature is controlled at 20±5°C to reduce thermal noise.
[0022] To ensure the accuracy and efficiency of neural network recognition of defects in weld images, traditional methods generally use histogram equalization to enhance weld image contrast and various filters to denoise weld images, thereby ensuring weld image quality. However, considering that traditional methods mostly perform holistic processing and use them to enhance weld areas, under- and over-processing are prone to occur, embodiments of the present invention provide a processing method called "adaptive local equalization + frequency domain texture smoothing" to achieve optimal denoising of weld images. See below for details.
[0023] After obtaining the weld image, preprocessing is performed to initially ensure its quality and lay the foundation for subsequent image enhancement. The preprocessing methods include: grayscale conversion, which converts the acquired color image to grayscale, and histogram normalization, linearly mapping the grayscale values to the range [0, 255] to enhance contrast; geometric correction and distortion correction, which uses a calibration plate (with a 10mm grid spacing) to obtain the distortion coefficient and corrects it using the OpenCV undistort function; and perspective transformation: For oblique images, the ROI area is corrected to the normal view using a four-point matching algorithm.
[0024] At this point, the preprocessed weld image, which is also a grayscale image, is obtained.
[0025] Step S102, performing initial block division on the grayscale image to obtain at least two initial sub-blocks, obtaining a local complexity index of each initial sub-block based on the gradient characteristics and grayscale value of each pixel in each initial sub-block, performing adaptive block division on the grayscale image based on the local complexity index of each initial sub-block to obtain at least two adaptive sub-blocks, performing adaptive local histogram equalization on each adaptive sub-block to obtain a target grayscale image.
[0026] Weld images often contain complex textures and details, resulting in significant contrast variations in local regions. Adaptive Local Histogram Equalization (ALHE) is an improvement to traditional histogram equalization. Its core concept is to divide the image into multiple sub-blocks and perform independent histogram equalization on each sub-block. In this way, ALHE better preserves local details in the weld area while avoiding the noise amplification and detail loss associated with global equalization. This effectively enhances local contrast and makes weld defects (such as cracks and pores) more prominent.
[0027] Considering that the core of adaptive local equalization for grayscale images lies in dynamically adjusting the block size based on local image characteristics, the goal of existing block division is to use small blocks to preserve detail in complex areas (such as edges and textures) and large blocks to avoid artifacts in uniform areas. This is generally based on analyzing local complexity (gradient magnitude and local grayscale variance), and then splitting or merging adjacent subblocks based on the analysis results to achieve image sub-blocking. While noise points and true edges may have similar gradient magnitudes, the gradient direction of noise is random, while the gradient direction of edges is continuous. Furthermore, due to the presence of common defects such as slag inclusions, pores, and bubbles in weld scenes, the internal pixel distribution is more dense and continuous. The characteristics of such regions are significantly different from the non-dense, non-uniform, and random characteristics of noise. Therefore, evaluating local complexity solely by calculating gradient magnitude has significant limitations. Therefore, embodiments of the present invention combine gradient direction to jointly quantify local features, thereby achieving adaptive block division in weld feature scenarios and improving the enhanced effect of adaptive local histogram equalization.
[0028] Specifically, the grayscale image is first divided into multiple 64×64 initial sub-blocks. Then, based on the gradient features and grayscale values of each pixel in each initial sub-block, the local complexity index of each initial sub-block is obtained. The specific process is as follows: (1) For any initial sub-block, use the Sobel operator to obtain the gradient value and gradient direction of each pixel point in the any initial sub-block, and obtain the gradient distribution chaos index of the any initial sub-block based on the distribution characteristics of the gradient value and gradient direction of each pixel point in the any initial sub-block.
[0029] Specifically, the mean gradient value of all pixels in any initial sub-block is calculated, the difference between a constant 1 and the mean gradient value is normalized to obtain a first normalized difference, the standard deviation of the gradient direction of all pixels in any initial sub-block is calculated, the difference between the constant 1 and the standard deviation is normalized to obtain a second normalized difference; and the first normalized difference and the second normalized difference are weightedly summed to obtain a gradient distribution chaos index of any initial sub-block.
[0030] In one embodiment, the calculation formula of the gradient distribution disorder index of any initial sub-block is:
[0031] in, represents the gradient distribution chaos index of any initial sub-block, represents the first weight, represents the normalization function, n represents the number of pixels in any initial sub-block, represents the gradient value of the i-th pixel in any initial sub-block, represents the second weight, Represents the standard deviation of the gradient direction of all pixels in any initial sub-block.
[0032] Since the gradient distribution chaos index of any initial sub-block is obtained from the gradient value and gradient direction, the effects of both are the same. Therefore, setting .
[0033] It should be noted that the larger the mean gradient value, the richer the details in any initial sub-block, the higher the clarity, the less likely it is to belong to the defect area, and the smaller the gradient distribution chaos index of any initial sub-block; since the gradient direction of the pixels in the defect area is highly consistent, The smaller the value of , the more consistent the gradient direction in any initial sub-block is, the more likely any initial sub-block is to belong to the defect area, and the larger the gradient distribution chaos index of any initial sub-block is.
[0034] (2) Obtaining the grayscale value of each pixel in any of the initial sub-blocks, obtaining the maximum grayscale value and the minimum grayscale value, and obtaining the grayscale distribution disorder index of any of the initial sub-blocks based on the maximum grayscale value, the minimum grayscale value, and the grayscale value difference of all the pixels.
[0035] Specifically, the grayscale difference between the maximum grayscale value and the minimum grayscale value is calculated to obtain the grayscale value ratio between the grayscale difference and the maximum value in the grayscale value range; the grayscale value variance of all pixel points in any initial sub-block is obtained, the subtraction value between the constant 1 and the grayscale value ratio is calculated to obtain the product of the subtraction value and the grayscale value variance, the product is normalized to obtain the grayscale distribution chaos index of any initial sub-block.
[0036] In one embodiment, the calculation formula of the grayscale distribution disorder index of any initial sub-block is:
[0037] in, Represents the grayscale distribution disorder index of any initial sub-block, represents the normalization function, 1 represents a constant, represents the maximum grayscale value in any initial sub-block, Represents the minimum grayscale value in any initial sub-block, 255 represents the maximum grayscale value in the range [0, 255], Represents the grayscale value variance of all pixels in any initial sub-block.
[0038] It should be noted that since the grayscale value of the noise area is relatively higher than that of the defect area, the smaller the difference between the maximum grayscale value and the minimum grayscale value in any initial sub-block is, the greater the possibility that any initial sub-block belongs to the defect area. The more complex its local grayscale distribution is, the greater the grayscale distribution chaos index of any initial sub-block is. In addition, combined with the grayscale value variance within any initial sub-block, the grayscale distribution chaos index of any initial sub-block is greater. , The larger the value of , the more unstable the grayscale value distribution in any initial sub-block is, the more chaotic the grayscale distribution in any initial sub-block is, and the more likely any initial sub-block is to belong to a defective area, and the larger the corresponding grayscale distribution chaos index is.
[0039] (3) Obtaining a local complexity index of any initial sub-block according to the mean value between the gradient distribution chaos index and the grayscale distribution chaos index of any initial sub-block.
[0040] In one embodiment, the calculation formula of the local complexity index of any initial sub-block is:
[0041] in, represents the local complexity index of any initial sub-block, represents the gradient distribution chaos index of any initial sub-block, Represents the grayscale distribution disorder index of any initial sub-block.
[0042] It should be noted that, since the gradient direction of the pixels in the defect area is highly consistent and the corresponding grayscale value changes closely and continuously along a certain direction, The larger the value of , the greater the probability that any initial sub-block belongs to the noise area, and the larger the corresponding local complexity index.
[0043] Similarly, the local complexity index of each initial sub-block is obtained, and then based on the local complexity index of each initial sub-block, the grayscale image is adaptively divided into blocks to obtain at least two adaptive sub-blocks, wherein the adaptive division method is: Get the preset first local complexity threshold and the second local complexity threshold , and the first local complexity threshold is less than the second local complexity threshold, preferably, set , to ensure extreme characteristic conditions (greater than or less than ) are similar to the sub-blocks under the same range, and the non-extreme features (belonging to [ , ] range) is relatively larger to ensure that the number of adjusted sub-blocks is relatively smaller than the number of unadjusted sub-blocks. There is no restriction here and it can be set according to the implementation scenario.
[0044] If the local complexity index of any initial sub-block is greater than the second local complexity threshold, the initial sub-block is evenly split into a preset number of target sub-blocks, for example, if the initial sub-block is 64×64, the initial sub-block is split into four 32×32 target sub-blocks; if the local complexity index of any initial sub-block is less than the first local complexity threshold, the initial sub-block and the initial sub-blocks within its four neighborhoods are merged into one target sub-block, for example, a 64×64 initial sub-block and its adjacent initial sub-blocks are merged into a 128×128 target sub-block; if the local complexity index of any initial sub-block is greater than or equal to the first local complexity threshold and less than or equal to the second local complexity threshold, the initial sub-block is used as the target sub-block; Traversing all initial sub-blocks to obtain at least two target sub-blocks, obtaining a local complexity index of each target sub-block, and if the local complexity indexes of all target sub-blocks are greater than or equal to a first local complexity threshold and less than or equal to a second local complexity threshold, using all target sub-blocks as adaptive sub-blocks of the grayscale image; If there is any target sub-block whose local complexity index is greater than the second local complexity threshold or less than the first local complexity threshold, then any target sub-block is used as the initial sub-block, and the target sub-block acquisition method is repeated until the local complexity indicators of all target sub-blocks are greater than or equal to the first local complexity threshold and less than or equal to the second local complexity threshold, then all target sub-blocks are used as adaptive sub-blocks of the grayscale image.
[0045] Since the purpose of ALHE is to smoothly suppress noise interference and retain some areas with a higher probability of defects, after obtaining multiple adaptive sub-blocks of the grayscale image, adaptive local histogram equalization is performed on each adaptive sub-block to obtain the target grayscale image. Among them, adaptive local histogram equalization belongs to the existing technology and will not be repeated here.
[0046] Step S103: Perform edge detection on the target grayscale image to obtain at least two edge pixels. A gradient direction histogram is constructed based on the gradient direction of each edge pixel. The horizontal axis of the gradient direction histogram is the angle range of the gradient direction, and the vertical axis is the frequency of the gradient direction. Mask processing is performed on the target grayscale image based on the gradient direction with the highest frequency in the gradient direction histogram to obtain an image to be converted into the frequency domain.
[0047] By applying adaptive local equalization (ALHE) to the grayscale image in step S102, effective noise reduction and detail preservation are achieved. Analysis reveals that processes such as multi-layer, multi-pass welding and spiral welding result in periodic or wavy texture features in weld images, which also exhibit strong edge characteristics in grayscale images. This texture is identified as an abnormal defect by the adaptive local equalization process and retained, significantly interfering with the identification of common weld defects such as cracks and fissures.
[0048] Considering that the frequency and number of periodic textures in weld images are far greater than those of ductile defects such as cracks and fissures, and that the periodic textures have a strong distribution pattern and extend in the same direction but differently from the cracks, with periodic textures generally extending longitudinally while cracks typically extend transversely, the present invention performs edge detection on the target grayscale image and, based on the detected edge pixels, processes the target grayscale image using a masking technique to obtain the image to be converted to the frequency domain.
[0049] Specifically, the Canny, Sobel or Prewitt edge detection algorithm is used to extract the edge lines in the target grayscale image, and then the edge pixel points in the target grayscale image are obtained. The grayscale value of the edge pixel points in the target grayscale image is set to 1, and the grayscale value of the non-edge pixel points is set to 0 to obtain a binary grayscale image. The Sobel operator is used to calculate the gradient direction of each edge pixel point in the binary grayscale image, and then the gradient direction of each edge pixel point is quantized to a discrete angle interval. The embodiment of the present invention sets an angle interval of every 10 degrees, that is, the angle interval [0 degrees, 10 degrees], the angle interval [11 degrees, 20 degrees], ..., and so on, to obtain multiple angle intervals.
[0050] Afterwards, a gradient direction histogram is constructed based on the gradient direction of each edge pixel point, wherein the horizontal axis of the gradient direction histogram is the angle interval of the gradient direction, and the vertical axis is the frequency of the gradient direction. And the dominant direction is found in the gradient direction histogram, that is, the angle interval of the gradient direction with the highest frequency is obtained in the gradient direction histogram. The edge pixel points within the range of ±10° of the dominant direction are taken as periodic texture pixel points, wherein ±10° represents the allowable angle error range, which is not limited here. After the periodic texture pixel points are determined, in the target grayscale image, the grayscale value of the periodic texture pixel points is marked as 1, and the grayscale value of the non-periodic texture pixel points is marked as 0 to obtain a binary mask image, and the binary mask image is multiplied by the target grayscale image to obtain the image to be converted in the frequency domain, wherein the image to be converted in the frequency domain only contains the periodic texture part.
[0051] Step S104 , performing frequency domain conversion on the image to be frequency domain converted to obtain a frequency domain image, performing filtering processing and time domain conversion on the frequency domain image to obtain a denoised image, and using a neural network to identify defects in the denoised image.
[0052] In order to achieve the effect of frequency domain texture smoothing, first, the frequency domain image to be converted is converted to the frequency domain using the fast Fourier transform (FFT) to obtain a frequency domain image. The frequency domain image is then centered (low-frequency components are moved to the center and high-frequency components are moved to the periphery). The bright spots (frequency peaks) in the frequency domain image are observed. These bright spots correspond to the frequency components of the periodic texture, and the frequency range of the periodic texture (such as the main frequency and secondary frequency) is recorded. Then, based on the above frequency analysis results, the center frequency, bandwidth, and transition band of the band-stop filter are determined (for example, the center frequency is the main frequency of the periodic texture, and the bandwidth covers all periodic frequency components). A band-stop filter mask is generated in the frequency domain. The periodic frequency component area in the filter mask is 0 (filtered) and the other areas are 1 (retained). Finally, the band-stop filter mask is multiplied by the frequency domain image to filter out the periodic frequency components. The filtered frequency domain image is subjected to an inverse fast Fourier transform (IFFT) to obtain a time domain image. At this time, the periodic texture in the time domain image is suppressed, and the crack defect area is retained and enhanced. The time domain image is then used as the denoised image.
[0053] It should be noted that the above-mentioned frequency domain conversion and band-stop filter filtering belong to the existing technology and will not be described in detail here.
[0054] Since the denoised image is the best denoised and enhanced image, a deep learning model can be used to detect defects in the denoised image. Specifically, multiple frames of weld images with defect type labels are obtained, and the multiple frames of weld images are used as input to the neural network. The neural network is trained according to the label of each frame of weld image to obtain a trained neural network for defect recognition; the denoised image is input into the trained neural network, and the corresponding defect recognition result is output.
[0055] Among them, the general operation of using the trained neural network to identify defects in the denoised image is as follows: (1) Data collection: Identify the weld defect categories (such as cracks, pores, slag inclusions, and lack of fusion), and collect weld images for each type of defect. Image data can be obtained through industrial cameras, X-ray inspection equipment, or historical weld inspection reports. (2) Data annotation: Use tools such as LabelImg and CVAT to annotate the weld defect area and generate bounding boxes or pixel-level segmentation labels. (3) Data partitioning: Training set / validation set / test set: Divide the dataset in a ratio of 7:1:2 or 8:1:1 to ensure that the test set is independent of the training set. (4) CNN model design: Use classic architecture or custom architecture. Classic architectures include Faster R-CNN, YOLO, SSD, etc. to directly locate the defect location; custom architectures design lightweight CNNs based on defect characteristics (such as reducing the number of convolution layers and using depthwise separable convolutions), which are suitable for resource-constrained scenarios. (5) Model training and evaluation optimization: This step includes the selection of loss function, the setting of optimizer and learning rate strategy, the optimization of classification indicators, and the tuning of hyperparameters. This is an existing technology and will not be described in detail here. (6) Model deployment: including model export (format conversion and quantization compression) and deployment environment (edge device and cloud deployment). (7) Real-time detection process: denoised image acquisition, input of denoised image into the model, and output of classification results such as defect category and location.
[0056] It is worth noting that the use of deep learning models to detect defects in denoised images is an existing technology and will not be described in detail here.
[0057] Based on the same inventive concept as the above method, an embodiment of the present invention also provides an anti-collision beam weld defect detection system based on image processing, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, the steps of any one of the above-mentioned anti-collision beam weld defect detection methods based on image processing are implemented.
[0058] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.
Claims
1. The anti-collision beam weld defect detection method based on image processing is characterized in that: The method comprises: During the production process of the anti-collision beam, an image of the weld area of the produced anti-collision beam is collected to obtain a weld image, and the weld image is pre-processed to obtain a grayscale image; Performing initial block division on the grayscale image to obtain at least two initial sub-blocks, obtaining a local complexity index for each initial sub-block based on the gradient characteristics and grayscale value of each pixel in each initial sub-block, performing adaptive block division on the grayscale image based on the local complexity index of each initial sub-block to obtain at least two adaptive sub-blocks, and performing adaptive local histogram equalization on each adaptive sub-block to obtain a target grayscale image; Performing edge detection on the target grayscale image to obtain at least two edge pixels, constructing a gradient direction histogram based on the gradient direction of each edge pixel, wherein the horizontal axis of the gradient direction histogram represents the angle interval of the gradient direction and the vertical axis represents the frequency of the gradient direction, and performing masking on the target grayscale image based on the gradient direction with the highest frequency in the gradient direction histogram to obtain an image to be converted into the frequency domain; The image to be frequency-domain-converted is subjected to frequency-domain conversion to obtain a frequency-domain image, the frequency-domain image is subjected to filtering processing and time-domain conversion to obtain a denoised image, and defects in the denoised image are identified using a neural network.
2. The method for detecting weld defects of anti-collision beams based on image processing according to claim 1, characterized in that: The step of obtaining a local complexity index of each initial sub-block according to the gradient characteristics and the grayscale value of each pixel in each initial sub-block comprises: For any initial sub-block, obtain the gradient value and gradient direction of each pixel in the any initial sub-block, and obtain a gradient distribution chaos index of the any initial sub-block based on the distribution characteristics of the gradient value and gradient direction of each pixel in the any initial sub-block; Obtaining the grayscale value of each pixel in any of the initial sub-blocks to obtain a maximum grayscale value and a minimum grayscale value, and obtaining a grayscale distribution disorder index of any of the initial sub-blocks based on the maximum grayscale value, the minimum grayscale value, and the difference in grayscale values of all pixels; A local complexity index of any initial sub-block is obtained according to a mean value between the gradient distribution chaos index and the grayscale distribution chaos index of any initial sub-block.
3. The method for detecting weld defects of anti-collision beams based on image processing according to claim 2, characterized in that: The step of obtaining a gradient distribution disorder index of any initial sub-block according to distribution characteristics of a gradient value and a gradient direction of each pixel point in any initial sub-block includes: Calculating a mean gradient value of all pixels in any of the initial sub-blocks, normalizing a difference between a constant 1 and the mean gradient value to obtain a first normalized difference, calculating a standard deviation of the gradient direction of all pixels in any of the initial sub-blocks, normalizing a difference between the constant 1 and the standard deviation to obtain a second normalized difference; and performing a weighted summation of the first normalized difference and the second normalized difference to obtain a gradient distribution chaos index of any of the initial sub-blocks.
4. The method for detecting weld defects of anti-collision beams based on image processing according to claim 2, characterized in that: The obtaining of the grayscale distribution disorder index of any initial sub-block according to the maximum grayscale value, the minimum grayscale value, and the grayscale value difference of all pixels includes: Calculate the grayscale difference between the maximum grayscale value and the minimum grayscale value to obtain the grayscale value ratio between the grayscale difference and the maximum value in the grayscale value range; obtain the grayscale value variance of all pixels in any of the initial sub-blocks, calculate the subtraction value between a constant 1 and the grayscale value ratio, obtain the product of the subtraction value and the grayscale value variance, normalize the product, and obtain the grayscale distribution chaos index of any of the initial sub-blocks.
5. The method for detecting weld defects of anti-collision beams based on image processing according to claim 1, characterized in that: Adaptively dividing the grayscale image into blocks based on the local complexity index of each initial sub-block to obtain at least two adaptive sub-blocks includes: Obtaining a preset first local complexity threshold and a second local complexity threshold, where the first local complexity threshold is less than the second local complexity threshold; if the local complexity index of any initial sub-block is greater than the second local complexity threshold, splitting the initial sub-block into a preset number of target sub-blocks on average; if the local complexity index of any initial sub-block is less than the first local complexity threshold, merging the initial sub-block and the initial sub-blocks within its four neighborhoods into one target sub-block; and if the local complexity index of any initial sub-block is greater than or equal to the first local complexity threshold and less than or equal to the second local complexity threshold, using the initial sub-block as the target sub-block; Traversing all initial sub-blocks to obtain at least two target sub-blocks, obtaining a local complexity index of each target sub-block, and if the local complexity indexes of all target sub-blocks are greater than or equal to a first local complexity threshold and less than or equal to a second local complexity threshold, using all target sub-blocks as adaptive sub-blocks of the grayscale image; If there is any target sub-block whose local complexity index is greater than the second local complexity threshold or less than the first local complexity threshold, then any target sub-block is used as the initial sub-block, and the target sub-block acquisition method is repeated until the local complexity indicators of all target sub-blocks are greater than or equal to the first local complexity threshold and less than or equal to the second local complexity threshold, then all target sub-blocks are used as adaptive sub-blocks of the grayscale image.
6. The method for detecting weld defects of anti-collision beams based on image processing according to claim 1, characterized in that: The step of performing mask processing on the target grayscale image according to the gradient direction with the highest frequency in the gradient direction histogram to obtain the image to be converted into the frequency domain includes: The angle interval of the gradient direction with the highest frequency is obtained in the gradient direction histogram, and periodic texture pixels are obtained from all edge pixels in combination with the angle interval and the angle allowable error range. In the target grayscale image, the grayscale values of the periodic texture pixels are marked as 1, and the grayscale values of the non-periodic texture pixels are marked as 0 to obtain a binary mask image. The binary mask image is multiplied by the target grayscale image to obtain the image to be frequency domain converted.
7. The method for detecting weld defects of anti-collision beams based on image processing according to claim 1, characterized in that: The identifying defects in the denoised image using a neural network includes: Obtain multiple frames of weld images with defect type labels, use the multiple frames of weld images as input to the neural network, train the neural network based on the labels of each weld image frame, and obtain a trained neural network for defect recognition; The denoised image is input into a trained neural network, and the corresponding defect recognition result is output.
8. An anti-collision beam weld defect detection system based on image processing, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the anti-collision beam weld defect detection method based on image processing as described in any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Intelligent defect detection method for aero-engine parts based on machine vision
CN117522870A
Electric iron tower part defect detection method based on artificial intelligence
CN117952960A
Image segmentation method and device, medium and equipment
CN118587229A
Self-adaptive segmentation method for steel rail surface defect image
CN118799302A
Pipeline wall defect detection method and system based on image recognition
CN120374625A
Cited By
Contrast enhancement method for ultrasonic detection image of generator circuit breaker box
CN120876340A
A contrast enhancement method of generator circuit breaker tank ultrasonic detection image
CN120876340B
Welding seam defect detection method and system capable of resisting smog and strong light interference based on electric arc welding environment and medium
CN120912604A
Weld defect detection method and system resistant to strong light interference of smoke based on arc welding environment and medium
CN120912604B
Weld joint performance visual inspection method and system based on image processing
CN121095235A