Image enhancement method and device and electronic equipment
Through multi-scale full-passband flat response filtering and adaptive histogram equalization, the problem of poor image enhancement effect in the existing technology is solved, full-scale feature separation and noise suppression are achieved, and image quality and detection effect are improved.
Patent Information
- Application Number
- CN202510952249.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-10
- Publication Date
- 2025-09-23
AI Technical Summary
Existing image enhancement technology cannot effectively take into account the characteristics of high grayscale value and low grayscale value areas, resulting in loss of details or noise enhancement, and cannot adapt to complex texture distribution, affecting image analysis and recognition effects.
A multi-scale full-band flat response low-pass filter is used for filtering, combined with dynamic range compression and adaptive histogram equalization. Through multi-scale interval division and grayscale boundary truncation, adaptive contrast enhancement is achieved and multi-scale equalized images are fused.
It achieves full-scale feature separation from micron-level defects to macroscopic structures, improves the dynamic range and local contrast of the image, suppresses noise and enhances fine features, and improves image quality and detection accuracy.
Smart Images

Figure CN120689213A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an image enhancement method, device and electronic equipment. Background Art
[0002] Image enhancement technology is a key means of improving image quality and visual effects, and is widely used in industrial X-ray imaging, medical imaging, remote sensing monitoring, computer vision, and other scenarios. However, due to factors such as imaging device performance and ambient lighting variations, raw images often suffer from uneven grayscale distribution, insufficient contrast, and blurred details, seriously affecting subsequent analysis and recognition.
[0003] Related technologies include the single-scale Retinex algorithm, whose fixed Gaussian kernel leads to insufficient dynamic range compression and cannot take into account the characteristics of high-grayscale and low-grayscale regions, resulting in loss of details; although histogram equalization can improve global contrast, the feature and noise enhancement effects are uncontrollable, which can easily lead to noise amplification and local over-enhancement; adaptive histogram equalization (such as CLAHE) can suppress noise amplification by limiting the local contrast enhancement amplitude, but its fixed block size cannot adapt to complex texture distribution, and the fixed contrast limiting threshold cannot take into account both noise suppression and feature presentation in low-contrast areas.
[0004] Based on this, there is an urgent need to provide a more efficient and robust image enhancement method to improve image quality and adapt to application requirements in complex scenarios. Summary of the Invention
[0005] The present invention provides an image enhancement method, device and electronic equipment to solve the defect of poor image enhancement effect in the prior art.
[0006] The present invention provides an image enhancement method, comprising: The image to be enhanced is filtered using a multi-scale low-pass filter with a full-band flat response, and the filtered image is subjected to dynamic range compression to obtain a multi-scale enhanced image; Based on the histogram distribution characteristics of the multi-scale enhanced image, the pixel value range of the multi-scale enhanced image is divided into a plurality of sub-intervals, and a grayscale boundary truncation process is performed on each sub-interval to obtain a multi-scale interval image; Dynamically determining a window size based on a scale feature of the multi-scale interval image, and performing multi-scale adaptive contrast-limited histogram equalization on the multi-scale interval image based on the window size to obtain a multi-scale equalized image; The multi-scale equalized images are fused to obtain a final enhanced image.
[0007] According to the image enhancement method provided by the present invention, the step of acquiring the image to be enhanced includes: Get the original image; Based on the grayscale mean and noise variance of the original image, the original image is globally corrected to obtain the image to be enhanced.
[0008] According to the image enhancement method provided by the present invention, performing global correction on the original image based on the grayscale mean and noise variance of the original image to obtain the image to be enhanced includes: Based on the difference between the noise variance of the original image and a preset variance threshold, performing noise suppression on each pixel in the original image to obtain a first correction value for each pixel; Based on the difference between the grayscale mean of the original image and a preset mean threshold, performing grayscale correction on each pixel to obtain a second correction value for each pixel; Based on the first correction value and the second correction value, the original image is globally corrected to obtain the image to be enhanced.
[0009] According to the image enhancement method provided by the present invention, the dynamic range compression of the filtered image to obtain a multi-scale enhanced image includes: Perform dynamic range compression on the filtered image to obtain an initial multi-scale enhanced image; The pixel grayscale values of the initial multi-scale enhanced image are normalized and mapped to a target grayscale interval to obtain the multi-scale enhanced image.
[0010] According to the image enhancement method provided by the present invention, the dynamic range compression of the filtered image to obtain the initial multi-scale enhanced image includes: Based on the scale feature of the filtered image, a nonlinear transformation is performed on the pixel grayscale values of the filtered image, so that the pixel grayscale values of the obtained initial multi-scale enhanced image are within the range of [0, 1].
[0011] According to the image enhancement method provided by the present invention, based on the histogram distribution characteristics of the multi-scale enhanced image, the pixel value range of the multi-scale enhanced image is divided into multiple sub-intervals, and grayscale boundary truncation processing is performed on each sub-interval to obtain a multi-scale interval image, including: Based on the histogram distribution characteristics of the multi-scale enhanced image, the pixel value range is divided into equal intervals with a fixed grayscale step size to generate a plurality of sub-intervals; Grayscale boundary truncation processing is performed on pixel values that exceed the interval range of the sub-interval to obtain the multi-scale interval image.
[0012] According to the image enhancement method provided by the present invention, the window size is linearly positively correlated with the scale feature of the multi-scale interval image.
[0013] According to the image enhancement method provided by the present invention, fusing the multi-scale equalized images to obtain a final enhanced image includes: Determine the comprehensive feature gradient of each pixel point based on the single feature gradient of each pixel point in the horizontal and vertical directions in each multi-scale equalized image; Determining an edge fusion weight for each pixel based on a comprehensive feature gradient of each pixel; The multi-scale equalized images are fused based on the edge fusion weights of the pixels to obtain the final enhanced image.
[0014] The present invention also provides an image enhancement device, comprising: A filtering and compression unit is used to filter the image to be enhanced using a multi-scale low-pass filter with a full-passband flat response, and perform dynamic range compression on the filtered image to obtain a multi-scale enhanced image; an interval division unit, configured to divide the pixel value range of the multi-scale enhanced image into a plurality of sub-intervals based on the histogram distribution characteristics of the multi-scale enhanced image, and perform grayscale boundary truncation processing on each sub-interval to obtain a multi-scale interval image; a histogram equalization unit, configured to dynamically determine a window size based on scale features of the multi-scale interval image, and perform multi-scale adaptive contrast-limited histogram equalization on the multi-scale interval image based on the window size to obtain a multi-scale equalized image; The image fusion unit is used to fuse the multi-scale equalized images to obtain a final enhanced image.
[0015] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-described image enhancement methods when executing the computer program.
[0016] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which implements any of the above-mentioned image enhancement methods when executed by a processor.
[0017] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any one of the above-mentioned image enhancement methods.
[0018] The image enhancement method, device, and electronic device provided by the present invention use a full-bandwidth flat-response filter bank for multi-scale decomposition, achieving full-scale feature separation from micron-level defects to macroscopic structures while maintaining zero-ripple characteristics; secondly, through adaptive grayscale sub-interval division and dynamic window adjustment, the high dynamic range is compressed to a resolvable range, while improving the local contrast of key areas; finally, through multi-scale fusion, fine features are enhanced while suppressing noise, thereby effectively improving the image enhancement effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] Figure 1 It is a flowchart of an image enhancement method provided by an embodiment of the present invention.
[0021] Figure 2 Schematic diagram of an image to be enhanced provided by an embodiment of the present invention.
[0022] Figure 3 Schematic diagram of an initial multi-scale enhanced image provided by an embodiment of the present invention.
[0023] Figure 4 Schematic diagram of a multi-scale enhanced image provided by an embodiment of the present invention.
[0024] Figure 5 is a schematic diagram of a multi-scale interval image provided by an embodiment of the present invention.
[0025] Figure 6 Schematic diagram of a multi-scale equalized image provided by an embodiment of the present invention.
[0026] Figure 7 is a schematic diagram of a final enhanced image provided by an embodiment of the present invention.
[0027] Figure 8 Schematic diagram of the structure of an image enhancement device provided by an embodiment of the present invention.
[0028] Figure 9 It is a structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0029] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0030] Industrial X-RAY images are visual images formed by non-destructive testing of the internal structure of an object through the penetration and absorption characteristics of X-rays. Since the X-ray imaging process is easily affected by factors such as scattered noise and low contrast, the original image is often difficult to clearly present the subtle features of key structures such as electrodes and diaphragms. Therefore, image enhancement processing is a key link to improve detection accuracy. Based on this, an embodiment of the present invention provides an image enhancement method, so that the enhanced industrial X-RAY image can clearly present key quality indicators such as the interface contact state of each layer of material inside the battery and the uniformity of electrode thickness, laying a data foundation for subsequent automatic defect recognition and three-dimensional reconstruction.
[0031] The image enhancement method provided by an embodiment of the present invention includes: filtering an image to be enhanced using a multi-scale low-pass filter with a full-passband flat response, performing dynamic range compression on the filtered image to obtain a multi-scale enhanced image; dividing the pixel value range of the multi-scale enhanced image into multiple sub-intervals based on the histogram distribution characteristics of the multi-scale enhanced image, performing grayscale boundary truncation processing on each sub-interval to obtain a multi-scale interval image; dynamically determining a window size based on the scale characteristics of the multi-scale interval image, performing multi-scale adaptive contrast-limited histogram equalization on the multi-scale interval image based on the window size to obtain a multi-scale equalized image; and fusing the multi-scale equalized images to obtain a final enhanced image.
[0032] The image enhancement method provided by an embodiment of the present invention innovatively uses a low-pass filter group with a full-passband flat response to perform multi-scale image decomposition. Compared to traditional Gaussian filters, this filter based on the Butterworth characteristic has a zero-ripple passband response characteristic, which can effectively avoid edge blurring effects while maintaining phase consistency of signals in each frequency band. By decomposing the image to be enhanced into sub-images containing characteristics of different frequency bands, full-scale feature separation is achieved, ensuring that micron-level defects and macroscopic structures can be optimally enhanced simultaneously.
[0033] Furthermore, to address the high dynamic range differences found in industrial X-ray images, this solution proposes an innovative adaptive enhancement strategy: First, the pixel value range of each scale sub-image is intelligently partitioned into multiple sub-intervals corresponding to different material densities. Grayscale boundaries are then truncated within each sub-interval, enabling targeted enhancement of high-absorption regions (such as metal current collectors) and low-absorption regions (such as porous membranes). In particular, given that the sub-images after multi-scale decomposition have significantly different frequency domain characteristics, this solution employs a dynamic windowing mechanism for adaptive contrast-limited histogram equalization (CLAHE), ensuring a balance between the sharpness of high-frequency features and the smooth transition of low-frequency structures.
[0034] Then, by organically integrating the optimized sub-images of each frequency band, the final enhanced image not only has a wider equivalent dynamic range, but also maintains excellent detail reproduction capabilities at all feature scales, improving the image enhancement effect. The final enhanced image can provide a large amount of high-quality datasets for defect detection tasks, thereby helping to improve the performance of defect detection models and enhance their generalization capabilities.
[0035] In a specific implementation, the image enhancement scheme mentioned above can be executed by a computer device. The computer device can be a terminal device or a server, or, of course, a computing system consisting of a terminal device and a server, which is not limited in this embodiment of the present invention. The terminal devices mentioned here may include, but are not limited to, smartphones, tablets, laptops, desktop computers, vehicle-mounted terminals, intelligent voice interaction devices, smart home appliances, aircraft, etc. In specific embodiments, the terminal device can also run a variety of applications (APPs) and / or clients, such as multimedia playback clients, image processing clients, social networking clients, browser clients, etc. The servers mentioned here may include, but are not limited to, independent physical servers, server clusters or distributed systems consisting of multiple physical servers, cloud servers that provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and basic cloud computing services such as big data and artificial intelligence platforms.
[0036] For example, when the computer device is a server, when any object has an image enhancement requirement, the image to be enhanced can be uploaded to the server through any terminal, so that the server uses the image enhancement processing solution to perform image enhancement processing on the image to be enhanced, thereby obtaining the final enhanced image.
[0037] See Figure 1 , Figure 1FIG. 1 is a flow chart of an image enhancement method provided by an embodiment of the present invention. Figure 1 As shown, the image enhancement processing method includes steps 110-140: Step 110 , filtering the image to be enhanced using a multi-scale low-pass filter with a full-passband flat response, and performing dynamic range compression on the filtered image to obtain a multi-scale enhanced image.
[0038] In this embodiment, the image to be enhanced may be an industrial X-ray image, and the number of images to be enhanced may be one or more. For ease of explanation, unless otherwise specified, the following detailed description of the implementation of the present invention is based on the example of a single image to be enhanced.
[0039] In practical applications, the image to be enhanced can be an original image captured by photography, or a preprocessed image obtained by preprocessing the original image, which is not specifically limited in the embodiments of the present invention. The preprocessing herein may include image cropping and / or global correction. For example, the image to be enhanced can be a complete captured image, or it can be composed of a portion of an image region of interest within a certain image.
[0040] A low-pass filter with a full-passband flat response means that the filter's passband amplitude response is strictly flat and ripple-free, and can be implemented using a Butterworth filter.
[0041] Multi-scale refers to the use of filter groups with different cutoff frequencies to decompose the image to be enhanced into sub-images of different frequency bands (such as high frequency, medium frequency, and low frequency) to enhance features of different scales respectively.
[0042] For example, a three-layer Butterworth low-pass filter is used with cutoff frequencies set to low, medium, and high frequencies, respectively. The resulting filtered images are low-frequency, medium-frequency, and high-frequency sub-images. The low-frequency sub-image contains the image's large-scale structural information and contains little detail or noise, while the high-frequency sub-image retains texture details and noise.
[0043] Dynamic range compression refers to the compression of high dynamic range images (such as the grayscale difference between metal and low density materials in industrial X-RAY images can reach Nonlinear adjustments are performed (multiple times) to ensure that both high and low grayscale areas are clearly displayed, making the overall image brightness distribution more balanced and avoiding overexposure or underexposure. Dynamic range compression can be achieved by performing logarithmic transformation or Sigmoid compression on each layer of sub-images.
[0044] After multi-scale filtering and dynamic range compression, a multi-scale enhanced image is obtained. The multi-scale enhanced image can be represented as an image sequence .in, 、 、 Respectively represent the low, medium and high frequency band images after dynamic range compression.
[0045] Step 120 : Based on the histogram distribution characteristics of the multi-scale enhanced image, the pixel value range of the multi-scale enhanced image is divided into a plurality of sub-intervals, and grayscale boundary truncation processing is performed on each sub-interval to obtain a multi-scale interval image.
[0046] Specifically, the histogram distribution characteristics of a multiscale enhanced image refer to the statistical characteristics of the pixel values of each frequency band sub-image after multi-scale decomposition. For example, the histogram of the low-frequency sub-image exhibits a broad peak distribution, the mid-frequency sub-image exhibits a multi-peak distribution, and the high-frequency sub-image exhibits a peaked, thick-tailed distribution. In other words, the number of sub-intervals within each frequency band sub-image and the grayscale boundaries of each sub-interval are dynamically adjusted based on the histogram distribution characteristics. Sub-interval division enables the layered extraction and feature enhancement of defect features distributed within each grayscale interval. Compared to non-layered sub-intervals, this method can increase the local contrast of defects while eliminating the blocking effect of traditional CLAHE in flat areas.
[0047] In this step, in order to eliminate extreme value interference and enhance the effective signal contrast, each sub-interval is also subjected to grayscale boundary truncation processing, and the pixel values outside the range are mapped to the grayscale boundary. The multi-scale interval image thus obtained can be represented as an image sequence ,in 、 、 Respectively represent the number of subintervals divided into low-frequency subgraph, medium-frequency subgraph and high-frequency subgraph.
[0048] Step 130 : dynamically determine the window size based on the scale feature of the multi-scale interval image, and perform multi-scale adaptive contrast-limited histogram equalization on the multi-scale interval image based on the window size to obtain a multi-scale equalized image.
[0049] Specifically, CLAHE is a local contrast enhancement method that divides an image into multiple windows and performs independent histogram equalization on each window to enhance local details. However, traditional CLAHE uses a fixed window size, which fails to balance noise suppression and detail enhancement. In this step, the window size is dynamically determined based on the scale characteristics of the multi-scale interval image.
[0050] According to the scale characteristics (spatial frequency characteristics) of each frequency band sub-image, the optimal processing window size of the histogram equalization is adaptively calculated, that is, the window size changes adaptively with the scale characteristics. For each scale interval image, after determining the window size corresponding to its scale characteristics, multi-scale adaptive contrast-limited histogram equalization processing is performed. The obtained multi-scale equalized image can be represented as an image sequence ,in 、 、 They represent the number of images obtained after histogram equalization of low-frequency sub-images, medium-frequency sub-images, and high-frequency sub-images, respectively.
[0051] Step 140: Fuse the multi-scale equalized images to obtain a final enhanced image.
[0052] Specifically, considering the complementary nature of multi-scale features in multi-scale equalized images, low-frequency sub-images carry overall structural information but have blurred edges, mid-frequency sub-images contain key texture features, and high-frequency sub-images carry fine defect information but have a high proportion of noise. Therefore, fusing these multi-scale equalized images can comprehensively retain full-scale information from macrostructure to microscopic defects, effectively suppressing noise interference while enhancing fine features. This results in an enhanced image with both a high signal-to-noise ratio and high resolution, optimally presenting key features in industrial inspection. For example, in lithium battery inspection, the final enhanced image can simultaneously and clearly display the overall electrode morphology (low frequency), coating uniformity (mid-frequency), and lithium dendrites (high frequency), enabling precise cross-scale inspection from millimeters to microns.
[0053] The fusion of multi-scale equalized images can be achieved through weighted fusion with dynamic weight allocation, frequency domain adaptive fusion, or deep learning fusion, which is not specifically limited in the embodiments of the present invention.
[0054] The method provided by the embodiment of the present invention uses a filter group with a full-passband flat response to perform multi-scale decomposition, while maintaining the zero-ripple characteristic, achieving full-scale feature separation from micron-level defects to macroscopic structures; secondly, through adaptive grayscale sub-interval division and dynamic window adjustment, the high dynamic range is compressed to a resolvable range, while improving the local contrast of key areas; finally, through multi-scale fusion, fine features are enhanced while suppressing noise, thereby effectively improving the image enhancement effect.
[0055] Based on the above embodiment, the method for acquiring the image to be enhanced includes: Get the original image; Based on the grayscale mean and noise variance of the original image, the original image is globally corrected to obtain the image to be enhanced.
[0056] Specifically, considering that the original image has inconsistent overall brightness distribution due to differences in imaging device response or uneven illumination, that is, the original image has problems of uneven grayscale and noise interference, in order to further improve the image enhancement effect, this embodiment performs a global correction on the original image to obtain the image to be enhanced. Figure 2 Schematic diagram of an image to be enhanced provided by an embodiment of the present invention.
[0057] Global correction refers to standardizing the grayscale distribution of an image through linear or nonlinear transformations, which usually includes grayscale normalization and noise suppression. Therefore, global correction of the original image can be achieved based on the grayscale mean and noise variance of the original image.
[0058] Grayscale mean is the arithmetic average of the pixel values across the entire image, reflecting the overall brightness level. It can be used to detect overexposure or underexposure. Noise variance reflects the degree to which pixel values deviate from the mean. It quantifies noise intensity and is used to distinguish signal from noise, guiding the selection of subsequent filtering parameters.
[0059] After obtaining the grayscale mean and noise variance of the original image, global brightness correction can be performed through linear stretching or gamma correction, and noise suppression can be achieved through adaptive filtering. The grayscale mean and noise variance of the image to be enhanced after global correction meet the preset range.
[0060] The method provided by the embodiment of the present invention provides standardized input for subsequent image enhancement processing through global coordinated correction of noise and grayscale, thereby further improving the image enhancement effect.
[0061] In some embodiments, performing global correction on the original image based on the grayscale mean and noise variance of the original image to obtain the image to be enhanced includes: Based on the difference between the noise variance of the original image and a preset variance threshold, noise suppression is performed on each pixel in the original image to obtain a first correction value for each pixel; Based on the difference between the grayscale mean of the original image and the preset mean threshold, grayscale correction is performed on each pixel to obtain a second correction value for each pixel; Based on the first correction value and the second correction value, a global correction is performed on the original image to obtain an image to be enhanced.
[0062] Specifically, the preset variance threshold may be pre-set according to the characteristics of the imaging device, and the preset mean threshold may be a pre-set ideal brightness target value. For example, the preset variance threshold may be 30, and the preset mean threshold may be 7000. Of course, these values may be flexibly adjusted according to actual conditions.
[0063] The noise suppression correction coefficient is determined by the difference between the noise variance and a preset variance threshold. Furthermore, the difference between the preset variance threshold and the noise variance can be represented by the ratio between the two. A larger ratio indicates a larger correction coefficient; conversely, a smaller ratio indicates a smaller correction coefficient.
[0064] The first correction value of each pixel point refers to a temporary pixel value of the pixel point after noise suppression, and can be obtained by multiplying the correction coefficient by the pixel value of the original image.
[0065] The second correction value of each pixel refers to the temporary pixel value of the pixel after grayscale correction, which is achieved based on the difference between the grayscale mean of the original image and the preset mean threshold. Furthermore, the difference between the two can be represented by the difference between the grayscale mean and the preset mean threshold. If the difference between the two is larger, the absolute value of the second correction value is larger; conversely, if the difference between the two is smaller, the absolute value of the second correction value is smaller. Preferably, if the grayscale mean is less than or equal to the preset mean threshold, the second correction value of each pixel is a positive value, which can appropriately increase the grayscale value of the image when the grayscale mean of the image is relatively low to achieve a better visual effect; conversely, if the grayscale mean is greater than the preset mean threshold, the second correction value of each pixel is a negative value, which can appropriately reduce the grayscale value of the image to an appropriate grayscale level when the grayscale mean of the image is relatively high.
[0066] After obtaining the first correction value and the second correction value of each pixel point, a global correction can be performed based on the sum of the first correction value and the second correction value, which helps to balance the overall brightness and contrast of the image, making the corrected image, that is, the image to be enhanced, more uniform and consistent, providing a better data basis for subsequent image enhancement processing.
[0067] The method provided in an embodiment of the present invention obtains a first correction value through noise suppression and obtains a second correction value through grayscale correction. Global correction is performed based on the first correction value and the second correction value, which can eliminate the influence of non-uniform rays in the original image, thereby improving the image quality.
[0068] In some embodiments, performing dynamic range compression on the filtered image to obtain a multi-scale enhanced image in step 110 includes: Step 111 : performing dynamic range compression on the filtered image to obtain an initial multi-scale enhanced image.
[0069] Specifically, the filtered image is a multi-scale sub-image, and dynamic range compression is performed on each scale of the filtered image. First, dynamic range analysis is performed, and different compression algorithms can be adaptively used for different dynamic ranges, such as linear compression, logarithmic compression, etc.
[0070] Preferably, based on the scale characteristics of the filtered image, a nonlinear transformation is performed on the pixel grayscale values of the filtered image to achieve dynamic range compression, and the pixel grayscale values of the obtained initial multi-scale enhanced image are in the range of [0, 1].
[0071] For example, a nonlinear transformation function is designed whose parameters include the scale features of the filtered image. The scale features and the pixel grayscale values of the filtered image are input into the nonlinear transformation function, and the pixel grayscale values of the initial multi-scale enhanced image are output, with the pixel grayscale values ranging from 0 to 1. When the scale feature takes a smaller value, the function changes relatively smoothly, preserving more high-frequency texture information in the image and making the image more detailed. When the scale feature takes a larger value, the function changes more steeply, which can more effectively suppress noise in the image, but may lose some detail information. In practical applications, the appropriate scale feature quantization value can be selected based on the specific image characteristics and processing requirements. In one embodiment, the quantization value of the scale feature can be 10, 20, or 30. Figure 3 Schematic diagram of an initial multi-scale enhanced image provided by an embodiment of the present invention.
[0072] Step 112 : Normalize and map the pixel grayscale values of the initial multi-scale enhanced image to the target grayscale range to obtain a multi-scale enhanced image.
[0073] Specifically, considering that the pixel grayscale values of the initial multi-scale enhanced image after dynamic range compression are in the range [0, 1], the pixel grayscale values can be further normalized to a specific integer interval, such as the target grayscale interval [0, 65535]. In a 16-bit image representation, each pixel is typically represented by a 16-bit binary number with a value range of [0, 65535]. Therefore, mapping to the target grayscale interval adapts the data to common image data format requirements and facilitates data standardization, allowing data from different ranges to be processed and analyzed at the same scale.
[0074] By multiplying the pixel value in the [0,1] interval by the target value, the pixel value is mapped to the target grayscale interval to obtain a multi-scale enhanced image. Figure 4 Schematic diagram of a multi-scale enhanced image provided by an embodiment of the present invention.
[0075] In some embodiments, based on the histogram distribution characteristics of the multi-scale enhanced image, the pixel value range of the multi-scale enhanced image is divided into multiple sub-intervals, and grayscale boundary truncation processing is performed on each sub-interval to obtain a multi-scale interval image. That is, step 120 specifically includes: Step 121 , based on the histogram distribution characteristics of the multi-scale enhanced image, the pixel value range is divided into equal intervals with a fixed grayscale step size to generate multiple sub-intervals; Step 122 , performing grayscale boundary truncation processing on pixel values that exceed the interval range of the sub-interval to obtain a multi-scale interval image.
[0076] Specifically, the histogram distribution characteristics of each image are statistically analyzed to divide the image grayscale range into multiple sub-intervals. The width of each interval can be fixed, such as 2048 or other step sizes. For example, the sub-intervals may be divided into the following sub-intervals: [0, 2048], [2049, 4096], [4097, 6144]…[63487, 65535].
[0077] It should be noted that the interval boundaries can be automatically adjusted based on the distribution of the image histogram. For example, if the histogram has a clear peak at grayscale value 1000, this point is set as the boundary of the new interval to avoid concentrating a large number of noise or background pixels in the same interval.
[0078] Then, pixel values outside the subinterval range are subjected to grayscale boundary truncation. If there are pixels outside the subinterval range in the subinterval image, the grayscale value of the pixel is forcibly mapped to the fixed boundary, thereby suppressing the interference of extreme values on subsequent processing. For example, in the interval [0, 2048], if there is a pixel with a grayscale value of 3000, the grayscale value of the pixel is adjusted to 2048. For another example, in the interval [2049, 4096], if there is a pixel with a grayscale value of 2000, the grayscale value of the pixel is adjusted to 2049, so that the grayscale value of each pixel in each subinterval image is within the subinterval range. Figure 5 is a schematic diagram of a multi-scale interval image provided by an embodiment of the present invention.
[0079] On this basis, multi-scale adaptive contrast-limited histogram equalization is performed independently on each multi-scale interval image. In the embodiment of the present invention, the window size is linearly positively correlated with the scale feature of the multi-scale interval image.
[0080] Specifically, by establishing a linear positive correlation between window size and scale features, targeted image enhancement is achieved. For low-frequency sub-images (which carry overall structural information), a larger processing window is used to avoid blocky artifacts caused by over-enhancement. For mid-frequency sub-images (which contain key texture features), a medium window size is used to enhance texture detail while maintaining a natural transition. For high-frequency sub-images (which carry subtle defect information), a smaller window is used to enhance the contrast of subtle features. Ensure that the window size increases linearly with scale to avoid sudden changes.
[0081] A calculation formula for the window size can be designed, and the formula parameters include scale characteristics. The window size is calculated according to the formula for each scale, and multiple non-overlapping windows are divided according to the window size. Multi-scale adaptive contrast-limited histogram equalization is performed, thereby obtaining a multi-scale equalized image. Figure 6 Schematic diagram of a multi-scale equalized image provided by an embodiment of the present invention.
[0082] In some embodiments, the multi-scale equalized images are fused to obtain a final enhanced image, that is, step 140 specifically includes: Step 141 , determining a comprehensive feature gradient of each pixel in each multi-scale equalized image based on the single feature gradient of each pixel in the horizontal and vertical directions; Step 142, determining the edge fusion weight of each pixel based on the comprehensive feature gradient of each pixel; Step 143 : Based on the edge fusion weight of each pixel, the multi-scale equalized images are fused to obtain a final enhanced image.
[0083] Specifically, after obtaining the grayscale value of each pixel in the multi-scale equalized image (hereinafter referred to as the grayscale image), the computer device can use the horizontal convolution factor and the vertical convolution factor of the Sobel operator to perform image plane convolution with the grayscale image to obtain the pixel change amplitude of each pixel in the grayscale image. For example, the horizontal convolution factor is convolved with the grayscale image to obtain the pixel change amplitude of each pixel in the grayscale image in the horizontal direction (i.e., horizontal direction). In addition, the vertical convolution factor can be convolved with the grayscale image to obtain the pixel change amplitude of each pixel in the grayscale image in the vertical direction (i.e., vertical direction). Here, the pixel change amplitude in the horizontal and vertical directions can be understood as a single feature gradient. In other words, any pixel corresponds to a single feature gradient in two directions.
[0084] Then, the single feature gradients in the two directions are added together to calculate the comprehensive feature gradient of each pixel, that is, the final pixel change amplitude of the pixel.
[0085] Here, the edge fusion weight is determined based on the comprehensive feature gradient of each pixel. The edge fusion weight represents the weight of each pixel in the fusion process, with the aim of making the area with rich edge information occupy a larger proportion in the fusion result. The edge fusion weight of each input image at each pixel is proportional to the comprehensive feature gradient at that point. The higher the comprehensive feature gradient (that is, the more obvious the edge), the greater the corresponding weight. Preferably, the edge fusion weight of any pixel of any image can be the ratio between the comprehensive feature gradient at that pixel of the image and the sum of the comprehensive feature gradients of multiple input images at that pixel.
[0086] After determining the edge fusion weight of each pixel in each multi-scale equalized image, the edge fusion weight is used as a weight coefficient to weightedly fuse the multi-scale equalized images to obtain the final enhanced image. Figure 7 is a schematic diagram of a final enhanced image provided by an embodiment of the present invention.
[0087] The method provided by the embodiments of the present invention assigns higher weights to edge regions, allowing the fused image to better preserve and highlight edge information, resulting in clearer and sharper edges. Considering that multi-scale superposition may result in some false edge information (artifacts) and haloing, the edge-weighted fusion method can more rationally allocate information across different scales and images, effectively reducing these undesirable effects and improving the visual quality and authenticity of the final enhanced image.
[0088] Based on any of the above embodiments, an image enhancement method is provided, including: S1, obtain the original image; based on the grayscale mean and noise variance of the original image, perform global correction on the original image to obtain the image to be enhanced. Specifically including: S11, based on the difference between the noise variance of the original image and the preset variance threshold, noise suppression is performed on each pixel in the original image to obtain a first correction value for each pixel; based on the difference between the grayscale mean of the original image and the preset mean threshold, grayscale correction is performed on each pixel to obtain a second correction value for each pixel; based on the first correction value and the second correction value, global correction is performed on the original image to obtain an image to be enhanced.
[0089] S2, filtering the image to be enhanced using a multi-scale low-pass filter with a full-band flat response, and performing dynamic range compression on the filtered image to obtain a multi-scale enhanced image. Specifically, it includes: S21, performing dynamic range compression on the filtered image to obtain an initial multi-scale enhanced image. Based on the scale characteristics of the filtered image, performing a nonlinear transformation on the pixel grayscale values of the filtered image, so that the pixel grayscale values of the obtained initial multi-scale enhanced image are in the range of [0, 1].
[0090] S22, normalizing the pixel grayscale values of the initial multi-scale enhanced image and mapping them to the target grayscale range to obtain a multi-scale enhanced image.
[0091] S3, based on the histogram distribution characteristics of the multi-scale enhanced image, divide the pixel value range of the multi-scale enhanced image into multiple sub-intervals, perform grayscale boundary truncation processing on each sub-interval, and obtain a multi-scale interval image. Specifically including: S31, based on the histogram distribution characteristics of the multi-scale enhanced image, the pixel value range is equally divided with a fixed grayscale step size to generate multiple sub-intervals; the pixel values exceeding the interval range of the sub-interval are subjected to grayscale boundary truncation processing to obtain a multi-scale interval image.
[0092] S4, dynamically determining a window size based on the scale characteristics of the multi-scale interval image, wherein the window size is linearly positively correlated with the scale characteristics of the multi-scale interval image. Based on the window size, multi-scale adaptive contrast-limited histogram equalization is performed on the multi-scale interval image to obtain a multi-scale equalized image.
[0093] S5, fuses the multi-scale equalized images to obtain the final enhanced image. Specifically includes: S51, based on the single feature gradient of each pixel in the horizontal and vertical directions in each multi-scale equalized image, determine the comprehensive feature gradient of each pixel; based on the comprehensive feature gradient of each pixel, determine the edge fusion weight of each pixel; based on the edge fusion weight of each pixel, fuse the multi-scale equalized images to obtain the final enhanced image.
[0094] The image enhancement device provided by the present invention is described below. The image enhancement device described below and the image enhancement method described above can be referenced to each other.
[0095] Based on any of the above embodiments, Figure 8 FIG. 1 is a schematic structural diagram of an image enhancement device provided by an embodiment of the present invention. Figure 8 As shown, the device includes: The filtering and compression unit 810 is configured to filter the image to be enhanced using a multi-scale low-pass filter with a full-passband flat response, and perform dynamic range compression on the filtered image to obtain a multi-scale enhanced image. an interval division unit 820 for dividing the pixel value range of the multi-scale enhanced image into a plurality of sub-intervals based on the histogram distribution characteristics of the multi-scale enhanced image, and performing grayscale boundary truncation processing on each sub-interval to obtain a multi-scale interval image; a histogram equalization unit 830 configured to dynamically determine a window size based on the scale features of the multi-scale interval image, and perform multi-scale adaptive contrast-limited histogram equalization on the multi-scale interval image based on the window size to obtain a multi-scale equalized image; The image fusion unit 840 is configured to fuse the multi-scale equalized images to obtain a final enhanced image.
[0096] The device provided by the embodiment of the present invention uses a filter group with a full-passband flat response to perform multi-scale decomposition, while maintaining the zero-ripple characteristic, achieving full-scale feature separation from micron-level defects to macroscopic structures; secondly, through adaptive grayscale sub-interval division and dynamic window adjustment, the high dynamic range is compressed to a resolvable range, while improving the local contrast of key areas; finally, through multi-scale fusion, fine features are enhanced while suppressing noise, thereby effectively improving the image enhancement effect.
[0097] Based on the above embodiment, the device further includes an image acquisition unit, which is configured to: Get the original image; Based on the grayscale mean and noise variance of the original image, the original image is globally corrected to obtain the image to be enhanced.
[0098] Based on the above embodiment, the image acquisition unit is specifically configured to: Based on the difference between the noise variance of the original image and a preset variance threshold, performing noise suppression on each pixel in the original image to obtain a first correction value for each pixel; Based on the difference between the grayscale mean of the original image and a preset mean threshold, performing grayscale correction on each pixel to obtain a second correction value for each pixel; Based on the first correction value and the second correction value, the original image is globally corrected to obtain the image to be enhanced.
[0099] Based on the above embodiment, the filtering and compression unit is specifically configured to: Perform dynamic range compression on the filtered image to obtain an initial multi-scale enhanced image; The pixel grayscale values of the initial multi-scale enhanced image are normalized and mapped to a target grayscale interval to obtain the multi-scale enhanced image.
[0100] Based on the above embodiment, the filtering and compression unit is specifically configured to: Based on the scale feature of the filtered image, a nonlinear transformation is performed on the pixel grayscale values of the filtered image, so that the pixel grayscale values of the obtained initial multi-scale enhanced image are within the range of [0, 1].
[0101] Based on the above embodiment, the interval division unit is specifically used to: Based on the histogram distribution characteristics of the multi-scale enhanced image, the pixel value range is divided into equal intervals with a fixed grayscale step size to generate a plurality of sub-intervals; Grayscale boundary truncation processing is performed on pixel values that exceed the interval range of the sub-interval to obtain the multi-scale interval image.
[0102] Based on the above embodiment, the window size is linearly positively correlated with the scale feature of the multi-scale interval image.
[0103] Based on the above embodiment, the image fusion unit is specifically used for: Determine the comprehensive feature gradient of each pixel point based on the single feature gradient of each pixel point in the horizontal and vertical directions in each multi-scale equalized image; Determining an edge fusion weight for each pixel based on a comprehensive feature gradient of each pixel; The multi-scale equalized images are fused based on the edge fusion weights of the pixels to obtain the final enhanced image.
[0104] Figure 9 An example of a physical structure diagram of an electronic device is shown below. Figure 9 As shown, the electronic device may include: a processor 910, a communication interface 920, a memory 930, and a communication bus 940, wherein the processor 910, the communication interface 920, and the memory 930 communicate with each other via the communication bus 940. The processor 910 may call logic instructions in the memory 930 to execute an image enhancement method, which includes: filtering an image to be enhanced using a multi-scale low-pass filter with a full-passband flat response, performing dynamic range compression on the filtered image to obtain a multi-scale enhanced image; dividing the pixel value range of the multi-scale enhanced image into multiple sub-intervals based on the histogram distribution characteristics of the multi-scale enhanced image, performing grayscale boundary truncation on each sub-interval to obtain a multi-scale interval image; dynamically determining a window size based on the scale characteristics of the multi-scale interval image, performing multi-scale adaptive contrast-limited histogram equalization on the multi-scale interval image based on the window size to obtain a multi-scale equalized image; and fusing the multi-scale equalized images to obtain a final enhanced image.
[0105] Furthermore, the logic instructions in the aforementioned memory 930 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product, stored in a storage medium, includes instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0106] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the image enhancement method provided by the above methods, the method including: filtering the image to be enhanced using a multi-scale low-pass filter with a full-passband flat response, and performing dynamic range compression on the filtered image to obtain a multi-scale enhanced image; based on the histogram distribution characteristics of the multi-scale enhanced image, dividing the pixel value range of the multi-scale enhanced image into multiple sub-intervals, and performing grayscale boundary truncation processing on each sub-interval to obtain a multi-scale interval image; dynamically determining the window size based on the scale characteristics of the multi-scale interval image, and performing multi-scale adaptive contrast-limited histogram equalization on the multi-scale interval image based on the window size to obtain a multi-scale equalized image; fusing the multi-scale equalized images to obtain a final enhanced image.
[0107] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the image enhancement method provided by the above-mentioned methods, the method comprising: filtering the image to be enhanced using a multi-scale low-pass filter with a full-passband flat response, performing dynamic range compression on the filtered image to obtain a multi-scale enhanced image; dividing the pixel value range of the multi-scale enhanced image into multiple sub-intervals based on the histogram distribution characteristics of the multi-scale enhanced image, performing grayscale boundary truncation processing on each sub-interval to obtain a multi-scale interval image; dynamically determining the window size based on the scale characteristics of the multi-scale interval image, and performing multi-scale adaptive contrast-limited histogram equalization on the multi-scale interval image based on the window size to obtain a multi-scale equalized image; and fusing the multi-scale equalized images to obtain a final enhanced image.
[0108] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0109] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a necessary general-purpose hardware platform, or of course, hardware. Based on this understanding, the essence of the above technical solution, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for causing a computer device (such as a personal computer, server, or network device) to execute the methods described in each embodiment or certain portions of the embodiments.
[0110] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. An image enhancement method, characterized in that: include: The image to be enhanced is filtered using a multi-scale low-pass filter with a full-band flat response, and the filtered image is subjected to dynamic range compression to obtain a multi-scale enhanced image; Based on the histogram distribution characteristics of the multi-scale enhanced image, the pixel value range of the multi-scale enhanced image is divided into a plurality of sub-intervals, and a grayscale boundary truncation process is performed on each sub-interval to obtain a multi-scale interval image; Dynamically determining a window size based on a scale feature of the multi-scale interval image, and performing multi-scale adaptive contrast-limited histogram equalization on the multi-scale interval image based on the window size to obtain a multi-scale equalized image; The multi-scale equalized images are fused to obtain a final enhanced image.
2. The image enhancement method according to claim 1, wherein: The step of acquiring the image to be enhanced comprises: Get the original image; Based on the grayscale mean and noise variance of the original image, the original image is globally corrected to obtain the image to be enhanced.
3. The image enhancement method according to claim 2, wherein: The step of performing global correction on the original image based on the grayscale mean and noise variance of the original image to obtain the image to be enhanced includes: Based on the difference between the noise variance of the original image and a preset variance threshold, performing noise suppression on each pixel in the original image to obtain a first correction value for each pixel; Based on the difference between the grayscale mean of the original image and a preset mean threshold, performing grayscale correction on each pixel to obtain a second correction value for each pixel; Based on the first correction value and the second correction value, the original image is globally corrected to obtain the image to be enhanced.
4. The image enhancement method according to claim 1, wherein: The step of performing dynamic range compression on the filtered image to obtain a multi-scale enhanced image includes: Perform dynamic range compression on the filtered image to obtain an initial multi-scale enhanced image; The pixel grayscale values of the initial multi-scale enhanced image are normalized and mapped to a target grayscale interval to obtain the multi-scale enhanced image.
5. The image enhancement method according to claim 4, characterized in that: The step of performing dynamic range compression on the filtered image to obtain an initial multi-scale enhanced image includes: Based on the scale feature of the filtered image, a nonlinear transformation is performed on the pixel grayscale values of the filtered image, so that the pixel grayscale values of the obtained initial multi-scale enhanced image are within the range of [0, 1].
6. The image enhancement method according to any one of claims 1 to 5, characterized in that: The method of dividing the pixel value range of the multi-scale enhanced image into a plurality of sub-intervals based on the histogram distribution characteristics of the multi-scale enhanced image and performing grayscale boundary truncation processing on each sub-interval to obtain a multi-scale interval image includes: Based on the histogram distribution characteristics of the multi-scale enhanced image, the pixel value range is divided into equal intervals with a fixed grayscale step size to generate a plurality of sub-intervals; Grayscale boundary truncation processing is performed on pixel values that exceed the interval range of the sub-interval to obtain the multi-scale interval image.
7. The image enhancement method according to any one of claims 1 to 5, characterized in that: The window size is linearly positively correlated with the scale feature of the multi-scale interval image.
8. The image enhancement method according to any one of claims 1 to 5, characterized in that: The fusing of the multi-scale equalized images to obtain a final enhanced image includes: Determine the comprehensive feature gradient of each pixel point based on the single feature gradient of each pixel point in the horizontal and vertical directions in each multi-scale equalized image; Determining an edge fusion weight for each pixel based on a comprehensive feature gradient of each pixel; The multi-scale equalized images are fused based on the edge fusion weights of the pixels to obtain the final enhanced image.
9. An image enhancement device, characterized in that: include: A filtering and compression unit is used to filter the image to be enhanced using a multi-scale low-pass filter with a full-passband flat response, and perform dynamic range compression on the filtered image to obtain a multi-scale enhanced image; an interval division unit, configured to divide the pixel value range of the multi-scale enhanced image into a plurality of sub-intervals based on the histogram distribution characteristics of the multi-scale enhanced image, and perform grayscale boundary truncation processing on each sub-interval to obtain a multi-scale interval image; a histogram equalization unit, configured to dynamically determine a window size based on scale features of the multi-scale interval image, and perform multi-scale adaptive contrast-limited histogram equalization on the multi-scale interval image based on the window size to obtain a multi-scale equalized image; The image fusion unit is used to fuse the multi-scale equalized images to obtain a final enhanced image.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the image enhancement method according to any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Face recognition tracking-based driver fatigue state early warning method and system
CN120932210A
Driver fatigue state early warning method and system based on face recognition tracking
CN120932210B
Infrared image noise reduction edge enhancement method
CN121837074A
Multi-scale hybrid DR image enhancement method and device, electronic equipment and storage medium
CN122134568A