An image processing method, device, storage medium and detection equipment
Patent Information
- Application Number
- CN202611524557.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-29
- Publication Date
- 2026-10-30
AI Technical Summary
[0002]在工业X光成像过程中,由于成像对象材料衰减差异较小、曝光剂量受限、探测器动态范围有限、散射线干扰以及灰度背景不均等因素,采集得到的X光图像常表现为整体对比度低、局部灰度层次不足、边缘和细纹理不清晰等问题
[0058]从以上技术方案可以看出,本申请实施例具有以下优点:将第一增强图与第二增强图进行自适应权重融合,能够充分发挥两类增强算法的互补特性。即,采用至少两种设定方法对所述目标图像进行图像处理、融合,有效地保留了清晰纹理与原始图像特征。采用神经网络对所述目标图像进行增强处理,能够有效地抑制光晕、噪声与块状伪影等。通过像素级动态权重分配实现区域差异化画质优化,既解决了易产生失真、单一神经网络易丢失细节的问题,同时具备算力灵活可调、算法可解释、泛化范围广、工程易部署的综合优势,有效地保证了融合增强图的质量。并且,图像的生成不完全依托神经网络生成,还依托了设定方式的增强,因此,降低了神经网络的要求,无需大量的数据训练神经网络,节约了成本。
Smart Images

Figure CN123015307A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of image processing methods, and more specifically, to an image processing method. Background Technology
[0002] In industrial X-ray imaging, due to factors such as small differences in material attenuation of the imaging object, limited exposure dose, limited detector dynamic range, scattered radiation interference, and uneven grayscale background, the acquired X-ray images often exhibit problems such as low overall contrast, insufficient local grayscale levels, and unclear edges and fine textures.
[0003] In related technologies, deep learning image enhancement methods can be used to learn complex nonlinear gray-level mapping relationships in order to improve image quality. However, this relies on a large amount of paired training data, resulting in high deployment costs. Therefore, traditional image enhancement methods are usually used. Although they have the advantages of fast computation speed and strong interpretability, they are prone to problems such as noise amplification and local over-enhancement in low-contrast X-ray images. Summary of the Invention
[0004] This application provides an image processing method that can better acquire the desired image.
[0005] The image processing method provided in this application adopts the following technical solution: an image processing method, comprising:
[0006] Obtain the target image to be processed;
[0007] The target image is processed using at least two setting methods and fused to obtain a first enhanced image; wherein the setting methods include at least two of the following: grayscale transformation method, histogram statistical equalization method, illumination decomposition method, filtering enhancement method, morphological enhancement method, and frequency domain enhancement method.
[0008] The target image is processed using a neural network to obtain a second enhanced image, a depth detail response image, and a depth feature confidence image.
[0009] Based on the deep detail response map, the deep feature confidence map, and the grayscale difference map between the first enhancement map and the second enhancement map, a fusion weight map is obtained;
[0010] Based on the fusion weight map, the first enhancement map and the second enhancement map are weighted and fused to obtain the fusion enhancement map.
[0011] According to some embodiments of the present invention, acquiring the target image to be processed includes:
[0012] The system receives and preprocesses the acquired raw image to obtain the desired target image; wherein the target image includes at least one of a normalized image, a local contrast image, an edge response image, a texture response image, a background estimation image, and a noise estimation image.
[0013] According to some embodiments of the present invention, the fusion weight map is further generated based on the local contrast map, the edge response map, the texture response map, and the noise estimation map.
[0014] According to some embodiments of the present invention, the step of performing image processing on the target image using at least two setting methods and fusing them to obtain a first enhanced image includes:
[0015] The normalized image is subjected to grayscale dynamic range stretching to obtain the first image;
[0016] The normalized image is subjected to contrast-limited histogram equalization to obtain the second image;
[0017] The normalized image is subjected to multi-scale enhancement and multi-scale fusion processing to obtain a third image.
[0018] The normalized image, the edge response image, and the noise estimation image are subjected to detail enhancement processing to obtain a fourth image;
[0019] The first image, the second image, the third image, and the fourth image are merged to obtain the first enhanced image.
[0020] According to some embodiments of the present invention, the step of performing detail enhancement processing on the normalized image, the edge response image, and the noise estimation image to obtain a fourth image includes:
[0021] The normalized image is subjected to guided filtering detail separation processing to obtain a base layer image and a detail layer image; wherein, the base layer image is used to represent the low-frequency grayscale background, and the detail layer image is used to represent edges, textures and subtle textures;
[0022] Adaptive detail enhancement processing is performed on the edge response map, the texture response map, and the noise estimation map to obtain a detail gain map;
[0023] The detail layer image is combined with the detail gain map to obtain the noise-reduced enhanced detail layer map;
[0024] The enhanced detail layer image is overlaid on the base layer image to obtain the fourth image.
[0025] According to some embodiments of the present invention, the enhancement processing of the target image using a neural network to obtain a second enhanced image, a depth detail response image, and a depth feature confidence image includes:
[0026] Obtain the normalized map, the first enhancement map, the local contrast map, the edge response map, the texture response map, the background estimation map, and the noise estimation map, and then concatenate them to obtain the fused input features;
[0027] The fused input features are processed by convolutional layers to obtain a first-scale feature map, a second-scale feature map, and a third-scale feature map. The first-scale feature map is used to recover fine edges and textures, the second-scale feature map is used to recover mid-scale layered structures, and the third-scale feature map is used to model a large-scale grayscale background.
[0028] The contrast map, texture response map, and noise estimation map are subjected to contrast-guided attention enhancement processing to obtain an attention map. The attention map is used to enhance regions with low contrast and containing real texture, and to reduce the enhancement weight of high-noise flat regions.
[0029] The attention map and the first scale feature are subjected to contrast-guided attention residual enhancement processing to obtain a residual enhanced feature map;
[0030] The residual enhancement feature map, the second scale feature map, and the third scale feature map are subjected to multi-scale feature fusion residual detail compensation and recovery processing to obtain a multi-scale fused feature map;
[0031] The multi-scale fusion feature map is subjected to multi-scale fusion feature detail residual extraction processing to obtain a detail residual map;
[0032] Adaptive frequency domain texture enhancement processing is performed on the third-scale feature map based on frequency weights to obtain a frequency domain enhanced feature map.
[0033] The frequency domain enhanced feature map is sampled and aligned, and then fused with the residual enhanced feature map to obtain a frequency domain spatial fusion feature map.
[0034] Image reconstruction is performed based on the normalized map, the detail residual map, and the frequency domain spatial fusion feature map to obtain the second enhanced map;
[0035] The residual enhanced feature map is subjected to deep detail response processing to obtain a deep detail response map;
[0036] The frequency domain spatial fusion feature map, the residual enhancement feature map, and the noise estimation map are subjected to deep feature confidence processing to obtain a deep feature confidence map.
[0037] According to some embodiments of the present invention, the step of weightedly fusing the first enhancement map and the second enhancement map according to the fusion weight map to obtain a fusion enhancement map includes:
[0038] The matrix obtained by inverting the fused weighted map is combined with the first enhanced map by performing a pixel-by-pixel Hadamard product operation to obtain the first weighted map.
[0039] The fused weighted map and the second enhanced map are subjected to a pixel-by-pixel Hadamard product operation to obtain the second weighted map;
[0040] The first weighted graph and the second weighted graph are superimposed to obtain the fused enhanced graph.
[0041] According to some embodiments of the present invention, after obtaining the fused enhanced image, the image processing method further includes:
[0042] Based on the normalized image, guided filtering is performed to separate and compensate for high-frequency details in the image, resulting in a high-frequency residual image.
[0043] Based on the edge response map, the texture response map, the depth detail response map, and the noise estimation map, a multi-feature fusion detail preservation weighting process is performed to obtain a detail preservation weighting map.
[0044] Based on the fused enhancement map, the high-frequency residual map, and the detail-preserving weighted map, a weighted detail compensation and value range truncation image fusion enhancement process is performed to obtain the compensated enhancement map.
[0045] According to some embodiments of the present invention, after obtaining the target fused image, the image processing method further includes:
[0046] Based on the compensation enhancement map, a local gradient map and a low-frequency background estimation map are obtained;
[0047] Based on the local gradient map and the low-frequency background estimation map, a gradient suppression factor and a background deviation suppression factor are generated respectively. The gradient suppression factor and the background deviation suppression factor are multiplied pixel by pixel to obtain a suppression weight map.
[0048] Based on the suppression weight map, the compensation enhancement map, and the normalization map, a hierarchical enhancement artifact suppression fusion process is performed to obtain the output enhancement map.
[0049] Secondly, this application also discloses an image processing apparatus, comprising:
[0050] The image receiving module acquires the target image to be processed;
[0051] The first image enhancement module performs image processing on the target image using at least two setting methods and fuses them to obtain a first enhanced image; wherein, the setting methods include at least one of grayscale transformation method, histogram statistical equalization method, illumination decomposition method, filtering enhancement method, morphological enhancement method and frequency domain enhancement method;
[0052] The second image enhancement module uses a neural network to enhance the target image, resulting in a second enhanced image, a depth detail response image, and a depth feature confidence image.
[0053] The adaptive fusion module obtains a fusion weight map based at least on the deep detail response map, the deep feature confidence map, and the grayscale difference map between the first enhancement map and the second enhancement map; and performs weighted fusion of the first enhancement map and the second enhancement map according to the fusion weight map to obtain a fusion enhancement map.
[0054] Thirdly, this application also discloses a storage medium storing instructions that, when executed, cause the image processing apparatus to perform the method described above.
[0055] Fourthly, this application also discloses a testing device, comprising:
[0056] Image acquisition device, used to acquire image information of the object under test;
[0057] An image processing device is used to receive image information acquired by the image acquisition device and execute the image processing method described above to identify defects in the object under test.
[0058] As can be seen from the above technical solutions, the embodiments of this application have the following advantages: Adaptive weight fusion of the first and second enhanced images can fully leverage the complementary characteristics of the two enhancement algorithms. That is, by employing at least two setting methods to process and fuse the target image, clear textures and original image features are effectively preserved. Using a neural network to enhance the target image can effectively suppress halos, noise, and block artifacts. Pixel-level dynamic weight allocation achieves regionally differentiated image quality optimization, solving the problems of easy distortion and loss of detail in single neural networks. It also possesses the comprehensive advantages of flexible and adjustable computing power, interpretable algorithms, wide generalization range, and easy engineering deployment, effectively ensuring the quality of the fused enhanced image. Furthermore, image generation does not rely entirely on neural network generation but also on enhancement through setting methods. Therefore, the requirements for the neural network are reduced, eliminating the need for large amounts of data to train the neural network and saving costs.
[0059] The fusion weight map is generated using a deep detail response map, a deep feature confidence map, and a grayscale difference map between the first enhancement map and the second enhancement map. It is jointly judged from three dimensions: texture, network reliability, and brightness distortion. It makes up for the blind spots of single feature discrimination, accurately and adaptively allocates the fusion ratio between the first enhancement map and the second enhancement map, which can not only completely preserve the small effective texture, but also simultaneously suppress halo distortion and neural network prediction distortion. It is suitable for various complex images, and the algorithm is controllable, easy to debug, and more robust.
[0060] It is important to note that the deep detail response map relies on deep networks to extract high-level edges, subtle textures, and target features, accurately distinguishing effective details from irrelevant noise. This ensures that lesions, defects, and subtle edges are not smoothed or weakened, compensating for the limitation of relying solely on grayscale to identify weak textures. Furthermore, the deep feature confidence map enhances confidence by quantizing high-level image features pixel by pixel; it accurately marks areas prone to distortion in the network, and is compatible with the enhancement network, allowing for joint iterative optimization and adaptability to various complex images, providing accurate and reliable criteria for weight fusion. Furthermore, the grayscale difference map represents the pixel grayscale difference between the first enhancement map and the second enhancement map. Areas with large differences indicate drastic differences in brightness and contrast between the two enhancement results. These areas are likely to have traditional enhancement halos, block effects, or loss of layers due to excessive noise reduction in the network. The weights will adaptively reduce the proportion of distortion branches to suppress the inherent defects of the two types of enhancement. To further explain, the depth detail response map, the depth feature confidence map, and the grayscale difference map jointly constrain the weights from three independent dimensions: texture features, model confidence, and grayscale brightness. The weights generated by a single feature are prone to misjudgment, while the joint use of multiple features significantly reduces the pixel classification error rate. Attached Figure Description
[0061] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings.
[0062] Figure 1 This is a schematic diagram of the structure of the image processing method X disclosed in the embodiments of this application;
[0063] Figure 2 This is a schematic diagram of the overall flow of the image processing method disclosed in the embodiments of this application;
[0064] Figure 3 This is a schematic diagram illustrating the process of obtaining the first enhanced image disclosed in an embodiment of this application;
[0065] Figure 4 This is a schematic diagram of the process for acquiring the fourth image disclosed in an embodiment of this application;
[0066] Figure 5 This is a schematic diagram illustrating the workflow of the neural network disclosed in the embodiments of this application;
[0067] Figure 6 This is a schematic diagram illustrating the process of obtaining the fusion enhancement map as disclosed in an embodiment of this application;
[0068] Figure 7 This is a schematic diagram illustrating the process of obtaining the compensation enhancement map as disclosed in an embodiment of this application. Detailed Implementation
[0069] The present application will be further described in detail below with reference to the accompanying drawings.
[0070] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present application. Furthermore, the technical solutions of various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by the present application.
[0071] The terms "first," "second," "third," "fourth," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0072] This application discloses an image processing method, including the following steps:
[0073] S100 acquires the target image to be processed.
[0074] The target image can be the original low-contrast image or the object processed from the original low-contrast image. This application will use the latter as an example for illustration, and will provide a detailed explanation later.
[0075] S200 performs image processing on the target image using at least two setting methods and fuses them to obtain a first enhanced image; wherein, the setting methods include at least two of the following: grayscale transformation method, histogram statistical equalization method, illumination decomposition method, filtering enhancement method, morphological enhancement method, and frequency domain enhancement method.
[0076] Among these, grayscale transformation methods include linear grayscale transformation (piecewise linear stretching, contrast linear broadening), nonlinear grayscale transformation, threshold transformation, and inversion transformation. Histogram statistical equalization methods include global histogram equalization, adaptive local histogram equalization (CLAHE), histogram matching, histogram dual-platform equalization, hierarchical histogram equalization, weighted histogram equalization, and exposure histogram equalization. Illumination decomposition methods include the Retinex series, such as SSR single-scale Retinex, MSR multi-scale Retinex, and MSRCR multi-scale Retinex with color restoration, as well as variational illumination decomposition, morphological illumination decomposition, guided filtering and / or bilateral filtering hierarchical decomposition, and gas scattering model illumination compensation. Filtering enhancement methods include smoothing edge-preserving filtering, such as Gaussian filtering, median filtering, bilateral filtering, guided filtering, and fast guided filtering. They can also be used for sharpening details. Morphological enhancement methods include enhancement derived from basic morphological operations, morphological transformation enhancement operators, morphological local contrast calculation, and morphological gradient. Frequency domain enhancement methods can employ low-pass frequency domain filtering, high-pass frequency domain filtering, band-pass and / or band-stop filtering, and wavelet transform frequency domain enhancement, among others.
[0077] In one specific embodiment, this application employs grayscale stretching, contrast-limited adaptive histogram equalization, multi-scale Retinex method, and guided filtering method, but is not limited to using only the above-mentioned methods.
[0078] S300 uses a neural network to enhance the target image, obtaining a second enhanced image, a depth detail response image, and a depth feature confidence image.
[0079] Among them, the depth detail response map is used to characterize the strength of details in various parts of the image, and serves as an intermediate feature map connecting detail separation and adaptive enhancement.
[0080] The detail feature confidence map is a single-channel weight map used to quantify the reliability of effective texture details at a given location pixel by pixel, distinguishing real image details from noise artifacts. Its values are generally normalized to [0,1].
[0081] The neural network is a pre-trained model. After acquiring the target image, the target image is input into the trained model, and the neural network model outputs a second enhancement map, a depth detail response map, and a depth feature confidence map.
[0082] S400 obtains a fusion weight map based on the depth detail response map, the depth feature confidence map, and the grayscale difference map between the first enhancement map and the second enhancement map.
[0083] In obtaining the fusion weight map, the data can be processed using only the depth detail response map, the depth feature confidence map, and the grayscale difference map. Of course, other images can also be added to the depth detail response map, the depth feature confidence map, and the grayscale difference map to obtain a better fusion weight map, which will be explained in detail later.
[0084] The grayscale difference image Ddiff can be represented as:
[0085]
[0086] Where It is the first augmented image; Id is the second augmented image.
[0087] Specifically, by integrating the complementary features of the first enhancement image It and the second enhancement image Id, the gray values of the two images are subtracted pixel by pixel, and then the absolute value of the difference is taken to obtain a gray-level difference image Diff that represents the size of the gray-level difference between the two enhancement images pixel by pixel. The larger the pixel value in the difference image, the more significant the difference in texture, brightness and detail restoration effect between the two enhancement images at that position.
[0088] S500 performs weighted fusion of the first enhancement map and the second enhancement map according to the fusion weight map to obtain a fusion enhancement map.
[0089] Specifically, each pixel value in the fusion weight map controls the fusion weight ratio of the first and second enhanced images at the same coordinate. The fusion weight pixels are used as weighting coefficients for the first enhanced image, and the difference between 1 and the fusion weight is used as the weighting coefficient for the second enhanced image. Pixel-by-pixel weighting operations are performed on both enhanced images, and the two sets of weighted results are summed to complete pixel-level adaptive fusion of the two images, thus obtaining the fused enhanced image. Furthermore, image generation does not rely entirely on neural network generation but also on enhancement through a predetermined method. Therefore, the requirements for the neural network are reduced, eliminating the need for extensive data training and saving costs.
[0090] It should be noted that adaptive weight fusion of the first and second enhanced images fully leverages the complementary characteristics of the two enhancement algorithms. That is, by employing at least two different methods to process and fuse the target image, clear textures and original image features are effectively preserved. Using a neural network to enhance the target image effectively suppresses halos, noise, and block artifacts. Pixel-level dynamic weight allocation achieves regionally differentiated image quality optimization, solving the problems of distortion and loss of detail in single neural networks. It also possesses the comprehensive advantages of flexible and adjustable computing power, interpretable algorithms, wide generalization range, and easy engineering deployment, effectively ensuring the quality of the fused enhanced image.
[0091] The fusion weight map is generated using a deep detail response map, a deep feature confidence map, and a grayscale difference map between the first enhancement map and the second enhancement map. It is jointly judged from three dimensions: texture, network reliability, and brightness distortion. It makes up for the blind spots of single feature discrimination, accurately and adaptively allocates the fusion ratio between the first enhancement map and the second enhancement map, which can not only completely preserve the small effective texture, but also simultaneously suppress halo distortion and neural network prediction distortion. It is suitable for various complex images, and the algorithm is controllable, easy to debug, and more robust.
[0092] It is important to note that the deep detail response map relies on deep networks to extract high-level edges, subtle textures, and target features, accurately distinguishing effective details from irrelevant noise. This ensures that lesions, defects, and subtle edges are not smoothed or weakened, compensating for the limitation of relying solely on grayscale to identify weak textures. Furthermore, the deep feature confidence map enhances confidence by quantizing high-level image features pixel by pixel; it accurately marks areas prone to distortion in the network, and is compatible with the enhancement network, allowing for joint iterative optimization and adaptability to various complex images, providing accurate and reliable criteria for weight fusion. Furthermore, the grayscale difference map represents the pixel grayscale difference between the first enhancement map and the second enhancement map. Areas with large differences indicate drastic differences in brightness and contrast between the two enhancement results. These areas are likely to have traditional enhancement halos, block effects, or loss of layers due to excessive noise reduction in the network. The weights will adaptively reduce the proportion of distortion branches to suppress the inherent defects of the two types of enhancement. To further explain, the depth detail response map, the depth feature confidence map, and the grayscale difference map jointly constrain the weights from three independent dimensions: texture features, model confidence, and grayscale brightness. The weights generated by a single feature are prone to misjudgment, while the joint use of multiple features significantly reduces the pixel classification error rate.
[0093] In some embodiments, acquiring the target image to be processed includes: step A1.
[0094] A1 receives the acquired raw image and performs preprocessing to obtain the desired target image; wherein, the target image includes at least one of a normalized image, a local contrast image, an edge response image, a texture response image, a background estimation image, and a noise estimation image.
[0095] Specifically, the image acquisition system includes an image input module and an image preprocessing module. The image input module receives raw low-contrast X-ray images, i.e., the raw images, from X-ray imaging equipment, industrial inspection workstations, or external image acquisition interfaces. The image preprocessing module is connected to the image input module and performs grayscale normalization, local contrast calculation, edge response extraction, texture response extraction, background estimation, and noise estimation on the raw low-contrast X-ray images to obtain a normalized image, a local contrast image, an edge response image, a texture response image, a background estimation image, and a noise estimation image.
[0096] In the following steps, the target image may include one or more of the following: a normalized image, a local contrast image, an edge response image, a texture response image, a background estimation image, and a noise estimation image, which may be set according to actual needs.
[0097] The specific formulas are as follows: By processing the original image X in different ways, we can obtain the normalized image Xn, the local contrast image C, the edge response image E, the texture response image T, the background estimation image Bbg, and the noise estimation image N.
[0098] The normalized graph Xn can be represented as:
[0099]
[0100] The local contrast image C can be represented as:
[0101] .
[0102] The edge response map E can be obtained by the Sobel, Scharr, or Laplacian operators:
[0103] .
[0104] Texture response map T can be obtained from local high-frequency residuals or multi-scale gradient responses:
[0105] .
[0106] The background estimation map Bbg can be obtained by large-scale guided filtering or Gaussian filtering, and the noise estimation map N can be obtained by median filtering residuals or variance estimation of flat regions.
[0107]
[0108] .
[0109] In some embodiments, the fusion weight map W is also generated based on the local contrast map, the edge response map, the texture response map, and the noise estimation map.
[0110] The fusion weight graph W can be represented as:
[0111] .
[0112] Where Sd is the depth feature confidence map. P is the depth feature confidence map. The grayscale difference map Ddiff is the grayscale difference map between the first enhancement map It and the second enhancement map id.
[0113] Grayscale difference map Ddiff
[0114] It is understandable that the fusion weight map W is generated based on the local contrast map, the edge response map, the texture response map, and the noise estimation map. These four types of features jointly constrain the fusion weight, allowing the first enhancement map and the second enhancement map to be fused selectively and avoid superimposing inferior ones. The final fused image balances clear outlines, rich micro-textures, balanced brightness and darkness, and low noise, resulting in a visual effect far superior to the fusion scheme that relies solely on brightness information to generate weights.
[0115] In some embodiments, in step S200, at least two setting methods are used to perform image processing on the target image and fuse them to obtain a first enhanced image, including: B1-B5.
[0116] B1 performs grayscale dynamic range stretching on the normalized image to obtain the first image.
[0117] The first image Istretch can be represented as:
[0118] .
[0119] Where stretch is a percentage-truncation linear stretching function (percentile histogram stretching, often used for image contrast enhancement).
[0120] Plow is a low percentile threshold (percentage, such as 0.02 representing 2%) that truncates noise in the dark areas on the left side of the histogram.
[0121] phigh high percentile threshold (percentage, e.g., 0.98 represents 98%), truncates the overexposed highlight area on the right side of the histogram.
[0122] B2 performs a contrast-limited histogram equalization process on the normalized image to obtain the second image.
[0123] The second image, Iclahe, can be represented as:
[0124] .
[0125] Among them, CLAHE(): a local contrast enhancement function, combines block equalization and contrast clipping to solve the problems of excessive global HE enhancement and noise amplification; L: the side length parameter of local image blocks, such as (L=8) means that the entire image is divided into (8×8) pixel non-overlapping blocks, and histogram equalization is performed on each block; the smaller the block, the stronger the local details, but the greater the computational cost. Tclip histogram height upper limit threshold: pixels in each block histogram exceeding this height will be evenly distributed across all gray levels, limiting the increase in local contrast and suppressing noise, halo, and artifacts.
[0126] B3 performs multi-scale enhancement and multi-scale fusion processing on the normalized image to obtain the third image.
[0127] The third image R can be represented as:
[0128]
[0129] .
[0130] Among them, the reflection component map Rk at the k-th scale is a single-scale Retinex output, representing the texture and details of the object itself in the image (feature map after removing illumination interference), and is also the source of the texture response map and / or local detail feature map mentioned above; the natural logarithm operation log() is the Retinex core transformation, which transforms the multiplicative illumination model of the image into an additive one, separating illumination and object reflection; the weight coefficient αk at the k-th scale is the multi-scale fusion weight.
[0131] Specifically, the normalized image Xn is first input into the algorithm. To avoid the undefined zero value in the logarithmic operation, a very small constant ℇ is introduced. Then, for multiple Gaussian kernels Gk with different preset standard deviations and corresponding different blur ranges, two-dimensional convolution operations are performed on the original image to obtain the illumination estimation map Gk*Xn at each scale, which retains only low-frequency brightness and darkness changes. Then, ℇ is added to the original image and the illumination map at each scale, the logarithm is taken, and a pixel-by-pixel difference operation is performed to obtain the single-scale reflection component Rk at each scale, which is stripped of illumination interference and retains only the texture details of the object. Since the single-scale component has the inherent defects of amplifying noise at small scales and losing subtle edges at large scales, the weight coefficient αk is used to perform a pixel-by-pixel weighted summation of Rk at all scales to complete the multi-scale fusion R. The fused image simultaneously takes into account the micro-fine texture, medium contours, and global illumination balance. Finally, the fusion result is globally linearly stretched and mapped back to the standard value range to output a complete texture enhancement feature map, which is used as the texture branch feature and participates in the calculation of subsequent image fusion weights together with CLAHE and the linearly stretched enhancement map.
[0132] B4 performs detail enhancement processing on the normalized image, the edge response image, and the noise estimation image to obtain a fourth image. For example, guided filtering detail separation is performed on the normalized image, and adaptive detail enhancement processing is performed on the edge response image and the noise estimation image, combined to obtain the fourth image. The third image can be represented as... We will provide a more detailed explanation later.
[0133] B5 merges the first image, the second image, the third image, and the fourth image to obtain the first enhanced image.
[0134] The first augmented graph It can be represented as:
[0135] .
[0136] The range truncation function Clip() restricts the result to the interval [0,1]. W1, W2, W3, and W4 are four sets of fusion weight coefficients that satisfy W1+W2+W3+W4=1.
[0137] Specifically, this formula is used to generate the first enhancement image It. The overall logic is as follows: first, the target image is preprocessed by channel splitting and normalization, generating two basic enhancement images: Istretch (obtained by global grayscale linear stretching) and Iclahe (obtained by CLAHE adaptive block equalization to optimize local contrast). The original normalized red channel R is extracted to retain the core features of the original image. At the same time, the normalized blue and green channels B and G are summed and multiplied element-wise with the detail feature map D to obtain the high-frequency detail components. Then, the four types of feature maps are linearly weighted and fused using weight coefficients W1, W2, W3, and W4 to balance the proportion of global brightness, local texture, original channel information, and subtle edge details. Finally, the Clip truncation function is used to constrain pixels that exceed the standard image value range of [0,1] after weighted fusion to 0 and 1, eliminating pixel overflow. The final output is the first enhanced image It, which balances global brightness, local details, original channel features, and details and textures.
[0138] Understandably, the approach involves four key steps: First, using Istretch global grayscale stretching addresses the overall darkness and narrow dynamic range of the original image, achieving balanced basic brightness across the entire image. Second, combining it with Iclahe adaptive histogram equalization compensates for the localized texture blurring caused by simple global stretching, enhancing contrast in specific regions such as lesions and small targets without amplifying overall noise. Third, introducing weighted components from the original R channel fully preserves the key target features carried by the original image's red channel, avoiding the loss of original effective information after multiple enhancement algorithms are stacked. Fourth, utilizing high-frequency detail components... The algorithm constructs high-frequency detail terms to precisely enhance image edges and subtle texture structures, highlighting weak boundary features. It employs independent weights W1, W2, W3, and W4, allowing for flexible adjustment of the contribution ratio of the four feature classes, adapting to different image scenarios such as uneven lighting, low illumination, and small targets. Finally, the Clip value range is truncated to constrain all pixels to the [0,1] interval, eliminating pixel oversaturation and negative value distortion caused by weighted superposition. The output image exhibits natural brightness levels, controllable noise, and complete details, while also considering both global visual effects and local recognition features. Compared to a single image enhancement algorithm, it significantly improves image visualization effects and feature extraction for subsequent segmentation and detection tasks.
[0139] Furthermore, the normalized image is subjected to guided filtering detail separation, and the edge response image and the noise estimation image are subjected to adaptive detail enhancement processing, which are combined to obtain a fourth image, including: C1 to C4.
[0140] C1 performs guided filtering detail separation processing on the normalized image to obtain a base layer image and a detail layer image; wherein, the base layer image is used to represent the low-frequency grayscale background, and the detail layer image is used to represent edges, textures, and subtle textures.
[0141] In this process, the guided filter detail separation decomposes Xn into a base layer B and a detail layer D:
[0142]
[0143] C2 performs adaptive detail enhancement processing on the edge response map E, texture response map T, and noise estimation map N to obtain a detail gain map.
[0144] The detail gain plot Gt can be represented as:
[0145]
[0146] Specifically, the image edge response map E, texture feature map T, and global noise estimation map N are extracted separately. Adjustable coefficients (a, b, c) are introduced to control the weights of the edge, texture, and noise components respectively. The weighted edge response aE and the weighted texture feature bT are added to enhance the effective detail information of the image. Then, the weighted noise term cN is subtracted to achieve noise suppression. The three are combined to obtain a linear feature term, which is then fed into the Sigmoid activation function. The output is mapped to the 0~1 interval, and finally, a detail gain map Gt that can adaptively distinguish between effective texture edges and background noise is obtained, achieving an adaptive detail control effect of giving higher gain to real detail areas and reducing gain to noise areas.
[0147] C3 combines the detail layer image with the detail gain map to obtain the noise-reduced enhanced detail layer map.
[0148] Among them, the enhanced detail layer diagram can be represented as Gt⨂D.
[0149] C4 overlays the enhanced detail layer image onto the base layer image to obtain the fourth image.
[0150] The fourth image can be represented as .
[0151] Understandably, after obtaining the detail layer D, the adaptive gain map Gt is used to weight the detail layer pixel by pixel, and then combined with the base layer B and fed into the final fusion formula to form a complete detail processing chain of layered extraction, noise discrimination, and selective detail enhancement: it not only preserves the stable lighting background of the base layer of the original image, but also selectively enhances the useful structure of the image and shields noise interference; at the same time, it complements the global stretching, CLAHE, and Retinex lighting restoration branches, and the four major goals of global brightness equalization, local contrast enhancement, lighting unevenness correction, and noiseless detail enhancement are completed simultaneously. The final output first enhanced image will not have the defects of single enhancement algorithms such as overexposure, noise explosion in dark areas, edge blurring, and texture loss. It is especially suitable for X-ray, low-light, and weak target detection images, improving the visualization effect while retaining highly recognizable and effective features for downstream segmentation and recognition tasks.
[0152] In some embodiments, the enhancement processing of the target image using a neural network to obtain a second enhanced image, a depth detail response image, and a depth feature confidence image includes: D1 to D11.
[0153] D1 acquires the normalized map, the first enhancement map, the local contrast map, the edge response map, the texture response map, the background estimation map, and the noise estimation map, and then concatenates them to obtain the fused input features.
[0154] The fused input feature Z can be represented as:
[0155]
[0156] Specifically, the image processing system includes an input feature construction unit, which performs channel concatenation of the normalized image Xn, the first enhancement image It, the local contrast image C, the edge response image E, the texture response image T, the background estimation image Bbg, and the noise estimation image N to obtain the fused input feature Z.
[0157] D2 performs convolutional layer processing on the fused input features to obtain a first-scale feature map, a second-scale feature map, and a third-scale feature map. The first-scale feature map is used to recover fine edges and textures, the second-scale feature map is used to recover mid-scale layered structures, and the third-scale feature map is used to model a large-scale grayscale background.
[0158] Among them, the first-scale feature map F1, the second-scale feature map F2, and the third-scale feature map F3 can be represented as:
[0159]
[0160] Where RB represents the residual convolution block, and Down represents the downsampling operation. The residual convolution block can be represented as:
[0161] .
[0162] Wherein, Conv3×3: 3×3 standard convolution, extracting local image features; Down: downsampling (generally stride 2 convolution and / or max pooling, halving the image width and height, compressing space and expanding the receptive field); Act: activation function (ReLU, etc., introducing non-linearity, allowing the network to learn complex brightness and texture).
[0163] Specifically, the image processing system includes a multi-scale convolutional coding unit, which comprises a first-scale convolutional coding sub-unit, a second-scale convolutional coding sub-unit, and a third-scale convolutional coding sub-unit. The input feature Z is fused and input to the first-scale convolutional coding sub-unit, which extracts fine edge textures, thus obtaining a first-scale feature map F1. The first-scale feature map F1 is input to the second-scale convolutional coding sub-unit, which extracts mid-scale layered structures, thus obtaining a second-scale feature map F2. The second-scale feature map F2 is input to the third-scale convolutional coding sub-unit, which extracts large-scale grayscale image features, thus obtaining a third-scale feature map F3.
[0164] Understandably, F3 controls the overall brightness of the image, F2 controls the uniformity of the object area, and F1 controls the texture clarity; the three-layer cascaded multi-scale features enhance the image's global exposure balance, ensure natural mid-level structure, and preserve minute details. At the same time, the training is stable and less prone to blurring and / or overexposure and / or fog distortion.
[0165] D3 performs contrast-guided attention enhancement processing on the contrast map, the texture response map, and the noise estimation map to obtain an attention map.
[0166] The attention map is used to enhance regions with low contrast and realistic texture, and to reduce the enhancement weight of high-noise, flat regions.
[0167] Attention map A can be represented as:
[0168] .
[0169] In this context, attention map A is used to enhance regions with low contrast but containing realistic textures, and to reduce the enhancement weight of high-noise, flat regions.
[0170] Specifically, the image processing system includes a contrast-guided attention unit. This unit first acquires a local contrast map C, a texture response map T, and a noise estimation map N. It then performs an inverse operation on the noise estimation map to obtain 1−N. Next, it concatenates and fuses C, T, and 1−N along the channel dimension to obtain joint prior features. Subsequently, it aggregates spatial and channel information through a 3×3 convolution. Finally, it maps the feature values to the 0~1 range using a Sigmoid activation function, generating an attention map A with pixel weight distribution. This process integrates three types of image physical prior information—contrast, texture, and noise—to generate a pixel-level attention mask. In the image enhancement task, it assigns high weights to effective detail regions with high contrast, rich texture, and clean noise to enhance texture and edge restoration, while assigning low weights to flat, textureless backgrounds and densely noisy dark areas to weaken the enhancement. This approach highlights the image's main details that are sensitive to the human eye, improves image contrast and clarity, and avoids simultaneously amplifying noise in dark areas during global enhancement, preventing color block breaks and over-sharpening artifacts on flat backgrounds. It achieves a balance between detail enhancement and noise suppression, resulting in a more natural and realistic visual effect after enhancement.
[0171] D4 performs contrast-guided attention residual enhancement processing on the attention map and the first-scale feature to obtain a residual enhanced feature map.
[0172] The residual enhancement feature map Fa can be represented as:
[0173]
[0174] F1: Input base feature map, i.e., the first-scale feature map (original image and / or previous layer output features); A: Adaptive attention weight map; ⨂: Pixel-wise corresponding multiplication (Hadamard product); Fa: Final output residual enhancement feature map.
[0175] Specifically, firstly, a pixel-wise Hadamard product operation is performed using a specially designed attention map A and the first-scale feature F1. Leveraging the weight characteristics of attention map A, regions with low contrast and real texture are given greater weight to amplify detail response, while high-noise flat regions are assigned minimal weight to suppress noise from being amplified simultaneously, resulting in attention-modulated feature components. Subsequently, this modulated component is directly added to the first-scale feature F1 of the original input. Relying on the residual connection mechanism, the basic feature information of the original image is fully preserved, and only the enhanced texture increments are superimposed. The final output is a residual enhanced feature map Fa that combines the complete outline of the original image, enhanced texture details, and effectively suppressed noise.
[0176] D5 performs multi-scale feature fusion residual detail compensation and restoration processing on the residual enhanced feature map, the second-scale feature map, and the third-scale feature map to obtain a multi-scale fused feature map.
[0177] The multi-scale fused feature map Fd can be represented as:
[0178]
[0179] D6 performs multi-scale fusion feature detail residual extraction processing on the multi-scale fusion feature map to obtain a detail residual map.
[0180] The detailed residual plot Rd can be represented as:
[0181]
[0182] The detail residual map represents the amount of detail compensation relative to the normalized map and the traditional enhancement map, rather than regenerating the image.
[0183] Among them, Up(): upsampling operation (interpolation and / or transposed convolution), which enlarges small-sized low-resolution features to the same width and height as \(F_a\), ensuring that the features can be concatenated; Concat: channel-dimensional concatenation, which stacks features of the same resolution on the channel axis, preserving all original information at all scales; Conv1: 1×1 convolution, which is used for dimensionality reduction and cross-channel information fusion, reducing channel redundancy; Conv3X3: 3×3 standard convolution, which is good at extracting high-frequency details such as edges and textures.
[0184] Specifically, the image processing system includes a residual detail restoration unit. The complete process of the residual detail restoration unit generating the detail residual Rd is as follows: First, the deep small-scale features F2 and F3 are upsampled to the same resolution as the attention enhancement feature map Fa through an upsampling operation Up. Then, a channel concatenation operation Concat is performed on Fa, the upsampled Up(F2), and Up(F3) features of three different scales. After concatenation, a 1×1 convolution Conv1×1 is used to complete the channel dimension compression and multi-scale information fusion to obtain a multi-scale fused feature map Fd. Then, a 3×3 convolution Conv3×3 is used on the fused feature Fd to extract the high-frequency texture and edge detail increment information of the image. Finally, the detail residual map Rd used for subsequent detail compensation is output.
[0185] Understandably, this residual detail recovery unit has multiple advantages when used for image enhancement. The unit first integrates high-resolution texture features that have been denoised and filtered by attention with two layers of deep global multi-scale features, taking into account both local fine textures and overall image structure, avoiding image fragmentation caused by single-scale enhancement. It compresses channel redundancy through 1×1 convolution and accurately extracts high-frequency details through 3×3 convolution, outputting a detail compensation map in the form of residual increments. It only enhances missing textures while completely preserving the basic light and shadow contours of the original image, making the enhancement effect natural and controllable. At the same time, the pre-attention mechanism reduces the weight of flat noise regions in advance, solving the problem of simultaneous amplification of details and noise in traditional enhancement algorithms from the root. Moreover, the residual learning mode simplifies the network training objective and alleviates gradient vanishing, making it more robust to detail restoration of degraded images such as low light, low contrast, and blur, and also more computationally efficient.
[0186] D7 performs adaptive frequency domain texture enhancement processing on the third-scale feature map based on frequency weights to obtain a frequency domain enhanced feature map.
[0187] The frequency domain enhanced feature map Ff can be represented as:
[0188]
[0189] D8 performs sampling alignment processing on the frequency domain enhanced feature map and fuses it with the residual enhanced feature map to obtain a frequency domain spatial fusion feature map.
[0190] The frequency domain spatial fusion feature map Fsf can be represented as:
[0191]
[0192] Where Af represents the learnable frequency weights. DCT(): Discrete Cosine Transform, maps spatial domain features to the frequency domain, separating low-frequency background and mid-to-high-frequency texture; ⨂: Hadamard Product (element-wise multiplication), weights and modulates different frequency components in the frequency domain; IDCT(): Inverse Discrete Cosine Transform, restores the weighted frequency domain signal back to spatial domain features; Up(): Upsampling operation, two Up operations represent two consecutive upsampling operations, magnifying small-sized frequency domain features to the same resolution as Fd; Concat(): Channel-dimensional concatenation, fusing frequency domain enhancement features with spatial detail features; Conv1×1: 1×1 convolution, compressing redundant channels after concatenation and fusing cross-channel information.
[0193] Understandably, the image processing system includes a frequency domain texture enhancement unit to enhance mid-to-high frequency information related to edges, layers, and subtle textures in the entire image, while suppressing low-frequency background unevenness. Specifically, this unit first uses DCT transform to independently control high and low frequency components in the frequency domain, specifically amplifying edge textures and suppressing low-frequency background unevenness, thus compensating for the deficiency of pure spatial convolution in separating bright and dark backgrounds from textures. Then, it fuses the frequency domain enhancement features with the spatial domain detail residuals mentioned earlier, combining the global correction capabilities of the frequency domain with the advantages of local detail extraction in the spatial domain to achieve global background equalization and simultaneous local texture enhancement.
[0194] D9 performs image reconstruction based on the normalized map, the detail residual map, and the frequency domain spatial fusion feature map to obtain the second enhanced map.
[0195] The second enhanced graph Id can be represented as:
[0196]
[0197] Wherein, α and β are learnable scaling weight coefficients that adaptively adjust the contribution ratio of the two types of enhancement residuals during network training, balancing spatial details and frequency domain global correction intensity. Conv3×3(): 3×3 convolution, further extracting global frequency domain texture compensation from the fused features \(F_{sf}\) and mapping it to the image channel dimension matching the original image. +: pixel-wise residual stacking operation, with dual-branch incremental stacking onto the original image. Clip(): pixel value truncation function, constraining the output pixels to the legal value range of the image (such as 0~1 or 0~255) to avoid overexposure, underexposure, and pixel overflow distortion after stacking increments.
[0198] Specifically, the image processing system includes an image reconstruction output unit. The reconstruction output unit uses the original input image Xn as the basis. On the one hand, it introduces a global residual map Rd to correct large-scale image quality defects such as overall blurring and brightness deviation. On the other hand, it performs a 3×3 convolution on the shallow fine-grained feature frequency domain spatial fusion feature map Fsf to extract local texture edge information. After superimposing the original image, the weighted global residual, and the weighted convolutional detail features, the pixel values are constrained to the legal value range of the image through the Clip function. Finally, the residual fusion output is completed, generating a second enhancement map Id that combines global image quality correction and local detail supplementation.
[0199] D10 performs deep detail response processing on the residual enhanced feature map to obtain a deep detail response map.
[0200] The depth detail response map Sd can be represented as:
[0201]
[0202] Wherein, Fd: the original depth feature map output by the network, containing global depth structure and local detail information; Conv(): a 1×1 point convolution, whose core function is to adjust the number of channels and fuse features from different channels of the same pixel without changing the width and height of the feature map; Sigmoid(): an activation function that maps any real number to the interval [0,1], adapting to the 0-1 value requirements of weights, confidence, and response maps; Sd: the depth detail response map, where a larger pixel value indicates richer depth edges and texture details at that location.
[0203] Understandably, generating \(S_d\) by performing deep detail response processing on the residual enhanced feature map can quantify the depth texture and edge detail richness of each pixel individually, decoupling the global depth structure from local detail information. This can accurately locate effective detail regions such as object contours and minute textures, suppress invalid responses in flat, informationless regions, and provide detail dimension priors for subsequent confidence map calculations. This allows confidence assessment to take into account both the overall depth structure and the integrity of local details, ultimately enabling adaptive differentiation between high-confidence, clear depth pixels and low-confidence, noisy, and / or blurred pixels, improving the detail restoration capability and noise resistance stability of subsequent depth reconstruction and image enhancement.
[0204] D11 performs deep feature confidence processing on the frequency domain spatial fusion feature map, the residual enhancement feature map, and the noise estimation map to obtain a deep feature confidence map.
[0205] The deep feature confidence map P can be represented as:
[0206]
[0207] Concat() is a channel-level concatenation operation that merges the original depth feature (F_d) and the detail response map (S_d) into a multi-channel composite feature. P is the depth feature confidence map; a higher pixel value indicates higher confidence in the depth feature at that location and less noise interference.
[0208] It is understandable that frequency domain spatial fusion features, residual enhancement features, and noise estimation are combined. Figure 3 Differential information is fed into the deep feature confidence process to generate a confidence map. It can simultaneously integrate frequency domain global texture information, enhanced detail information after residual repair, and pixel-level noise distribution information. It can jointly judge the reliability of depth features at each location from multiple dimensions, accurately distinguish clear and effective areas, blurred and distorted areas, and noise-contaminated areas, and achieve adaptive weighted adjustment of the compensation intensity of subsequent image reconstruction. While enhancing the edge detail restoration effect, it suppresses noise amplification and improves the overall stability and realism of the reconstructed image.
[0209] In some embodiments, step S500 performs weighted fusion of the first enhancement map and the second enhancement map according to the fusion weight map to obtain a fusion enhancement map, including: E1 to E3.
[0210] E1 performs a pixel-by-pixel Hadamard product operation between the inverted matrix of the fused weighted map and the first enhanced map to obtain the first weighted map.
[0211] E2 performs a pixel-by-pixel Hadamard product operation between the fused weight map and the second enhancement map to obtain the second weighted map.
[0212] E3 overlays the first weighted graph with the second weighted graph to obtain a fused enhanced graph.
[0213] The fusion enhancement graph If can be represented as:
[0214]
[0215] Where W: fused weight map, with each pixel value ranging from 0 to 1, jointly calculated from the local contrast map, edge response map, texture response map, noise estimation map, grayscale difference map, depth detail response map, and detail feature confidence map. ⨂: pixel-wise multiplication operation (Hadamard product), multiplying only the pixel values at the same coordinate positions in the two images, without convolution sliding operation; It: the first enhanced map output after enhancement synthesis according to the set method. Id: the second enhanced map output after neural network enhancement. W⨂Id represents the first weighted map; (1-W)⨂It represents the second weighted map.
[0216] Specifically, the fused enhancement map If is obtained by adaptively weighting and fusing the first enhancement map and the second enhancement map: the single-channel adaptive fusion weight map W is subjected to a pixel-wise Hadamard product operation with the second enhancement map Id output by the neural network, and then the matrix (1-W) after the weight map is inverted is subjected to a pixel-wise Hadamard product operation with the first enhancement map Id generated by the set method. The two sets of pixel-wise multiplication results are added pixel-wise to obtain the required fused enhancement map If.
[0217] Understandably, It is responsible for global illumination, broad color range, and overall contrast correction, but it is prone to blurring small edges; Id is specifically designed to repair local depth details and broken contours, but it is prone to amplifying noise in flat areas. Linear weighted fusion absorbs the advantages of both: the global level is supported by It, while local fine textures are supplemented by Id, avoiding the defect of a single enhancement image being "either blurry or noisy". Thus, this pixel-level linear weighted fusion formula controls the contribution ratio of the detail enhancement image and the global correction image separately through learnable dynamic weights. It enhances the local detail repair effect in texture edge areas and retains stable and uniform global image quality in flat background areas. The two enhancement information complement each other and are fused, while also possessing the advantages of lightweight computation, stable pixel value range, and smooth training convergence. It balances image detail sharpness and noise reduction smoothness, significantly improving the overall visual effect of the final enhancement image.
[0218] In some embodiments, after obtaining the fused enhancement map in the step, the image processing system includes a residual detail restoration unit. The residual detail restoration unit is used to generate a depth detail residual based on multi-scale convolutional features, edge response maps, and texture response maps, and applies the depth detail residual as a compensation amount to the normalized map or the first enhancement map to restore weak details of the entire image. Specific methods also include: F1 to F3.
[0219] F1 performs guided filtering on the normalized image to separate and compensate for high-frequency details, resulting in a high-frequency residual image.
[0220] The high-frequency residual plot H can be represented as:
[0221]
[0222] F2 performs multi-feature fusion detail-preserving weighting based on the edge response map, the texture response map, the depth detail response map, and the noise estimation map to obtain a detail-preserving weight map.
[0223] The detail-preserving weighted graph can be represented as:
[0224]
[0225] F3 performs weighted detail compensation and value range image fusion enhancement processing based on the fused enhancement map, the high-frequency residual map, and the detail preservation weight map to obtain a detail compensation enhancement map.
[0226] The detail compensation enhancement map Ic can be represented as:
[0227] .
[0228] Wherein, GF(): guided filter function; K1, K2, K3, K4: learnable balanced weight coefficients; Clip(): pixel value truncation, constraining grayscale to 0~1.
[0229] Specifically, the detail preservation module first inputs the normalized image Xn into the guided filter GF to obtain a smooth low-frequency substrate. Then, it extracts the high-frequency residual image H, which includes tissue edges, texture, and imaging noise, by subtracting the original image from the substrate. Next, it fuses the positive features of the edge response image E, texture response image T, and depth detail response image Sd with the inverse suppression information of the noise estimation image N. After weighted summation, the results are fed into the Sigmoid function to map to the 0~1 range, generating a pixel-level adaptive detail preservation weight image Q. Subsequently, the weight image is multiplied pixel by pixel with the high-frequency residual and multiplied by the global compensation coefficient r. The effective high-frequency details after filtering out noise are superimposed onto the pre-fusion enhancement image If. Finally, the pixel grayscale is constrained to the 0~1 range by the Clip operator, outputting the final detail compensation enhancement image Ic, which has clear details and no noise amplification.
[0230] In some embodiments, after obtaining the detail-compensated enhanced image, the image processing system further includes a frequency-domain texture enhancement unit. This unit includes a spatial convolution enhancement subunit and a frequency-domain response correction subunit. The frequency-domain response correction subunit is used to suppress low-frequency background unevenness and enhance the mid-to-high frequency responses corresponding to edges, textures, and weak textures in the entire image. The artifact and noise suppression module is used to post-process the detail-compensated image Ic to suppress halos, block artifacts, noise amplification, and edge over-sharpening. Specific methods also include G1 to G3.
[0231] G1 obtains the local gradient map G and the low-frequency background estimation map Lb based on the detail compensation enhancement map.
[0232] The local gradient map G and the low-frequency background estimation map Lb can be expressed as:
[0233]
[0234] Where ∇ represents the gradient algorithm; GF() guided filtering is a classic algorithm for image decomposition and edge-preserving smoothing.
[0235] Specifically, firstly, the detail compensation enhancement image Ic is input, and the image gradient is calculated and the gradient magnitude is obtained through the gradient operator to obtain the local gradient image G representing the changes in image edge texture. Then, the original image is used as both the guide image and the image to be filtered. The background filtering window radius rb and the smoothing regularization coefficient are set, and the guide filter GF is used to perform edge-preserving low-pass smoothing on the original image to filter out high-frequency texture and edge information. Finally, the low-frequency background estimation image Lb, which retains only the slow illumination changes, is obtained, thus completing the layered extraction of low-frequency background and high-frequency gradient texture of the image.
[0236] Based on the local gradient map and the low-frequency background estimation map, G2 generates a gradient suppression factor and a background deviation suppression factor, respectively, and multiplies the gradient suppression factor and the background deviation suppression factor pixel by pixel to obtain a suppression weight map.
[0237]
[0238] Wherein, Tg: gradient threshold, used to distinguish between strong texture and / or noise regions and smooth regions; Tb: background difference threshold, used to distinguish between regions with large image fluctuations and gentle background regions; Sigmoid(): Sigmoid activation function, outputting the interval \((0,1)\), to achieve numerical smoothing mapping.
[0239] Specifically, based on the gradient map G, detail compensation enhancement map Ic, and low-frequency background estimation map Lb obtained above, the absolute value of the residual between the original image and the background image, |Ic-Lb|, is first calculated. The gradient map is subtracted by the gradient threshold Tg, and the residual map is subtracted by the background threshold Tb, respectively. The two sets of differences are input into the Sigmoid function to generate two smooth masks of 0 to 1. The two masks are multiplied pixel by pixel to obtain the suppression weight S. This weight assigns a very low weight to texture noise regions with high gradients and high residuals to achieve signal suppression, and assigns a high weight to smooth backgrounds to retain basic brightness information. At the same time, the Sigmoid function ensures that the region transition is natural and there are no hard segmentation traces.
[0240] G3 performs layered enhancement and artifact suppression fusion processing based on the suppression weight map, the detail compensation enhancement map, and the normalized map to obtain the output enhancement map.
[0241]
[0242] Where, ⨂: Hadamard product (pixel-by-pixel multiplication of an image); Clip(): range truncation function, which restricts the input pixel value to the range \([0,1]\), setting it to 0 if less than 0 and 1 if greater than 1.
[0243] The pixel-level adaptive weight map S is used to perform pixel-by-pixel Hadamard product operations and summation with the detail compensation enhancement map Ic, the inverse weight 1-S, and the smoothing and denoising baseline map Xn, respectively, to complete the linear weighted fusion of the two images. The weight S in flat areas approaches 1 to preserve the complete details of the original image, while the weight S in noisy and textured areas approaches 0. Clean and smooth signals are used to suppress noise, and continuously gradually changing weights can eliminate the discontinuity of regional stitching. Finally, the Clip function is used to clamp the pixel values of the fused image to the [0,1] interval to avoid numerical overflow and distortion. The entire fusion strategy achieves pixel-level adaptive adjustment, which takes into account both strong noise reduction capability and detail preservation effect. The transition is natural and there are no artifacts. The output image values are compliant and stable, and it is compatible with subsequent image storage and processing.
[0244] Understandably, this layered enhancement and artifact suppression fusion scheme relies on the layered collaborative operation of a suppression weight map, a detail compensation enhancement map, and a normalized map. It automatically distinguishes between noise regions and effective detail regions by using pixel-level adaptive weights. Noise regions are suppressed by a normalized smooth base, while flat effective regions retain texture and edge information completely through the detail compensation enhancement map. The continuous gradient of weights eliminates blocky breaks and boundary distortion problems when different regions are fused. The layered architecture decouples noise reduction, detail enhancement, and value range constraints, making each module independent and controllable for easy parameter tuning. At the same time, the end value range normalization truncation can prevent image distortion caused by pixel value overflow. The final output enhancement map can not only effectively suppress noise and compress artifacts, but also restore the original details of the image to the greatest extent. The image transition is smooth and natural, and robustness and visual effect are improved simultaneously.
[0245] This application discloses an image processing apparatus, comprising: an image receiving module, a first image enhancement module, a second image enhancement module, and an adaptive fusion module. The image receiving module acquires a target image to be processed; the first image enhancement module performs image processing on the target image using at least two setting methods and fuses them to obtain a first enhanced image; wherein, the setting methods include at least one of grayscale transformation, histogram statistical equalization, illumination decomposition, filtering enhancement, morphological enhancement, and frequency domain enhancement; the second image enhancement module performs enhancement processing on the target image using a neural network to obtain a second enhanced image, a depth detail response image, and a depth feature confidence image; the adaptive fusion module obtains a fusion weight image based at least on the depth detail response image, the depth feature confidence image, and the grayscale difference image between the first enhanced image and the second enhanced image; and the first enhanced image and the second enhanced image are weighted and fused according to the fusion weight image to obtain a fused enhanced image.
[0246] Understandably, the adaptive fusion module performs adaptive weight fusion of the first and second enhanced images, fully leveraging the complementary characteristics of the two enhancement algorithms. That is, by employing at least two different methods to process and fuse the target image, clear textures and original image features are effectively preserved. Using a neural network to enhance the target image effectively suppresses halos, noise, and block artifacts. Pixel-level dynamic weight allocation achieves regionally differentiated image quality optimization, solving the problems of distortion and loss of detail in single neural networks. It also possesses the comprehensive advantages of flexible and adjustable computing power, interpretable algorithms, wide generalization range, and easy deployment in engineering, effectively ensuring the quality of the fused enhanced image.
[0247] The fusion weight map is generated using a deep detail response map, a deep feature confidence map, and a grayscale difference map between the first enhancement map and the second enhancement map. It is jointly judged from three dimensions: texture, network reliability, and brightness distortion. It makes up for the blind spots of single feature discrimination, accurately and adaptively allocates the fusion ratio between the first enhancement map and the second enhancement map, which can not only completely preserve the small effective texture, but also simultaneously suppress halo distortion and neural network prediction distortion. It is suitable for various complex images, and the algorithm is controllable, easy to debug, and more robust.
[0248] It is important to note that the deep detail response map relies on deep networks to extract high-level edges, subtle textures, and target features, accurately distinguishing effective details from irrelevant noise. This ensures that lesions, defects, and subtle edges are not smoothed or weakened, compensating for the limitation of relying solely on grayscale to identify weak textures. Furthermore, the deep feature confidence map enhances confidence by quantizing high-level image features pixel by pixel; it accurately marks areas prone to distortion in the network, and is compatible with the enhancement network, allowing for joint iterative optimization and adaptability to various complex images, providing accurate and reliable criteria for weight fusion. Furthermore, the grayscale difference map represents the pixel grayscale difference between the first enhancement map and the second enhancement map. Areas with large differences indicate drastic differences in brightness and contrast between the two enhancement results. These areas are likely to have traditional enhancement halos, block effects, or loss of layers due to excessive noise reduction in the network. The weights will adaptively reduce the proportion of distortion branches to suppress the inherent defects of the two types of enhancement. To further explain, the depth detail response map, the depth feature confidence map, and the grayscale difference map jointly constrain the weights from three independent dimensions: texture features, model confidence, and grayscale brightness. The weights generated by a single feature are prone to misjudgment, while the joint use of multiple features significantly reduces the pixel classification error rate.
[0249] This application also discloses a storage medium storing instructions that, when executed, cause the image processing apparatus to perform the method described above.
[0250] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives), or optical disc, etc. The random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0251] Fourthly, this application also discloses a detection device, including an image acquisition device and an image processing device. The image acquisition device is used to acquire image information of the object to be tested; the image processing device is used to receive the image information acquired by the image acquisition device and execute the above-described image processing method to identify defects in the object to be tested.
[0252] It is understandable that by using the image processing method described above, the image processing device can accurately obtain the enhanced image, thereby enabling accurate identification of defects in the object under test.
[0253] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0254] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0255] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0256] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0257] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
Claims
1. An image processing method, characterized in that, include: Obtain the target image to be processed; The target image is processed using at least two setting methods and fused to obtain a first enhanced image; wherein the setting methods include at least two of the following: grayscale transformation method, histogram statistical equalization method, illumination decomposition method, filtering enhancement method, morphological enhancement method, and frequency domain enhancement method. The target image is processed using a neural network to obtain a second enhanced image, a depth detail response image, and a depth feature confidence image. Based on the deep detail response map, the deep feature confidence map, and the grayscale difference map between the first enhancement map and the second enhancement map, a fusion weight map is obtained; Based on the fusion weight map, the first enhancement map and the second enhancement map are weighted and fused to obtain a fusion enhancement map; The step of weightedly fusing the first enhancement map and the second enhancement map according to the fusion weight map to obtain the fusion enhancement map includes: The matrix obtained by inverting the fused weighted map is combined with the first enhanced map by performing a pixel-by-pixel Hadamard product operation to obtain the first weighted map. The fused weighted map and the second enhanced map are subjected to a pixel-by-pixel Hadamard product operation to obtain the second weighted map; The first weighted graph and the second weighted graph are superimposed to obtain the fused enhanced graph.
2. The image processing method according to claim 1, characterized in that, The acquisition of the target image to be processed includes: The system receives and preprocesses the acquired raw image to obtain the desired target image; wherein the target image includes at least one of a normalized image, a local contrast image, an edge response image, a texture response image, a background estimation image, and a noise estimation image.
3. The image processing method according to claim 2, characterized in that, The fusion weight map is also generated based on the local contrast map, the edge response map, the texture response map, and the noise estimation map.
4. The image processing method according to claim 2, characterized in that, The step of processing the target image using at least two setting methods and fusing them to obtain a first enhanced image includes: The normalized image is subjected to grayscale dynamic range stretching to obtain the first image; The normalized image is subjected to contrast-limited histogram equalization to obtain the second image; The normalized image is subjected to multi-scale enhancement and multi-scale fusion processing to obtain a third image. The normalized image, the edge response image, and the noise estimation image are subjected to detail enhancement processing to obtain a fourth image; The first image, the second image, the third image, and the fourth image are merged to obtain the first enhanced image.
5. The image processing method according to claim 4, characterized in that, The process of performing detail enhancement processing on the normalized image, the edge response image, and the noise estimation image to obtain a fourth image includes: The normalized image is subjected to guided filtering detail separation processing to obtain a base layer image and a detail layer image; wherein, the base layer image is used to represent the low-frequency grayscale background, and the detail layer image is used to represent edges, textures and subtle textures; Adaptive detail enhancement processing is performed on the edge response map and the noise estimation map to obtain a detail gain map; The detail layer image is combined with the detail gain map to obtain the noise-reduced enhanced detail layer map; The enhanced detail layer image is overlaid on the base layer image to obtain the fourth image.
6. The image processing method according to claim 2, characterized in that, The process of enhancing the target image using a neural network to obtain a second enhanced image, a depth detail response image, and a depth feature confidence image includes: Obtain the normalized map, the first enhancement map, the local contrast map, the edge response map, the texture response map, the background estimation map, and the noise estimation map, and then concatenate them to obtain the fused input features; The fused input features are processed by convolutional layers to obtain a first-scale feature map, a second-scale feature map, and a third-scale feature map. The first-scale feature map is used to recover fine edges and textures, the second-scale feature map is used to recover mid-scale layered structures, and the third-scale feature map is used to model a large-scale grayscale background. The contrast map, texture response map, and noise estimation map are subjected to contrast-guided attention enhancement processing to obtain an attention map. The attention map is used to enhance regions with low contrast and containing real texture, and to reduce the enhancement weight of high-noise flat regions. The attention map and the first scale feature are subjected to contrast-guided attention residual enhancement processing to obtain a residual enhanced feature map; The residual enhancement feature map, the second scale feature map, and the third scale feature map are subjected to multi-scale feature fusion residual detail compensation and recovery processing to obtain a multi-scale fused feature map; The multi-scale fusion feature map is subjected to multi-scale fusion feature detail residual extraction processing to obtain a detail residual map; Adaptive frequency domain texture enhancement processing is performed on the third-scale feature map based on frequency weights to obtain a frequency domain enhanced feature map. The frequency domain enhanced feature map is sampled and aligned, and then fused with the residual enhanced feature map to obtain a frequency domain spatial fusion feature map. Image reconstruction is performed based on the normalized map, the detail residual map, and the frequency domain spatial fusion feature map to obtain the second enhanced map; The residual enhanced feature map is subjected to deep detail response processing to obtain a deep detail response map; The frequency domain spatial fusion feature map, the residual enhancement feature map, and the noise estimation map are subjected to deep feature confidence processing to obtain a deep feature confidence map.
7. The image processing method according to claim 2, characterized in that, After obtaining the fused enhanced image, the image processing method further includes: Based on the normalized image, guided filtering is performed to separate and compensate for high-frequency details in the image, resulting in a high-frequency residual image. Based on the edge response map, texture response map, depth detail response map, and noise estimation map, multi-feature fusion detail preservation weighting is performed to obtain a detail preservation weight map: Based on the fused enhancement map, the high-frequency residual map, and the detail-preserving weight map, weighted detail compensation and value-domain image fusion enhancement processing are performed to obtain the detail-compensated enhancement map.
8. The image processing method according to claim 7, characterized in that, After obtaining the detail-compensated enhanced map, the image processing method further includes: Based on the detail compensation enhancement map, a local gradient map and a low-frequency background estimation map are obtained; Based on the local gradient map and the low-frequency background estimation map, a gradient suppression factor and a background deviation suppression factor are generated respectively. The gradient suppression factor and the background deviation suppression factor are multiplied pixel by pixel to obtain a suppression weight map. Based on the suppression weight map, the detail compensation enhancement map, and the normalized map, a hierarchical enhancement and artifact suppression fusion process is performed to obtain the output enhancement map.
9. An image processing apparatus, characterized in that, include: The image receiving module acquires the target image to be processed; The first image enhancement module performs image processing on the target image using at least two setting methods and fuses them to obtain a first enhanced image; wherein, the setting methods include at least one of grayscale transformation method, histogram statistical equalization method, illumination decomposition method, filtering enhancement method, morphological enhancement method and frequency domain enhancement method; The second image enhancement module uses a neural network to enhance the target image, resulting in a second enhanced image, a depth detail response image, and a depth feature confidence image. The adaptive fusion module obtains a fusion weight map based at least on the deep detail response map, the deep feature confidence map, and the grayscale difference map between the first enhancement map and the second enhancement map; and performs weighted fusion of the first enhancement map and the second enhancement map according to the fusion weight map to obtain a fusion enhancement map.
10. A storage medium, characterized in that, The storage medium stores instructions that, when executed, cause the image processing apparatus to perform the method as described in any one of claims 1 to 8.
11. A testing device, characterized in that, include: Image acquisition device, used to acquire image information of the object under test; An image processing device is used to receive image information acquired by the image acquisition device and execute the image processing method according to any one of claims 1 to 8 to identify defects in the object under test.
