Weld defect recognition and area quantitative calculation method and system
By using a 32-channel array eddy current probe and adaptive filtering, combined with an adaptive nonlinear mapping function and parameter optimization algorithm, the shortcomings of eddy current detection technology in weld defect identification and area quantitative calculation are solved, achieving efficient weld defect identification and accurate area quantitative calculation.
Patent Information
- Application Number
- CN202510656558.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-21
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2045-05-21
AI Technical Summary
Existing eddy current testing technology has several drawbacks in weld defect identification and quantitative area calculation. These include difficulty in handling complex morphologies and multiple defect types, the inability of image enhancement algorithms to adaptively adjust, and a lack of effective quantitative calculation methods. Consequently, the reliability and accuracy of the detection results are not high.
A 32-channel array eddy current probe is used to acquire signals. Through image mapping and adaptive filtering, combined with an adaptive nonlinear mapping function and parameter optimization algorithm, the accurate identification of weld defects and quantitative calculation of their area are achieved.
It significantly improves the quality of weld eddy current C-scan images and the accuracy of defect identification, enhances the adaptability and robustness of image processing, provides a more objective image quality assessment, and ensures the reliability of welding quality control.
Smart Images

Figure CN120374402B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to defect recognition technology, in particular to a weld defect recognition and area quantitative calculation method and system. BACKGROUND
[0002] Weld defect recognition and area quantitative calculation is an important link to ensure the quality of welding 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 intelligentization, weld defect recognition methods based on eddy current testing technology have gradually attracted attention. Eddy current testing technology has the advantages of non-destructive, fast, high sensitivity, etc., and can effectively detect defects on the surface and near the surface of the weld.
[0003] However, the existing eddy current testing technology still has some deficiencies in weld defect recognition and area quantitative calculation. First, the traditional eddy current signal processing method is difficult to effectively process complex weld topography and multiple defect types, resulting in low reliability of the detection results. Second, the existing image enhancement algorithm often uses fixed parameters, which cannot be adaptively adjusted according to different weld characteristics and defect types, affecting the accuracy of defect recognition. Finally, there is a lack of effective quantitative calculation method, which makes it difficult to accurately evaluate the area and severity of defects, and is not conducive to the accurate control and evaluation of welding quality.
[0004] In order to solve these problems, a new method is needed that can adaptively process eddy current signals, optimize image enhancement parameters, realize accurate defect recognition and area quantitative calculation. This method should be able to fully utilize the advantages of multi-channel array eddy current probe, combined with advanced signal processing and image analysis technology, to improve the accuracy and reliability of weld defect recognition, and provide more powerful technical support for welding quality control in industrial production. SUMMARY
[0005] The embodiments of the present application provide a weld defect recognition and area quantitative calculation method and system, which can solve the problems in the prior art.
[0006] The first aspect of the embodiments of the present application is,
[0007] A weld defect recognition and area quantitative calculation method is provided, comprising:
[0008] The scanning signal of the thirty-two channel array eddy current probe maps the row and column indexes of the eddy current signal matrix to image coordinate positions, maps the signal amplitude to a gray value, and determines the actual pixel spacing according to the encoder sampling interval and the spacing between adjacent channels to generate a weld eddy current C-scan original image; the column number and the row number of the filter window are determined based on the weld reinforcement divided by the horizontal and vertical pixel spacing and rounded up by one, a rectangular filter window matrix is constructed, the rectangular filter window matrix is moved on the weld eddy current C-scan original image point by point, and the original gray value of the to-be-processed point is replaced by the median value of the gray values in the window coverage area to obtain a filtered image;
[0009] The third-order rectangular convolution kernel matrix is moved on the filtered image point by point, and the gray value is updated to obtain a sharpened image by combining an adaptive enhancement coefficient; an adaptive nonlinear mapping function is constructed based on the sharpened image, and the normalized image is obtained by normalizing the sharpened image; a plurality of parameter combinations are randomly generated in a predetermined parameter range to form an initial parameter population, and the parameter combinations in the initial parameter population are substituted into the adaptive nonlinear mapping function to differentially enhance the pixel points in the normalized image;
[0010] The initial parameter population is taken as the current iteration population, the features of the enhanced image are extracted by combining the horizontal and vertical gradient operators, the signal-to-noise ratio, the edge intensity and the image contrast are calculated and weightedly summed to obtain the fitness value, and the adaptive optimization of the weld eddy current C-scan image enhancement parameters is realized through multiple iterations.
[0011] The scanning signal of the thirty-two channel array eddy current probe maps the row and column indexes of the eddy current signal matrix to image coordinate positions, maps the signal amplitude to a gray value, and determines the actual pixel spacing according to the encoder sampling interval and the spacing between adjacent channels to generate a weld eddy current C-scan original image includes:
[0012] The thirty-two channel array eddy current probe is placed on the surface of the weld of the workpiece to be measured, wherein the linear array direction of the thirty-two channel array eddy current probe is perpendicular to the weld direction, 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;
[0013] The thirty-two channel array eddy current probe is controlled to scan along the weld direction, and the eddy current impedance signal amplitude at each sampling position is obtained through equal spatial sampling of the scanning encoder of the thirty-two channel array eddy current probe, wherein the sampling interval of the scanning encoder is set to a fixed value in advance, and the eddy current signal matrix is constructed according to the eddy current impedance signal amplitude at the sampling position; the number of rows of the eddy current signal matrix corresponds to the number of samplings, 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;
[0014] The actual distance of longitudinally adjacent pixels in the weld array eddy current imaging image is determined according to the sampling interval of the scanning encoder, and the actual distance of transversely adjacent pixels in the weld array eddy current imaging image is determined according to the distance between adjacent channels of the thirty-two channel array eddy current probe.
[0015] The spatial resolution of the weld array eddy current imaging image in the longitudinal direction and the transverse direction is calculated, wherein the spatial resolution in the longitudinal direction is the inverse of the actual distance of longitudinally adjacent pixels, and the spatial resolution in the transverse direction is the inverse of the actual distance of transversely adjacent pixels; the weld array eddy current imaging image is calibrated according to the spatial resolution to ensure the correspondence between the pixel position and the actual physical position in the weld array eddy current imaging image, and a weld eddy current C-scan original image is generated.
[0016] The number of columns and the number of rows of the filter window are determined based on the weld reinforcement divided by the transverse and longitudinal pixel distances, and the number of columns and the number of rows of the filter window are determined by rounding up and adding one, a rectangular filter window matrix is constructed, and the rectangular filter window matrix is moved point by point on the weld eddy current C-scan original image, and the original gray value of the processing point is replaced by the median value of the gray values in the window covered area after sorting to obtain a filtered image.
[0017] The maximum size of the weld reinforcement in the array probe length direction and the weld direction is collected, the maximum size of the array probe length direction is divided by the transverse pixel distance to obtain a first quotient, the maximum size of the weld direction is divided by the longitudinal pixel distance to obtain a second quotient, the first quotient is rounded up and added by one to obtain the number of columns of the filter window, and the second quotient is rounded up and added by one to obtain the number of rows of the filter window.
[0018] A rectangular filter window matrix is constructed according to the number of rows of the filter window and the number of columns of the filter window, the number of rows of the rectangular filter window matrix is the number of rows of the filter window, and the number of columns of the rectangular filter window matrix is the number of columns of the filter window.
[0019] The center position of the rectangular filter window matrix is coincided with the position of the processing point in the gray value matrix of the eddy current array C-scan original image, all gray values in the covered range of the rectangular filter window matrix are extracted to form a gray value set.
[0020] The gray values in the gray value set are sorted according to the numerical value to obtain an ordered gray value sequence, and the median value of the ordered gray value sequence is replaced by the original gray value of the processing point to obtain an updated gray value of the processing point.
[0021] The rectangular filter window matrix is moved point by point along the gray value matrix of the eddy current array C-scan original image, and the gray value extraction, sorting and replacement processes are repeatedly executed until all points in the gray value matrix of the eddy current array C-scan original image are updated, and a filtered image is obtained based on the updated gray value matrix of the eddy current array C-scan original image.
[0022] The sharpened image is obtained by moving the third-order rectangular convolution kernel matrix on the filtered image point by point, and updating the gray value by combining the adaptive enhancement coefficient. The edge gain index and the signal quality index are used to evaluate the enhancement effect, including:
[0023] A third-order rectangular convolution kernel matrix is constructed, the center element of the third-order rectangular convolution kernel matrix is set to negative eight, and the other eight elements are set to one. The center position of the third-order rectangular convolution kernel matrix is coincided with the position of the to-be-processed point in the gray value matrix of the filtered vortex array C scan image;
[0024] An original gray value matrix is constructed by extracting the image gray values in the coverage range of the third-order rectangular convolution kernel matrix. The original gray value matrix is extended at the boundary, and when the extraction position is located at the image boundary, the gray values at the image boundary are filled to obtain the extended original gray value matrix;
[0025] The extended original gray value matrix is convolved with the third-order rectangular convolution kernel matrix to obtain the Laplacian response value of the current to-be-processed point. The ratio of the square of the Laplacian response value to the preset variance parameter is calculated, and the product of the negative exponent of the ratio and the preset basic enhancement intensity is obtained as the adaptive enhancement coefficient;
[0026] The product of the adaptive enhancement coefficient and the Laplacian response value is subtracted from the original gray value to obtain the enhanced gray value, and the enhanced gray value is used to replace the original gray value;
[0027] The third-order rectangular convolution kernel matrix is moved on the filtered vortex array C scan image gray value matrix point by point until all pixel points are processed to obtain the enhanced vortex array C scan image gray value matrix;
[0028] The edge gradient amplitude sum of the enhanced vortex array C scan image gray value matrix and the filtered vortex array C scan image gray value matrix is calculated, and the ratio of the edge gradient amplitude sum to the edge gradient amplitude sum before enhancement is taken as the edge gain index. The difference between the signal-to-noise ratio before and after enhancement is taken as the signal quality index, and the signal enhancement effect is evaluated according to the edge gain index and the signal quality index.
[0029] An adaptive nonlinear mapping function is constructed based on the sharpened image, and a normalized image is obtained by normalizing the sharpened image. A plurality of parameter combinations are randomly generated within a preset parameter range to form an initial parameter population, and the parameter combinations in the initial parameter population are substituted into the adaptive nonlinear mapping function to perform differential enhancement on the pixel points in the normalized image, including:
[0030] The normalized weld eddy current C-scan image gray value matrix is obtained by subtracting the minimum gray value multiplied by 255 from the gray value of each pixel point in the weld eddy current C-scan image gray value matrix and then dividing the result by the difference between the maximum gray value and the minimum gray value;
[0031] The arithmetic mean of the gray values of all pixel points in the normalized weld eddy current C-scan image gray value matrix is calculated to obtain the average gray value, and the square root of the sum of the squares of the differences between the gray values of all pixel points in the normalized weld eddy current C-scan image gray value matrix and the average gray value is calculated to obtain the standard deviation value;
[0032] The ratio of the standard deviation value to the average gray value is multiplied by the first adjustment coefficient to obtain the nonlinear curve shape parameter, and the average gray value is multiplied by the second adjustment coefficient to obtain the nonlinear gray threshold parameter;
[0033] The pixel points with a gray value less than or equal to the average gray value in the normalized weld eddy current C-scan image gray value matrix are divided into a first type of pixel points, and the pixel points with a gray value greater than the average gray value are divided into a second type of pixel points;
[0034] For the first type of pixel points, 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 is calculated, the ratio is multiplied by the third adjustment coefficient and then added by one, and the result is multiplied by the nonlinear curve shape parameter to obtain the first enhancement coefficient;
[0035] For the second type of pixel points, 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 is calculated, the ratio is multiplied by the fourth adjustment coefficient and then added by one, and the result is multiplied by the nonlinear curve shape parameter to obtain the second enhancement coefficient; the first type of pixel points and the second type of pixel points are respectively subjected to differential enhancement processing by using a nonlinear mapping function.
[0036] The initial parameter population is taken as the current iteration population, the features of the enhanced image are extracted by combining the horizontal and vertical gradient operators, the signal-to-noise ratio, the edge intensity and the image contrast are calculated and weightedly summed to obtain the fitness value, and the adaptive optimization of the weld eddy current C-scan image enhancement parameters is realized through multiple iterations, including:
[0037] The initial parameter population is taken as the current iteration population; the parameter combination in the current iteration population is substituted into the nonlinear transformation function to obtain the enhanced image by performing gray mapping on the weld eddy current C-scan image; the horizontal gradient operator and the vertical gradient operator are constructed to extract the edge features of the enhanced image in the horizontal direction and the vertical direction, respectively, and the edge intensity value is calculated according to the edge features in the horizontal direction and the vertical direction;
[0038] The signal-to-noise ratio of the enhanced image relative to the original image is calculated, and the gray contrast of the enhanced image is calculated; the edge intensity value, the signal-to-noise ratio and the gray contrast are multiplied by the corresponding weight coefficients respectively and summed to obtain the fitness value of the current parameter combination; the selection probability is calculated according to the fitness value of each parameter combination in the current iteration population, and part of the high-quality parameter combinations are selected based on the selection probability to form an optimal population; the parameter combinations in the optimal population are randomly paired, and the paired parameters are linearly combined through a preset cross coefficient to obtain the parameters after crossing; the parameters after crossing are mutated by adding random disturbance of a preset step size to obtain the parameters after mutation;
[0039] The parameters after mutation are substituted into the nonlinear transformation function again for image enhancement, and a new fitness value is calculated; whether the preset iteration number is reached or the optimal fitness value meets the preset condition is judged, if yes, the parameter combination with the highest fitness value at present is output as the optimal enhancement parameter, if not, the parameters after mutation form a new current iteration population to continue the parameter optimization process.
[0040] The second aspect of the embodiment of the application,
[0041] A weld defect recognition and area quantitative calculation system is provided, comprising:
[0042] The first unit is configured to collect the scanning signals of the thirty-two 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 spacing between adjacent channels to generate a weld eddy current C-scan original image; determine the number of columns and rows of the filter window based on the weld reinforcement divided by the horizontal and vertical pixel spacing and taking the upper integer plus one, construct a rectangular filter window matrix, move the matrix point by point on the weld eddy current C-scan original image, and replace the original gray value of the to-be-processed point with the median value of the gray values in the window coverage area after sorting to obtain a filtered image.
[0043] The second unit is configured to move the third-order rectangular convolution kernel matrix point by point on the filtered image, and realize gray value updating based on the adaptive enhancement coefficient to obtain a sharpened image, and evaluate the enhancement effect by using the edge gain index and the 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 a plurality of parameter combinations in 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.
[0044] The third unit is configured to take the initial parameter population as a current iteration population, extract enhanced image features by combining horizontal and vertical gradient operators, calculate signal-to-noise ratio, edge intensity and image contrast, and perform weighted summation to obtain a fitness value, and realize adaptive optimization of the weld eddy current C-scan image enhancement parameters through multiple iterations of optimization.
[0045] A third aspect of the embodiments of the present application,
[0046] An electronic device is provided, comprising:
[0047] a processor;
[0048] a memory for storing processor-executable instructions;
[0049] The processor is configured to invoke the instructions stored in the memory to perform the method described above.
[0050] A fourth aspect of the embodiments of the present application,
[0051] A computer-readable storage medium is provided, which stores computer program instructions, and the computer program instructions are executed by a processor to implement the method described above.
[0052] The beneficial effects of the present application are as follows:
[0053] The weld defect recognition and area quantitative calculation method provided by the present application can effectively improve the quality of the weld eddy current C-scan image. By using a multi-channel array probe to collect signals and perform image mapping, combined with adaptive filtering and sharpening processing, the image clarity and contrast can be significantly improved, laying a foundation for subsequent defect recognition.
[0054] The method uses an adaptive nonlinear mapping function and a parameter optimization algorithm to realize 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.
[0055] The present application considers multiple indicators such as signal-to-noise ratio, edge intensity and image contrast to build a comprehensive image quality evaluation system. This multi-dimensional evaluation method can more objectively measure the image enhancement effect, providing a reliable guarantee for the accuracy of defect recognition. BRIEF DESCRIPTION OF DRAWINGS
[0056] Figure 1 A flowchart of the weld defect recognition and area quantitative calculation method of the embodiments of the present application is shown;
[0057] Figure 2 A logic block diagram of the embodiments of the present application based on adaptive filtering processing of weld reinforcement is shown;
[0058] Figure 3 A logic diagram of a weld seam eddy current C-scan image enhancement processing based on adaptive nonlinear mapping for an embodiment of the present application;
[0059] Figure 4 A flowchart of a weld seam eddy current C-scan image enhancement based on parameter population iterative optimization for an embodiment of the present application. DETAILED DESCRIPTION
[0060] In order to make the objects, technical solutions and advantages of embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0061] The technical solutions of the present application will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and some embodiments may not be described again for the same or similar concepts or processes.
[0062] Figure 1 A flowchart of a weld seam defect identification and area quantitative calculation method for an embodiment of the present application is shown as follows, Figure 1 The method comprises:
[0063] Collecting scanning signals of a thirty-two-channel array eddy current probe, mapping row and column indexes of an eddy current signal matrix to image coordinate positions, mapping signal amplitudes to gray values, and determining actual pixel point spacings according to a sampling interval of an encoder and a spacing between adjacent channels to generate a weld seam eddy current C-scan original image; determining the number of columns and the number of rows of a filter window based on weld seam reinforcement divided by horizontal and vertical pixel spacings and taking an integer greater than one, constructing a rectangular filter window matrix, moving the matrix on the weld seam eddy current C-scan original image point by point, and replacing original gray values of a to-be-processed point with a median value of gray values in a covered area of the window to obtain a filtered image;
[0064] Moving a third-order rectangular convolution kernel matrix on the filtered image point by point, and combining an adaptive enhancement coefficient to realize gray value updating to obtain a sharpened image, and using an edge gain index and a signal quality index to evaluate the enhancement effect; constructing an adaptive nonlinear mapping function based on the sharpened image, performing normalization processing on the sharpened image to obtain a normalized image; randomly generating a plurality of parameter combinations in a preset parameter range to form an initial parameter population, and substituting the parameter combinations in the initial parameter population into the adaptive nonlinear mapping function to perform differential enhancement on pixel points in the normalized image;
[0065] The initial parameter population is taken as the current iteration population, the enhanced image features are extracted by combining horizontal and vertical gradient operators, the signal-to-noise ratio, edge intensity and image contrast are calculated and weighted summation is performed to obtain the fitness value, and the adaptive optimization of the weld eddy current C-scan image enhancement parameters is realized through multiple iteration optimization.
[0066] In an alternative embodiment, the acquisition of the scanning signal of the thirty-two channel array eddy current probe maps the row and column indexes of the eddy current signal matrix to the image coordinate positions, maps the signal amplitude to the gray value, and determines the actual pixel spacing according to the encoder sampling interval and the spacing between adjacent channels to generate the weld eddy current C-scan original image, which includes:
[0067] The thirty-two channel array eddy current probe is placed on the weld surface of the workpiece to be measured, wherein the linear array direction of the thirty-two channel array eddy current probe is perpendicular to the weld direction, 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;
[0068] The thirty-two channel array eddy current probe is controlled to scan along the weld direction, and the eddy current impedance signal amplitude at each sampling position is obtained through equal spatial sampling of the scanning encoder of the thirty-two channel array eddy current probe, wherein the sampling interval of the scanning encoder is set to a fixed value in advance, and the eddy current signal matrix is constructed according to the eddy current impedance signal amplitude at the sampling position, the number of rows of the eddy current signal matrix corresponds to the 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;
[0069] The actual spacing of longitudinally adjacent pixel points in the weld array eddy current imaging image is determined according to the sampling interval of the scanning encoder, and the actual spacing of transversely adjacent pixel points in the weld array eddy current imaging image is determined according to the spacing between adjacent channels of the thirty-two channel array eddy current probe;
[0070] The spatial resolution of the weld array eddy current imaging image in the longitudinal and transverse directions is calculated, wherein the spatial resolution in the longitudinal direction is the inverse of the actual spacing of longitudinally adjacent pixel points, and the spatial resolution in the transverse direction is the inverse of the actual spacing of transversely adjacent pixel points; the weld array eddy current imaging image is calibrated according to the spatial resolution to ensure the correspondence between the pixel position and the actual physical position in the weld array eddy current imaging image, and the weld eddy current C-scan original image is generated.
[0071] The structure configuration of the array eddy current probe adopts a thirty-two channel linear arrangement form, each channel is composed of an excitation coil and a detection coil. The spacing between adjacent channels is accurately set to 2mm to ensure that the transverse scanning coverage width reaches 62mm. When the probe is placed on the weld surface, the linear array direction needs to be perpendicular to the weld direction, so that the probe can completely cover the weld and its heat affected zone.
[0072] The probe is driven by a stepper motor to move along the weld direction at a constant speed, and the sampling is triggered by a photoelectric encoder. The encoder resolution is set to 1024 pulses per revolution, and combined with a 30 mm diameter encoder wheel, the sampling interval accuracy is 0.092 mm. To improve the signal-to-noise ratio, the sampling interval can be set to 0.5 mm, i.e. the full-channel signal acquisition is triggered once every 0.5 mm movement.
[0073] The signal acquisition circuit adopts a multiplexing structure to sequentially excite and detect 32 channels. The excitation signal is a sinusoidal wave with a frequency of 100 kHz and a peak-to-peak value of 5 V. When the probe scans a certain position, the array eddy current instrument simultaneously acquires the eddy current impedance signals through 32 independent channels and extracts the signal amplitude data. For example, for a weld area with a length of 200 mm, if the sampling interval is set to 0.5 mm, a total of 400 points are acquired along the weld direction, generating a 400 x 32 size eddy current signal matrix.
[0074] 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 50 mm (i.e. 100 x 0.5 mm) along the weld direction.
[0075] After the signal matrix is constructed, image coordinate mapping processing is performed. The row and column indices of the matrix are converted to pixel coordinates of the image, and the signal amplitude is converted to a gray value. In specific implementation, first determine the maximum and minimum values in the signal matrix, for example, the maximum amplitude is 1.5 V and the minimum amplitude is 0.2 V, then linearly map this range to the 0-255 gray scale range. The conversion formula can be expressed as: subtract the minimum amplitude 0.2 V from the signal amplitude, divide by the amplitude range 1.3 V, and then multiply by 255 to get the corresponding gray value.
[0076] The determination of the actual pixel spacing is a key step in image space calibration. The actual spacing of horizontally adjacent pixels is directly the spacing between adjacent channels of the probe, i.e. 2 mm; the actual spacing of vertically adjacent pixels is the sampling interval of the encoder, i.e. 0.5 mm. 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 inverse of the 0.5 mm spacing), and the horizontal spatial resolution is 0.5 pixels / mm (the inverse of the 2 mm spacing).
[0077] To verify the accuracy of image calibration, a reference point with a known size can be marked on the workpiece to be measured, for example, a 10 mm x 10 mm standard square is marked at the starting position of the weld. By comparing the pixel size (should be 20 x 5 pixels) of the square in the imaging result with the actual size, the correspondence between the pixel position and the actual physical position is verified.
[0078] A 200 mm long and 4 mm wide stainless steel weld was detected, and a 400 x 32 size eddy current signal matrix was obtained after setting the above parameters. After image processing, the imaging results clearly showed the weld profile and possible internal defects. For example, a region with a significantly lower gray value was found at a distance of 75 mm from the starting point of the weld, with a size of about 3 mm x 2 mm, corresponding to the actual physical position (75 mm, 12 mm), which was confirmed as a pore defect inside the weld after subsequent verification.
[0079] Image post-processing can further improve defect recognition capability. Applying median filtering to the original C-scan image can effectively suppress random noise, and the filter window size is selected to be 3 x 3 pixels. Contrast enhancement is achieved through gray scale histogram equalization, which increases the contrast between the defect area and the background area by about 30%, facilitating visual identification.
[0080] In an alternative embodiment, the number of columns and rows of the filter window is determined based on the weld reinforcement divided by the horizontal and vertical pixel pitch, respectively, and rounded up by one. A rectangular filter window matrix is constructed, which is moved point by point on the weld eddy current C-scan original image, and the median value of the sorted gray values in the window coverage area is used to replace the original gray value of the point to be processed to obtain the filtered image, including:
[0081] The maximum size of the weld reinforcement in the array probe length direction and the weld direction is collected. The maximum size of the array probe length direction is divided by the horizontal pixel pitch to obtain a first quotient, and the maximum size of the weld direction is divided by the vertical pixel pitch to obtain a second quotient. The first quotient is rounded up by one to obtain the number of columns of the filter window, and the second quotient is rounded up by one to obtain the number of rows of the filter window.
[0082] A rectangular filter window matrix is constructed according to the number of rows and columns of the filter window. The number of rows of the rectangular filter window matrix is the number of rows of the filter window, and the number of columns of the rectangular filter window matrix is the number of columns of the filter window.
[0083] The center position of the rectangular filter window matrix is coincided with the position of the point to be processed in the eddy current array C-scan original image gray value matrix, and all gray values in the coverage range of the rectangular filter window matrix are extracted to form a gray value set.
[0084] The gray values in the gray value set are sorted according to the numerical value to obtain an ordered gray value sequence, and the median value of the ordered gray value sequence is used to replace the original gray value of the point to be processed to obtain the updated gray value of the point to be processed.
[0085] The rectangular filter window matrix is moved along the eddy current array C-scan original image gray value matrix point by point, and the gray value extraction, sorting and replacement process is repeatedly executed until all points in the eddy current array C-scan original image gray value matrix are updated, and a filtered image is obtained based on the updated eddy current array C-scan original image gray value matrix.
[0086] The maximum size of the weld reinforcement in the length direction of the array probe and the weld direction is collected. In actual application, the weld reinforcement is measured by a laser measuring instrument or other measuring equipment to obtain the maximum size of the weld reinforcement in the length direction (transverse direction) and the weld direction (longitudinal direction) of the array probe. For example, the maximum size of a certain weld reinforcement in the transverse direction is 3.2 mm, and the maximum size in the longitudinal direction is 2.8 mm.
[0087] The number of rows and columns of the filter window is determined. First, the transverse and longitudinal pixel spacings of the eddy current C-scan image are obtained. In this embodiment, the transverse pixel spacing is 0.5 mm / pixel, and the longitudinal pixel spacing is 0.4 mm / pixel. The maximum size of the weld reinforcement in the transverse direction is divided by the transverse pixel spacing to obtain a first quotient: 3.2 mm ÷ 0.5 mm / pixel = 6.4. The quotient is rounded up and then added by one to obtain the number of columns of the filter window: ceil(6.4) + 1 = 7 + 1 = 8. Similarly, the maximum size of the weld reinforcement in the longitudinal direction is divided by the longitudinal pixel spacing to obtain a second quotient: 2.8 mm ÷ 0.4 mm / pixel = 7. The quotient is rounded up and then added by one to obtain the number of rows of the filter window: ceil(7) + 1 = 7 + 1 = 8.
[0088] According to the calculated number of rows and columns of the filter window, a rectangular filter window matrix is constructed. In this embodiment, an 8x8 rectangular filter window matrix is constructed. The matrix can be represented as an 8x8 region for moving filtering operation on the eddy current C-scan original image.
[0089] The center position of the rectangular filter window matrix is aligned with the position of the point to be processed in the eddy current array C-scan original image gray value matrix. For example, for a pixel point with coordinates (50, 60) in the original image, the center of the 8x8 filter window matrix is aligned with the point. Since the center of the 8x8 matrix is between the 4th row and the 5th row and the 4th column and the 5th column, the window covers the area from (50-4, 60-4) to (50+3, 60+3) in the original image, i.e., the 8x8 area from (46, 56) to (53, 63).
[0090] All the gray values in the rectangular filter window matrix coverage are extracted to form a gray value set. In the embodiment, the gray values of 64 pixel points in the 8*8 region are extracted to form the gray value set. Assuming that the extracted gray value set is {120, 125, 118, 130, 122,..., 128}, there are 64 gray values.
[0091] The gray values in the gray value set are sorted according to the numerical value to obtain an ordered gray value sequence. For example, the above-mentioned gray value set is sorted to obtain {105, 108, 110,..., 145, 148, 150}. The median value of the ordered gray value sequence is found, which is the average of the 32th and 33th values in this example, and is assumed to be 124.
[0092] The median value of the ordered gray value sequence is replaced by the original gray value of the to-be-processed point to obtain an updated gray value of the to-be-processed point. For example, the gray value of the pixel point with coordinates (50, 60) in the original image is updated to 124.
[0093] The rectangular filter window matrix is moved along the eddy current array C to scan the original image gray value matrix point by point, and the gray value extraction, sorting and replacement processes are repeatedly performed. For example, after the (50, 60) point is processed, the filter window is moved to the (50, 61) point, and the above-mentioned operation is repeated. In this way, until all points in the eddy current array C scanning the original image gray value matrix are updated.
[0094] For the edge region of the image, the filter window may exceed the image range. In this case, edge padding methods such as zero padding, mirror padding or repetition padding can be used. In the embodiment, the mirror padding method is used, that is, the image edge pixels are copied along the edge to ensure that the filter window always covers the effective region.
[0095] After all the pixel points are processed, the filtered image is obtained based on the updated eddy current array C scanning the original image gray value matrix. Compared with the original image, the noise of the filtered image is effectively suppressed, and the weld feature is clearer, which is conducive to the subsequent weld defect detection and analysis.
[0096] The experimental results show that the signal-to-noise ratio of the eddy current C scanning image processed by the method is improved from 8.5dB to 15.2dB, and the accuracy of the weld defect detection is improved from 82% to 94.5%, effectively improving the reliability and accuracy of the weld detection.
[0097] Figure 2 The logic block diagram of the embodiment of the present application based on the adaptive filtering processing of the weld reinforcement is as follows:
[0098] The image filter processing flowchart shows a complete median filter algorithm processing process. The system obtains the maximum size data of the weld reinforcement as input. Then, the filter window size is calculated, where the number of columns is equal to the reinforcement transverse size divided by the transverse pixel pitch plus 1. Then, a rectangular filter window matrix is constructed to ensure that the row size multiplied by the column size meets the requirements. In the core processing link, the algorithm positions the window at the pixel point to be processed, and extracts all the gray values within the window coverage. The gray values are sorted and the median value is taken, and the median value is used to replace the gray value of the pixel point to be processed. Then, the window moves to the next pixel point for repeated processing. This is an iterative process controlled by the judgment condition "whether all pixel points have been processed?" If not, return to the window positioning step for further processing; if yes, output the filtered weld reinforcement scan image as the final result. This flowchart clearly shows the application of median filtering in image processing, especially in the specific implementation steps of weld reinforcement detection, which embodies the systematic and cyclical characteristics of digital image processing.
[0099] In an alternative embodiment, a third-order rectangular convolution kernel matrix is moved point by point on the filtered image, and an adaptive enhancement coefficient is used to update the gray value to obtain a sharpened image. The edge gain index and the signal quality index are used to evaluate the enhancement effect, including:
[0100] A third-order rectangular convolution kernel matrix is constructed, with the center element set to negative eight and the other eight elements set to one. The center position of the third-order rectangular convolution kernel matrix is aligned with the position of the pixel point to be processed in the gray value matrix of the filtered eddy current array C scan image;
[0101] An image gray value matrix is constructed by extracting the gray values within the coverage range of the third-order rectangular convolution kernel matrix. The boundary of the original gray value matrix is extended, and when the extraction position is located at the image boundary, the gray values at the image boundary are used to fill the positions outside the image range to obtain the extended original gray value matrix;
[0102] The extended original gray value matrix is convolved with the third-order rectangular convolution kernel matrix to obtain the Laplacian operator response value of the current pixel point to be processed. The ratio of the square of the Laplacian operator response value to the preset variance parameter is calculated, and the negative exponent of the ratio is multiplied by the preset basic enhancement intensity to obtain the adaptive enhancement coefficient;
[0103] The product of the adaptive enhancement coefficient and the Laplacian operator response value is subtracted from the original gray value to obtain the enhanced gray value, which replaces the original gray value;
[0104] The third-order rectangular convolution kernel matrix is moved on the filtered eddy current array C scan image gray value matrix point by point until the processing of all pixel points is completed to obtain the enhanced eddy current array C scan image gray value matrix.
[0105] The edge gradient amplitude sum of the enhanced eddy current array C scan image gray value matrix and the filtered eddy current array C scan image gray value matrix is calculated respectively, and the ratio of the edge gradient amplitude sum to the edge gradient amplitude sum before enhancement is taken as the edge gain index; the difference of the signal-to-noise ratio before and after enhancement is taken as the signal quality index, and the signal enhancement effect is evaluated according to the edge gain index and the signal quality index.
[0106] A third-order rectangular convolution kernel matrix is constructed. The matrix is a 3x3 matrix, the center element is set to -8, and the other eight elements are all set to 1. For example, the third-order rectangular convolution kernel matrix can be represented as:
[0107] The center position element is -8, and the eight surrounding position elements are all 1. The convolution kernel matrix is used to extract the edge and detail information in the image.
[0108] The filtered eddy current array C scan image is processed. Assuming that the filtered image gray value matrix is a 256x256 matrix, and the gray value range is 0-255. When processing, the center position of the third-order rectangular convolution kernel matrix is coincided with the position of the pixel point to be processed in the image gray value matrix.
[0109] For each pixel point in the image, the image gray values in the range covered by the third-order rectangular convolution kernel matrix are extracted to construct the original gray value matrix. For example, for the pixel point located at the image coordinate (100, 100), the gray values in the 3x3 region centered on the point are extracted to form the original gray value matrix.
[0110] When the processed pixel point is located at the image boundary, boundary extension processing is needed. For example, for the pixel point located at the top-left corner coordinate (0, 0) of the image, the left side, the upper side and the top-left corner position are out of the image range, at this time the gray values at the image boundary are filled. Specifically, if the pixel point is located at the left boundary, the pixel value on the left side of the pixel point is set to the boundary value of the column where the pixel point is located; if the pixel point is located at the upper boundary, the pixel value on the upper side of the pixel point is set to the boundary value of the row where the pixel point is located; if the pixel point is located at the top-left corner, the pixel value at the top-left corner is set to the gray value of the pixel point.
[0111] For the extended original gray value matrix, a convolution operation is performed with the 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 gray value matrix with the element of the convolution kernel matrix at the corresponding position, and then add all the products. For example, assuming that the 3x3 neighborhood gray values of a point are: 120, 125, 130, 118, 122, 127, 115, 120, 125, the Laplacian operator response value obtained after the convolution operation with the convolution kernel matrix is:
[0112] 1x120+1x125+1x130+1x118+(-8)x122+1x127+1x115+1x120+1x125-8x122=980-976=4.
[0113] The adaptive enhancement coefficient is calculated. First, the ratio of the square of the Laplacian operator response value to the preset variance parameter is calculated. 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 of the square of the Laplacian operator response value to the preset variance parameter is 16 / 25=0.64. Taking the negative exponent of the ratio, e^(-0.64)≈0.527, and multiplying it by the preset basic enhancement intensity, the adaptive enhancement coefficient is obtained. The preset basic enhancement intensity can be set to 0.8, and the adaptive enhancement coefficient is 0.8x0.527≈0.422.
[0114] The product of the adaptive enhancement coefficient and the Laplacian operator response value is subtracted from the original gray value to obtain the enhanced gray value. For the above example, the product of the adaptive enhancement coefficient and the Laplacian operator response value is 0.422x4≈1.688, and the original gray value is 122, so the enhanced gray value is 122-1.688≈120.312, which is rounded to 120.
[0115] The third-order rectangular convolution kernel matrix is moved on the filtered eddy current array C scan image gray value matrix point by point, and the above steps are repeated until all pixel points are processed to obtain the enhanced eddy current array C scan image gray value matrix.
[0116] The signal enhancement effect is evaluated. First, the edge gain index, which is the ratio of the edge gradient amplitude sum of the enhanced image to the filtered image, is calculated. The edge gradient amplitude can be calculated by the Sobel operator. For example, for the filtered image, the edge gradient amplitude sum is 25000, and the edge gradient amplitude sum of the enhanced image is 35000, so the edge gain index is 35000 / 25000=1.4, indicating that the edge is enhanced by 40%.
[0117] The signal quality index is calculated, that is, the difference of the signal-to-noise ratio before and after enhancement. Assuming that the signal-to-noise ratio of the image after filtering processing is 15 dB, and the signal-to-noise ratio of the image after enhancement is 17 dB, the signal quality index is 17-15=2 dB, indicating that the signal-to-noise ratio is improved by 2 dB.
[0118] Through the comprehensive evaluation of the edge gain index and the signal quality index, the image enhancement effect can be objectively evaluated. In actual application, the preset variance parameter and the preset basic enhancement intensity can be adjusted according to specific needs 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 a typical vortex array C scan image, a good enhancement effect 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.
[0119] In an alternative embodiment, an adaptive nonlinear mapping function is constructed based on the sharpened image, and a normalized image is obtained by normalizing the sharpened image; a plurality of parameter combinations are randomly generated within a preset parameter range to form an initial parameter population, and the parameter combinations in the initial parameter population are substituted into the adaptive nonlinear mapping function to perform differential enhancement on the pixel points in the normalized image, including:
[0120] The gray value matrix of the weld vortex C scan image after sharpening processing is obtained, the maximum gray value and the minimum gray value in the gray value matrix of the weld vortex C scan image are calculated, and the gray value of each pixel point in the gray value matrix of the weld vortex C scan image is subtracted by the minimum gray value multiplied by two hundred and fifty-five and then divided by the difference between the maximum gray value and the minimum gray value to obtain the normalized gray value matrix of the weld vortex C scan image;
[0121] The arithmetic mean of the gray values of all pixel points in the normalized gray value matrix of the weld vortex C scan image is calculated to obtain the average gray value, and 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 weld vortex C scan image and the average gray value is calculated to obtain the standard deviation value;
[0122] The ratio of the standard deviation value to the average gray value is multiplied by a first adjustment coefficient to obtain a nonlinear curve shape parameter, and the average gray value is multiplied by a second adjustment coefficient to obtain a nonlinear gray threshold parameter;
[0123] The pixel points with a gray value less than or equal to the average gray value in the normalized gray value matrix of the weld vortex C scan image are divided into a first type of pixel points, and the pixel points with a gray value greater than the average gray value are divided into a second type of pixel points;
[0124] For the first type of pixel points, 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 is calculated, the ratio is multiplied by a third adjustment coefficient and then added by one, and the result is multiplied by the nonlinear curve shape parameter to obtain a first enhancement coefficient;
[0125] For the second type of pixel points, 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 is calculated, the ratio is multiplied by the fourth adjustment coefficient to obtain a second enhancement coefficient. The first type of pixel points and the second type of pixel points are respectively subjected to differential enhancement processing by using a nonlinear mapping function.
[0126] The sharpening processing can use Laplace operator or high-pass filtering method to enhance the edge and detail information in the image. For example, a 3x3 Laplace operator is used to perform convolution operation on the original image to obtain the sharpened weld eddy current C scan image.
[0127] The gray value matrix of the sharpened weld eddy current C scan image is obtained, and it is assumed that the maximum gray value in the matrix is 220 and the minimum gray value is 30. For the gray value of each pixel point in the matrix, the minimum gray value 30 is subtracted, multiplied by 255, and then divided by the difference between the maximum gray value and the minimum gray value, i.e. 190, to obtain the normalized gray value matrix of the weld eddy current C scan image. For example, for a pixel point with an original gray value of 125, the normalized gray value is (125-30) x 255 ÷ 190 = 127.5, which is rounded to 128.
[0128] The arithmetic mean of the gray values of all pixel points in the normalized gray value matrix of the weld eddy current C scan image is calculated to obtain the average gray value. It is assumed that the calculated average gray value is 120. 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 weld eddy current C scan image and the average gray value is calculated to obtain the standard deviation value. It is assumed that the calculated standard deviation value is 45.
[0129] Based on the calculated statistical characteristics, the parameters of the adaptive nonlinear mapping function are constructed. The ratio of the standard deviation value to the average gray value is multiplied by the first adjustment coefficient to obtain the nonlinear curve shape parameter. For example, the ratio of the standard deviation value to the average gray value is 45 ÷ 120 = 0.375, and the first adjustment coefficient is set to 2.5, so the nonlinear curve shape parameter is 0.375 x 2.5 = 0.9375. The average gray value is multiplied by the second adjustment coefficient to obtain the nonlinear gray threshold parameter. For example, the second adjustment coefficient is set to 1.2, so the nonlinear gray threshold parameter is 120 x 1.2 = 144.
[0130] According to the average gray value, the pixel points are divided into two types. The pixel points in the normalized gray value matrix of the weld eddy current C scan image with a gray value less than or equal to the average gray value 120 are divided into the first type of pixel points, and the pixel points with a gray value greater than the average gray value 120 are divided into the second type of pixel points.
[0131] For the first type of pixel points, the enhancement coefficient of each pixel point is calculated. For example, for the first type of pixel point with a gray value of 80, the ratio of the absolute value of the difference between the gray value and the average gray value to the average gray value is calculated: |80-120| ÷ 120 = 0.333. The ratio is multiplied by the third adjustment coefficient 1.8 and then 1 is added to obtain 1.6. The value is multiplied by the nonlinear curve shape parameter 0.9375 to obtain the first enhancement coefficient 1.5.
[0132] For the second type of pixel points, the enhancement coefficient of each pixel point is also calculated. For example, for the second type of pixel point with a gray value of 180, the ratio of the absolute value of the difference between the gray value and the average gray value to the average gray value is calculated: |180-120| ÷ 120 = 0.5. The ratio is multiplied by the fourth adjustment coefficient 2.2 and then 1 is added to obtain 2.1. The value is multiplied by the nonlinear curve shape parameter 0.9375 to obtain the second enhancement coefficient 1.97.
[0133] The first type of pixel points and the second type of pixel points are respectively subjected to differential enhancement processing by using a nonlinear mapping function. For the first type of pixel points, the nonlinear mapping function is used for enhancement processing. For example, for the first type of pixel point with a gray value of 80, the 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, 255 is taken. For the second type of pixel points, the nonlinear mapping function is also used for enhancement processing. For example, for the second type of pixel point with a gray value of 180, the enhanced gray value can be obtained by multiplying the original gray value by the second enhancement coefficient 1.97: 180 × 1.97 = 354.6, which exceeds 255, so 255 is taken.
[0134] A plurality of parameter combinations are randomly generated within a 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]. Twenty parameter combinations are randomly generated, each containing four adjustment coefficients. These parameter combinations are substituted into the adaptive nonlinear mapping function to perform differential enhancement on the pixel points in the normalized image, obtaining twenty enhanced images.
[0135] By comparing and analyzing the quality of the twenty enhanced images, the best parameter combination is selected. Image quality can be evaluated by using indicators such as contrast, sharpness, and signal-to-noise ratio. For example, the image with the highest contrast and moderate signal-to-noise ratio is selected as the final enhancement result.
[0136] Figure 3 The logic diagram for the weld seam eddy current C scan image enhancement processing based on the adaptive nonlinear mapping of the embodiments of the present application:
[0137] The figure shows a differential enhancement processing flowchart of a weld filter image, describing a complete image enhancement algorithm process. The system obtains the weld filter scanning image after digital processing. Then preliminary processing is carried out, including calculating the maximum and minimum gray value of the image, and normalizing the image to make the gray value distribution more uniform. Then the average gray value and standard deviation value of the normalized image are calculated, which will be used in the subsequent image enhancement processing. In the core of the processing, the system calculates the non-linear curve shape parameter and the non-linear gray scale adjustment parameter. Based on the average gray value, the pixel points are divided into two categories: the first category is less than or equal to the average gray value, and the second category is greater than the average gray value. Different processing is carried out for the two categories of pixels: the enhancement coefficient is calculated (based on the gray difference value and the second adjustment coefficient), and then the non-linear mapping function is applied respectively. The two types of processing results are combined to obtain the differential enhanced image, and the final weld filter scanning 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 embodies the systematicness and pertinence of image enhancement processing, and is especially suitable for industrial application scenarios such as weld detection.
[0138] In an optional embodiment, the initial parameter population is taken as the current iteration population, the enhanced image features are extracted by combining horizontal and vertical gradient operators, the signal-to-noise ratio, edge intensity and image contrast are calculated and weighted summed to obtain the fitness value, and the adaptive optimization of the weld eddy current C scan image enhancement parameters is realized through multiple iteration optimization, including:
[0139] The initial parameter population is taken as the current iteration population; the parameter combination in the current iteration population is substituted into the non-linear transformation function, and the gray mapping of the weld eddy current C scan image is carried out to obtain the enhanced image; the horizontal gradient operator and the vertical gradient operator are constructed to extract the edge features of the enhanced image in the horizontal direction and the vertical direction respectively, and the edge intensity value is calculated according to the edge features in the horizontal direction and the vertical direction;
[0140] The signal-to-noise ratio of the enhanced image relative to the original image is calculated, and the gray contrast of the enhanced image is calculated; the edge intensity value, the signal-to-noise ratio and the gray contrast are multiplied by the corresponding weight coefficients respectively and summed to obtain the fitness value of the current parameter combination; the selection probability is calculated according to the fitness value of each parameter combination in the current iteration population, and part of the high-quality parameter combinations are selected based on the selection probability to form the preferred population; the parameter combinations in the preferred population are randomly paired, and the paired parameters are linearly combined through a predetermined crossover coefficient to obtain the crossed parameters; the mutated parameters are obtained by adding random disturbance with a predetermined step size to the crossed parameters;
[0141] The parameters after mutation are substituted into the nonlinear transformation function for image enhancement, and a new fitness value is calculated; it is determined whether the preset iteration number is reached or the optimal fitness value meets the preset condition, if yes, the current parameter combination with the highest fitness value is output as the optimal enhancement parameter, if not, the parameters after mutation form a new current iteration population to continue the parameter optimization process.
[0142] An initial parameter population is generated as a current iteration population. Multiple groups of parameter combinations can be randomly generated, each group containing parameters of the nonlinear transformation function. For example, 100 groups of parameters can be generated, each group containing 4 parameters a, b, c, d, with value ranges of [0.1, 2], [0, 255], [0, 255], [0.1, 10] respectively.
[0143] Each group of parameters in the current iteration population is substituted into the nonlinear transformation function, and the original weld eddy current C scan image is gray mapped to obtain an enhanced image. The nonlinear transformation function can use an S-shaped function, specifically: y = 255 / (1 + (x / b)^(-a)) - c, where x is the original image gray value, y is the mapped gray value, a, b, c are the parameters to be optimized. For a 256x256 original image, gray mapping is performed pixel by pixel to obtain the enhanced image.
[0144] Horizontal and vertical gradient operators are constructed to extract edge features in the horizontal and vertical directions of the enhanced image respectively. The horizontal gradient operator can use a one-dimensional convolution kernel of [-1, 0, 1], and the vertical gradient operator can use a one-dimensional convolution kernel of [-1; 0; 1]. Convolution operation is performed on the enhanced image to obtain horizontal gradient image Gx and vertical gradient image Gy.
[0145] The edge intensity value is calculated according to the horizontal gradient image Gx and the vertical gradient image Gy. The gradient amplitude can be used as a measure of edge intensity, i.e. 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 the average edge intensity of all pixel points is calculated to obtain the average edge intensity value E_avg of the whole image.
[0146] The signal-to-noise ratio of the enhanced image relative to the original image is calculated. The peak signal-to-noise ratio (PSNR) can be used as a measure, the specific calculation method is: first calculate the mean square error (MSE), i.e. the sum of the squares of the difference between the original image and the enhanced image corresponding pixel gray values divided by the total number of pixels; then calculate PSNR = 10*log10(255^2 / MSE).
[0147] The gray scale contrast of the enhanced image is calculated. The RMS contrast can be used as a measure, which is the standard deviation of the gray scale values of all pixels divided by the average gray scale value. In the specific calculation, the average gray scale value μ of the image is first calculated, then the sum of the squares of the difference between each pixel gray scale value and μ is calculated, and then the square root of the sum divided by the total number of pixels is calculated, and finally the RMS contrast is obtained by dividing μ.
[0148] The edge strength value E_avg, the signal-to-noise ratio PSNR, and the gray scale contrast RMS are multiplied by the preset weight coefficients w1, w2, and w3, respectively, 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.
[0149] The selection probability is calculated according to the fitness values of the parameter combinations in the current iteration population. The roulette wheel 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 being selected for the parameter combination.
[0150] Based on the selection probability, some high-quality parameter combinations are selected to form an optimal population. A random number between 0 and 1 can be generated using a random number generator, and 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 groups of parameters form the optimal population.
[0151] The parameter combinations in the optimal population are randomly paired. The 50 groups of parameters can be randomly sorted, and then the adjacent two groups of parameters are paired to obtain 25 pairs of parameter combinations.
[0152] The paired parameters are linearly combined by a preset crossover coefficient to obtain the crossed parameters. The crossover coefficient α can be set to 0.5, and for the paired parameter combinations (a1, b1, c1, d1) and (a2, b2, c2, d2), the new parameter combination (0.5a1+0.5a2, 0.5b1+0.5b2, 0.5c1+0.5c2, 0.5d1+0.5d2) is obtained after crossing.
[0153] Random perturbations with a preset step size are added to the crossed parameters to perform parameter mutation. The mutation step size β can be set to 0.1, and a random number in the range of [-0.1, 0.1] is added to each parameter after crossing to obtain the mutated parameters. It should be noted that the parameter values should be kept within the effective range.
[0154] The mutated parameters are re-substituted into the nonlinear transformation function for image enhancement, and the new fitness value is calculated according to the aforementioned method.
[0155] It is judged whether the preset iteration number is reached or the optimal fitness value meets the preset condition. The maximum iteration number can be set as 100, or the fitness value threshold can be set as 0.9. If the maximum iteration number is reached or the optimal fitness value exceeds the threshold, the parameter combination with the highest fitness value in the current iteration is output as the optimal enhancement parameter; otherwise, the mutated parameters form a new current iteration population, and the parameter optimization process is continued.
[0156] Through the above steps, the adaptive optimization of the weld eddy current C-scan image enhancement parameters can be realized. The method can automatically find the optimal image enhancement parameters according to the edge features, signal-to-noise ratio, contrast and other indicators of the image, and improve the quality and recognizability of the weld eddy current C-scan image. In actual application, the parameters and weight coefficients can be adjusted according to specific needs to obtain the best enhancement effect.
[0157] Figure 4 The flowchart of the weld eddy current C-scan image enhancement based on the parameter population iterative optimization of the embodiment of the application is as follows:
[0158] This picture shows a parameter optimization genetic algorithm flowchart, which describes a complete adaptive optimization process. The population initialization process is performed to establish the initial parameter group. Then the current iteration population is set, which is the starting point of the iterative optimization. In the core processing link, the system applies the parameter combination for nonlinear transformation to obtain the enhanced image. Then the horizontal and vertical gradient operators are applied to extract the image edge features and calculate the edge intensity. The algorithm continues to calculate the signal-to-noise ratio and the gray scale contrast, and calculates the fitness value based on the same. Based on these fitness values, the system calculates the selection probability and selects the high-quality parameter combination to form the preferred population. The parameter crossover operation is performed on the preferred population to generate new parameters through linear combination. Then random disturbance is added to the crossed parameters to realize parameter mutation to obtain the mutated parameters. The system will judge whether the preset iteration number is reached or the fitness condition is met. If the condition is not met, the process returns to the step of setting the current iteration population to continue optimization; if the condition is met, the optimal enhancement parameter combination is output as the final result. This flowchart reflects the application of genetic algorithm in image processing parameter optimization. Through continuous iteration and optimization, the best parameter combination is found to achieve the optimal effect of image enhancement. The whole process shows the clever use of biological evolution theory in computer algorithm, which has strong adaptability and optimization ability.
[0159] The second aspect of the embodiment of the application,
[0160] The weld defect recognition and area quantitative calculation system is provided, which comprises:
[0161] The first unit is used for collecting the scanning signals of the thirty-two channel array eddy current probe, mapping the row and column indexes of the eddy current signal matrix into image coordinate positions, mapping the signal amplitude into a gray value, and determining the actual pixel spacing according to the encoder sampling interval and the spacing between adjacent channels to generate a weld eddy current C-scan original image; the weld reinforcement is divided by the horizontal and vertical pixel spacing respectively, and one is added after the upward rounding to determine the number of columns and rows of the filter window, a rectangular filter window matrix is constructed, the rectangular filter window matrix is moved on the weld eddy current C-scan original image point by point, and the original gray value of the to-be-processed point is replaced by the median value of the gray values in the window coverage area after sorting to obtain a filtered image;
[0162] The second unit is used for moving the third-order rectangular convolution kernel matrix on the filtered image point by point, and realizing gray value updating by combining an adaptive enhancement coefficient to obtain a sharpened image, and evaluating the enhancement effect by using an edge gain index and a signal quality index; an adaptive nonlinear 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 in a preset parameter range to form an initial parameter population, and the parameter combinations in the initial parameter population are substituted into the adaptive nonlinear mapping function to differentially enhance the pixel points in the normalized image;
[0163] The third unit is used for taking the initial parameter population as a current iteration population, extracting the features of the enhanced image by combining horizontal and vertical gradient operators, calculating the signal-to-noise ratio, edge intensity and image contrast and performing weighted summation to obtain an adaptability value, and realizing adaptive optimization of the weld eddy current C-scan image enhancement parameters through multiple iterations.
[0164] A third aspect of the embodiment of the present application,
[0165] An electronic device is provided, comprising:
[0166] a processor;
[0167] a memory for storing processor-executable instructions;
[0168] The processor is configured to invoke the instructions stored in the memory to perform the method described above.
[0169] A fourth aspect of the embodiment of the present application,
[0170] A computer-readable storage medium is provided, which stores computer program instructions, and the computer program instructions are executed by a processor to implement the method described above.
[0171] The present application can be a method, device, system and / or computer program product. The computer program product can include a computer readable storage medium having computer readable program instructions loaded thereon for performing various aspects of the present application.
[0172] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and are not intended to limit the present application; although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions recorded in the above embodiments can be modified, or some or all of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for recognizing a weld defect and quantitatively calculating an area, characterized by, The method comprises the following steps: Collecting the scanning signals of the thirty-two channel array eddy current probe maps the row and column indexes of the eddy current signal matrix to the image coordinate positions, maps the signal amplitude to the gray value, and determines the actual pixel spacing according to the encoder sampling interval and the spacing between adjacent channels to generate a weld eddy current C-scan original image; the column number and the row number of the filter window are determined based on the weld reinforcement divided by the horizontal and vertical pixel spacing and then rounded up by one, a rectangular filter window matrix is constructed, the rectangular filter window matrix is moved on the weld eddy current C-scan original image point by point, and the original gray value of the to-be-processed point is replaced by the median value of the gray values in the window coverage area to obtain a filtered image; The third-order rectangular convolution kernel matrix is moved on the filtered image point by point, and the gray value is updated to obtain a sharpened image by combining the adaptive enhancement coefficient; the edge gain index and the signal quality index are used to evaluate the enhancement effect; the adaptive nonlinear mapping function is constructed based on the sharpened image, and the normalized image is obtained by normalizing the sharpened image; a plurality of parameter combinations are randomly generated in a predetermined parameter range to form an initial parameter population, and the parameter combinations in the initial parameter population are substituted into the adaptive nonlinear mapping function to differentially enhance the pixels in the normalized image; The initial parameter population is taken as the current iteration population, the features of the enhanced image are extracted by combining the horizontal and vertical gradient operators, the signal-to-noise ratio, the edge intensity and the image contrast are calculated and weightedly summed to obtain the fitness value, and the adaptive optimization of the weld eddy current C-scan image enhancement parameters is realized through multiple iterations.
2. The method of claim 1, wherein, Collecting the scanning signals of the thirty-two channel array eddy current probe maps the row and column indexes of the eddy current signal matrix to the image coordinate positions, maps the signal amplitude to the gray value, and determines the actual pixel spacing according to the encoder sampling interval and the spacing between adjacent channels to generate a weld eddy current C-scan original image includes: The thirty-two channel array eddy current probe is placed on the weld surface of the workpiece to be measured, wherein the linear array direction of the thirty-two channel array eddy current probe is perpendicular to the weld direction, 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 arranged; The thirty-two channel array eddy current probe is controlled to scan along the weld direction, and the scanning encoder of the thirty-two channel array eddy current probe is used for equal space sampling to obtain the eddy current impedance signal amplitude at each sampling position, wherein the sampling interval of the scanning encoder is set to a fixed value in advance, an eddy current signal matrix is constructed according to the eddy current impedance signal amplitude at the sampling position, the number of rows of the eddy current signal matrix corresponds to the 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; The actual spacing of the longitudinally adjacent pixels in the weld array eddy current imaging image is determined according to the sampling interval of the scanning encoder, and the actual spacing of the horizontally adjacent pixels in the weld array eddy current imaging image is determined according to the spacing between the adjacent channels of the thirty-two channel array eddy current probe; The spatial resolution of the weld array eddy current imaging image in the longitudinal direction and the transverse direction is calculated, wherein the spatial resolution in the longitudinal direction is the inverse of the actual distance between adjacent pixels in the longitudinal direction, and the spatial resolution in the transverse direction is the inverse of the actual distance between adjacent pixels in the transverse direction; the weld array eddy current imaging image is calibrated according to the spatial resolution, so as to ensure the corresponding relationship between the pixel position and the actual physical position in the weld array eddy current imaging image, and a weld eddy current C-scan original image is generated.
3. The method of claim 1, wherein, Based on the weld reinforcement being divided by the transverse and longitudinal pixel pitch respectively, and the column number and the row number of the filter window being determined by taking one more than the upper integer, a rectangular filter window matrix is constructed, the rectangular filter window matrix is moved on the weld eddy current C-scan original image point by point, and the original gray value of the to-be-processed point is replaced by the median value of the gray values in the window coverage area after sorting to obtain a filtered image, including: The maximum size of the weld reinforcement in the array probe length direction and the weld direction is collected, the maximum size of the array probe length direction is divided by the transverse pixel pitch to obtain a first quotient, the maximum size of the weld direction is divided by the longitudinal pixel pitch to obtain a second quotient, the first quotient is taken as one more than the upper integer to obtain the column number of the filter window, and the second quotient is taken as one more than the upper integer to obtain the row number of the filter window; A rectangular filter window matrix is constructed according to the filter window row number and the filter window column number, the row number of the rectangular filter window matrix is the filter window row number, and the column number of the rectangular filter window matrix is the filter window column number; The center position of the rectangular filter window matrix is coincided with the position of the to-be-processed point in the eddy current array C-scan original image gray value matrix, all gray values in the coverage range of the rectangular filter window matrix are extracted to form a gray value set; The gray values in the gray value set are sorted according to the numerical value to obtain an ordered gray value sequence, and the median value of the ordered gray value sequence is replaced by the original gray value of the to-be-processed point to obtain an updated to-be-processed point gray value; The rectangular filter window matrix is moved along the eddy current array C-scan original image gray value matrix point by point, and the gray value extraction, sorting and replacement processes are repeatedly executed until all points in the eddy current array C-scan original image gray value matrix are updated, and a filtered image is obtained based on the updated eddy current array C-scan original image gray value matrix.
4. The method of claim 1, wherein, Based on the third-order rectangular convolution kernel matrix moving on the filtered image point by point, and combined with the adaptive enhancement coefficient, the gray value is updated to obtain a sharpened image, and the edge gain index and the signal quality index are used to evaluate the enhancement effect, including: A third-order rectangular convolution kernel matrix is constructed, the center element of the third-order rectangular convolution kernel matrix is set to negative eight, and the other eight elements are all set to one, the center position of the third-order rectangular convolution kernel matrix is coincided with the position of the to-be-processed point in the eddy current array C-scan image gray value matrix after filter processing; An original gray value matrix is constructed by extracting the image gray values in the coverage range of the third-order rectangular convolution kernel matrix, and the boundary is extended when the extraction position is located at the image boundary, and the gray values at the image boundary are filled into the positions exceeding the image range to obtain an extended original gray value matrix; Conduct convolution operation on the extended original gray value matrix and the third-order rectangular convolution kernel matrix to obtain a Laplace operator response value of the current point to be processed, calculate a ratio of a square of the Laplace operator response value to a preset variance parameter, obtain an adaptive enhancement coefficient by taking a negative exponent of the ratio and multiplying the adaptive enhancement coefficient by a preset basic enhancement intensity; Subtract the product of the adaptive enhancement coefficient and the Laplace operator response value from the original gray value to obtain an enhanced gray value, and replace the original gray value with the enhanced gray value; Move the third-order rectangular convolution kernel matrix on the filtered eddy current array C scan image gray value matrix point by point until all pixel points are processed to obtain an enhanced eddy current array C scan image gray value matrix; Calculate a sum of edge gradient amplitudes of the enhanced eddy current array C scan image gray value matrix and the filtered eddy current array C scan image gray value matrix respectively, and take a ratio of the sum of the edge gradient amplitudes to a sum of edge gradient amplitudes before enhancement as an edge gain index; calculate a difference value of signal-to-noise ratios before and after enhancement as a signal quality index, and evaluate a signal enhancement effect according to the edge gain index and the signal quality index.
5. The method of claim 1, wherein, Construct an adaptive nonlinear mapping function based on the sharpened image, normalize the sharpened image to obtain a normalized image; randomly generate a plurality of parameter combinations in 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, including: Obtain a gray value matrix of the weld eddy current C scan image after sharpening, calculate a maximum gray value and a minimum gray value in the gray value matrix of the weld eddy current C scan image, subtract the minimum gray value multiplied by two hundred and fifty-five from the gray value of each pixel point in the gray value matrix of the weld eddy current C scan image, and divide the result by a difference between the maximum gray value and the minimum gray value to obtain a normalized gray value matrix of the weld eddy current C scan image; Calculate an arithmetic mean value of the gray values of all pixel points in the normalized gray value matrix of the weld eddy current C scan image to obtain an average gray value, and calculate a square root of a sum of squares of differences between the gray values of all pixel points in the normalized gray value matrix of the weld eddy current C scan image and the average gray value to obtain a standard deviation value; Multiply the ratio of the standard deviation value to the average gray value by a first adjustment coefficient to obtain a nonlinear curve shape parameter, and multiply the average gray value by a second adjustment coefficient to obtain a nonlinear gray threshold parameter; Divide the pixel points with a gray value less than or equal to the average gray value in the normalized gray value matrix of the weld eddy current C scan image into a first type of pixel points, and divide the pixel points with a gray value greater than the average gray value into a second type of pixel points; For the first type of pixel points, calculate a ratio of an absolute value of a difference between the gray value of each pixel point and the average gray value to the average gray value, multiply the ratio by a third adjustment coefficient, add one to the result, and multiply the result by the nonlinear curve shape parameter to obtain a first enhancement coefficient. For the second type of pixel points, 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 is calculated, the ratio is multiplied by a fourth adjustment coefficient and then added by one, and the obtained result is multiplied by a nonlinear curve shape parameter to obtain a second enhancement coefficient; the first type of pixel points and the second type of pixel points are respectively subjected to differential enhancement processing by using a nonlinear mapping function.
6. The method of claim 1, wherein, The initial parameter population is taken as the current iteration population, the enhanced image features are extracted by combining horizontal and vertical gradient operators, the signal-to-noise ratio, edge intensity and image contrast are calculated and weightedly summed to obtain the fitness value, and the adaptive optimization of the weld eddy current C-scan image enhancement parameters is realized through multiple iteration optimization, including: The initial parameter population is taken as the current iteration population; the parameter combination in the current iteration population is substituted into the nonlinear transformation function, and the gray mapping of the weld eddy current C-scan image is performed to obtain an enhanced image; the horizontal gradient operator and the vertical gradient operator are constructed to extract the edge features of the enhanced image in the horizontal direction and the vertical direction respectively, and the edge intensity value is calculated according to the edge features in the horizontal direction and the edge features in the vertical direction; The signal-to-noise ratio of the enhanced image relative to the original image is calculated, and the gray contrast of the enhanced image is calculated; the edge intensity value, the signal-to-noise ratio and the gray contrast are multiplied by the corresponding weight coefficients respectively and summed to obtain the fitness value of the current parameter combination; the selection probability is calculated according to the fitness value of each parameter combination in the current iteration population, and part of the high-quality parameter combinations are selected based on the selection probability to form an optimal population; the parameter combinations in the optimal population are randomly paired, and the paired parameters are linearly combined through a preset crossover coefficient to obtain the parameters after crossover; the parameters after mutation are obtained by adding random disturbance with a preset step to the parameters after crossover; The parameters after mutation are substituted into the nonlinear transformation function for image enhancement and the new fitness value is calculated; whether the preset iteration number is reached or the optimal fitness value meets the preset condition is judged, if yes, the parameter combination with the highest fitness value in the current is output as the optimal enhancement parameter, if not, the parameters after mutation form a new current iteration population to continue the parameter optimization process.
7. System for weld defect recognition and area quantification, for implementing the method according to any one of the preceding claims 1-6, characterized in that, including: The first unit is used for acquiring the scanning signals of a thirty-two channel array eddy current probe, mapping the row and column indexes of the eddy current signal matrix into image coordinate positions, mapping the signal amplitude into gray values, and determining the actual pixel spacing according to the encoder sampling interval and the spacing between adjacent channels to generate a weld eddy current C-scan original image; the column number and the row number of the filter window are determined based on the weld crown height divided by the horizontal and vertical pixel spacing and then rounded up by one, a rectangular filter window matrix is constructed, the window matrix is moved on the weld eddy current C-scan original image point by point, and the original gray value of the to-be-processed point is replaced by the median value of the gray values in the window coverage area after sorting to obtain a filtered image; The second unit is used for moving on the filtered image point by point based on a third-order rectangular convolution kernel matrix, and updating the gray value to obtain a sharpened image by combining an adaptive enhancement coefficient; an edge gain index and a signal quality index are used to evaluate the enhancement effect; an adaptive nonlinear mapping function is constructed based on the sharpened image, and the normalized image is obtained by normalizing the sharpened image; a plurality of parameter combinations are randomly generated in a preset parameter range to form an initial parameter population, and the parameter combinations in the initial parameter population are substituted into the adaptive nonlinear mapping function to differentially enhance the pixel points in the normalized image; The third unit is used for taking the initial parameter population as a current iteration population, extracting the features of the enhanced image by combining the horizontal and vertical gradient operators, calculating the signal-to-noise ratio, the edge intensity and the image contrast, and performing weighted summation to obtain the fitness value, and realizing adaptive optimization of the weld eddy current C scan image enhancement parameters through multiple iterations.
8. An electronic device, comprising: It comprises: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to invoke the instructions stored in the memory to execute the method of any one of claims 1 to 6.
9. A computer-readable storage medium having stored thereon computer program instructions, wherein, The computer program instructions are executed by the processor to implement the method of any one of claims 1 to 6.
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