A multi-focus image pixel-level fusion method and system based on MTF field smoothing enhancement

CN122989434APending Publication Date: 2026-10-27SHENZHEN KUMO TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611282745.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-24
Publication Date
2026-10-27

AI Technical Summary

Benefits of technology

[0046]通过逐像素统计多幅图像平滑梯度值的标准差,结合预设分辨率调节参数自适应换算高斯衰减函数的带宽参数,可随图像局部纹理特征动态调整权重衰减速率;在聚焦边缘区域维持较高的权重区分度以保障图像锐度,在纹理平坦区域实现平缓的权重过渡以避免融合边界生硬,解决了传统固定参数方案难以兼顾边界清晰度与融合自然度的问题;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122989434A_ABST
    Figure CN122989434A_ABST
Patent Text Reader

Abstract

The application discloses a kind of multi-focus image pixel-level fusion method and system based on MTF field smooth enhancement, in view of the problems that traditional fusion scheme weight parameter is fixed, is easily disturbed by noise, it is difficult to take into account boundary sharpness and smooth transition, this scheme is first to input multi-focus image local MTF response value is calculated pixel by pixel, and smooth MTF field is obtained by Gaussian smoothing;Standard deviation of the smooth MTF value of multiple images is counted pixel by pixel, and the bandwidth parameter of Gaussian attenuation function is adaptively converted in combination with the preset resolution adjustment parameter;Based on bandwidth parameter, pixel-by-pixel Gaussian attenuation coefficient is calculated, and the fusion image is generated after weighted summation by normalization to obtain fusion weight.The application can adaptively adjust the weight transition characteristics with local texture of image, effectively suppresses fusion artifact, takes into account focusing boundary sharpness and regional smoothness, and adapts to different resolution multi-focus image fusion scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of multifocal image fusion technology, and in particular to a multifocal image pixel-level fusion method and system based on MTF field smoothing enhancement. Background Technology

[0002] Multi-focus image fusion is a key technology in computational imaging, optical microscopy, and consumer digital photography. Its core principle is to fuse multiple source images taken at different focal points on the same scene to obtain a single, clear fused image. This compensates for the limited depth of field in optical imaging systems, improving the image's sharpness and detail. With the increasing demands for image clarity in fields such as microscopic inspection and machine vision, pixel-level multi-focus image fusion technology has gained widespread application and research due to its advantages of high detail preservation and flexible algorithmic logic.

[0003] Currently, most mainstream spatial domain pixel-level fusion schemes are based on MTF features to construct fusion weights. The MTF response value characterizes the image's sharpness, and then Gaussian mapping is used to obtain pixel-level fusion weights. However, existing schemes generally use globally fixed Gaussian decay bandwidth parameters, resulting in a uniform weight decay rate. This makes it impossible to adaptively adjust according to the local texture density and edge intensity of the image: in the focused edge region, excessive bandwidth can easily lead to insufficient weight discrimination, causing edge blurring and decreased sharpness; in flat texture regions, insufficient bandwidth can easily cause weight jumps, resulting in abrupt and harsh fusion boundaries, making it difficult to balance the sharpness of the focused boundary with the smoothness of the regional transition.

[0004] Meanwhile, most existing solutions directly calculate the fusion weights based on the original MTF response values ​​without smoothing or enhancing the MTF field. The original MTF estimates are easily affected by image acquisition noise, compression artifacts, and small registration deviations, resulting in a large number of isolated MTF estimate abrupt changes. This leads to localized mottled and abrupt changes in the weight distribution, ultimately producing visual defects such as block effects and false edges in the fused image, which seriously affects the quality of the fused imaging.

[0005] In addition, the model parameters of existing fusion algorithms are mostly fixed values, which are only adapted to images with specific resolutions and imaging devices. When the pixel resolution and imaging modality of the input image change, the parameters need to be manually readjusted to obtain a stable fusion effect. The versatility and adaptability of the scene are insufficient, making it difficult to meet the fusion needs of multi-specification and multi-focus images. Summary of the Invention

[0006] The main objective of this invention is to provide a pixel-level fusion method and system for multi-focus images based on MTF field smoothing enhancement. This method adaptively adjusts the weight transition characteristics according to the local texture of the image, effectively suppresses fusion artifacts, balances the sharpness of the focus boundary and the smoothness of the region, and is suitable for multi-focus image fusion scenarios with different resolutions.

[0007] To achieve the above objectives, this invention provides a multi-focus image pixel-level fusion method based on MTF field smoothing enhancement, comprising the following steps:

[0008] Acquire multiple images of the same scene taken from different focus positions, and verify the consistency of resolution across all images;

[0009] For each image, the local MTF response value is calculated pixel by pixel to generate an MTF response distribution map. Gaussian smoothing filter is then applied to the MTF response distribution map to obtain the smoothed MTF field corresponding to each image.

[0010] Take any pixel position in the smoothed MTF field as the current pixel position, select the maximum value from the smoothed MTF values ​​of all images at the current pixel position as the reference MTF value, calculate the standard deviation of the smoothed MTF values ​​of all images at the current pixel position, and combine the preset resolution adjustment parameters to obtain the bandwidth parameter of the Gaussian decay function.

[0011] Calculate the difference between the smoothed MTF value of each image at the current pixel position and the reference MTF value. Using the difference as the independent variable and the bandwidth parameter as the standard deviation of the Gaussian decay function, calculate the Gaussian decay coefficient of each image at the current pixel position. Then, normalize all Gaussian decay coefficients to obtain the fusion weight of each image at the current pixel position.

[0012] Iterate through all pixel positions to obtain the fusion weight corresponding to each pixel position in each image. Then, sum the pixel values ​​of each image at each pixel position according to the corresponding fusion weight to generate a fused image.

[0013] Furthermore, the step of calculating the standard deviation of the smoothed MTF values ​​of all images at the current pixel position, and converting it into the bandwidth parameter of the Gaussian decay function by combining it with preset resolution adjustment parameters, includes:

[0014] The quotient of the standard deviation divided by the preset resolution adjustment parameter is used as the bandwidth parameter of the Gaussian decay function.

[0015] The preset resolution adjustment parameter is a positive real number, which is used to scale the standard deviation to control the value of the bandwidth parameter. The larger the value of the resolution adjustment parameter, the smaller the bandwidth parameter, thus accelerating the attenuation rate of the Gaussian attenuation coefficient under the condition that the MTF value difference is the same.

[0016] When the standard deviation is 0, the bandwidth parameter is set to a preset non-zero lower limit value;

[0017] The calculated bandwidth parameters are constrained by a range to obtain the final bandwidth parameters.

[0018] Furthermore, the step of constraining the range of the calculated bandwidth parameters includes:

[0019] The calculated bandwidth parameter is compared with the preset bandwidth upper limit. If the bandwidth parameter is greater than the preset bandwidth upper limit, the preset bandwidth upper limit is used as the final bandwidth parameter.

[0020] The preset bandwidth upper limit is set to 8 to 15 times the preset non-zero lower limit, thus constraining the maximum value of the bandwidth parameter.

[0021] Furthermore, the step of calculating the Gaussian attenuation coefficient of each image at the current pixel position and normalizing all Gaussian attenuation coefficients includes:

[0022] Let (x, y) represent the current pixel position. Calculate the Gaussian attenuation coefficient of each image at the current pixel position, satisfying:

[0023] Where k is the image number, Let be the Gaussian decay coefficient at pixel position (x, y) in the k-th image; Let be the MTF value of the k-th image at pixel position (x, y); The reference MTF value is the maximum smoothed MTF value among all images at pixel location (x, y); The bandwidth parameter is the bandwidth parameter of the Gaussian decay function corresponding to the current pixel position; exp is an exponential function with the natural constant e as the base.

[0024] The Gaussian attenuation coefficients of all images at the current pixel position are normalized to obtain the fusion weight of each image at the current pixel position, satisfying the following:

[0025] ,in, Let be the fusion weight of the k-th image at pixel position (x, y); j is the image index. This is the sum of the Gaussian decay coefficients at pixel position (x,y) for all images;

[0026] After the above normalization calculation, the sum of the fusion weights of all images at the same pixel location is 1.

[0027] Furthermore, the step of calculating the local MTF response value pixel by pixel for each image and generating an MTF response distribution map includes:

[0028] The local MTF response value is calculated pixel by pixel using the neighborhood modulation method. A square neighborhood is taken with the current pixel as the center, and the MTF response value at each pixel position is calculated according to the following formula:

[0029] ,in This represents the MTF response value at pixel location (x, y). The maximum gray value in the neighborhood. The minimum gray value within the neighborhood;

[0030] The neighborhood window size of the MTF estimate is the same as the kernel size of the Gaussian smoothing filter, and both are square windows.

[0031] Furthermore, after the step of weighted summation of pixel values ​​at each pixel position in each image according to the corresponding fusion weights to generate a fused image, the method further includes:

[0032] Traverse each pixel position in the smoothed MTF field, filter out the maximum value from the smoothed MTF values ​​of all images at the same pixel position, and directly use the pixel value of the image corresponding to the maximum value as the output pixel value at the same pixel position to generate a hard mask fusion image.

[0033] The fused image generated by the weighted summation is used as the default output, and the fused image with hard mask is used as the alternative output. When there is misalignment between the images, causing ghosting in the default output, the output is switched to the fused image with hard mask.

[0034] Furthermore, the switching output of the hard mask fused image includes:

[0035] The distribution of smooth MTF values ​​of all images within a preset neighborhood window at the current pixel position is statistically analyzed. If at least two images at the same pixel position have smooth MTF values ​​that both exceed a preset MTF threshold, and the difference between the smooth MTF values ​​of the at least two images is less than a preset difference threshold, then the current pixel position is determined to be a misaligned ghosting region.

[0036] For the pixel positions identified as misaligned ghosting regions, output the pixel value of the corresponding pixel position in the hard mask fused image; for the remaining pixel positions, output the pixel value of the corresponding pixel position in the fused image generated by the weighted summation.

[0037] This invention also provides a multi-focus image pixel-level fusion system based on MTF field smoothing enhancement, which executes the multi-focus image pixel-level fusion method based on MTF field smoothing enhancement described above. The multi-focus image pixel-level fusion system based on MTF field smoothing enhancement includes:

[0038] The MTF response calculation module is used to calculate the MTF response value pixel by pixel for each input multifocal image and generate the corresponding MTF response distribution map for each image.

[0039] The MTF field smoothing module is used to apply Gaussian smoothing filter to each MTF response distribution map and output the smoothed MTF field corresponding to each image.

[0040] The adaptive bandwidth calculation module is used to calculate the standard deviation of the smoothed MTF value of all images at the current pixel position on a pixel-by-pixel basis, and combine it with the preset resolution adjustment parameters to obtain the bandwidth parameters of the Gaussian decay function.

[0041] The fusion weight calculation module is used to calculate the Gaussian decay coefficient of each image at the current pixel position, and normalize all Gaussian decay coefficients to obtain the fusion weight of each image at the current pixel position.

[0042] The pixel fusion output module is used to sum the pixel values ​​of each image at each pixel position according to the corresponding fusion weight, and generate and output the fused image.

[0043] The present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the multi-focus image pixel-level fusion method based on MTF field smoothing enhancement described above.

[0044] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the multi-focus image pixel-level fusion method based on MTF field smoothing enhancement described above.

[0045] The multi-focus image pixel-level fusion method based on MTF field smoothing enhancement provided by this invention has the following beneficial effects:

[0046] By statistically analyzing the standard deviation of smooth gradient values ​​in multiple images pixel by pixel, and combining the bandwidth parameter of the Gaussian decay function with the preset resolution adjustment parameter, the weight decay rate can be dynamically adjusted according to the local texture features of the image. It maintains a high weight discrimination in the focused edge area to ensure image sharpness, and achieves a smooth weight transition in the texture flat area to avoid harsh fusion boundary. This solves the problem that traditional fixed parameter schemes cannot balance boundary clarity and fusion naturalness.

[0047] A smoothed MTF field is obtained by applying Gaussian smoothing filter to the original MTF amplitude map, which filters out the interference of isolated noise points and single-point MTF abrupt changes on the weight calculation, improves the spatial continuity of the weight distribution, and significantly reduces artifacts such as local mottles and block effects in the fused image.

[0048] The bandwidth parameter can be adjusted to adapt to input images with different pixel resolutions, and it can maintain a stable fusion effect in multifocal image scenarios of different specifications. It is suitable for various multifocal image fusion scenarios such as microscopic imaging and consumer-grade cameras. Attached Figure Description

[0049] Figure 1 This is a flowchart of a multi-focus image pixel-level fusion method based on MTF field smoothing enhancement in one embodiment of the present invention;

[0050] Figure 2 This is a structural block diagram of a multi-focus image pixel-level fusion method based on MTF field smoothing enhancement in one embodiment of the present invention;

[0051] Figure 3 This is a multi-focus source image at a near-focus position in one embodiment of the present invention;

[0052] Figure 4 This is a multi-focus source image at the focal position in one embodiment of the present invention;

[0053] Figure 5 This is a multi-focus source image at a far-focusing position in one embodiment of the present invention;

[0054] Figure 6 This is a full-field fusion effect image in one embodiment of the present invention;

[0055] Figure 7 This is a magnified and fused image of a portion of the pad lead area in one embodiment of the present invention;

[0056] Figure 8 This is the fusion effect image of the pixel-by-pixel hard switching fusion method in Comparative Example 1 of the present invention;

[0057] Figure 9 This is a fusion effect image of the Laplace pyramid weighted fusion method in Comparative Example 2 of this invention;

[0058] Figure 10 This is the fusion effect image of the complex wavelet transform hard switching fusion method in Comparative Example 3 of this invention;

[0059] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0060] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0061] Reference Figure 1This is a flowchart illustrating a multi-focus image pixel-level fusion method based on MTF field smoothing enhancement proposed in this invention, including the following steps:

[0062] S1: Acquire multiple images of the same scene taken from different focus positions, and verify the consistency of resolution of all images;

[0063] S2, calculate the local MTF response value pixel by pixel for each image, generate an MTF response distribution map, and apply Gaussian smoothing filter to the MTF response distribution map to obtain the smoothed MTF field corresponding to each image;

[0064] S3, take any pixel position in the smooth MTF field as the current pixel position, select the maximum value from the smooth MTF values ​​of all images at the current pixel position as the reference MTF value, calculate the standard deviation of the smooth MTF values ​​of all images at the current pixel position, and combine the preset resolution adjustment parameters to obtain the bandwidth parameter of the Gaussian decay function.

[0065] S4, calculate the difference between the smoothed MTF value of each image at the current pixel position and the reference MTF value, use the difference as the independent variable and the bandwidth parameter as the standard deviation of the Gaussian decay function, calculate the Gaussian decay coefficient of each image at the current pixel position, and normalize all Gaussian decay coefficients to obtain the fusion weight of each image at the current pixel position.

[0066] S5. Traverse all pixel positions to obtain the fusion weight corresponding to each pixel position of each image. Then, sum the pixel values ​​of each image at each pixel position according to the corresponding fusion weight to generate a fused image.

[0067] As described in step S1 above, the multi-focus image sequence is captured by the same imaging device from a fixed position. During the shooting process, the relative position of the camera's field of view and the scene remains unchanged, and only the lens focusing distance is adjusted to ensure that objects in different depth-of-field ranges are in a clear imaging state. At least two images are acquired, covering the entire depth-of-field range of the scene from near to far, ensuring that a clear imaging result for the entire scene can be obtained after fusion. After image acquisition, the images are directly stored in the processing cache, awaiting MTF estimation calculation and fusion processing. After image acquisition, the pixel width and pixel height values ​​of each image are read one by one. The horizontal and vertical pixel counts of all images are compared separately. When the horizontal and vertical pixel counts of all images are completely equal, the resolution is considered consistent, and the process can proceed. If there is a mismatch between the image resolution and the other images, bicubic interpolation scaling is performed on the images with different resolutions to make their pixel size consistent with the reference image. The reference image is selected as the image with the highest resolution in the sequence. During the scaling process, the aspect ratio of the image is kept unchanged to avoid distortion of the scene content. After processing, the resolution consistency check is performed again until the pixel size of all images is completely uniform.

[0068] As described in step S2 above, the multi-focus images that have undergone resolution unification processing are then processed one by one to calculate the MTF response value. The local MTF response value is calculated pixel-by-pixel using the neighborhood modulation method. A square neighborhood is taken centered on the current pixel, and the maximum and minimum grayscale values ​​within the neighborhood are statistically analyzed. The MTF response value for a single pixel is then calculated using the modulation formula. The MTF response value directly characterizes the imaging contrast and resolution within the pixel's neighborhood; a higher value indicates more significant edge features and higher image clarity. After traversing all coordinates of the entire image pixel by pixel and calculating the response value for all positions, an MTF response distribution map with the same size as the original image is generated. After generating the MTF response distribution map, a Gaussian smoothing filter is applied to the entire MTF response distribution map. The Gaussian smoothing uses a two-dimensional Gaussian kernel to perform a convolution operation with the MTF response distribution map. The window size of the Gaussian kernel is consistent with the neighborhood window size of the MTF estimation; both use square windows, ensuring uniform horizontal and vertical scales in the neighborhood calculation. The Gaussian kernel assigns different weights to each pixel in its neighborhood based on a two-dimensional Gaussian distribution function, with the center pixel having the highest weight, decreasing gradually with increasing distance. This filtering process effectively removes isolated noise points and abrupt changes in MTF estimation caused by local gray-level fluctuations in the MTF response distribution map, resulting in a continuous transition in the MTF distribution across the spatial dimension. After processing, a smoothed MTF field is obtained for each image, and the smoothed MTF value at each pixel location can be directly used in the calculation of the fusion weights.

[0069] As described in step S3 above, after the smoothed MTF field is constructed, all coordinate positions of the entire image are traversed pixel by pixel, and adaptive calculation of the bandwidth parameter is performed for each pixel position. The smoothed MTF values ​​corresponding to the current pixel position of all input images are extracted. The maximum value is selected from all extracted values ​​and used as the reference MTF value for the current pixel position. The reference MTF value represents the highest imaging resolution among all images at the current position and serves as the calculation benchmark for the Gaussian attenuation coefficient. Standard deviation statistics are performed on the smoothed MTF values ​​of all images at the current pixel position. The statistical result reflects the level of difference in sharpness among multiple images at that position. The greater the difference, the higher the standard deviation value, and the more obvious the focus distinction between the corresponding images; the smaller the difference, the lower the standard deviation value, and the closer the sharpness between the corresponding images. The calculated standard deviation value is divided by a preset resolution adjustment parameter. The result is used as the initial bandwidth parameter of the Gaussian attenuation function. The resolution adjustment parameter is a positive real number and can be set according to the overall pixel resolution of the input image. The higher the image pixel resolution, the larger the adjustment parameter value, and the smaller the corresponding bandwidth parameter. When the statistically obtained standard deviation is zero, a preset non-zero lower limit value is directly used as the initial bandwidth parameter to avoid computational anomalies and ensure the stability of the weight calculation process. The calculated initial bandwidth parameter, after being constrained by its value range, is used as the final bandwidth parameter in the attenuation coefficient calculation. The preset upper limit value is set to 8 to 15 times the preset non-zero lower limit value. When the initial bandwidth parameter value exceeds the preset upper limit value, the preset upper limit value is directly used as the constrained output result.

[0070] As described in step S4 above, after obtaining the reference MTF value and final bandwidth parameter at the current pixel position, the Gaussian attenuation coefficient for each input image is calculated frame by frame. The smoothed MTF value at the current pixel position of a single image is taken, and the difference between this value and the reference MTF value is calculated. This difference is then substituted into the Gaussian attenuation function as the independent variable. The Gaussian attenuation function uses the bandwidth parameter as its standard deviation parameter to control the rate of change in the attenuation process. The function output value decreases monotonically as the difference increases. The closer the smoothed MTF value is to the reference MTF value, the closer the output attenuation coefficient is to one, indicating a higher level of image clarity at the current position, and thus requiring a higher fusion weight. Conversely, the greater the difference between the smoothed MTF value and the reference MTF value, the closer the output attenuation coefficient is to zero, and thus requiring a lower fusion weight. After calculating the attenuation coefficients for all images, all attenuation coefficients at the current pixel position are normalized. All attenuation coefficients are summed to obtain a total value. The attenuation coefficient of each image is then divided by this total value to obtain the corresponding fusion weight for the current pixel position. The fusion weights of all images at the same pixel location are summed to one, which ensures that the pixel value after weighted fusion is within a reasonable range, avoids overall brightness shift in the fused image, and ensures visual consistency of the fusion result.

[0071] As described in step S5 above, after calculating the fusion weights for all pixel positions, a fusion weight map with the same size as the original image is generated for each input image. The values ​​at each position in the weight map correspond to the fusion ratio of the corresponding pixel in the image. The entire image is traversed pixel by pixel in row-major order, extracting the original pixel values ​​of all input images at the same pixel position. These values ​​are then multiplied by the corresponding fusion weights for that position, and all products are summed to obtain the fused pixel value for that position. For grayscale images, weighted operations are directly performed on the single-channel pixel values. For color images, the same weighted fusion logic is performed on the red, green, and blue color channels respectively. Each channel is calculated independently and then combined into a complete color fused pixel. During the operation, the dynamic range of the fused pixel values ​​is kept consistent with the input image. Values ​​exceeding the valid range are truncated to ensure that the output pixel values ​​are within the value range of the standard image. After all pixel positions are calculated, a fully focused fused image with the same size as the input image is generated. The output result can be directly used for display, storage, or image processing. A hard mask fused image can be generated simultaneously with the weighted fused image generation. The algorithm iterates through all coordinate positions pixel by pixel, selecting the maximum value from the smoothed MTF values ​​at the same pixel location across all images. The original pixel value at that location corresponding to the maximum value is then directly used as the output pixel value. After this process, a hard-mask fused image is obtained. The weighted summation-generated fused image is used as the default primary output, while the hard-mask fused image serves as a backup output. When identifying image misalignment / ghosting regions, a neighborhood window of a preset size is selected centered on the current pixel location. The distribution of smoothed MTF values ​​across all images within the window is statistically analyzed. If at least two images at the same pixel location have smoothed MTF values ​​exceeding a preset MTF threshold, and the difference between their smoothed MTF values ​​is less than a preset difference threshold, then the current pixel location is determined to be a misalignment / ghosting region. For pixels identified as misalignment / ghosting regions, the corresponding pixel value in the hard-mask fused image is output; for other pixel locations, the output result of the default weighted fused image is retained.

[0072] Example 1

[0073] This embodiment is applied to the microscopic inspection of industrial precision parts. The imaging equipment adopts a fixed-position optical microscopy system. The lens focusing distance is adjusted sequentially for the same workpiece surface to acquire multiple source images at different focusing positions.

[0074] The input image sequence used in this embodiment is as follows: Figure 3 As shown, where Figure 3 The source image is taken from a near-focus position, where the near-end pads and leads of the workpiece are in a clear imaging state, while the far-end structure is in a defocused state. Figure 4 The source image was taken from the center focal position. The structure in the middle of the workpiece is clear, while the near and far ends are blurred to varying degrees. Figure 5 The source image is taken from a distant focusing position, where the far end of the workpiece is clearly visible, while the near end is out of focus. The three images have the same resolution and together constitute the fusion input sequence of this embodiment. After the multi-focus image sequence is acquired, the pixel width and pixel height values ​​of each image are read one by one, and the horizontal and vertical pixel counts of all images are compared separately. When the horizontal and vertical pixel counts of all images are completely equal, the resolution is considered consistent, and the process can proceed. If there are cases where the image resolution does not match the other images, bicubic interpolation scaling is performed on the images with different resolutions to make their pixel dimensions consistent with the reference image. The reference image is selected as the image with the highest resolution in the sequence. During the scaling process, the aspect ratio of the image remains unchanged to avoid distortion of the scene content. After processing, a resolution consistency check is performed again until the pixel dimensions of all images are completely uniform.

[0075] After resolution unification processing, multi-focus images are processed one by one to calculate their MTF response values. A neighborhood modulation method is used to calculate the local MTF response value pixel by pixel. A 3×3 square neighborhood is taken centered on the current pixel, and the maximum and minimum grayscale values ​​within the neighborhood are counted. For the k-th image, the MTF response value at pixel position (x, y) is calculated. satisfy: ,in The maximum gray value in the neighborhood. The minimum grayscale value within the neighborhood. The MTF response value directly characterizes the imaging contrast and resolution within the pixel's neighborhood; a higher value indicates more significant edge features and higher image clarity at that location. After calculating the response value for all locations by traversing the entire image pixel by pixel, an MTF response distribution map with the same size as the original image is generated.

[0076] After generating the MTF response distribution map, a two-dimensional Gaussian smoothing filter is applied to the entire MTF response distribution map. The neighborhood window size of the MTF estimate is consistent with the window size of the Gaussian smoothing kernel, both using square windows. The Gaussian smoothing kernel size ranges from 15 to 61, with a typical value of 31; the standard deviation of the Gaussian smoothing is... With core size Linkage, satisfying The filtering process effectively removes isolated noise points and sudden changes in MTF estimation caused by local gray-level fluctuations in the MTF response distribution map, making the MTF distribution exhibit a continuous transition characteristic in the spatial dimension. After processing, a smoothed MTF field corresponding to each image is obtained, and the MTF value at pixel position (x,y) of the k-th image is denoted as... .

[0077] After the smoothed MTF field is constructed, the entire image is traversed pixel by pixel, and the bandwidth parameter is adaptively calculated for each pixel. For pixel position (x, y), the maximum value is first selected from the smoothed MTF values ​​of all images and used as the reference MTF value for that position. ,Right now: , where K is the total number of input images, and the MTF value represents the highest imaging resolution among all images at the current position, serving as the benchmark for calculating the Gaussian attenuation coefficient.

[0078] Calculate the standard deviation of the smoothed MTF values ​​for all images at this location. The statistical results reflect the difference in sharpness among multiple images at this location. Dividing the standard deviation by the preset resolution adjustment parameter r yields the initial bandwidth parameter of the Gaussian decay function. ,satisfy: The resolution adjustment parameter r is a positive real number, ranging from 1 to 4, with a typical value of 2. The higher the image pixel resolution, the larger the value of r, the smaller the corresponding bandwidth parameter, and the faster the weight decay rate.

[0079] When the calculated standard deviation is 0, the initial bandwidth parameter is directly set to the preset non-zero lower limit value. To avoid division by zero exceptions during calculations, a range constraint is applied to the initial bandwidth parameter, with a preset upper limit for bandwidth. The value is 8 to 15 times the preset non-zero lower limit; if the initial bandwidth parameter is greater than Then As the final bandwidth parameter Value range constraints can prevent excessive local texture differences from causing bandwidth runaway and ensure the stability of weight calculation.

[0080] After obtaining the reference MTF value and final bandwidth parameters for the current pixel position, the Gaussian attenuation coefficient for each input image is calculated frame by frame. The Gaussian attenuation coefficient for the k-th image at pixel position (x, y) is... satisfy: ,in It is an exponential function with the natural constant e as the base. The output value of the function decreases monotonically as the difference between the smoothed MTF value and the reference MTF value increases. The closer the smoothed MTF value is to the reference MTF value, the closer the decay coefficient is to 1, which means that the image is clearer at the current position. The larger the difference, the closer the decay coefficient is to 0, and the lower the corresponding fusion weight.

[0081] After calculating the attenuation coefficients for all images, normalization is performed on all attenuation coefficients to obtain the fusion weights for the corresponding images. ,satisfy: ,in This is the sum of the Gaussian attenuation coefficients of all images at this location. After normalization, the sum of the fusion weights of all images at the same pixel location is 1, which ensures that the weighted fused pixel value is within a reasonable range and avoids overall brightness shift in the fused image.

[0082] As an alternative implementation, the weight calculation can also employ a linear weighting strategy or a power-law weighting strategy. Linear weighting directly uses the proportion of the smoothed MTF value as the fusion weight, resulting in the highest computational efficiency. Power-law weighting normalizes the smoothed MTF value by raising it to the power of p, where p ranges from 1 to 4, with a typical value of 2. The larger the exponent, the stronger the amplification effect on the difference in MTF values ​​and the more thoroughly the overexposed flat areas are suppressed. The three weighting strategies can be flexibly switched according to the scene characteristics.

[0083] After traversing all pixel positions to complete the fusion weight calculation, a fusion weight map with the same size as the original image is generated for each input image. Weighted fusion operations are performed pixel-by-pixel, and the pixel value F(x,y) of the fused image at (x,y) satisfies: ,in This represents the pixel value at the corresponding position in the k-th input image. For grayscale images, a weighted operation is directly performed on the single-channel pixel values. For color images, the same weighted fusion logic is performed on the red, green, and blue color channels respectively. Each channel is calculated independently and then combined to form a complete color-fused pixel. During the operation, pixel values ​​exceeding the valid range are truncated to ensure that the output pixel values ​​are within the numerical range of the standard image.

[0084] The weighted fused image serves as the default primary output, while a hard-masked fused image can be generated simultaneously as an alternative output. The hard-masked fused image selects the original pixel value of the image with the largest smoothed MTF value as the output pixel by pixel; that is, for pixel position (x, y), the following condition must be met: , When switching output modes, misaligned ghosting regions can be automatically determined based on the neighborhood MTF distribution. The smoothed MTF value distribution of all images within the statistical window is analyzed. If at least two images at the same pixel location have smoothed MTF values ​​exceeding a preset MTF threshold, and the difference between the smoothed MTF values ​​of the two images is less than a preset difference threshold, then the current pixel location is determined to be a misaligned ghosting region. The corresponding pixel values ​​of the hard-masked fused image are output for misaligned ghosting regions, while the corresponding pixel values ​​of the weighted fused image are output for other regions, achieving adaptive hybrid output of the two fusion modes.

[0085] After all pixels are processed, a fully focused fused image with the same size as the input image is generated. The output can be directly used for industrial defect detection, dimensional measurement, or storage and archiving.

[0086] The fusion output result of this embodiment is as follows: Figure 6 , Figure 7 As shown, where Figure 6 This is a full-view fusion rendering of the workpiece. Figure 7 This is a magnified view of the pad and lead areas. The fused image covers the entire depth of field of the workpiece from near to far, with structures at all heights remaining clearly imaged. The transition between the focused and defocused areas is natural and continuous, with no visible fusion boundaries. The overexposed edge areas of the metal pads show smooth transitions without bright rings or halo artifacts, verifying that the MTF field-guided weighting mechanism can naturally suppress overexposed flat areas with MTF response values ​​approaching zero, fundamentally avoiding ringing and halo defects caused by factor band coefficient redistribution in multi-scale decomposition methods. The lead edge lines are continuous and sharp, without ghosting, tearing, or jagged distortion, demonstrating the MTF spatial correlation characteristics established by Gaussian smoothing preprocessing. Combined with the weighted soft fusion mechanism, it can effectively tolerate sub-pixel-level vibration misalignment during shooting, achieving stable fusion quality without the need for pre-registration steps. The image background and the flat surface area of ​​the workpiece are uniform and clean, without bubble-like faults, salt-and-pepper noise or step-like layering artifacts. Compared with traditional hard-switching fusion methods and multi-scale decomposition methods, visual consistency and detail fidelity are significantly improved.

[0087] Comparative Example 1

[0088] This comparative example uses a pixel-by-pixel hard switching fusion scheme based on Gaussian smoothing MTF values. It uses the same input image sequence and MTF preprocessing process as the present invention. The input is a group of multi-focus images of industrial precision parts. The MTF calculation adopts the neighborhood modulation method, and the Gaussian smoothing kernel size is set to 31.

[0089] The fusion process of Comparative Example 1 is as follows: calculate the local MTF response value for each input image pixel by pixel to generate an MTF response distribution map; apply a Gaussian smoothing filter with the same parameters to the MTF response distribution map to obtain a smoothed MTF field; for each pixel position, compare the smoothed MTF values ​​of all images at that position, and directly select the original pixel value of the image with the largest MTF value as the fused output pixel.

[0090] The fusion results of this comparative example are as follows: Figure 8 As shown, at the transition boundary between the focused and defocused areas, the pixel source changes abruptly, resulting in obvious bubble-like tomographic artifacts. The transition boundary of the sparse texture area exhibits a stepped visual discontinuity. Because the hard switching decision is directly affected by local MTF estimation fluctuations, a small number of salt-and-pepper-like abnormal noises are scattered within the smooth area. At the overexposed edges of the metal pads, the overexposed area boundary still retains a high gradient value; hard switching directly selects these edge pixels, forming a harsh bright halo. When subpixel-level vibrational misalignment exists between images, hard switching directly performs binary selection at the misaligned edges, causing ghosting and local tearing at the lead edges.

[0091] Compared with the present invention, although the calculation process of this scheme is simple, it lacks a weight smoothing transition mechanism, cannot take into account both edge sharpness and regional continuity, has insufficient adaptability to overexposed areas and vibration misalignment, and has obvious defects in the visual consistency and detail fidelity of the fused image.

[0092] Comparative Example 2

[0093] This comparison uses a pixel-wise absolute value weighted soft fusion scheme based on the Laplacian pyramid. The input image is completely consistent with the embodiment of the present invention, and a 5-level Laplacian pyramid is constructed to complete the fusion process.

[0094] The implementation process of this comparison is as follows: A Gaussian pyramid is constructed for each input image. Low-pass filtering and downsampling are performed layer by layer starting from the original resolution, resulting in five layers of images at different resolutions. A Laplacian pyramid is then constructed based on the Gaussian pyramid. Except for the top low-frequency base layer, each layer is obtained by subtracting the current layer's image from the upsampled image of the previous layer, corresponding to different scales of detail information. At each layer of the Laplacian pyramid, the absolute value of the Laplacian coefficients for each image is calculated pixel by pixel. The absolute values ​​are normalized to obtain the fusion weights. The coefficients of each layer are then weighted and summed to obtain the fusion pyramid. Starting from the top low-frequency base layer, upsampling is performed layer by layer, and the fusion details of the corresponding layers are superimposed, reconstructing the image step by step to the original resolution, resulting in the final fused image.

[0095] The fusion results of this comparative example are as follows: Figure 9 As shown, the fused image exhibits an overall hazy and blurred appearance, with insufficient sharpness in the surface texture details of the workpiece, low contrast at the edges of the pads and leads, and a lack of transparency. This is because the weighted averaging mechanism mixes the high-frequency details of the sharp image with the flat residual of the defocused image, diluting the detail signals at all scales. After successive reconstruction, the intensity of high-frequency information systematically decreases. The top-level low-frequency substrate, after multi-image weighted fusion, compresses the global brightness and darkness contrast, further exacerbating the grayish and dark visual effect of the image. Furthermore, the cascaded operation of multi-level upsampling and downsampling significantly increases processing time compared to pixel-level direct fusion schemes. The computational cost increases significantly when dealing with high-resolution images. When sub-pixel misalignment exists between images, the Laplacian coefficients of different images exhibit positive and negative inverses at the edges. After weighted fusion, the coefficients cancel each other out, resulting in blurring and double-line ghosting at the lead edges.

[0096] Compared with the present invention, although the solution has soft transition characteristics, the multi-scale decomposition and reconstruction process introduces the problems of detail dilution and increased computational overhead, and has weak fault tolerance for vibration misalignment, and cannot simultaneously meet the dual requirements of fusion quality and computational efficiency.

[0097] Comparative Example 3

[0098] This comparative example adopts a coefficient-wise maximum modulus hard switching fusion scheme based on complex wavelet transform. The input image sequence is completely consistent with the embodiment of the present invention, and a 6-tap Daubechies complex wavelet is used to complete multi-scale decomposition and fusion.

[0099] For each input grayscale image, a multi-level complex wavelet decomposition is performed, with the decomposition level set to 5 to 10. Each level outputs a low-pass sub-band, a horizontal detail sub-band, a vertical detail sub-band, and a diagonal detail sub-band, transforming the image from the spatial domain to the complex wavelet domain. At each coefficient position in the wavelet domain, the modulus square value of the corresponding coefficient in each image is calculated, which is the sum of the squares of the real and imaginary parts of the complex number. The coefficient corresponding to the image with the largest modulus square value is directly selected as the fusion coefficient at that position. The selection process for all coefficients is performed independently position by position. After the fusion coefficients are calculated, consistency filtering is performed. One method is the inter-sub-band voting rule: if the majority coefficients of three detail sub-bands in the same level are selected from the same image, the coefficients of the third sub-band are forced to be synchronously modified to the same source. The other method is spatial neighborhood filtering: if the source of the coefficients at a certain pixel position is different from all the surrounding neighbors, the mean of the neighborhood coefficients is used for replacement. Finally, an inverse transform is performed on the fused complex wavelet coefficients to reconstruct the fused image step by step.

[0100] The fusion results of this comparative example are as follows: Figure 10 As shown, at the transition boundary between the focused and defocused areas, obvious ripple-like ringing artifacts appear, with oscillating stripes resembling water ripples distributed along the edges, particularly prominent in flat areas with sparse texture. This defect stems from the limited length of the complex wavelet filter and insufficient frequency selectivity. Hard switching causes discontinuities in coefficients from different sources between adjacent scales, resulting in Gibbs oscillations after the inverse transform. A large number of salt-and-pepper-like abnormal noise points are scattered in smooth areas of the image. The coefficient-by-coefficient hard switching decision is extremely sensitive to noise. The large squared modulus of local noise in a single image is directly retained in the fusion result. Consistency filtering can only eliminate extremely isolated noise points and cannot handle continuously distributed noise interference.

[0101] In the focal plane transition region, stepped layering artifacts are visible. The fusion decisions of each decomposition level are independent of each other. The image sources selected at different scales are different. After reconstruction, layered lines are formed at the boundaries of different frequency components, which destroys the visual continuity of the image. Under high magnification, fine stitching marks at the sub-band boundaries can be observed. The forced adjustment of voting correction between sub-bands will introduce local discontinuities at the junction of sub-bands in different directions. When there is subpixel-level vibration misalignment in the input image, the wavelet coefficients of different images are shifted to their corresponding physical positions. Hard switching directly merges the coefficients at the misaligned positions, resulting in local tearing and ghosting at the lead edge.

[0102] Compared with the present invention, although the scheme has multi-scale frequency analysis capability, the decision mechanism of hard switching by coefficients lacks spatial continuity. The frequency leakage of short filters and the accumulation of hierarchical errors in multi-level decomposition introduce multiple artifact defects. At the same time, the computational complexity of multi-scale decomposition and inverse transformation is much higher than that of pixel-level MTF direct fusion scheme, which cannot balance fusion quality and computational efficiency, and is not feasible for industrial real-time detection scenarios.

[0103] The combined experimental results of the comprehensive implementation examples and the three comparative examples, combined with... Figure 3 Input source image and Figures 5 to 8 The fusion effects of each scheme are evident, and the three existing representative schemes each have fundamental defects in different dimensions: The hard-switching fusion scheme in Comparative Example 1, while having simple computational logic, lacks a weighted transition mechanism, resulting in bubble-like tomographic artifacts and overexposed edge bright rings in the focusing transition zone. It also lacks fault tolerance for vibration misalignment, leading to poor spatial continuity in the fusion result. The complex wavelet multi-scale hard-switching scheme in Comparative Example 3 is limited by short filter frequency leakage and independent coefficient-by-coefficient decision-making, resulting in obvious ripple ringing artifacts in the transition zone, scattered salt-and-pepper noise in the smooth area, and stepped layering and sub-band stitching defects. Multiple artifacts severely affect image quality. While the Laplacian pyramid weighted fusion scheme in Comparative Example 2 possesses soft transition characteristics, the multi-scale weighted averaging systematically dilutes high-frequency detail signals, resulting in an overall hazy, blurred fusion result with insufficient contrast. Furthermore, the high computational cost of multi-level upsampling and downsampling makes it unsuitable for real-time scenarios. In contrast, this invention's pixel-level fusion scheme based on MTF field smoothing enhancement establishes MTF spatial correlation through Gaussian smoothing preprocessing, combined with pixel-by-pixel adaptive weighting and a dual-path complementary fusion mechanism, achieving… Figure 6 , Figure 7 The fusion results achieve the effects of no halo at overexposed edges, no discontinuity in transition areas, and sharp and coherent detail edges. At the same time, it effectively tolerates subpixel-level vibration misalignment. No multi-scale decomposition and pre-registration are required throughout the process, resulting in low computational complexity. It is significantly superior to the three existing solutions in terms of fusion quality, anti-interference capability, and deployment efficiency, and is more suitable for practical application scenarios such as industrial precision inspection.

[0104] Reference Figure 2 Here is a structural block diagram of a multi-focus image pixel-level fusion device based on MTF field smoothing enhancement according to an embodiment of the present invention, comprising:

[0105] The MTF response calculation module is used to calculate the MTF response value pixel by pixel for each input multifocal image and generate the corresponding MTF response distribution map for each image.

[0106] The MTF field smoothing module is used to apply Gaussian smoothing filter to each MTF response distribution map and output the smoothed MTF field corresponding to each image.

[0107] The adaptive bandwidth calculation module is used to calculate the standard deviation of the smoothed MTF value of all images at the current pixel position on a pixel-by-pixel basis, and combine it with the preset resolution adjustment parameters to obtain the bandwidth parameters of the Gaussian decay function.

[0108] The fusion weight calculation module is used to calculate the Gaussian decay coefficient of each image at the current pixel position, and normalize all Gaussian decay coefficients to obtain the fusion weight of each image at the current pixel position.

[0109] The pixel fusion output module is used to sum the pixel values ​​of each image at each pixel position according to the corresponding fusion weight, and generate and output the fused image.

[0110] For the specific implementation of each module in the above device example, please refer to the above method embodiments, which will not be repeated here.

[0111] In summary, this invention utilizes an MTF-guided pixel-level fusion framework, combined with Gaussian smoothing preprocessing to establish the spatial continuity of the gradient field, integrates three adaptive weighting strategies (linear, Gaussian, and power-law), and constructs a dual-path complementary fusion mechanism of weighted soft fusion and maximum gradient hard mask selection. This achieves effective suppression of halo artifacts in overexposed areas, natural tolerance to subpixel-level vibration misalignment, and a significant improvement in fusion computation efficiency. Simultaneously, it balances edge detail sharpness and transition region smoothness. High-quality fully focused fused images are obtained without the need for multi-scale decomposition, deep learning models, or pre-registration, making it widely applicable to various scenarios such as industrial precision inspection and microscopic imaging.

[0112] An embodiment of the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described method. It is understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.

[0113] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the present invention and embodiments can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM, etc.

[0114] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, apparatus, article, or method. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.

[0115] The above description is only a preferred embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A pixel-level fusion method for multi-focus images based on MTF field smoothing enhancement, characterized in that, Includes the following steps: Acquire multiple images of the same scene taken from different focus positions, and verify the consistency of resolution across all images; For each image, the local MTF response value is calculated pixel by pixel to generate an MTF response distribution map. Gaussian smoothing filter is then applied to the MTF response distribution map to obtain the smoothed MTF field corresponding to each image. Take any pixel position in the smoothed MTF field as the current pixel position, select the maximum value from the smoothed MTF values ​​of all images at the current pixel position as the reference MTF value, calculate the standard deviation of the smoothed MTF values ​​of all images at the current pixel position, and combine the preset resolution adjustment parameters to obtain the bandwidth parameter of the Gaussian decay function. Calculate the difference between the smoothed MTF value of each image at the current pixel position and the reference MTF value. Using the difference as the independent variable and the bandwidth parameter as the standard deviation of the Gaussian decay function, calculate the Gaussian decay coefficient of each image at the current pixel position. Then, normalize all Gaussian decay coefficients to obtain the fusion weight of each image at the current pixel position. Iterate through all pixel positions to obtain the fusion weight corresponding to each pixel position in each image. Then, sum the pixel values ​​of each image at each pixel position according to the corresponding fusion weight to generate a fused image.

2. The multi-focus image pixel-level fusion method based on MTF field smoothing enhancement according to claim 1, characterized in that, The step of calculating the standard deviation of the smoothed MTF values ​​of all images at the current pixel position, and converting it into the bandwidth parameter of the Gaussian decay function by combining it with preset resolution adjustment parameters, includes: The quotient of the standard deviation divided by the preset resolution adjustment parameter is used as the bandwidth parameter of the Gaussian decay function. The preset resolution adjustment parameter is a positive real number, which is used to scale the standard deviation to control the value of the bandwidth parameter. The larger the value of the resolution adjustment parameter, the smaller the bandwidth parameter, thus accelerating the attenuation rate of the Gaussian attenuation coefficient under the condition that the MTF value difference is the same. When the standard deviation is 0, the bandwidth parameter is set to a preset non-zero lower limit value; The calculated bandwidth parameters are constrained by a range to obtain the final bandwidth parameters.

3. The multi-focus image pixel-level fusion method based on MTF field smoothing enhancement according to claim 2, characterized in that, The step of constraining the range of the calculated bandwidth parameters includes: The calculated bandwidth parameter is compared with the preset bandwidth upper limit. If the bandwidth parameter is greater than the preset bandwidth upper limit, the preset bandwidth upper limit is used as the final bandwidth parameter. The preset bandwidth upper limit is set to 8 to 15 times the preset non-zero lower limit, thus constraining the maximum value of the bandwidth parameter.

4. The multi-focus image pixel-level fusion method based on MTF field smoothing enhancement according to claim 1, characterized in that, The step of calculating the Gaussian attenuation coefficient of each image at the current pixel position and normalizing all Gaussian attenuation coefficients includes: Let (x, y) represent the current pixel position. Calculate the Gaussian attenuation coefficient of each image at the current pixel position, satisfying: Where k is the image number, Let be the Gaussian decay coefficient at pixel position (x, y) in the k-th image; Let be the MTF value of the k-th image at pixel position (x, y); The reference MTF value is the maximum smoothed MTF value among all images at pixel location (x, y); The bandwidth parameter is the bandwidth parameter of the Gaussian decay function corresponding to the current pixel position; exp is an exponential function with the natural constant e as the base. The Gaussian attenuation coefficients of all images at the current pixel position are normalized to obtain the fusion weight of each image at the current pixel position, satisfying the following: ,in, Let be the fusion weight of the k-th image at pixel position (x, y); j is the image index. This is the sum of the Gaussian decay coefficients at pixel position (x,y) for all images; After the above normalization calculation, the sum of the fusion weights of all images at the same pixel location is 1.

5. The multi-focus image pixel-level fusion method based on MTF field smoothing enhancement according to claim 1, characterized in that, The step of calculating the local MTF response value pixel by pixel for each image and generating an MTF response distribution map includes: The local MTF response value is calculated pixel by pixel using the neighborhood modulation method. A square neighborhood is taken with the current pixel as the center, and the MTF response value at each pixel position is calculated according to the following formula: ,in This represents the MTF response value at pixel location (x, y). The maximum gray value in the neighborhood. The minimum gray value within the neighborhood; The neighborhood window size of the MTF estimate is the same as the kernel size of the Gaussian smoothing filter, and both are square windows.

6. The multi-focus image pixel-level fusion method based on MTF field smoothing enhancement according to claim 1, characterized in that, After the step of weighted summation of pixel values ​​at each pixel position in each image according to the corresponding fusion weight to generate a fused image, the method further includes: Traverse each pixel position in the smoothed MTF field, filter out the maximum value from the smoothed MTF values ​​of all images at the same pixel position, and directly use the pixel value of the image corresponding to the maximum value as the output pixel value at the same pixel position to generate a hard mask fusion image. The fused image generated by the weighted summation is used as the default output, and the fused image with hard mask is used as the alternative output. When there is misalignment between the images, causing ghosting in the default output, the output is switched to the fused image with hard mask.

7. The multi-focus image pixel-level fusion method based on MTF field smoothing enhancement according to claim 6, characterized in that, The switching output of the hard mask fused image includes: The distribution of smooth MTF values ​​of all images within a preset neighborhood window at the current pixel position is statistically analyzed. If at least two images at the same pixel position have smooth MTF values ​​that both exceed a preset MTF threshold, and the difference between the smooth MTF values ​​of the at least two images is less than a preset difference threshold, then the current pixel position is determined to be a misaligned ghosting region. For the pixel positions identified as misaligned ghosting regions, output the pixel value of the corresponding pixel position in the hard mask fused image; for the remaining pixel positions, output the pixel value of the corresponding pixel position in the fused image generated by the weighted summation.

8. A multi-focus image pixel-level fusion system based on MTF field smoothing enhancement, characterized in that, The multi-focus image pixel-level fusion method based on MTF field smoothing enhancement according to any one of claims 1-7, wherein the multi-focus image pixel-level fusion system based on MTF field smoothing enhancement comprises: The MTF response calculation module is used to calculate the MTF response value pixel by pixel for each input multifocal image and generate the corresponding MTF response distribution map for each image. The MTF field smoothing module is used to apply Gaussian smoothing filter to each MTF response distribution map and output the smoothed MTF field corresponding to each image. The adaptive bandwidth calculation module is used to calculate the standard deviation of the smoothed MTF value of all images at the current pixel position on a pixel-by-pixel basis, and combine it with the preset resolution adjustment parameters to obtain the bandwidth parameters of the Gaussian decay function. The fusion weight calculation module is used to calculate the Gaussian decay coefficient of each image at the current pixel position, and normalize all Gaussian decay coefficients to obtain the fusion weight of each image at the current pixel position. The pixel fusion output module is used to sum the pixel values ​​of each image at each pixel position according to the corresponding fusion weight, and generate and output the fused image.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the multi-focus image pixel-level fusion method based on MTF field smoothing enhancement as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the multi-focus image pixel-level fusion method based on MTF field smoothing enhancement as described in any one of claims 1 to 7.