Heat exchanger welding seam image enhancement processing method

Through dynamic threshold segmentation and pixel-level fusion processing, the image enhancement problem of weld images in the prior art under strong and low-light environments is solved, the texture details and boundary clarity of the weld area are improved, and the recognition ability of microcracks and pseudo-defects is enhanced.

CN120451019APending Publication Date: 2025-08-08QINGDAO PINGDIAN BOILER AUXILIARY EQUIP CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202510844880.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-23
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

The existing image enhancement technology loses texture details in the weld area under strong light scenes, the boundaries between the base material and the weld are blurred in low light environments, and global processing leads to noise and effective features enhancement, affecting the effect of the weld image of the heat exchanger.

Method used

The weld and base material areas are divided by dynamic thresholds, and gradient reconstruction, dynamic range expansion and brightness calibration are performed on the highlight area, dark area and intermediate area respectively. Combined with pixel-level fusion and edge sharpness verification, weld images are generated.

Benefits of technology

Effectively suppress texture loss caused by strong reflection, improve the clarity of weld areas in low-light environments, avoid noise amplification, and significantly improve the recognition ability of microcracks and pseudo-defects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120451019A_ABST
    Figure CN120451019A_ABST
Patent Text Reader

Abstract

The invention discloses a heat exchanger welding seam image enhancement processing method, and belongs to the technical field of image processing, and the method comprises the steps: S1, collecting a heat exchanger welding seam original image through a preset collection module, and converting the original image into a grayscale image; s2, a processing module is preset, the gray level image is segmented based on a preset dynamic threshold value, and a welding seam area image and a base metal area image are generated; s3, in the welding seam area image, generating a first enhanced image, a second enhanced image and a third enhanced image through a preset generation module; and S4, extracting a reference edge contour of the weld joint area image from the base metal area image, performing pixel-level fusion on the first enhanced image, the second enhanced image and the third enhanced image, and outputting a weld joint image. According to the method, the weld joint area is divided into the highlight area, the dark area and the middle area to be processed respectively, weld pool texture loss caused by strong reflection is effectively restrained, and the problem that details are lost in a highlight scene in an existing method is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method for enhancing the image of a heat exchanger weld. Background Art

[0002] A heat exchanger is an energy-saving device that transfers heat between two or more fluids at different temperatures. During the welding process, improper welding temperature or speed can cause welding defects. The main external welding defects include weld bumps, cracks, and porosity. When visually inspecting weld images, the images are complex in color, low in contrast, and accompanied by a small amount of noise. Many defects are difficult to detect and cannot be accurately identified. Traditionally, this involves image enhancement of the weld area.

[0003] Existing image enhancement techniques use linear transformation to globally adjust grayscale values, map pixel grayscales by a fixed slope, and apply histogram equalization to forcibly equalize the grayscale distribution of the entire image.

[0004] However, existing image enhancement methods overexpose the weld area and lose texture details in strong light scenes, blur the boundary between the base material and the weld in low light environments, and use global processing to enhance both noise and effective features, resulting in amplified spatter noise in the weld and the masking of microcracks, affecting the image enhancement effect of the heat exchanger weld.

[0005] Therefore, there is an urgent need to provide a heat exchanger weld image enhancement processing method to solve the above problems. Summary of the Invention

[0006] The technical problem to be solved by the present invention is to overcome the shortcomings of the above-mentioned existing image enhancement processing method, such as overexposure and loss of texture details in the weld area in strong light scenes, blurred boundaries between the base material and the weld in low light environments, and the use of global processing to simultaneously enhance noise and effective features, resulting in amplification of spatter noise at the weld and masking of microcracks, which affects the effect of heat exchanger weld image enhancement. A heat exchanger weld image enhancement processing method is provided.

[0007] To solve the above technical problems, the present invention adopts a technical solution: providing a heat exchanger weld image enhancement processing method, comprising the following steps:

[0008] S1. Collecting the original image of the heat exchanger weld through a preset acquisition module and converting the original image into a grayscale image;

[0009] S2, a preset processing module, which segments the grayscale image based on a preset dynamic threshold to generate a weld area image and a base material area image;

[0010] S3. Extracting, from the weld area image, highlight areas having grayscale values greater than a preset first threshold and dark areas having grayscale values less than a preset second threshold using a preset generation module, performing a preset gradient reconstruction operation on the highlight areas to generate a first enhanced image, performing a preset dynamic range expansion operation on the dark areas to generate a second enhanced image, and generating a third enhanced image using a preset brightness calibration unit for intermediate areas having grayscale values between the first threshold and the second threshold;

[0011] S4. Extract the reference edge contour of the weld area image from the base material area image, perform pixel-level fusion on the first enhanced image, the second enhanced image, and the third enhanced image to generate a complete image, and use the reference edge contour as a geometric constraint to repair the broken boundary of the complete image and output a weld image.

[0012] The present invention is further configured as follows: the specific content of step S1 is:

[0013] S11. Adjusting the position and parameters of the preset optical components, aligning the acquisition module with the center line of the heat exchanger weld and maintaining a vertical shooting angle, continuously capturing multiple frames of original images, and transmitting the original images in real time to a preset memory via a preset data bus;

[0014] S12: extracting the RGB three-channel pixel data of the original image in the memory, performing weighted calculation on the three-channel pixel data according to a preset weight formula, and merging the calculation results into a grayscale image.

[0015] The present invention is further configured as follows: the specific steps of generating the weld area image and the base material area image in step S2 include:

[0016] S21, the processing module divides the grayscale image into a plurality of independent sub-region images, each of the sub-region images containing a preset number of pixels of local features of the weld;

[0017] S22, dividing the pixels in each sub-region image into two sets of pixels above the dynamic threshold and below the dynamic threshold using the segmentation parameters in the preset feature analysis model;

[0018] S23. Merge the multiple sub-region images corresponding to all pixel sets above the dynamic threshold to generate a weld region image, and merge the multiple sub-region images corresponding to all pixel sets below the dynamic threshold to generate a base material region image.

[0019] The present invention is further configured as follows: the method for generating the dynamic threshold in step S22 includes:

[0020] S221, the processing module extracts the grayscale gradient features and spatial distribution features of the pixels in the sub-region image to form a feature matrix;

[0021] S222, calculating the feature matrix using the feature analysis model to generate a regional reference threshold;

[0022] S223 , performing adaptive compensation based on the gradient change rate of the reference threshold of the adjacent sub-region image to generate a dynamic threshold.

[0023] The present invention is further configured such that the generation of the first enhanced image in step S3 includes the following steps:

[0024] S31, defining a set of linear filter templates in the generation module, performing a convolution operation preset by the linear filter templates in each direction on each pixel in the highlight area, and generating a set of convolution response values of each pixel in the highlight area on the linear filter templates in each direction;

[0025] S32, sorting the convolution response values in the convolution response value set of each pixel in the highlighted area, and selecting the direction corresponding to the largest convolution response value as the dominant direction of the pixel;

[0026] S33. For each pixel in the highlighted area, calculate the grayscale mean along its dominant direction and its adjacent directions. If the difference between the grayscale mean of the pixel and the grayscale mean of the pixels in the direction adjacent to the dominant direction exceeds a preset tolerance threshold, replace the grayscale mean of the current pixel with the grayscale mean of the pixels in the direction adjacent to the dominant direction.

[0027] S34. For the highlighted area processed by step S33, the current pixel point and the continuous pixel points adjacent to it and with the same dominant direction in the highlighted area are divided into independent processing blocks, the grayscale difference value of all pixel points in each independent processing block is calculated, the grayscale weight coefficient of each pixel point in the independent processing block is synchronously adjusted according to the grayscale difference value, and an enhanced pixel point set is generated. The enhanced pixel point sets after adjustment of all blocks are superimposed to generate a first enhanced image.

[0028] The present invention is further configured as follows: the method for generating the second enhanced image in step S3 is as follows:

[0029] S301, traversing all pixels in the dark area and establishing a coordinate system within the dark area, calculating the grayscale values of all pixels in the dark area using a generation module, grouping pixels with adjacent grayscale values and continuous spatial positions into processing groups, calculating the average grayscale value of the pixels in each processing group using the generation module, and obtaining the boundary coordinates of each processing group in the coordinate system;

[0030] S302, calculating the difference between the maximum grayscale value and the minimum grayscale value in each processing group, and taking the difference as a local discrete quantity, calculating the absolute value of the difference between the average grayscale values of adjacent processing groups according to the boundary coordinates of each processing group, adjusting the preset basic adjustment factor in each processing group according to the local discrete quantity, and merging the adjacent processing groups into a single new group when the absolute value of the difference between the average grayscale values of adjacent processing groups is less than a preset merging threshold, and if the absolute value of the difference between the average grayscale values of adjacent processing groups is greater than or equal to the preset merging threshold, the generation module respectively extracts the coordinates of the two pixels with the smallest distance between them in the adjacent processing groups, and replaces the grayscale values of all pixels in the adjacent processing groups with the weighted average of the grayscale values of these two pixels;

[0031] S303 , using the average value of the basic adjustment factors of each merged single new group as a grayscale multiplication base, and multiplying the grayscale average value of all pixels in each single new group by the corresponding grayscale multiplication base to generate a second enhanced image.

[0032] The present invention is further configured such that the generation of the third enhanced image in step S3 includes the following steps:

[0033] S3001: The brightness calibration unit traverses all pixels in the middle area, calculates the sum of the absolute values of the grayscale values of the boundary pixels and the grayscale value of the current pixel, and divides the sum by the number of all boundary pixels as the neighborhood fluctuation amount of the current pixel;

[0034] S3002, calculating the mean and variance of the grayscale values of all pixels in the middle area, and dynamically calculating the reference adjustment coefficient of each pixel in the middle area using the variance as a constraint condition;

[0035] S3003. Multiply the neighborhood fluctuation amount of each pixel point by the benchmark adjustment coefficient to obtain a final calibration coefficient, and perform an operation of multiplying the grayscale value by the final calibration coefficient for each pixel point whose grayscale value is between the first threshold and the second threshold to generate a third enhanced image.

[0036] The present invention is further configured as follows: the steps for generating the weld seam image in step S4 are as follows:

[0037] S41, taking the coordinate position of each pixel point in the first enhanced image, the second enhanced image, and the third enhanced image as a reference, respectively, calculating the original grayscale value of each pixel point in the weld area image, and calculating the maximum deviation between the grayscale value of each pixel point in the first enhanced image, the second enhanced image, and the third enhanced image and the original grayscale value, and generating a preliminary fusion weight factor for each pixel point based on the maximum deviation;

[0038] S42, extending a transition buffer zone of a set pixel width on both sides of the reference edge contour in the mother material region image, extracting a preset reference grayscale distribution pattern from the mother material region image within the transition buffer zone, and synchronously adjusting a preliminary fusion weight factor of each pixel point within the transition buffer zone according to the reference grayscale distribution pattern;

[0039] S43: Mapping the adjusted preliminary fusion weight factors to pixel grayscale contribution coefficients of the first enhanced image, the second enhanced image, and the third enhanced image, and calculating the fusion grayscale value of each pixel by multiplying the grayscale value of each pixel in the first enhanced image, the second enhanced image, and the third enhanced image by the corresponding pixel grayscale contribution coefficient and summing the results;

[0040] S44. Perform a preset edge sharpness consistency check on the fused grayscale value at the junction of the weld area image and the base material area image, and merge the checked fused grayscale value with the fused grayscale value at the non-junction area to output a complete image.

[0041] The beneficial effects of the present invention are as follows:

[0042] 1. This method divides the weld area into highlight, dark, and intermediate areas and processes them separately. In the highlight area, it uses a dominant directional gradient reconstruction and block grayscale coordinated adjustment mechanism to perform directional texture restoration and compensate for intra-block differences in overexposed areas. This effectively suppresses the loss of weld pool texture caused by strong reflections and solves the problem of detail loss in high-light scenes often encountered by existing methods.

[0043] 2. The present invention generates a transition buffer zone based on the base material area baseline contour and performs dynamic edge sharpness verification. Combined with the dynamic range expansion and noise control of the dark area processing group, the clarity of the boundary between the weld area image and the base material area image in a low-light environment is improved. At the same time, a partitioning processing mechanism is used to avoid the amplification of spatter noise caused by global enhancement, significantly improving the ability to distinguish between microcracks and pseudo-defects. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 is a flow chart of the method of the present invention;

[0045] Figure 2 Flowchart of the method for generating weld area image and base material area image of the present invention;

[0046] Figure 3 is a flow chart of a method for generating a first enhanced image according to the present invention;

[0047] Figure 4 This is a flow chart of the method for generating a weld image of the present invention. DETAILED DESCRIPTION

[0048] The preferred embodiments of the present invention are described in detail below with reference to the accompanying drawings so that the advantages and features of the present invention can be more easily understood by those skilled in the art, thereby making a clearer and more precise definition of the protection scope of the present invention.

[0049] See also Figures 1-4 A heat exchanger weld image enhancement processing method includes the following steps:

[0050] S1. Collecting the original image of the heat exchanger weld through a preset acquisition module and converting the original image into a grayscale image;

[0051] The specific content of step S1 is:

[0052] S11. Adjust the position and parameters of the preset optical components, align the acquisition module with the centerline of the heat exchanger weld and maintain a vertical shooting angle, continuously capture multiple frames of original images, and transmit the original images in real time to a preset memory via a preset data bus. The optical components include an industrial camera, an optical lens, and a controllable light source. The data bus is preferably a PCIe bus or a Camera Link interface for transmitting image signals. The memory is preferably a DDR memory or a flash memory chip for storing the acquired image data.

[0053] S12, extracting RGB three-channel pixel data of the original image in the memory, performing weighted calculation on the three-channel pixel data according to a preset weight formula, and merging the calculation results into a grayscale image, where the weight formula refers to the RGB to grayscale coefficient commonly used in the industrial inspection field: R×0.299+G×0.587+B×0.114;

[0054] S2, a preset processing module, which segments the grayscale image based on a preset dynamic threshold value to generate a weld area image and a base material area image;

[0055] The specific steps of generating the weld area image and the base material area image in step S2 include:

[0056] S21, the processing module divides the grayscale image into a plurality of independent sub-region images, each sub-region image includes a local feature of the weld with a preset number of pixels, and the preferred range of the preset number of pixels is between 0 and 1024 pixels on a single side;

[0057] S22. Divide the pixels in each sub-region image into two sets of pixels above and below a dynamic threshold using segmentation parameters in a preset feature analysis model. The feature analysis model is preferably a dynamic binarization decision mechanism based on grayscale statistical characteristics, which is common knowledge.

[0058] S23. Merge multiple sub-region images corresponding to all pixel sets above the dynamic threshold to generate a weld region image, and merge multiple sub-region images corresponding to all pixel sets below the dynamic threshold to generate a base material region image.

[0059] The method for generating the dynamic threshold in step S22 includes:

[0060] S221, the processing module extracts the grayscale gradient features and spatial distribution features of the pixels in the sub-region image to form a feature matrix;

[0061] Specifically, all pixels in the sub-region image are traversed, and for each pixel, the maximum grayscale difference between it and its eight neighboring pixels is calculated as the gradient eigenvalue. At the same time, the Euclidean distance from the pixel coordinate to the center pixel of the sub-region image is recorded as the spatial distribution eigenvalue. The gradient eigenvalue and spatial distribution eigenvalue of each pixel are arranged in a fixed order as the row vector of a two-dimensional array. Finally, the row vectors of all pixels are integrated to form a feature matrix.

[0062] S222, calculating the feature matrix through a feature analysis model to generate a regional benchmark threshold;

[0063] Specifically, the gradient feature mean and spatial distribution standard deviation are calculated for each column of the feature matrix, and the gradient feature mean multiplied by the weight coefficient A and the spatial distribution mean multiplied by the weight coefficient B are added to obtain the initial reference value. The initial reference value is then added to the sum of the gradient feature standard deviation and the spatial distribution standard deviation multiplied by the adjustment coefficient C as the regional reference threshold, where the weight coefficient A is the contribution intensity of the grayscale gradient feature to the reference threshold, preferably 0.7; the weight coefficient B is the contribution intensity of the spatial distribution feature to the reference threshold, preferably 0.3; the adjustment coefficient C is the interference intensity of the local noise on the reference threshold, preferably 0.03;

[0064] S223, performing adaptive compensation based on the gradient change rate of the reference threshold of the adjacent sub-region image to generate a dynamic threshold;

[0065] Specifically, with the current sub-region image as the center, the absolute value of the difference between it and the baseline threshold of the adjacent four directional sub-region images is calculated and divided by the distance between the adjacent sub-region images to obtain the gradient change rate. If the gradient change rate is greater than the preset sensitive threshold, the current baseline threshold is reduced in proportion to the excess; otherwise, it is increased in proportion. The adjusted value is output as the dynamic threshold. The compensation amplitude is negatively correlated with the gradient change rate. The sensitive threshold refers to the critical value of the gradient change rate between adjacent sub-regions that triggers dynamic threshold compensation, and the preferred value is 0.15.

[0066] In Example 1, a segmentation process is performed on a 2000×1500 pixel grayscale image of a heat exchanger weld. In step S21, the image is divided into 12 sub-regions of 512×512 pixels (one side is within the preferred range of 0-1024). For each sub-region, a feature matrix is calculated in step S221: the maximum grayscale difference of its eight neighborhoods is calculated as the gradient feature value (for example, the grayscale difference of the eight neighborhoods of pixel (100, 200) = 45). At the same time, the Euclidean distance of each point coordinate to the center pixel of the sub-region image is recorded as the spatial feature value (for example, the distance from the center pixel = 158.3 pixels) to form a row vector matrix. In step S222, the reference threshold of each sub-region image is calculated by taking the mean of the gradient feature × 0.7 (for example, 35.2 × 0. 7=24.64) plus the spatial distribution mean × 0.3 (e.g., 145.6 × 0.3=43.68) to obtain an initial value of 68.32, and then add (gradient standard deviation + spatial standard deviation) × 0.03 (e.g., (8.4+12.1) × 0.03≈0.62), and output the reference threshold ≈68.94; dynamic compensation is performed in step S223: the absolute value of the reference threshold difference between the current sub-region image and the four adjacent sub-region images / the gradient change rate of the spacing is calculated (e.g., the reference threshold difference of adjacent sub-region images is 15.3 / the spacing is 512≈0.03). Since 0.03 is less than the sensitive threshold of 0.15, the reference threshold is proportionally increased to 70.5. Finally, this value is used as the dynamic threshold to complete the pixel binary classification in step S22, and the weld and parent material area images are output.

[0067] Example 1 accurately identifies the weld structure through dynamic threshold segmentation (such as the baseline threshold of 68.94 is compensated to 70.5 by a gradient change rate of 0.03), significantly improving the segmentation quality: feature fusion design (gradient feature weight 0.7 + spatial feature weight 0.3) enhances the robustness of local features and avoids over-segmentation of traditional single threshold; the sub-region division strategy (512×512 pixels) is combined with an adaptive compensation mechanism (sensitive threshold 0.15 to regulate the compensation amplitude) to effectively smooth the threshold jumps between adjacent regions (such as gradient difference 15.3) and eliminate pseudo-edge interference; the spatial standard deviation adjustment item (weight 0.03) suppresses the influence of noise, ensuring the output of continuous and clear weld area contours in the large-size image of 2000×1500, providing a high-precision segmentation basis for subsequent enhancement.

[0068] S3. In the weld area image, a preset generation module is used to extract highlight areas having grayscale values greater than a preset first threshold and dark areas having grayscale values less than a preset second threshold, and a preset gradient reconstruction operation is performed on the highlight areas to generate a first enhanced image. A preset dynamic range expansion operation is performed on the dark areas to generate a second enhanced image. A preset brightness calibration unit is used to generate a third enhanced image for an intermediate area having grayscale values between the first and second thresholds. The first threshold is in the range of 150-220, and the second threshold is in the range of 50-70.

[0069] The generation of the first enhanced image in step S3 includes the following steps:

[0070] S31, defining a set of linear filter templates in a generation module, performing a convolution operation preset by the linear filter templates in each direction on each pixel in the highlight area, and generating a set of convolution response values of each pixel in the highlight area on the linear filter templates in each direction;

[0071] The direction of the linear filter template covers a full half-circle direction range of 180°, with the horizontal direction as the 0° reference and rotated to a fixed angle interval (such as 15°).

[0072] Convolution operation execution steps: For each pixel point in the highlight area, superimpose the linear filter template in each direction at its spatial position, multiply the grayscale value of the pixel point at each corresponding position within the coverage range of the linear filter template by the template weight value and sum them up. The calculation result is the convolution response value of the pixel point in the direction of the current linear filter template. After traversing the linear filter template in all directions in turn, the set of convolution response values in each direction is output. This set represents the characteristic intensity distribution of the pixel point in the gradient direction;

[0073] S32, sorting the convolution response values in the convolution response value set of each pixel in the highlight area, and selecting the direction corresponding to the largest convolution response value as the dominant direction of the pixel;

[0074] S33. For each pixel in the highlight area, calculate the grayscale mean along its dominant direction and its adjacent directions. If the difference between the grayscale mean of the pixel and the grayscale mean of the pixels in the direction adjacent to the dominant direction exceeds a preset tolerance threshold, replace the grayscale mean of the current pixel with the grayscale mean of the pixels in the direction adjacent to the dominant direction.

[0075] The preset tolerance threshold is an allowable deviation range set based on the fluctuation characteristics of the average grayscale value of the highlight area, and its value is an integer grayscale value of 10 to 20;

[0076] Grayscale mean calculation steps: Dominant direction calculation: Starting from the current pixel point, extend the preset step length (preferably 5 pixels) along the dominant direction axis, sum the grayscale values of all pixels along the axis and divide it by the number of pixels; Adjacent direction calculation: Repeat the same operation in adjacent directions with a fixed angle (preferably 15°) on both sides of the dominant direction to obtain the mean value, and finally take the arithmetic mean of the three-direction means as the mean grayscale value of the dominant direction and adjacent directions;

[0077] S34. For the highlighted area processed by step S33, the current pixel point and the continuous pixel points adjacent to it and with the same dominant direction in the highlighted area are divided into independent processing blocks, the grayscale difference values of all pixel points in each independent processing block are calculated, and the grayscale weight coefficients of each pixel point in the independent processing block are synchronously adjusted according to the grayscale difference values to generate an enhanced pixel point set, and the enhanced pixel point sets after adjustment of all blocks are superimposed to generate a first enhanced image.

[0078] The grayscale difference value calculation in step S34 specifically includes: traversing all pixels in the independent processing block, recording the absolute difference (taking the absolute value) of the grayscale value of the current pixel and each adjacent pixel in its eight-neighborhood neighborhood, accumulating the sum of the absolute differences of all adjacent pixel pairs as the basic difference value, and calculating the sum of twice the maximum grayscale value and two-thirds the minimum grayscale value of all pixels in the independent processing block as an adjustment factor. The basic difference value is divided by the total number of pixels in the independent processing block and multiplied by the adjustment factor. The final output is the grayscale difference value of the independent processing block, which is used to represent the overall grayscale fluctuation intensity within the block.

[0079] The specific steps of synchronously adjusting the weight coefficients in step S34 are as follows: setting the base adjustment amount to 50 divided by the grayscale difference value of the current independently processed block (the larger the difference value, the smaller the increment), then taking the original grayscale value of the pixel in the independently processed block as the base, the weight coefficient of each pixel = original weight + (base adjustment amount × the ratio of the pixel grayscale value to the total grayscale value of the independently processed block), and finally normalizing the weight coefficients of all pixels (the sum of the weights is always 1) to give higher enhancement weights to high grayscale areas while avoiding over-enhancement of areas with large differences;

[0080] Example 2: For a 512×512 highlight area (first threshold = 180) extracted from a heat exchanger weld image, convolution is performed in step S31 using 12 linear filter templates (0°-180°) spaced 15° apart: the pixel (100, 150) is weighted and the weighted sum of 9 pixels within the coverage area is calculated under a 45° direction template (weight matrix [-1, 0, 1; -2, 0, 2; -1, 0, 1]) (e.g., 1×(-1)+87×0+183×1+45×(-2)+...) to obtain a convolution response value of 38; after sorting in S32, the dominant direction is determined to be 45° (the convolution response value in this direction is the largest); in step S33, the grayscale value mean (195) is calculated by extending a 5-pixel axis along the dominant direction, and the mean values of the adjacent 60° and 30° directions are 205 and 188, respectively. The mean value of the three is 196, which is consistent with the mean value of the 45° direction. The original pixel value 182 differs by 14, and since 14 is less than the tolerance threshold 15, the original value is retained. In step S34, the continuous pixels (99-101, 149-151) with dominant directions of 45° are divided into a 3×3 processing block, and the basic difference value (the accumulated absolute difference value of adjacent pixels in the block is 1200) is calculated. The adjustment factor = 2×maximum grayscale of the block 210+0.67×minimum grayscale 176≈503, grayscale difference value = 1200÷9×503≈67,066; the baseline adjustment value is set as 50 / 67,066≈0.000745, and the weight coefficient is calculated as 0.5+0.000745×0.106≈0.50008 based on the ratio of the grayscale 182 of the pixel (100, 150) to the total grayscale of the block 0.106. The enhanced pixels are output after normalization, and the first enhanced image is finally generated.

[0081] Example 2 significantly improves the details of the highlight area through multi-directional gradient reconstruction: 12 directional filter templates accurately capture the 45° dominant direction feature (convolution response value 38), and the tolerance threshold 15 intelligently retains the original grayscale value (difference 14 does not trigger replacement) to avoid false smoothing of textures; independent block division (3×3 pixel blocks) and grayscale difference value calculation (67,066) form an adaptive weight distribution system (baseline adjustment amount 0.000745), so that the weight of high grayscale pixels (210) is increased by 0.00008. After normalization, it not only enhances the contrast of the weld fusion line, but also suppresses excessive noise enhancement (adjustment factor 503 automatically suppresses the fluctuation area), and comprehensively improves the structural clarity and defect recognition rate of the first enhanced image.

[0082] The method for generating the second enhanced image in step S3 is as follows:

[0083] S301, traversing all pixels in the dark area and establishing a coordinate system within the dark area, calculating the grayscale values of all pixels in the dark area using a generation module, grouping pixels with adjacent grayscale values and continuous spatial positions into processing groups, calculating the average grayscale value of the pixels in each processing group using the generation module, and obtaining the boundary coordinates of each processing group in the coordinate system;

[0084] S302, calculate the difference between the maximum grayscale value and the minimum grayscale value in each processing group, and use the difference as the local discrete quantity. According to the boundary coordinates of each processing group, calculate the absolute value of the difference between the average grayscale values of adjacent processing groups. Adjust the preset basic adjustment factor in each processing group according to the local discrete quantity (the larger the local discrete quantity, the smaller the basic adjustment factor). At the same time, when the absolute value of the difference between the average grayscale values of adjacent processing groups is less than the preset merging threshold, merge the adjacent processing groups into a single new group. If the absolute value of the difference between the average grayscale values of adjacent processing groups is greater than or equal to the preset merging threshold, the generation module extracts the coordinates of the two pixels with the smallest distance in the adjacent processing groups, and replaces the grayscale values of all pixels in the adjacent processing groups with the weighted average of the grayscale values of these two pixels.

[0085] S303 , using the average value of the basic adjustment factors of each merged single new group as a grayscale multiplication base, and multiplying the grayscale average value of all pixels in each single new group by the corresponding grayscale multiplication base to generate a second enhanced image.

[0086] Example 3, processing is performed on the dark area of the heat exchanger weld (second threshold = 60): in step S301, continuous pixels with adjacent grayscale values in the 512×512 dark area are aggregated into a processing group of 20×20 pixels (for example, the average grayscale of group 1 boundary coordinates (0-20, 0-20) is 45); in step S302, the local discrete amount of group 1 is calculated (maximum grayscale 58-minimum grayscale 32=26). Since the average grayscale of group 2 is 47 and the difference between it and group 1 is 2 < the merging threshold 5, so they are merged into a new group; for the difference 14≥5 between the unmerged group 3 (average grayscale 52) and the adjacent group 4 (average grayscale 38), the grayscale 41 of the two groups' nearest pixels (40, 50) and the grayscale 43 of (40, 51) are taken, and the weighted average 42 is used to replace the grayscales of all pixels in the group; in step S303, the mean of the basic adjustment factors of each group after merging (discrete value 20 → factor 0.8) is taken as the multiplication base, and the average grayscale of each group is multiplied by the base to output the second enhanced image.

[0087] By processing group dynamic merging (merging threshold 5 controls the aggregation range) and local discrete amount (26) to regulate the basic adjustment factor (0.8), when expanding the dynamic range of dark areas, the weighted replacement strategy (grayscale replacement of the nearest pixel) is used to eliminate block artifacts; the multiplication base average mechanism compensates for the grayscale jump area (such as the gradient 14 of group 3 / 4), and outputs a second enhanced image of the dark area without faults.

[0088] The generation of the third enhanced image in step S3 includes the following steps:

[0089] S3001: The brightness calibration unit traverses all pixels in the middle area and calculates the sum of the absolute values of the grayscale values of the boundary pixels and the grayscale value of the current pixel, and divides the sum by the number of all boundary pixels as the neighborhood fluctuation amount of the current pixel.

[0090] S3002, calculating the mean and variance of the grayscale values of all pixels in the middle area, and dynamically calculating the reference adjustment coefficient of each pixel in the middle area using the variance as a constraint condition;

[0091] The specific content of dynamically calculating the reference adjustment coefficient of each pixel in the middle area with the variance as the constraint condition in step S3002 is as follows: according to the grayscale mean and variance of all pixels in the middle area, the calculation rule of the reference adjustment coefficient is set: first, the grayscale mean of the pixels in the entire middle area is taken as the reference reference value; when the grayscale value of the pixel is higher than the mean, the reference adjustment coefficient = 1.0-(variance × reduction coefficient); when the grayscale value of the pixel is lower than the mean, the reference adjustment coefficient = 1.0+(variance × increase coefficient), where the reduction coefficient is a constant in the range of 0.003 to 0.008, and the increase coefficient is a constant in the range of 0.005 to 0.012. The larger the variance, the higher the adjustment intensity;

[0092] S3003: Multiply the neighborhood fluctuation amount of each pixel by the reference adjustment coefficient to obtain a final calibration coefficient, and perform an operation of multiplying the grayscale value by the final calibration coefficient for each pixel whose grayscale value is between the first threshold and the second threshold to generate a third enhanced image;

[0093] Example 4, calibration is performed in the middle area (grayscale is limited to between the second threshold 70 and the first threshold 150): S3001 calculates the neighborhood fluctuation of pixel (200, 300) (the sum of the absolute values of the grayscale differences of 8 neighborhoods ÷ 8 = 6.2); S3002 counts the regional grayscale mean 120 and the variance 25. Since the pixel value 135>120, the benchmark adjustment coefficient = 1.0-(25×0.005) = 0.875; S3003 final calibration coefficient = 6.2×0.875 = 5.425, the pixel grayscale value × 5.425 is the calibrated grayscale value, and the third enhanced image is generated by traversal.

[0094] The variance constraint calibration in Example 4 (variance reduction of 25×0.005=0.875) is combined with the neighborhood fluctuation amount (6.2) to dynamically balance the brightness of the intermediate transition zone, accurately covering the grayscale transition bands between 50-70 and 150-220. The asymmetric adjustment mechanism suppresses overexposure in the near-highlight area (>120) while enhancing the details in the near-dark area (<120), eliminating the brightness discontinuity at the boundary between the first and second thresholds (70 and 150) in the traditional method, and maintaining a natural transition between the texture of the molten pool and the heat-affected zone.

[0095] S4. Extract the reference edge contour of the weld area image from the base material area image, perform pixel-level fusion on the first enhanced image, the second enhanced image, and the third enhanced image to generate a complete image, and use the reference edge contour as a geometric constraint to repair the fracture boundary of the complete image and output the weld image.

[0096] The steps for generating the weld image in step S4 are as follows:

[0097] S41, using the coordinate position of each pixel point in the first enhanced image, the second enhanced image, and the third enhanced image as a reference, respectively, calculating the original grayscale value of each pixel point in the weld area image, and calculating the maximum deviation between the grayscale value of each pixel point in the first enhanced image, the second enhanced image, and the third enhanced image and the original grayscale value, and generating a preliminary fusion weight factor for each pixel point based on the maximum deviation;

[0098] Specifically, for each pixel, after calculating the maximum deviation between the grayscale values of the three enhanced images and the original grayscale value, the initial weight cardinality is obtained by adding the unit constant 1 to the maximum deviation. The initial weight cardinality of all enhanced images corresponding to the current pixel is then accumulated to obtain the sum. Finally, the initial weight cardinality of each enhanced image is divided by the sum to generate the preliminary fusion weight factor of each enhanced image at the corresponding pixel.

[0099] S42, extending a transition buffer zone of a set pixel width on both sides of the reference edge contour in the parent material region image, extracting a preset reference grayscale distribution pattern from the parent material region image within the transition buffer zone, and synchronously adjusting the preliminary fusion weight factor of each pixel point within the transition buffer zone according to the reference grayscale distribution pattern;

[0100] The reference grayscale distribution pattern refers to the spatial gradient-related grayscale features extracted from the parent material area image by the transition buffer. Its construction process is as follows: with each pixel point in the transition buffer as the center, the grayscale mean of its eight neighboring pixels is calculated as the basic reference value. At the same time, the grayscale values of three equidistant positions (1-3 pixels apart) along the normal extension line of the weld edge contour of the point are detected, and the median of the three is taken as the directional reference value. When synchronously adjusting the preliminary fusion weight factor, for each pixel point in the transition buffer, the Euclidean distance to the weld reference boundary is mapped into a spatial attenuation coefficient (the closer to the weld, the smaller the coefficient). The basic reference value and the directional reference value are weighted and summed with a weight of 0.6:0.4, and then multiplied by the attenuation coefficient. The result is used to replace the original preliminary fusion weight factor of the pixel point, so that the weight transition from the parent material area image to the weld area meets the radiation continuity constraint and avoids the edge jump effect caused by geometric deformation.

[0101] S43, mapping the adjusted preliminary fusion weight factors into pixel grayscale contribution coefficients of the first enhanced image, the second enhanced image, and the third enhanced image, and calculating the fusion grayscale value of each pixel by multiplying the grayscale value of each pixel in the first enhanced image, the second enhanced image, and the third enhanced image by the corresponding pixel grayscale contribution coefficient and summing the results;

[0102] S44, performing a preset edge sharpness consistency check on the fused grayscale value at the junction of the weld area image and the base material area image, merging the checked fused grayscale value with the fused grayscale value at the non-junction area to output a complete image.

[0103] Edge sharpness consistency check in step S44: within the three-by-three neighborhood of each pixel point on the boundary line between the weld area image and the base material area image, calculate the maximum absolute value of the pixel grayscale gradient as the current edge sharpness value, and at the same time extract the average gradient value of the neighboring area of the reference edge contour in the same direction (5 pixels on each side) as the reference sharpness. If the current edge sharpness value is less than the preset ratio threshold of the reference sharpness (such as 0.8 times), the fused grayscale value of the intersection point is multiplied by the compensation coefficient (the inverse of the gradient ratio threshold) to enhance the contrast; otherwise, the original fused grayscale value remains unchanged.

[0104] Example 5, for the image of the base material area of the heat exchanger, first perform step S41: after extracting the weld reference edge contour, calculate the maximum deviation of the grayscale value of the pixel (150, 200) from the original value 130 in the first enhanced image, the second enhanced image, and the third enhanced image (first enhanced image 170 → deviation 40, second enhanced image 120 → deviation 10, third enhanced image 140 → deviation 10), the initial weight base = 1 / (40+1)≈0.024, 1 / (10+1)≈0.091, 1 / (10+1)≈0.091, the total is 0.206, and the preliminary fusion weight factors are 0.024 / 0.206≈0.12, 0.091 / 0.206≈0.44, and 0.091 / 0.206≈0.44 respectively; S42 extends 5 pixels on both sides of the edge slowly For the collision zone, taking pixel (155, 200) as an example: calculate the eight-neighborhood mean (base value 125) and the three-position median in the normal direction (direction value 128), and add a weighted value of 125×0.6+128×0.4=126.2; map the attenuation coefficient 0.6 based on the Euclidean distance to the weld boundary 3 pixels, and the adjusted weight factor = 126.2×0.6=75.72; S43 maps the adjusted weight to a contribution coefficient (sum normalized), and calculates the fused grayscale value = 170×0.15+120×0.42+140×0.43≈138; S44 finds during verification that the maximum gradient value of the three neighborhoods at the intersection point (150, 200) is 28 < the reference sharpness 35×0.8=28, triggering a compensation coefficient of 1.25. The final output grayscale value is 138×1.25=172.5, completing the repair of the fracture boundary.

[0105] The natural grayscale transition between weld and parent material is achieved by combining the inverse weight base of the deviation (0.024 / 0.091) and the double reference value anchoring of the buffer (126.2); the edge sharpness check (28<28 triggers compensation) actively repairs the broken boundary and eliminates the pixel-level jump of traditional fusion; the normal direction median constraint (128) and the spatial attenuation coefficient (0.6) resist the interference of geometric deformation and output a continuous and complete weld image.

[0106] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention's description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A heat exchanger weld image enhancement processing method, characterized by: The following steps are involved: S1. Collecting the original image of the heat exchanger weld through a preset acquisition module and converting the original image into a grayscale image; S2, a preset processing module, which segments the grayscale image based on a preset dynamic threshold to generate a weld area image and a base material area image; S3. Extracting, from the weld area image, highlight areas having grayscale values greater than a preset first threshold and dark areas having grayscale values less than a preset second threshold using a preset generation module, performing a preset gradient reconstruction operation on the highlight areas to generate a first enhanced image, performing a preset dynamic range expansion operation on the dark areas to generate a second enhanced image, and generating a third enhanced image using a preset brightness calibration unit for intermediate areas having grayscale values between the first threshold and the second threshold; S4. Extract the reference edge contour of the weld area image from the base material area image, perform pixel-level fusion on the first enhanced image, the second enhanced image, and the third enhanced image to generate a complete image, and use the reference edge contour as a geometric constraint to repair the broken boundary of the complete image and output a weld image.

2. The heat exchanger weld image enhancement processing method according to claim 1, characterized in that: The specific content of step S1 is: S11. Adjusting the position and parameters of the preset optical components, aligning the acquisition module with the center line of the heat exchanger weld and maintaining a vertical shooting angle, continuously capturing multiple frames of original images, and transmitting the original images in real time to a preset memory via a preset data bus; S12: extracting the RGB three-channel pixel data of the original image in the memory, performing weighted calculation on the three-channel pixel data according to a preset weight formula, and merging the calculation results into a grayscale image.

3. The heat exchanger weld image enhancement processing method according to claim 2, characterized in that: The specific steps of generating the weld area image and the base material area image in step S2 include: S21, the processing module divides the grayscale image into a plurality of independent sub-region images, each of the sub-region images containing a preset number of pixels of local features of the weld; S22, dividing the pixels in each sub-region image into two sets of pixels above the dynamic threshold and below the dynamic threshold using the segmentation parameters in the preset feature analysis model; S23. Merge the multiple sub-region images corresponding to all pixel sets above the dynamic threshold to generate a weld region image, and merge the multiple sub-region images corresponding to all pixel sets below the dynamic threshold to generate a base material region image.

4. The heat exchanger weld image enhancement processing method according to claim 3, characterized in that: The method for generating the dynamic threshold in step S22 includes: S221, the processing module extracts the grayscale gradient features and spatial distribution features of the pixels in the sub-region image to form a feature matrix; S222, calculating the feature matrix using the feature analysis model to generate a regional reference threshold; S223 , performing adaptive compensation based on the gradient change rate of the reference threshold of the adjacent sub-region image to generate a dynamic threshold.

5. The heat exchanger weld image enhancement processing method according to claim 4, characterized in that: The generation of the first enhanced image in step S3 includes the following steps: S31, defining a set of linear filter templates in the generation module, performing a convolution operation preset by the linear filter templates in each direction on each pixel in the highlight area, and generating a set of convolution response values of each pixel in the highlight area on the linear filter templates in each direction; S32, sorting the convolution response values in the convolution response value set of each pixel in the highlighted area, and selecting the direction corresponding to the largest convolution response value as the dominant direction of the pixel; S33. For each pixel in the highlighted area, calculate the grayscale mean along its dominant direction and its adjacent directions. If the difference between the grayscale mean of the pixel and the grayscale mean of the pixels in the direction adjacent to the dominant direction exceeds a preset tolerance threshold, replace the grayscale mean of the current pixel with the grayscale mean of the pixels in the direction adjacent to the dominant direction. S34. For the highlighted area processed by step S33, the current pixel point and the continuous pixel points adjacent to it and with the same dominant direction in the highlighted area are divided into independent processing blocks, the grayscale difference value of all pixel points in each independent processing block is calculated, the grayscale weight coefficient of each pixel point in the independent processing block is synchronously adjusted according to the grayscale difference value, and an enhanced pixel point set is generated. The enhanced pixel point sets after adjustment of all blocks are superimposed to generate a first enhanced image.

6. The heat exchanger weld image enhancement processing method according to claim 5, characterized in that: The method for generating the second enhanced image in step S3 is as follows: S301, traversing all pixels in the dark area and establishing a coordinate system within the dark area, calculating the grayscale values of all pixels in the dark area using a generation module, grouping pixels with adjacent grayscale values and continuous spatial positions into processing groups, calculating the average grayscale value of the pixels in each processing group using the generation module, and obtaining the boundary coordinates of each processing group in the coordinate system; S302, calculating the difference between the maximum grayscale value and the minimum grayscale value in each processing group, and taking the difference as a local discrete quantity, calculating the absolute value of the difference between the average grayscale values of adjacent processing groups according to the boundary coordinates of each processing group, adjusting the preset basic adjustment factor in each processing group according to the local discrete quantity, and merging the adjacent processing groups into a single new group when the absolute value of the difference between the average grayscale values of adjacent processing groups is less than a preset merging threshold, and if the absolute value of the difference between the average grayscale values of adjacent processing groups is greater than or equal to the preset merging threshold, the generation module respectively extracts the coordinates of the two pixels with the smallest distance between them in the adjacent processing groups, and replaces the grayscale values of all pixels in the adjacent processing groups with the weighted average of the grayscale values of these two pixels; S303 , using the average value of the basic adjustment factors of each merged single new group as a grayscale multiplication base, and multiplying the grayscale average value of all pixels in each single new group by the corresponding grayscale multiplication base to generate a second enhanced image.

7. The heat exchanger weld image enhancement processing method according to claim 6, characterized in that: The generation of the third enhanced image in step S3 includes the following steps: S3001: The brightness calibration unit traverses all pixels in the middle area, calculates the sum of the absolute values of the grayscale values of the boundary pixels and the grayscale value of the current pixel, and divides the sum by the number of all boundary pixels as the neighborhood fluctuation amount of the current pixel; S3002, calculating the mean and variance of the grayscale values of all pixels in the middle area, and dynamically calculating the reference adjustment coefficient of each pixel in the middle area using the variance as a constraint condition; S3003. Multiply the neighborhood fluctuation amount of each pixel point by the benchmark adjustment coefficient to obtain a final calibration coefficient, and perform an operation of multiplying the grayscale value by the final calibration coefficient for each pixel point whose grayscale value is between the first threshold and the second threshold to generate a third enhanced image.

8. The heat exchanger weld image enhancement processing method according to claim 7, characterized in that: The steps for generating the weld seam image in step S4 are as follows: S41, taking the coordinate position of each pixel point in the first enhanced image, the second enhanced image, and the third enhanced image as a reference, respectively, calculating the original grayscale value of each pixel point in the weld area image, and calculating the maximum deviation between the grayscale value of each pixel point in the first enhanced image, the second enhanced image, and the third enhanced image and the original grayscale value, and generating a preliminary fusion weight factor for each pixel point based on the maximum deviation; S42, extending a transition buffer zone of a set pixel width on both sides of the reference edge contour in the mother material region image, extracting a preset reference grayscale distribution pattern from the mother material region image within the transition buffer zone, and synchronously adjusting a preliminary fusion weight factor of each pixel point within the transition buffer zone according to the reference grayscale distribution pattern; S43: Mapping the adjusted preliminary fusion weight factors to pixel grayscale contribution coefficients of the first enhanced image, the second enhanced image, and the third enhanced image, and calculating the fusion grayscale value of each pixel by multiplying the grayscale value of each pixel in the first enhanced image, the second enhanced image, and the third enhanced image by the corresponding pixel grayscale contribution coefficient and summing the results; S44. Perform a preset edge sharpness consistency check on the fused grayscale value at the junction of the weld area image and the base material area image, and merge the checked fused grayscale value with the fused grayscale value at the non-junction area to output a complete image.

Citation Information

Cited By

  • Automatic deviation correction method and system for operation of underwater robot, medium and product

    CN120689420A

  • Weldment welding seam automatic detection method and device based on machine vision

    CN121120603A

  • Riding state monitoring method and equipment based on visual identification and medium

    CN121708626A