Weld defect identification and area quantitative calculation method and system
Through the 32-channel array eddy current probe, signal acquisition and combination with adaptive filtering and sharpening processing, the shortcomings of existing eddy current detection technology in weld defect identification and area quantitative calculation are solved, and the accurate identification and area quantitative calculation of weld defects are realized, which improves the accuracy and reliability of detection.
Patent Information
- Application Number
- CN202510656558.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-21
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2045-05-21
AI Technical Summary
The existing eddy current detection technology has difficulty in dealing with complex morphology and multiple defect types, the inability to adaptively adjust the image enhancement algorithm, and the lack of effective quantitative calculation methods in terms of weld defect identification and area quantitative calculation, resulting in insufficient reliability and accuracy of the detection results.
The 32-channel array eddy current probe is used to collect signals, and through image mapping, adaptive filtering and sharpening processing, combined with adaptive nonlinear mapping functions and parameter optimization algorithms, weld defects are accurately identified and area quantitatively calculated.
It significantly improves the quality and detection accuracy of the weld vortex C scan image, improves the adaptability and robustness of weld defect recognition, provides a more objective image quality evaluation, and ensures the reliability of welding quality control.
Smart Images

Figure CN120374402A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to defect recognition technology, and in particular to a method and system for weld defect recognition and area quantitative calculation. Background Art
[0002] Weld defect recognition and area quantitative calculation are important links in ensuring welding quality in industrial production. Traditional weld detection methods mainly rely on manual visual inspection or simple non-destructive testing techniques, which often have problems such as low efficiency and low accuracy. With the development of industrial automation and intelligence, weld defect recognition methods based on eddy current testing technology have gradually attracted attention. Eddy current testing technology has the advantages of being non-destructive, fast, and highly sensitive, and can effectively detect defects on the surface and near the surface of the weld.
[0003] However, existing eddy current testing technology still has some deficiencies in weld defect recognition and area quantitative calculation. First, traditional eddy current signal processing methods are difficult to effectively process complex weld morphologies and various defect types, resulting in low reliability of the detection results. Second, existing image enhancement algorithms often use fixed parameters and cannot be adaptively adjusted according to different weld characteristics and defect types, which affects the accuracy of defect recognition. Finally, the lack of an effective quantitative calculation method makes it difficult to accurately evaluate the area and severity of defects, which is not conducive to the precise control and evaluation of welding quality.
[0004] To solve these problems, a new method that can adaptively process eddy current signals, optimize image enhancement parameters, and achieve precise defect recognition and area quantitative calculation needs to be developed. This method should be able to make full use of the advantages of multi-channel array eddy current probes, combined with advanced signal processing and image analysis technologies, to improve the accuracy and reliability of weld defect recognition and provide more powerful technical support for welding quality control in industrial production. Summary of the Invention
[0005] Embodiments of the present invention provide a method and system for weld defect recognition and area quantitative calculation, which can solve the problems in the prior art.
[0006] In the first aspect of the embodiments of the present invention, A method for weld defect recognition and area quantitative calculation is provided, including: Collect the scanning signals of a 32-channel array eddy current probe, map the row and column indices of the eddy current signal matrix to image coordinate positions, map the signal amplitude to the gray value, and determine the actual spacing of pixel points according to the encoder sampling interval and the adjacent channel spacing to generate the original weld eddy current C-scan image; based on the weld reinforcement, divide it by the horizontal and vertical pixel spacings respectively, round up and add one to determine the number of columns and rows of the filtering window, construct a rectangular filtering window matrix, move it point by point on the original weld eddy current C-scan image, and replace the original gray value of the point to be processed with the median value of the gray values sorted within the window-covered area to obtain the filtered image; Move point by point on the filtered image based on a third-order rectangular convolution kernel matrix, and combine an adaptive enhancement coefficient to update the gray value to obtain the sharpened image, and evaluate the enhancement effect using edge gain index and signal quality index; construct an adaptive non-linear mapping function based on the sharpened image, and perform normalization processing on the sharpened image to obtain the normalized image; randomly generate multiple parameter combinations within the preset parameter range to form an initial parameter population, substitute the parameter combinations in the initial parameter population into the adaptive non-linear mapping function to perform differential enhancement on the pixel points in the normalized image; Take the initial parameter population as the current iteration population, combine horizontal and vertical gradient operators to extract the features of the enhanced image, calculate the signal-to-noise ratio, edge intensity and image contrast, and perform weighted summation to obtain the fitness value, and realize the adaptive optimization of the weld eddy current C-scan image enhancement parameters through multiple iterations of optimization.
[0007] Collecting the scanning signals of a 32-channel array eddy current probe, mapping the row and column indices of the eddy current signal matrix to image coordinate positions, mapping the signal amplitude to the gray value, and determining the actual spacing of pixel points according to the encoder sampling interval and the adjacent channel spacing to generate the original weld eddy current C-scan image includes: Place the 32-channel array eddy current probe on the surface of the weld of the workpiece to be measured, where the linear array direction of the 32-channel array eddy current probe is perpendicular to the weld direction, and each channel of the 32-channel array eddy current probe includes an excitation coil and a detection coil, and the spacing between adjacent channels is fixedly set; Control the 32-channel array eddy current probe to scan along the weld direction, perform equal-space sampling through the scanning encoder of the 32-channel array eddy current probe, and obtain the amplitude of the eddy current impedance signal at each sampling position, where the sampling interval of the scanning encoder is preset as a fixed value, construct an eddy current signal matrix according to the amplitude of the eddy current impedance signal at the sampling position, the number of rows of the eddy current signal matrix corresponds to the number of sampling times, and the number of columns of the eddy current signal matrix corresponds to the number of channels of the 32-channel array eddy current probe; Determine the actual spacing of longitudinally adjacent pixel points in the weld array eddy current imaging image according to the sampling interval of the scanning encoder, and determine the actual spacing of laterally adjacent pixel points in the weld array eddy current imaging image according to the spacing between adjacent channels of the 32-channel array eddy current probe; Calculate the spatial resolution of the weld array eddy current imaging image in the longitudinal and transverse directions. The longitudinal spatial resolution is the reciprocal of the actual spacing between adjacent pixel points in the longitudinal direction, and the transverse spatial resolution is the reciprocal of the actual spacing between adjacent pixel points in the transverse direction; calibrate and verify the weld array eddy current imaging image according to the spatial resolution to ensure the correspondence between the pixel positions and the actual physical positions in the weld array eddy current imaging image, and generate the original weld eddy current C-scan image.
[0008] Based on the weld reinforcement divided by the transverse and longitudinal pixel spacings respectively, and adding one after rounding up, determine the number of columns and rows of the filtering window. Construct a rectangular filtering window matrix and move it point by point on the original weld eddy current C-scan image, and replace the original gray value of the point to be processed with the median value of the gray values sorted within the window-covered area to obtain the filtered image, including: Collect the maximum dimensions of the weld reinforcement in the length direction of the array probe and the weld direction. Divide the maximum dimension in the length direction of the array probe by the transverse pixel spacing to obtain the first quotient value, divide the maximum dimension in the weld direction by the longitudinal pixel spacing to obtain the second quotient value, add one after rounding up the first quotient value to obtain the number of columns of the filtering window, and add one after rounding up the second quotient value to obtain the number of rows of the filtering window; Construct a rectangular filtering window matrix according to the number of rows and columns of the filtering window. The number of rows of the rectangular filtering window matrix is the number of rows of the filtering window, and the number of columns of the rectangular filtering window matrix is the number of columns of the filtering window; Coincide the center position of the rectangular filtering window matrix with the position of the point to be processed in the gray value matrix of the original eddy current array C-scan image, and extract all the gray values within the coverage of the rectangular filtering window matrix to form a gray value set; Sort the gray values in the gray value set according to the numerical size to obtain an ordered gray value sequence, and replace the original gray value of the point to be processed with the median value of the ordered gray value sequence to obtain the updated gray value of the point to be processed; Move the rectangular filtering window matrix point by point along the gray value matrix of the original eddy current array C-scan image, and repeat the processes of gray value extraction, sorting, and replacement until all points in the gray value matrix of the original eddy current array C-scan image are updated, and obtain the filtered image based on the updated gray value matrix of the original eddy current array C-scan image.
[0009] Move a third-order rectangular convolution kernel matrix point by point on the filtered image, and combine with an adaptive enhancement coefficient to achieve gray value update to obtain the sharpened image. Evaluate the enhancement effect using the edge gain index and the signal quality index, including: Construct a third-order rectangular convolution kernel matrix, set the central element of the third-order rectangular convolution kernel matrix to negative eight, and the remaining eight elements to one. Coincide the center position of the third-order rectangular convolution kernel matrix with the position of the point to be processed in the gray value matrix of the eddy current array C-scan image after filtering; Extract the image gray values within the coverage of the third-order rectangular convolution kernel matrix to construct the original gray value matrix. Perform boundary extension on the original gray value matrix. When the extraction position is at the image boundary, fill the positions beyond the image range with the gray values at the image boundary to obtain the extended original gray value matrix. Perform convolution operation on the extended original gray value matrix and the third-order rectangular convolution kernel matrix to obtain the Laplacian operator response value of the current point to be processed. Calculate the ratio of the square of the Laplacian operator response value to the preset variance parameter, and multiply the negative exponent of the ratio by the preset basic enhancement intensity to obtain the adaptive enhancement coefficient. Subtract the product of the adaptive enhancement coefficient and the Laplacian operator response value from the original gray value to obtain the enhanced gray value, and replace the original gray value with the enhanced gray value. Move the third-order rectangular convolution kernel matrix point by point on the gray value matrix of the eddy current array C-scan image after filtering until all pixel points are processed to obtain the enhanced gray value matrix of the eddy current array C-scan image. Calculate the total sum of the edge gradient amplitudes of the enhanced gray value matrix of the eddy current array C-scan image and the gray value matrix of the eddy current array C-scan image after filtering respectively. Take the ratio of the total sum of the edge gradient amplitudes to the total sum of the edge gradient amplitudes before enhancement as the edge gain index; calculate the difference in signal-to-noise ratio before and after enhancement as the signal quality index, and evaluate the signal enhancement effect according to the edge gain index and the signal quality index.
[0010] Construct an adaptive non-linear mapping function based on the sharpened image, and perform normalization processing on the sharpened image to obtain the normalized image; randomly generate multiple parameter combinations within the preset parameter range to form an initial parameter population, and substitute the parameter combinations in the initial parameter population into the adaptive non-linear mapping function to perform differential enhancement on the pixel points in the normalized image, including: Obtain the gray value matrix of the welded joint eddy current C-scan image after sharpening processing, calculate the maximum gray value and the minimum gray value in the gray value matrix of the welded joint eddy current C-scan image, and subtract the minimum gray value from each pixel point in the gray value matrix of the welded joint eddy current C-scan image, multiply by 255, and then divide by the difference between the maximum gray value and the minimum gray value to obtain the normalized gray value matrix of the welded joint eddy current C-scan image. Calculate the arithmetic mean of the gray values of all pixel points in the normalized gray value matrix of the welded joint eddy current C-scan image to obtain the average gray value, and calculate the square root of the sum of the squares of the differences between the gray values of all pixel points in the normalized gray value matrix of the welded joint eddy current C-scan image and the average gray value to obtain the standard deviation. Multiply the ratio of the standard deviation to the average gray value by the first adjustment coefficient to obtain the non-linear curve shape parameter, and multiply the average gray value by the second adjustment coefficient to obtain the non-linear gray threshold parameter. Divide the pixel points in the gray value matrix of the normalized weld eddy current C-scan image whose gray values are less than or equal to the average gray value into the first type of pixel points, and divide the pixel points whose gray values are greater than the average gray value into the second type of pixel points; For the first type of pixel points, calculate the ratio of the absolute value of the difference between the gray value of each pixel point and the average gray value to the average gray value, add one after multiplying the ratio by the third adjustment coefficient, and then multiply the obtained result by the non-linear curve shape parameter to obtain the first enhancement coefficient; For the second type of pixel points, calculate the ratio of the absolute value of the difference between the gray value of each pixel point and the average gray value to the average gray value, add one after multiplying the ratio by the fourth adjustment coefficient, and then multiply the obtained result by the non-linear curve shape parameter to obtain the second enhancement coefficient; Use the non-linear mapping function to perform differential enhancement processing on the first type of pixel points and the second type of pixel points respectively.
[0011] Take the initial parameter population as the current iteration population, extract the features of the enhanced image by combining the horizontal and vertical gradient operators, calculate the signal-to-noise ratio, edge intensity and image contrast, and perform weighted summation to obtain the fitness value. The adaptive optimization of the weld eddy current C-scan image enhancement parameters is achieved through multiple iterations of optimization, including: Take the initial parameter population as the current iteration population; substitute the parameter combinations in the current iteration population into the non-linear transformation function to perform gray mapping on the weld eddy current C-scan image to obtain the enhanced image; construct a horizontal gradient operator and a vertical gradient operator to extract the edge features of the enhanced image in the horizontal and vertical directions respectively, and calculate the edge intensity value according to the edge features in the horizontal direction and the vertical direction; Calculate the signal-to-noise ratio of the enhanced image relative to the original image, and calculate the gray contrast of the enhanced image; multiply the edge intensity value, signal-to-noise ratio and gray contrast by the corresponding weight coefficients respectively and sum to obtain the fitness value of the current parameter combination; calculate the selection probability according to the fitness values of the parameter combinations in the current iteration population, and select some high-quality parameter combinations based on the selection probability to form an optimal population; randomly pair the parameter combinations in the optimal population, and linearly combine the paired parameters through a preset crossover coefficient to obtain the crossed parameters; add a random perturbation with a preset step size to the crossed parameters to perform parameter mutation to obtain the mutated parameters; Substitute the mutated parameters back into the non-linear transformation function for image enhancement and calculate the new fitness value; determine whether the preset number of iterations is reached or whether the optimal fitness value meets the preset conditions. If so, output the parameter combination with the highest current fitness value as the optimal enhancement parameter. If not, form a new current iteration population with the mutated parameters and continue to execute the parameter optimization process.
[0012] In the second aspect of the embodiments of the present invention, Provide a weld defect identification and area quantitative calculation system, including: The first unit is used to collect the scanning signals of a 32-channel array eddy current probe, map the row and column indexes of the eddy current signal matrix to image coordinate positions, map the signal amplitude to gray values, and determine the actual pixel spacing based on the encoder sampling interval and the adjacent channel spacing to generate the original weld eddy current C-scan image; based on the weld reinforcement, divide it by the horizontal and vertical pixel spacings respectively, round up and add one to determine the number of columns and rows of the filtering window, construct a rectangular filtering window matrix, move it point by point on the original weld eddy current C-scan image, and replace the original gray value of the point to be processed with the median value after sorting the gray values in the window-covered area to obtain the filtered image; The second unit is used to move point by point on the filtered image based on a third-order rectangular convolution kernel matrix, and combine an adaptive enhancement coefficient to update the gray values to obtain a sharpened image, and use edge gain indicators and signal quality indicators to evaluate the enhancement effect; construct an adaptive non-linear mapping function based on the sharpened image, and perform normalization processing on the sharpened image to obtain a normalized image; randomly generate multiple parameter combinations within a preset parameter range to form an initial parameter population, and substitute the parameter combinations in the initial parameter population into the adaptive non-linear mapping function to perform differential enhancement on the pixel points in the normalized image; The third unit is used to use the initial parameter population as the current iteration population, extract the features of the enhanced image in combination with horizontal and vertical gradient operators, calculate the signal-to-noise ratio, edge strength, and image contrast, and perform weighted summation to obtain the fitness value, and realize the adaptive optimization of the weld eddy current C-scan image enhancement parameters through multiple iterative optimizations.
[0013] In the third aspect of the embodiments of the present invention, A kind of electronic equipment is provided, including: A processor; A memory for storing instructions executable by the processor; Wherein, the processor is configured to call the instructions stored in the memory to execute the method described above.
[0014] In the fourth aspect of the embodiments of the present invention, A computer-readable storage medium is provided, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the method described above is realized.
[0015] The beneficial effects of this application are as follows: The weld defect recognition and area quantitative calculation method proposed by the present invention can effectively improve the quality of weld eddy current C-scan images. By using a multi-channel array probe to collect signals and perform image mapping, combined with adaptive filtering and sharpening processing, the clarity and contrast of the image can be significantly improved, laying a foundation for subsequent defect recognition.
[0016] This method adopts an adaptive non - linear mapping function and a parameter optimization algorithm to achieve automatic adjustment of image enhancement parameters. This adaptive optimization mechanism can flexibly adjust the enhancement effect according to the characteristics of different welds, effectively improving the adaptability and robustness of image processing.
[0017] The present invention constructs a comprehensive image quality evaluation system by comprehensively considering multiple indicators such as signal - to - noise ratio, edge strength, and image contrast. This multi - dimensional evaluation method can more objectively measure the image enhancement effect and provide a reliable guarantee for the accuracy of defect recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a schematic flowchart of the method for weld defect recognition and area quantitative calculation in an embodiment of the present invention; Figure 2 It is a logic block diagram of adaptive filtering processing based on weld reinforcement in an embodiment of the present invention; Figure 3 It is a logic diagram of weld eddy current C - scan image enhancement processing based on adaptive non - linear mapping in an embodiment of the present invention; Figure 4 It is a flowchart of weld eddy current C - scan image enhancement based on parameter population iterative optimization in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0019] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0020] The technical solutions of the present invention will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
[0021] Figure 1 It is a schematic flowchart of the method for weld defect recognition and area quantitative calculation in an embodiment of the present invention, as Figure 1 shown, the method includes: Collect the scanning signals of a 32-channel array eddy current probe, map the row and column indices of the eddy current signal matrix to image coordinate positions, map the signal amplitude to gray values, and determine the actual pixel spacing based on the encoder sampling interval and adjacent channel spacing to generate the original weld eddy current C-scan image; based on the weld reinforcement, divide it by the horizontal and vertical pixel spacings respectively, round up, and add one to determine the number of columns and rows of the filtering window, construct a rectangular filtering window matrix, move it point by point on the original weld eddy current C-scan image, and replace the original gray value of the point to be processed with the median value after sorting the gray values in the window-covered area to obtain the filtered image; Move point by point on the filtered image based on a third-order rectangular convolution kernel matrix, and combine an adaptive enhancement coefficient to update the gray values to obtain the sharpened image, and use the edge gain index and signal quality index to evaluate the enhancement effect; construct an adaptive non-linear mapping function based on the sharpened image, and perform normalization processing on the sharpened image to obtain the normalized image; randomly generate multiple parameter combinations within the preset parameter range to form an initial parameter population, substitute the parameter combinations in the initial parameter population into the adaptive non-linear mapping function to perform differential enhancement on the pixel points in the normalized image; Take the initial parameter population as the current iteration population, combine the horizontal and vertical gradient operators to extract the features of the enhanced image, calculate the signal-to-noise ratio, edge strength, and image contrast, and perform weighted summation to obtain the fitness value, and achieve the adaptive optimization of the weld eddy current C-scan image enhancement parameters through multiple iterative optimizations.
[0022] In an optional implementation manner, collecting the scanning signals of a 32-channel array eddy current probe, mapping the row and column indices of the eddy current signal matrix to image coordinate positions, mapping the signal amplitude to gray values, and determining the actual pixel spacing based on the encoder sampling interval and adjacent channel spacing to generate the original weld eddy current C-scan image includes: Place the 32-channel array eddy current probe on the surface of the weld of the workpiece to be measured, where the linear array direction of the 32-channel array eddy current probe is perpendicular to the weld direction, and each channel of the 32-channel array eddy current probe includes an excitation coil and a detection coil, and the spacing between adjacent channels is fixedly set; Control the 32-channel array eddy current probe to scan along the weld direction, perform equal-space sampling through the scanning encoder of the 32-channel array eddy current probe, and obtain the amplitude of the eddy current impedance signal at each sampling position, where the sampling interval of the scanning encoder is preset as a fixed value, construct an eddy current signal matrix based on the amplitude of the eddy current impedance signal at the sampling position, the number of rows of the eddy current signal matrix corresponds to the number of sampling times, and the number of columns of the eddy current signal matrix corresponds to the number of channels of the 32-channel array eddy current probe; Determine the actual spacing between adjacent pixels in the longitudinal direction in the weld array eddy current imaging image according to the sampling interval of the scanning encoder, and determine the actual spacing between adjacent pixels in the transverse direction in the weld array eddy current imaging image according to the spacing between adjacent channels of the thirty-two-channel array eddy current probe; The longitudinal and lateral spatial resolutions of the weld array eddy current imaging image are calculated, where the longitudinal spatial resolution is the reciprocal of the actual spacing between adjacent longitudinal pixels, and the lateral spatial resolution is the reciprocal of the actual spacing between adjacent lateral pixels. The weld array eddy current imaging image is calibrated and verified according to the spatial resolution to ensure the correspondence between the pixel position in the weld array eddy current imaging image and the actual physical position, and generate the weld eddy current C-scan original image.
[0023] The structure of the array eddy current probe adopts a linear arrangement of 32 channels, each channel consists of an excitation coil and a detection coil. The spacing between adjacent channels is precisely set to 2mm to ensure that the horizontal scanning coverage width reaches 62mm. When the probe is placed on the weld surface, the linear array direction must be perpendicular to the weld direction so that the probe can completely cover the weld and its heat affected zone.
[0024] A stepper motor is used to drive the probe to move at a constant speed along the weld direction, and the photoelectric encoder is used to trigger sampling. The encoder resolution is set to 1024 pulses / turn, and with a 30mm diameter encoder wheel, the sampling interval accuracy can be achieved to 0.092mm. To improve the signal-to-noise ratio, the sampling interval can be set to 0.5mm, that is, every 0.5mm movement triggers a full-channel signal acquisition.
[0025] The signal acquisition circuit adopts a multiplexing structure to stimulate and detect 32 channels in turn. The excitation signal uses a sine wave with a frequency of 100kHz and a peak-to-peak value of 5V. When the probe scans a certain position, the array eddy current instrument simultaneously collects eddy current impedance signals through 32 independent channels and extracts signal amplitude data. For example, for a weld area with a length of 200mm, if the sampling interval is set to 0.5mm, a total of 400 points are collected along the weld direction to generate a 400×32 eddy current signal matrix.
[0026] The row index of the eddy current signal matrix corresponds to the position coordinate of the probe along the weld direction, and the column index corresponds to the channel position coordinate perpendicular to the weld direction. For example, the element at position (100,15) in the matrix represents the signal amplitude detected by the 15th channel when the probe moves 50mm (i.e. 100×0.5mm) along the weld direction.
[0027] After the signal matrix is constructed, image coordinate mapping processing is performed. The row and column indices of the matrix are converted into the pixel coordinates of the image, and the signal amplitude is converted into a gray value. In specific implementation, first determine the maximum and minimum values in the signal matrix. For example, the measured maximum amplitude is 1.5V and the minimum amplitude is 0.2V. Then linearly map this range to the gray range of 0 - 255. The conversion formula can be expressed as: subtract the minimum amplitude of 0.2V from the signal amplitude, divide by the amplitude range of 1.3V, and finally multiply by 255 to obtain the corresponding gray value.
[0028] Determining the actual spacing of pixel points is a key step in image space calibration. The actual spacing between adjacent horizontal pixel points directly uses the spacing between adjacent channels of the probe, which is 2mm; the actual spacing between adjacent vertical pixel points uses the sampling interval of the encoder, which is 0.5mm. Based on these parameters, the spatial resolution of the weld array eddy current imaging image can be calculated: the vertical spatial resolution is 2 pixels / mm (the reciprocal of the 0.5mm spacing), and the horizontal spatial resolution is 0.5 pixels / mm (the reciprocal of the 2mm spacing).
[0029] To verify the accuracy of image calibration, reference points with known sizes can be pre-marked on the workpiece to be measured. For example, a standard square of 10mm×10mm is marked at the starting position of the weld. By comparing the pixel size (which should be 20×5 pixels) of this square in the imaging result with the actual size, it is checked whether the correspondence between the pixel position and the actual physical position is accurate.
[0030] A stainless steel weld with a length of 200mm and a width of 4mm is detected. After setting the above parameters, an eddy current signal matrix of 400×32 is obtained. After image processing, the imaging result clearly shows the weld contour and possible internal defects. For example, a region with significantly lower gray value is found at 75mm from the starting point of the weld, with a size of approximately 3mm×2mm, corresponding to the actual physical position of (75mm, 12mm). After subsequent verification, it is confirmed as a pore defect inside the weld.
[0031] Image post-processing can further improve the defect recognition ability. Applying median filtering to the original C-scan image can effectively suppress random noise, and the size of the filtering window is selected as 3×3 pixels. Contrast enhancement is achieved through gray histogram equalization, increasing the contrast between the defect region and the background region by about 30%, which is convenient for visual recognition.
[0032] In an alternative implementation, based on dividing the weld reinforcement by the horizontal and vertical pixel spacings respectively, and adding one after rounding up, determine the number of columns and rows of the filtering window. Construct a rectangular filtering window matrix and move it point by point on the original weld eddy current C-scan image, and replace the original gray value of the point to be processed with the median value after sorting the gray values in the window-covered area to obtain the filtered image, including: Collect the maximum dimensions of the weld reinforcement in the length direction of the array probe and the weld direction. Divide the maximum dimension in the length direction of the array probe by the horizontal pixel pitch to obtain a first quotient value, and divide the maximum dimension in the weld direction by the vertical pixel pitch to obtain a second quotient value. Round up the first quotient value and add one to obtain the number of columns of the filtering window, and round up the second quotient value and add one to obtain the number of rows of the filtering window; Construct a rectangular filtering window matrix according to the number of rows and columns of the filtering window. The number of rows of the rectangular filtering window matrix is the number of rows of the filtering window, and the number of columns of the rectangular filtering window matrix is the number of columns of the filtering window; Coincide the center position of the rectangular filtering window matrix with the position of the point to be processed in the gray value matrix of the original eddy current array C-scan image, and extract all the gray values within the coverage of the rectangular filtering window matrix to form a gray value set; Sort the gray values in the gray value set according to the numerical size to obtain an ordered gray value sequence, and replace the original gray value of the point to be processed with the median value of the ordered gray value sequence to obtain the updated gray value of the point to be processed; Move the rectangular filtering window matrix point by point along the gray value matrix of the original eddy current array C-scan image, and repeat the processes of gray value extraction, sorting, and replacement until all points in the gray value matrix of the original eddy current array C-scan image are updated, and obtain the filtered image based on the updated gray value matrix of the original eddy current array C-scan image.
[0033] Collect the maximum dimensions of the weld reinforcement in the length direction of the array probe and the weld direction. In practical applications, measure the weld reinforcement with a laser measuring instrument or other measuring equipment to obtain the maximum dimension values of the weld reinforcement in the length direction (horizontal) and the weld direction (vertical) of the array probe. For example, the maximum dimension of a certain weld reinforcement in the horizontal direction is 3.2 mm, and the maximum dimension in the vertical direction is 2.8 mm.
[0034] Determine the number of rows and columns of the filtering window. First, obtain the horizontal and vertical pixel pitches of the eddy current C-scan image. In this embodiment, the horizontal pixel pitch is 0.5 mm / pixel, and the vertical pixel pitch is 0.4 mm / pixel. Divide the maximum dimension of the weld reinforcement in the horizontal direction by the horizontal pixel pitch to obtain a first quotient value: 3.2 mm ÷ 0.5 mm / pixel = 6.4. Round up the quotient value and add one to obtain the number of columns of the filtering window: ceil(6.4)+1 = 7+1 = 8. Similarly, divide the maximum dimension of the weld reinforcement in the vertical direction by the vertical pixel pitch to obtain a second quotient value: 2.8 mm ÷ 0.4 mm / pixel = 7. Round up the quotient value and add one to obtain the number of rows of the filtering window: ceil(7)+1 = 7+1 = 8.
[0035] Construct a rectangular filtering window matrix according to the calculated number of rows and columns of the filtering window. In this embodiment, a rectangular filtering window matrix with 8 rows and 8 columns is constructed. This matrix can be represented as an 8×8 area for performing a moving filtering operation on the original eddy current C-scan image.
[0036] Align the center position of the rectangular filtering window matrix with the position of the point to be processed in the grayscale value matrix of the original eddy current array C-scan image. For example, for a pixel point with coordinates (50, 60) in the original image, align the center of the 8×8 filtering window matrix with this point. Since the center of the 8×8 matrix is between the 4th row and 4th column and the 5th row and 5th column, the area covered by the window is the area from (50 - 4, 60 - 4) to (50 + 3, 60 + 3) in the original image, that is, an 8×8 area from (46, 56) to (53, 63).
[0037] Extract all the grayscale values within the range covered by the rectangular filtering window matrix to form a grayscale value set. In this embodiment, extract the grayscale values of 64 pixel points in the above 8×8 area to form a grayscale value set. Suppose the extracted grayscale value set is {120, 125, 118, 130, 122,..., 128}, a total of 64 grayscale values.
[0038] Sort the grayscale values in the grayscale value set according to their numerical magnitudes to obtain an ordered grayscale value sequence. For example, after sorting the above grayscale value set, we get {105, 108, 110,..., 145, 148, 150}. Find the median value of the ordered grayscale value sequence. In this example, it is the average of the 32nd and 33rd values, assumed to be 124.
[0039] Replace the original grayscale value of the point to be processed with the median value of the ordered grayscale value sequence to obtain the updated grayscale value of the point to be processed. For example, update the grayscale value of the pixel point with coordinates (50, 60) in the original image to 124.
[0040] Move the rectangular filtering window matrix point by point along the grayscale value matrix of the original eddy current array C-scan image, and repeat the processes of grayscale value extraction, sorting, and replacement. For example, after processing the point (50, 60), move the filtering window to the point (50, 61) and repeat the above operations. And so on until all points in the grayscale value matrix of the original eddy current array C-scan image are updated.
[0041] For the edge region of the image, the filtering window may exceed the image range. In this case, it can be processed by means of edge filling, such as zero filling, mirror filling, or repeated filling, etc. In this embodiment, the mirror filling method is adopted, that is, mirror-copy the edge pixels along the edge to ensure that the filtering window always covers the valid area.
[0042] After processing all pixel points, a filtered image is obtained based on the updated eddy current array C-scan original image grayscale value matrix. Compared with the original image, the noise in the filtered image is effectively suppressed, and the weld features are clearer, which is beneficial to subsequent weld defect detection and analysis.
[0043] The experimental results show that for the eddy current C-scan images processed by this method, the signal-to-noise ratio is increased from the original 8.5 dB to 15.2 dB, and the weld defect detection accuracy is increased from 82% to 94.5%, effectively improving the reliability and accuracy of weld detection.
[0044] Figure 2 The following is the logic block diagram of the adaptive filtering process based on the weld reinforcement in the embodiments of the present invention: This picture shows a flowchart of image filtering processing, describing a complete median filtering algorithm processing process. The system obtains the maximum size data of the weld reinforcement as input. Subsequently, by calculating the filtering window size, where the number of columns is equal to the transverse size of the reinforcement divided by the transverse pixel pitch plus 1. Then, a rectangular filtering window matrix is constructed to ensure that the product of the number of rows and the number of columns meets the requirements. In the core processing step, the algorithm positions the window at the pixel point to be processed and extracts all grayscale values within the window coverage. These grayscale values are sorted and the median value is taken, and the grayscale value of the point to be processed is replaced with this median value. Then, the window moves to the next pixel point for repeated processing. This is an iterative process, controlled by the judgment condition of "whether all pixel points have been processed?". If not, it returns to the window positioning step for continued processing; if so, the filtered weld reinforcement scan image is output as the final result. This process clearly shows the application of median filtering in image processing, especially the specific implementation steps in weld reinforcement detection, reflecting the systematic and cyclic characteristics of digital image processing.
[0045] In an alternative embodiment, based on a third-order rectangular convolution kernel matrix, it moves point by point on the filtered image, and combines an adaptive enhancement coefficient to update the grayscale value to obtain a sharpened image. The evaluation of the enhancement effect using the edge gain index and the signal quality index includes: Construct a third-order rectangular convolution kernel matrix, set the central element of the third-order rectangular convolution kernel matrix to negative eight, and the remaining eight elements to one. Coincide the central position of the third-order rectangular convolution kernel matrix with the position of the point to be processed in the grayscale value matrix of the eddy current array C-scan image after filtering processing; Extract the image grayscale values within the coverage of the third-order rectangular convolution kernel matrix to construct an original grayscale value matrix, and perform boundary extension on the original grayscale value matrix. When the extraction position is at the image boundary, fill the position outside the image range with the grayscale value at the image boundary to obtain the extended original grayscale value matrix; Perform a convolution operation on the extended original grayscale value matrix and the third-order rectangular convolution kernel matrix to obtain the Laplacian operator response value of the current point to be processed. Calculate the ratio of the square of the Laplacian operator response value to the preset variance parameter, and multiply the negative exponential of the ratio by the preset basic enhancement intensity to obtain the adaptive enhancement coefficient; Subtract the product of the adaptive enhancement coefficient and the Laplacian operator response value from the original grayscale value to obtain the enhanced grayscale value, and replace the original grayscale value with the enhanced grayscale value; Move the third-order rectangular convolution kernel matrix point by point on the grayscale value matrix of the eddy current array C-scan image after filtering until all pixel points are processed to obtain the enhanced grayscale value matrix of the eddy current array C-scan image; Calculate the total edge gradient amplitude of the enhanced grayscale value matrix of the eddy current array C-scan image and the grayscale value matrix of the eddy current array C-scan image after filtering respectively, and take the ratio of the total edge gradient amplitude to the total edge gradient amplitude before enhancement as the edge gain index; Calculate the difference in signal-to-noise ratio before and after enhancement as the signal quality index, and evaluate the signal enhancement effect according to the edge gain index and the signal quality index.
[0046] Construct a third-order rectangular convolution kernel matrix. This matrix is a 3×3 matrix, with the central element set to -8 and the remaining eight elements all set to 1. For example, the third-order rectangular convolution kernel matrix can be expressed as: The element at the central position is -8, and the elements at the surrounding eight positions are all 1. This convolution kernel matrix is used to extract edge and detail information in the image.
[0047] Process the eddy current array C-scan image after filtering. Assume that the grayscale value matrix of the filtered image is a 256×256 matrix, and the grayscale value range is 0 - 255. During processing, the central position of the third-order rectangular convolution kernel matrix coincides with the position of the point to be processed in the image grayscale value matrix.
[0048] For each pixel point in the image, extract the grayscale values of the image within the coverage of the third-order rectangular convolution kernel matrix to construct the original grayscale value matrix. For example, for the pixel point located at the image coordinate (100, 100), extract the grayscale values within the 3×3 area centered on this point to form the original grayscale value matrix.
[0049] When the processed pixel point is located at the image boundary, boundary extension processing is required. For example, for the pixel point located at the upper left corner coordinate (0, 0) of the image, its left side, upper side, and upper left corner positions are outside the image range, and in this case, the grayscale value at the image boundary is used for filling. Specifically, if the pixel point is located at the left boundary, set the pixel value on its left side to the boundary value of the column where this point is located; if the pixel point is located at the upper boundary, set the pixel value on its upper side to the boundary value of the row where this point is located; if the pixel point is located at the upper left corner, set the pixel value at the upper left corner to the grayscale value of this point.
[0050] For the extended original grayscale value matrix, perform a convolution operation with a third-order rectangular convolution kernel matrix to obtain the Laplacian operator response value of the current point to be processed. The specific operation is to multiply each element in the original grayscale value matrix by the corresponding element in the convolution kernel matrix, and then sum all the products. For example, assume that the grayscale values in the 3×3 neighborhood of a certain point are: 120, 125, 130, 118, 122, 127, 115, 120, 125. After performing the convolution operation with the convolution kernel matrix, the Laplacian operator response value obtained is: 1×120 + 1×125 + 1×130 + 1×118 + (-8)×122 + 1×127 + 1×115 + 1×120 + 1×125 - 8×122 = 980 - 976 = 4.
[0051] Calculate the adaptive enhancement coefficient. First, calculate the ratio of the square of the Laplacian operator response value to the preset variance parameter. The preset variance parameter can be set to 25. For the above example, the square of the Laplacian operator response value is 16, and the ratio to the preset variance parameter is 16 / 25 = 0.64. Take the negative exponent of this ratio to get e^(-0.64) ≈ 0.527, and then multiply it by the preset base enhancement intensity to obtain the adaptive enhancement coefficient. The preset base enhancement intensity can be set to 0.8, so the adaptive enhancement coefficient is 0.8×0.527 ≈ 0.422.
[0052] Subtract the product of the adaptive enhancement coefficient and the Laplacian operator response value from the original grayscale value to obtain the enhanced grayscale value. For the above example, the product of the adaptive enhancement coefficient and the Laplacian operator response value is 0.422×4 ≈ 1.688, and the original grayscale value is 122. Then the enhanced grayscale value is 122 - 1.688 ≈ 120.312, and after rounding, it is 120.
[0053] Move the third-order rectangular convolution kernel matrix point by point on the grayscale value matrix of the eddy current array C-scan image after filtering, and repeat the above steps until all pixel points are processed to obtain the enhanced grayscale value matrix of the eddy current array C-scan image.
[0054] Evaluate the signal enhancement effect. First, calculate the edge gain index, which is the ratio of the sum of the edge gradient amplitudes of the enhanced image to that of the filtered image. The edge gradient amplitude can be calculated by the Sobel operator. For example, for the filtered image, the sum of the edge gradient amplitudes is 25000, and for the enhanced image, the sum of the edge gradient amplitudes is 35000. Then the edge gain index is 35000 / 25000 = 1.4, indicating that the edge is enhanced by 40%.
[0055] Calculate the signal quality index, which is the difference in signal-to-noise ratio before and after enhancement. Assume that the signal-to-noise ratio of the image after filtering is 15 dB, and the signal-to-noise ratio of the enhanced image is 17 dB. Then the signal quality index is 17 - 15 = 2 dB, indicating that the signal-to-noise ratio has increased by 2 dB.
[0056] Through the comprehensive evaluation of the edge gain index and the signal quality index, the image enhancement effect can be objectively evaluated. In practical applications, the preset variance parameter and the preset basic enhancement intensity can be adjusted according to specific requirements to obtain the best enhancement effect. Experiments show that when the preset variance parameter is 25 and the preset basic enhancement intensity is 0.8, for typical eddy current array C-scan images, good enhancement effects with an edge gain index of about 1.35 - 1.45 and a signal quality index of about 1.8 - 2.2 dB can be obtained.
[0057] In an alternative embodiment, an adaptive non-linear mapping function is constructed based on the sharpened image, and the sharpened image is normalized to obtain a normalized image; a plurality of parameter combinations are randomly generated within a preset parameter range to form an initial parameter population, and substituting the parameter combinations in the initial parameter population into the adaptive non-linear mapping function to perform differential enhancement on the pixel points in the normalized image includes: Obtain the gray value matrix of the weld eddy current C-scan image after sharpening, calculate the maximum gray value and the minimum gray value in the gray value matrix of the weld eddy current C-scan image, and divide the product of subtracting the minimum gray value from each pixel point gray value in the gray value matrix of the weld eddy current C-scan image by 255 and then divide by the difference between the maximum gray value and the minimum gray value to obtain the normalized gray value matrix of the weld eddy current C-scan image; Calculate the arithmetic mean of all pixel point gray values in the normalized gray value matrix of the weld eddy current C-scan image to obtain the average gray value, and calculate the square root of the sum of the squares of the differences between all pixel point gray values and the average gray value in the normalized gray value matrix of the weld eddy current C-scan image to obtain the standard deviation; Multiply the ratio of the standard deviation to the average gray value by the first adjustment coefficient to obtain the non-linear curve shape parameter, and multiply the average gray value by the second adjustment coefficient to obtain the non-linear gray threshold parameter; Divide the pixel points in the normalized gray value matrix of the weld eddy current C-scan image with gray values less than or equal to the average gray value into the first type of pixel points, and divide the pixel points with gray values greater than the average gray value into the second type of pixel points; For the first type of pixel points, calculate the ratio of the absolute value of the difference between each pixel point gray value and the average gray value to the average gray value, add 1 after multiplying the ratio by the third adjustment coefficient, and then multiply the obtained result by the non-linear curve shape parameter to obtain the first enhancement coefficient; For the second type of pixel points, calculate the ratio of the absolute value of the difference between the grayscale value of each pixel point and the average grayscale value to the average grayscale value, add one after multiplying the ratio by the fourth adjustment coefficient, and then multiply the obtained result by the non-linear curve shape parameter to obtain the second enhancement coefficient; use a non-linear mapping function to perform differential enhancement processing on the first type of pixel points and the second type of pixel points respectively.
[0058] Sharpening processing can adopt methods such as the Laplace operator or high-pass filtering to enhance the edge and detail information in the image. For example, perform a convolution operation on the original image using a 3×3 Laplace operator to obtain the sharpened weld eddy current C-scan image.
[0059] Obtain the grayscale value matrix of the sharpened weld eddy current C-scan image. Assume that the maximum grayscale value in this matrix is 220 and the minimum grayscale value is 30. For the grayscale value of each pixel point in the matrix, subtract the minimum grayscale value of 30, multiply by 255, and then divide by the difference between the maximum grayscale value and the minimum grayscale value of 190 to obtain the normalized grayscale value matrix of the weld eddy current C-scan image. For example, for a pixel point with an original grayscale value of 125, the normalized grayscale value is (125 - 30)×255÷190 = 127.5, and rounding it gives 128.
[0060] Calculate the arithmetic mean of the grayscale values of all pixel points in the normalized grayscale value matrix of the weld eddy current C-scan image to obtain the average grayscale value. Assume that the calculated average grayscale value is 120. Calculate the square root of the sum of the squares of the differences between the grayscale values of all pixel points in the normalized grayscale value matrix of the weld eddy current C-scan image and the average grayscale value to obtain the standard deviation. Assume that the calculated standard deviation is 45.
[0061] Based on the calculated statistical features, construct the parameters of the adaptive non-linear mapping function. Multiply the ratio of the standard deviation to the average grayscale value by the first adjustment coefficient to obtain the non-linear curve shape parameter. For example, the ratio of the standard deviation to the average grayscale value is 45÷120 = 0.375, and the first adjustment coefficient is set to 2.5, then the non-linear curve shape parameter is 0.375×2.5 = 0.9375. Multiply the average grayscale value by the second adjustment coefficient to obtain the non-linear grayscale threshold parameter. For example, the second adjustment coefficient is set to 1.2, then the non-linear grayscale threshold parameter is 120×1.2 = 144.
[0062] Divide the pixel points into two categories according to the average grayscale value. Divide the pixel points in the normalized grayscale value matrix of the weld eddy current C-scan image whose grayscale values are less than or equal to the average grayscale value of 120 into the first type of pixel points, and divide the pixel points whose grayscale values are greater than the average grayscale value of 120 into the second type of pixel points.
[0063] For the first type of pixel points, calculate the enhancement coefficient for each pixel point. For example, for the first type of pixel point with a gray value of 80, calculate the ratio of the absolute value of the difference between it and the average gray value to the average gray value: |80 - 120| ÷ 120 = 0.333. Multiply this ratio by the third adjustment coefficient 1.8 and then add 1 to get 1.6. Then multiply this value by the non-linear curve shape parameter 0.9375 to obtain the first enhancement coefficient 1.5.
[0064] For the second type of pixel points, calculate the enhancement coefficient for each pixel point in the same way. For example, for the second type of pixel point with a gray value of 180, calculate the ratio of the absolute value of the difference between it and the average gray value to the average gray value: |180 - 120| ÷ 120 = 0.5. Multiply this ratio by the fourth adjustment coefficient 2.2 and then add 1 to get 2.1. Then multiply this value by the non-linear curve shape parameter 0.9375 to obtain the second enhancement coefficient 1.97.
[0065] Use the non-linear mapping function to perform differential enhancement processing on the first type of pixel points and the second type of pixel points respectively. For the first type of pixel points, use the non-linear mapping function for enhancement processing. For example, for the first type of pixel point with a gray value of 80, its enhanced gray value can be obtained by multiplying the original gray value by the first enhancement coefficient 1.5: 80 × 1.5 = 120. If the enhanced gray value exceeds 255, then take 255. For the second type of pixel points, use the non-linear mapping function for enhancement processing in the same way. For example, for the second type of pixel point with a gray value of 180, its enhanced gray value can be obtained by multiplying the original gray value by the second enhancement coefficient 1.97: 180 × 1.97 = 354.6. Since it exceeds 255, take 255.
[0066] Randomly generate multiple parameter combinations within the preset parameter range to form an initial parameter population. For example, the range of the first adjustment coefficient is [1.5, 3.0], the range of the second adjustment coefficient is [0.8, 1.5], the range of the third adjustment coefficient is [1.0, 2.5], and the range of the fourth adjustment coefficient is [1.5, 3.0]. Randomly generate 20 groups of parameter combinations, each group containing four adjustment coefficients. Substitute these parameter combinations into the adaptive non-linear mapping function to perform differential enhancement on the pixel points in the normalized image, and obtain 20 enhanced images.
[0067] By comparing and analyzing the quality of these 20 enhanced images, select the best parameter combination. The image quality can be evaluated using indicators such as contrast, sharpness, and signal-to-noise ratio. For example, select the image with the highest contrast and moderate signal-to-noise ratio as the final enhancement result.
[0068] Figure 3 This is the logic diagram of the weld eddy current C-scan image enhancement processing based on the adaptive non-linear mapping in the embodiment of the present invention: This figure shows a flow chart of differential enhancement processing for a weld current flow image, describing a complete image enhancement algorithm process. The system acquires the digitized weld current flow scan image. Subsequently, preliminary processing is carried out, including calculating the maximum and minimum gray values of the image and performing normalization to make the gray value distribution more uniform. Then, the average gray value and standard deviation of the normalized image are calculated, and these parameters will be used for subsequent image enhancement processing. In the core part of the processing, the system calculates the non-linear curve shape parameter and non-linear gray value adjustment parameter. Based on the average gray value, the pixel points are divided into two categories: the first category is those less than or equal to the average gray value, and the second category is those greater than the average gray value. Different processing is performed on these two categories of pixels respectively: calculating their respective enhancement coefficients (based on the gray difference value and the second adjustment coefficient), and then applying the non-linear mapping function respectively. The processing results of the two categories are combined to obtain the differentially enhanced image, and the final weld current flow scan image is output. This processing flow fully considers the characteristics of different regions of the image, and improves the overall quality and detail performance of the image through differential processing. The whole process reflects the systematic and targeted characteristics of image enhancement processing, and is particularly suitable for industrial application scenarios such as weld detection.
[0069] In an alternative implementation, taking the initial parameter population as the current iteration population, combining horizontal and vertical gradient operators to extract the features of the enhanced image, calculating the signal-to-noise ratio, edge intensity and image contrast, and performing weighted summation to obtain the fitness value, the adaptive optimization of the weld eddy current C-scan image enhancement parameters is achieved through multiple iterations of optimization, including: Taking the initial parameter population as the current iteration population; substituting the parameter combinations in the current iteration population into the non-linear transformation function to perform gray mapping on the weld eddy current C-scan image to obtain the enhanced image; constructing a horizontal gradient operator and a vertical gradient operator to extract the edge features of the enhanced image in the horizontal and vertical directions respectively, and calculating the edge intensity value according to the edge features in the horizontal direction and the edge features in the vertical direction; Calculating the signal-to-noise ratio of the enhanced image relative to the original image, and calculating the gray contrast of the enhanced image; multiplying the edge intensity value, signal-to-noise ratio and gray contrast by the corresponding weight coefficients respectively and summing them to obtain the fitness value of the current parameter combination; calculating the selection probability according to the fitness values of the parameter combinations in the current iteration population, and selecting some high-quality parameter combinations based on the selection probability to form an optimized population; randomly pairing the parameter combinations in the optimized population, and linearly combining the paired parameters through a preset crossover coefficient to obtain the crossed parameters; adding a random perturbation with a preset step size to the crossed parameters to perform parameter mutation to obtain the mutated parameters; Substitute the mutated parameters back into the non - linear transformation function for image enhancement and calculate the new fitness value; determine whether the preset number of iterations is reached or whether the optimal fitness value meets the preset conditions. If so, output the parameter combination with the highest fitness value at present as the optimal enhancement parameter. If not, form a new current iteration population with the mutated parameters and continue to execute the parameter optimization process.
[0070] Generate an initial parameter population as the current iteration population. Multiple groups of parameter combinations can be randomly generated, and each group contains the parameters of the non - linear transformation function. For example, 100 groups of parameters can be generated, and each group contains 4 parameters a, b, c, d, with value ranges of [0.1, 2], [0, 255], [0, 255], [0.1, 10] respectively.
[0071] Substitute each group of parameters in the current iteration population into the non - linear transformation function, perform gray - level mapping on the original weld eddy current C - scan image, and obtain the enhanced image. The non - linear transformation function can adopt the S - type function, and its specific form is: y = 255 / (1+(x / b)^(-a)) - c, where x is the gray - level value of the original image, y is the mapped gray - level value, and a, b, c are the parameters to be optimized. For a 256×256 - sized original image, gray - level mapping is performed pixel - by - pixel to obtain the enhanced image.
[0072] Construct a horizontal gradient operator and a vertical gradient operator, and extract the edge features of the enhanced image in the horizontal and vertical directions respectively. The horizontal gradient operator can adopt a one - dimensional convolution kernel of [-1, 0, 1], and the vertical gradient operator can adopt a one - dimensional convolution kernel of [-1; 0; 1]. Perform convolution operations on the enhanced image to obtain the horizontal gradient image Gx and the vertical gradient image Gy.
[0073] Calculate the edge intensity value according to the horizontal gradient image Gx and the vertical gradient image Gy. The gradient magnitude can be used as a measure of the edge intensity. That is, for each pixel point (i, j) in the image, its edge intensity E(i, j) is equal to the square root of the sum of the squares of the horizontal gradient Gx(i, j) and the vertical gradient Gy(i, j). Then, average the edge intensities of all pixel points to obtain the average edge intensity value E_avg of the entire image.
[0074] Calculate the signal - to - noise ratio of the enhanced image relative to the original image. The peak signal - to - noise ratio (PSNR) can be used as a measure. The specific calculation method is: first calculate the mean squared error MSE, that is, the sum of the squares of the differences between the corresponding pixel gray - level values of the original image and the enhanced image divided by the total number of pixels; then calculate PSNR = 10 * log10(255^2 / MSE).
[0075] Calculate the grayscale contrast of the enhanced image. RMS contrast can be used as a metric, that is, the standard deviation of the grayscale values of all pixels in the image divided by the average grayscale value. When calculating specifically, first find the average grayscale value μ of the image, then calculate the sum of the squares of the difference between the grayscale value of each pixel and μ, divide it by the total number of pixels and take the square root, and finally divide it by μ to get the RMS contrast.
[0076] The edge intensity value E_avg, signal-to-noise ratio PSNR and grayscale contrast RMS are respectively multiplied by the preset weight coefficients w1, w2, and w3 and summed to obtain the fitness value F of the current parameter combination. The weight coefficients can be adjusted according to actual needs, for example, w1=0.4, w2=0.3, and w3=0.3.
[0077] The selection probability is calculated based on the fitness value of each parameter combination in the current iteration population. The roulette selection method can be used, that is, the fitness value of each parameter combination is divided by the sum of all fitness values to obtain the probability of the parameter combination being selected.
[0078] Based on the selection probability, select some high-quality parameter combinations to form the preferred population. Random number generation can be used to generate a random number between [0,1]. If it is less than the selection probability of a certain parameter combination, the combination is selected. Repeat this process until a preset number of parameter combinations are selected, for example, 50 sets of parameters are selected to form the preferred population.
[0079] Randomly pair the parameter combinations in the preferred population. 50 groups of parameters can be randomly sorted, and then two adjacent groups of parameters are paired to obtain 25 pairs of parameter combinations.
[0080] The paired parameters are linearly combined by preset cross coefficients to obtain the crossover parameters. The cross coefficient α can be set to 0.5. For the paired parameter combinations (a1, b1, c1, d1) and (a2, b2, c2, d2), new parameter combinations (0.5a1+0.5a2, 0.5b1+0.5b2, 0.5c1+0.5c2, 0.5d1+0.5d2) are obtained after crossover.
[0081] Add a random perturbation with a preset step size to the crossover parameters to perform parameter mutation. You can set the step size β=0.1, add a random number in the range of [-0.1, 0.1] to each parameter after the crossover, and get the mutated parameter. It should be noted that the parameter value should be kept within the valid range.
[0082] Substitute the mutated parameters back into the nonlinear transformation function for image enhancement, and calculate the new fitness value according to the above method.
[0083] Determine whether the preset number of iterations is reached or whether the optimal fitness value meets the preset conditions. The maximum number of iterations can be set to 100, or the fitness value threshold can be set to 0.9. If the maximum number of iterations is reached or the optimal fitness value exceeds the threshold, output the parameter combination with the highest fitness value at present as the optimal enhancement parameter; otherwise, form a new current iteration population with the mutated parameters and continue to execute the parameter optimization process.
[0084] Through the above steps, the adaptive optimization of the weld eddy current C-scan image enhancement parameters can be realized. This method can automatically find the optimal image enhancement parameters according to indicators such as the edge features, signal-to-noise ratio, and contrast of the image, and improve the quality and recognizability of the weld eddy current C-scan image. In practical applications, various parameters and weight coefficients can be adjusted according to specific requirements to obtain the best enhancement effect.
[0085] Figure 4 The following is the flowchart of the weld eddy current C-scan image enhancement based on parameter population iterative optimization in the embodiment of the present invention: This picture shows the flowchart of a genetic algorithm for parameter optimization, which describes a complete adaptive optimization process. Perform the initialization process of the population to establish the initial parameter group. Subsequently, set the current iteration population, which is the starting point of iterative optimization. In the core processing link, the system applies the parameter combination for non-linear transformation to obtain the enhanced image. Then, apply the horizontal and vertical gradient operators to extract the edge features of the image and calculate the edge intensity. The algorithm continues to calculate the signal-to-noise ratio and gray contrast, and calculates the fitness value based on this. Based on these fitness values, the system calculates the selection probability and selects high-quality parameter combinations to form the preferred population. Perform parameter crossover operations on these preferred populations to generate new parameters through linear combination. Then add random perturbations to the crossed parameters to achieve parameter mutation and obtain the mutated parameters. The system will determine whether the preset number of iterations is reached or the fitness condition is met. If the condition is not met, return to the step of setting the current iteration population to continue optimization; if the condition is met, output the optimal enhancement parameter combination as the final result. This process reflects the application of the genetic algorithm in the parameter optimization of image processing. By continuously iterating and optimizing, the best parameter combination is found to achieve the optimal effect of image enhancement. The whole process demonstrates the ingenious application of the biological evolution theory in computer algorithms, with strong self-adaptability and optimization ability.
[0086] In the second aspect of the embodiment of the present invention, A weld defect recognition and area quantitative calculation system is provided, including: The first unit is used to collect the scanning signals of a 32-channel array eddy current probe, map the row and column indices of the eddy current signal matrix to image coordinate positions, map the signal amplitude to gray values, and determine the actual pixel spacing based on the encoder sampling interval and the adjacent channel spacing to generate the original weld eddy current C-scan image; based on the weld reinforcement, divide it by the horizontal and vertical pixel spacings respectively, round up and add one to determine the number of columns and rows of the filtering window, construct a rectangular filtering window matrix, move it point by point on the original weld eddy current C-scan image, and replace the original gray value of the point to be processed with the median value after sorting the gray values in the window-covered area to obtain the filtered image; The second unit is used to move point by point on the filtered image based on a third-order rectangular convolution kernel matrix, and combine an adaptive enhancement coefficient to update the gray values to obtain a sharpened image, and evaluate the enhancement effect using edge gain indicators and signal quality indicators; construct an adaptive non-linear mapping function based on the sharpened image, and perform normalization processing on the sharpened image to obtain a normalized image; randomly generate multiple parameter combinations within a preset parameter range to form an initial parameter population, and substitute the parameter combinations in the initial parameter population into the adaptive non-linear mapping function to perform differential enhancement on the pixel points in the normalized image; The third unit is used to take the initial parameter population as the current iteration population, extract the features of the enhanced image by combining horizontal and vertical gradient operators, calculate the signal-to-noise ratio, edge intensity, and image contrast, and perform weighted summation to obtain the fitness value, and realize the adaptive optimization of the weld eddy current C-scan image enhancement parameters through multiple iterative optimizations.
[0087] In the third aspect of the embodiments of the present invention, A kind of electronic device is provided, including: A processor; A memory for storing instructions executable by the processor; Wherein, the processor is configured to call the instructions stored in the memory to execute the method described above.
[0088] In the fourth aspect of the embodiments of the present invention, A computer-readable storage medium is provided, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the method described above is implemented.
[0089] The present invention can be a method, device, system, and / or computer program product. The computer program product can include a computer-readable storage medium, on which computer-readable program instructions for executing various aspects of the present invention are uploaded.
[0090] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for weld defect identification and area quantitative calculation, characterized in that, Including: Collect the scanning signals of a thirty-two-channel array eddy current probe, map the row and column indices of the eddy current signal matrix to image coordinate positions, map the signal amplitude to gray values, and determine the actual spacing of pixel points according to the encoder sampling interval and the adjacent channel spacing to generate the original weld eddy current C-scan image; Based on the weld reinforcement, divide it by the horizontal and vertical pixel spacings respectively, round up and add one to determine the number of columns and rows of the filtering window, construct a rectangular filtering window matrix, move it point by point on the original weld eddy current C-scan image, and replace the original gray value of the point to be processed with the median value after sorting the gray values in the window-covered area to obtain the filtered image; Move point by point on the filtered image based on a third-order rectangular convolution kernel matrix, and combine with an adaptive enhancement coefficient to update the gray values to obtain the sharpened image, and use the edge gain index and signal quality index to evaluate the enhancement effect; Based on the sharpened image, construct an adaptive non-linear mapping function, and perform normalization processing on the sharpened image to obtain the normalized image; Randomly generate multiple parameter combinations within the preset parameter range to form an initial parameter population, substitute the parameter combinations in the initial parameter population into the adaptive non-linear mapping function to perform differential enhancement on the pixel points in the normalized image; Take the initial parameter population as the current iteration population, combine the horizontal and vertical gradient operators to extract the features of the enhanced image, calculate the signal-to-noise ratio, edge intensity and image contrast, and perform weighted summation to obtain the fitness value, and realize the adaptive optimization of the weld eddy current C-scan image enhancement parameters through multiple iterative optimizations.
2. The method according to claim 1, wherein Collecting the scanning signals of a thirty-two-channel array eddy current probe, mapping the row and column indices of the eddy current signal matrix to image coordinate positions, mapping the signal amplitude to gray values, and determining the actual spacing of pixel points according to the encoder sampling interval and the adjacent channel spacing to generate the original weld eddy current C-scan image includes: Place the thirty-two-channel array eddy current probe on the surface of the weld of the workpiece to be measured, where the linear array direction of the thirty-two-channel array eddy current probe is perpendicular to the weld direction, and each channel of the thirty-two-channel array eddy current probe includes an excitation coil and a detection coil, and the spacing between adjacent channels is fixedly set; Control the thirty-two-channel array eddy current probe to scan along the weld direction, perform equal-space sampling through the scanning encoder of the thirty-two-channel array eddy current probe, and obtain the amplitude of the eddy current impedance signal at each sampling position, where the sampling interval of the scanning encoder is preset as a fixed value, and construct an eddy current signal matrix according to the amplitude of the eddy current impedance signal at the sampling position. The number of rows of the eddy current signal matrix corresponds to the number of sampling times, and the number of columns of the eddy current signal matrix corresponds to the number of channels of the thirty-two-channel array eddy current probe; Determine the actual spacing of longitudinally adjacent pixel points in the weld array eddy current imaging image according to the sampling interval of the scanning encoder, and determine the actual spacing of laterally adjacent pixel points in the weld array eddy current imaging image according to the spacing between adjacent channels of the thirty-two-channel array eddy current probe; Calculate the spatial resolution of the eddy current imaging image of the weld array in the longitudinal and transverse directions. The spatial resolution in the longitudinal direction is the reciprocal of the actual spacing between adjacent pixels in the longitudinal direction, and the spatial resolution in the transverse direction is the reciprocal of the actual spacing between adjacent pixels in the transverse direction. Calibrate and verify the eddy current imaging image of the weld array according to the spatial resolution to ensure the correspondence between the pixel positions and the actual physical positions in the eddy current imaging image of the weld array, and generate the original C-scan image of the weld eddy current.
3. The method according to claim 1, wherein Based on the weld reinforcement divided by the pixel spacing in the transverse and longitudinal directions respectively, and adding one after rounding up, determine the number of columns and rows of the filtering window. Construct a rectangular filtering window matrix and move it point by point on the original C-scan image of the weld eddy current, and replace the original gray value of the point to be processed with the median value after sorting the gray values in the covered area of the window to obtain the filtered image, including: Collect the maximum dimensions of the weld reinforcement in the length direction of the array probe and the weld direction. Divide the maximum dimension in the length direction of the array probe by the pixel spacing in the transverse direction to obtain the first quotient value, divide the maximum dimension in the weld direction by the pixel spacing in the longitudinal direction to obtain the second quotient value, add one after rounding up the first quotient value to obtain the number of columns of the filtering window, and add one after rounding up the second quotient value to obtain the number of rows of the filtering window. Construct a rectangular filtering window matrix according to the number of rows and columns of the filtering window. The number of rows of the rectangular filtering window matrix is the number of rows of the filtering window, and the number of columns of the rectangular filtering window matrix is the number of columns of the filtering window. Coincide the center position of the rectangular filtering window matrix with the position of the point to be processed in the gray value matrix of the original C-scan image of the eddy current array, and extract all the gray values within the coverage of the rectangular filtering window matrix to form a gray value set. Sort the gray values in the gray value set according to the numerical size to obtain an ordered gray value sequence, and replace the original gray value of the point to be processed with the median value of the ordered gray value sequence to obtain the updated gray value of the point to be processed. Move the rectangular filtering window matrix point by point along the gray value matrix of the original C-scan image of the eddy current array, and repeat the processes of gray value extraction, sorting and replacement until all points in the gray value matrix of the original C-scan image of the eddy current array are updated, and obtain the filtered image based on the updated gray value matrix of the original C-scan image of the eddy current array.
4. The method according to claim 1, characterized in that Move the third-order rectangular convolution kernel matrix point by point on the filtered image, and combine the adaptive enhancement coefficient to realize gray value update to obtain the sharpened image. Evaluate the enhancement effect by using the edge gain index and the signal quality index, including: Construct a third-order rectangular convolution kernel matrix, set the central element of the third-order rectangular convolution kernel matrix to negative eight, and set the remaining eight elements to one. Coincide the center position of the third-order rectangular convolution kernel matrix with the position of the point to be processed in the gray value matrix of the eddy current array C-scan image after filtering. Extract the image gray values within the coverage of the third-order rectangular convolution kernel matrix to construct the original gray value matrix, and perform boundary extension on the original gray value matrix. When the extraction position is at the image boundary, fill the position outside the image range with the gray value at the image boundary to obtain the extended original gray value matrix. Perform a convolution operation on the extended original grayscale value matrix and the third-order rectangular convolution kernel matrix to obtain the Laplacian operator response value of the current point to be processed. Calculate the ratio of the square of the Laplacian operator response value to the preset variance parameter, and multiply the negative exponent of the ratio by the preset basic enhancement intensity to obtain the adaptive enhancement coefficient; Subtract the product of the adaptive enhancement coefficient and the Laplacian operator response value from the original grayscale value to obtain the enhanced grayscale value, and replace the original grayscale value with the enhanced grayscale value; Move the third-order rectangular convolution kernel matrix point by point on the grayscale value matrix of the eddy current array C-scan image after filtering until the processing of all pixel points is completed to obtain the enhanced grayscale value matrix of the eddy current array C-scan image; Calculate the total sum of the edge gradient amplitudes of the enhanced grayscale value matrix of the eddy current array C-scan image and the grayscale value matrix of the eddy current array C-scan image after filtering respectively, and take the ratio of the total sum of the edge gradient amplitudes to the total sum of the edge gradient amplitudes before enhancement as the edge gain index; Calculate the difference in signal-to-noise ratio before and after enhancement as the signal quality index, and evaluate the signal enhancement effect according to the edge gain index and the signal quality index.
5. The method according to claim 1, wherein Construct an adaptive non-linear mapping function based on the sharpened image, and perform normalization processing on the sharpened image to obtain a normalized image; Randomly generate multiple parameter combinations within the preset parameter range to form an initial parameter population, and substitute the parameter combinations in the initial parameter population into the adaptive non-linear mapping function to perform differential enhancement on the pixel points in the normalized image, including: Obtain the grayscale value matrix of the weld eddy current C-scan image after sharpening processing, calculate the maximum grayscale value and the minimum grayscale value in the grayscale value matrix of the weld eddy current C-scan image, and divide the product of subtracting the minimum grayscale value from each pixel point grayscale value in the grayscale value matrix of the weld eddy current C-scan image by two hundred and fifty-five and then divide by the difference between the maximum grayscale value and the minimum grayscale value to obtain the normalized grayscale value matrix of the weld eddy current C-scan image; Calculate the arithmetic mean of the grayscale values of all pixel points in the normalized grayscale value matrix of the weld eddy current C-scan image to obtain the average grayscale value, and calculate the square root of the sum of the squares of the differences between the grayscale values of all pixel points in the normalized grayscale value matrix of the weld eddy current C-scan image and the average grayscale value to obtain the standard deviation; Multiply the ratio of the standard deviation to the average grayscale value by the first adjustment coefficient to obtain the non-linear curve shape parameter, and multiply the average grayscale value by the second adjustment coefficient to obtain the non-linear grayscale threshold parameter; Divide the pixel points in the normalized grayscale value matrix of the weld eddy current C-scan image whose grayscale values are less than or equal to the average grayscale value into the first type of pixel points, and divide the pixel points whose grayscale values are greater than the average grayscale value into the second type of pixel points; For the first type of pixel points, calculate the ratio of the absolute value of the difference between each pixel point grayscale value and the average grayscale value to the average grayscale value, add one after multiplying the ratio by the third adjustment coefficient, and then multiply the obtained result by the non-linear curve shape parameter to obtain the first enhancement coefficient; For the second type of pixel points, calculate the ratio of the absolute value of the difference between the gray value of each pixel point and the average gray value to the average gray value, add one after multiplying the ratio by the fourth adjustment coefficient, and then multiply the obtained result by the non-linear curve shape parameter to obtain the second enhancement coefficient; use the non-linear mapping function to perform differential enhancement processing on the first type of pixel points and the second type of pixel points respectively.
6. The method according to claim 1, wherein Taking the initial parameter population as the current iteration population, extract the features of the enhanced image by combining the horizontal and vertical gradient operators, calculate the signal-to-noise ratio, edge intensity and image contrast, and perform weighted summation to obtain the fitness value. The adaptive optimization of the weld eddy current C-scan image enhancement parameters is achieved through multiple iterations of optimization, including: Taking the initial parameter population as the current iteration population; substituting the parameter combinations in the current iteration population into the non-linear transformation function to perform gray mapping on the weld eddy current C-scan image to obtain the enhanced image; constructing a horizontal gradient operator and a vertical gradient operator to extract the edge features of the enhanced image in the horizontal and vertical directions respectively, and calculating the edge intensity value according to the edge features in the horizontal direction and the edge features in the vertical direction; Calculating the signal-to-noise ratio of the enhanced image relative to the original image, and calculating the gray contrast of the enhanced image; multiplying the edge intensity value, signal-to-noise ratio and gray contrast by the corresponding weight coefficients respectively and summing them to obtain the fitness value of the current parameter combination; calculating the selection probability according to the fitness values of the parameter combinations in the current iteration population, and selecting some high-quality parameter combinations based on the selection probability to form an optimized population; randomly pairing the parameter combinations in the optimized population, and linearly combining the paired parameters through a preset crossover coefficient to obtain the crossed parameters; adding a random perturbation with a preset step size to the crossed parameters to perform parameter mutation to obtain the mutated parameters; Substituting the mutated parameters back into the non-linear transformation function for image enhancement and calculating the new fitness value; determining whether the preset number of iterations is reached or whether the optimal fitness value meets the preset conditions. If so, output the parameter combination with the highest current fitness value as the optimal enhancement parameter. If not, form a new current iteration population with the mutated parameters and continue to execute the parameter optimization process.
7. A weld defect recognition and area quantitative calculation system for implementing the method described in any one of the foregoing claims 1-6, characterized in that, Including: The first unit is used to collect the scanning signals of the 32-channel array eddy current probe, map the row and column indexes of the eddy current signal matrix to the image coordinate positions, map the signal amplitude to the gray value, and determine the actual pixel spacing according to the encoder sampling interval and the adjacent channel spacing to generate the original weld eddy current C-scan image; based on the weld reinforcement divided by the horizontal and vertical pixel spacings respectively and rounding up and adding one, determine the number of columns and rows of the filtering window, construct a rectangular filtering window matrix, move it point by point on the original weld eddy current C-scan image, and replace the original gray value of the point to be processed with the median value after sorting the gray values in the window-covered area to obtain the filtered image; The second unit is used to move point by point on the filtered image based on a third-order rectangular convolution kernel matrix, and combine an adaptive enhancement coefficient to update the gray value to obtain a sharpened image, and evaluate the enhancement effect by using an edge gain index and a signal quality index; construct an adaptive nonlinear mapping function based on the sharpened image, and perform normalization processing on the sharpened image to obtain a normalized image; randomly generate multiple parameter combinations within a preset parameter range to form an initial parameter population, and substitute the parameter combinations in the initial parameter population into the adaptive nonlinear mapping function to perform differential enhancement on the pixel points in the normalized image; The third unit is used to take the initial parameter population as the current iteration population, combine horizontal and vertical gradient operators to extract the features of the enhanced image, calculate the signal-to-noise ratio, edge intensity, and image contrast, and perform weighted summation to obtain a fitness value, and realize the adaptive optimization of the weld eddy current C-scan image enhancement parameters through multiple iterative optimizations.
8. An electronic device, characterized in that, Comprising: A processor; A memory for storing instructions executable by the processor; Wherein, the processor is configured to call the instructions stored in the memory to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
System and method for removing background of three-dimensional image of biological tissue
CN107590798A
Virtual volume scan data generation method and system for radar data stream
CN119474939A
Raw scaler with chromatic aberration correction
US20130321675A1
Systems and methods for local tone mapping
US20130322753A1
Cited By
Power transmission and transformation line steel structure welding quality evaluation method based on edge calculation
CN120894371A
Edge computing-based power transmission line steel structure welding quality evaluation method
CN120894371B
Tube plate area small defect detection method based on array probe
CN121656374A
Image enhancement method for surface defects of mining sputtering sensor
CN121937329A