Image local dynamic contrast enhancement method and device
Patent Information
- Application Number
- CN202510561825.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2045-04-29
AI Technical Summary
但由于它们是以整个图像为参考对象,缺乏对图像局部特性的考虑,因此场景适应性较差;而局部对比度增强则侧重于对图像的局部区域进行对比度调整,以突出局部细节
[0102] In this embodiment of the invention, a brightness layering operation is performed on the original image to obtain a layered image; the layered image is then divided into blocks to obtain multiple image blocks; and a target filter is applied to the initial brightness averaging function corresponding to the first sub-image block in each image block. Subsequently, based on the target filtered function corresponding to the first sub-image block, brightness mapping and saturation processing are performed on the image blocks to obtain target image blocks. Thus, the contrast-enhanced image is determined based on all target image blocks. It is evident that implementing this invention enables local dynamic contrast enhancement of the image by performing brightness layering, block division, initial brightness averaging function filtering, and post-processing operations on the original image. This improves the image contrast enhancement effect, resulting in a natural image with low noise and superior color performance; simultaneously, it reduces computational complexity.
Smart Images

Figure CN120672635B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image enhancement technology, and in particular to a method and apparatus for enhancing the local dynamic contrast of an image. Background Technology
[0002] In the field of image processing, image contrast is a key indicator for measuring image quality. It reflects the difference in brightness between the brightest part (white) and the darkest part (black) of an image, and directly affects the visual effect and detail presentation of the image.
[0003] Currently, image contrast enhancement techniques are mainly divided into two categories: Global Contrast Enhancement (GCE) and Local Contrast Enhancement (LCE). Global contrast enhancement focuses on adjusting the contrast of the entire image to improve its overall contrast, and is suitable for situations where the overall brightness and contrast of the image are weak. However, because it uses the entire image as a reference, it lacks consideration for local image characteristics, resulting in poor scene adaptability. Local contrast enhancement, on the other hand, focuses on adjusting the contrast of local areas of the image to highlight local details. However, existing local contrast enhancement techniques such as adaptive histogram equalization and adaptive contrast enhancement suffer from high computational complexity, and may even result in over-enhancement and significant noise, limiting their further development and application. Therefore, providing an image processing technique that can improve contrast enhancement effects is particularly important. Summary of the Invention
[0004] This invention provides a method and apparatus for enhancing local dynamic contrast of images, which improves the contrast enhancement effect, makes the image appear natural, has less noise, and has excellent color performance; at the same time, it reduces the computational complexity.
[0005] To address the aforementioned technical problems, the first aspect of this invention discloses a method for enhancing local dynamic contrast of an image, the method comprising:
[0006] A brightness layering operation is performed on the original image to be enhanced to obtain a layered image; the layered image includes a base layer image and a residual layer image.
[0007] The layered image is divided into blocks to obtain multiple image blocks corresponding to the layered image; each image block includes a first sub-image block corresponding to the base layer image and a second sub-image block corresponding to the residual layer image;
[0008] For each image block, the initial brightness average function corresponding to the first sub-image block and the average texture parameter corresponding to the second sub-image block are determined. The initial brightness average function corresponding to the first sub-image block is then subjected to target filtering operation using the average texture parameter corresponding to the second sub-image block to obtain the target filtered function corresponding to the first sub-image block.
[0009] For each image block, a brightness mapping operation is performed on the image block using the target filtered function corresponding to the first sub-image block to obtain a mapped image block, and a saturation processing operation is performed on the mapped image block to obtain a target image block.
[0010] Based on all the target image blocks, determine the contrast-enhanced image corresponding to the original image.
[0011] A second aspect of the present invention discloses an image local dynamic contrast enhancement device, the device comprising:
[0012] The layering module is used to perform brightness layering operations on the original image to be enhanced, resulting in a layered image; the layered image includes a base layer image and a residual layer image.
[0013] The segmentation module is used to perform segmentation operations on the layered image to obtain multiple image blocks corresponding to the layered image; each image block includes a first sub-image block corresponding to the base layer image and a second sub-image block corresponding to the residual layer image;
[0014] The filtering module is used to determine, for each image block, the initial brightness average function corresponding to the first sub-image block and the average texture parameter corresponding to the second sub-image block in the image block, and to perform a target filtering operation on the initial brightness average function corresponding to the first sub-image block using the average texture parameter corresponding to the second sub-image block to obtain the target filtered function corresponding to the first sub-image block.
[0015] The post-processing module is used to perform a brightness mapping operation on each image block using the target filtering function corresponding to the first sub-image block to obtain a mapped image block, and to perform a saturation processing operation on the mapped image block to obtain a target image block.
[0016] The determining module is used to determine the contrast-enhanced image corresponding to the original image based on all the target image blocks.
[0017] As an optional implementation, in a second aspect of the present invention, the filtering module determines the initial brightness averaging function corresponding to the first sub-image block in the image block specifically by:
[0018] For each first pixel contained in the first sub-image block in the image block, a multi-order orthogonal transformation function of the brightness value is determined based on the brightness value of the first pixel, and a multi-order average orthogonal transformation function of the brightness value is determined based on the multi-order orthogonal transformation function of the brightness value.
[0019] The multi-order average orthogonal transformation function of all the brightness values of the first pixel is determined as the initial brightness average function corresponding to the first sub-image block in the image block;
[0020] Wherein, for each of the first pixels contained in the first sub-image block, the multi-order orthogonal transformation function of the brightness value of the first pixel is:
[0021]
[0022] I b Let be the brightness value of the first pixel, K be a preset normalization constant, and i be the target order index parameter of the brightness value of the first pixel, where i ranges from [0, N] and N is the preset fitting order of the maximum orthogonal basis polynomial.
[0023] And, the average texture parameter value corresponding to the second sub-image block is;
[0024]
[0025] T Ω Let Ω be the total number of pixels in the second sub-image block, and LP(x,y) be the residual value of the second pixel with pixel coordinates (x,y) in the second sub-image block.
[0026] As an optional implementation, in a second aspect of the present invention, the filtering module performs a target filtering operation on the initial brightness averaging function corresponding to the first sub-image block using the average texture parameter value corresponding to the second sub-image block, and obtains the target filtered function corresponding to the first sub-image block in the following specific ways:
[0027] For each first pixel contained in the first sub-image block, an indefinite integral operation is performed on the multi-order orthogonal transformation function of the brightness value according to the multi-order orthogonal transformation function of the brightness value of the first pixel to obtain the multi-order target transformation function of the brightness value.
[0028] Based on the multi-order target transformation function of the brightness values of all first pixels in the first sub-image block and the initial brightness averaging function corresponding to the first sub-image block, the cumulative probability distribution function corresponding to the first sub-image block is determined.
[0029] Using the average texture parameter value corresponding to the second sub-image block and the cumulative probability distribution function, a basic filtering operation is performed on the initial brightness average function corresponding to the first sub-image block to obtain the basic filtered brightness average function corresponding to the first sub-image block. Then, a spatial domain guided filtering operation is performed on the basic filtered brightness average function to obtain the target filtered function corresponding to the first sub-image block.
[0030] The multi-order target transformation function for the brightness value is:
[0031]
[0032] And, the cumulative probability distribution function corresponding to the first sub-image block is:
[0033]
[0034] Let M be the initial brightness averaging function corresponding to the first sub-image block, and M be the maximum brightness value under the bit width corresponding to the first sub-image block.
[0035] As an optional implementation, in a second aspect of the present invention, the filtering module performs a basic filtering operation on the initial brightness average function corresponding to the first sub-image block using the average texture parameter value corresponding to the second sub-image block and the cumulative probability distribution function, specifically including the following methods to obtain the basic filtered brightness average function corresponding to the first sub-image block:
[0036] Based on the average texture parameter value corresponding to the second sub-image block, the cumulative probability distribution function corresponding to the first sub-image block is subjected to curve texture adjustment to obtain the first adjusted function corresponding to the first sub-image block;
[0037] Based on the first adjusted function, determine the approximate histogram distribution function corresponding to the first sub-image block, and calculate the brightness difference function before and after the first mapping corresponding to the first sub-image block based on the first adjusted function and the approximate histogram distribution function.
[0038] Based on the brightness difference function before and after the first mapping, determine the brightness guidance function corresponding to the first sub-image block, and based on the brightness guidance function and the first adjusted function, determine the second brightness difference function before and after mapping corresponding to the first sub-image block.
[0039] Based on the first and second mapping brightness difference functions, the mapping blending coefficients corresponding to the first sub-image block are determined, and based on the mapping blending coefficients, the brightness guiding function, and the first adjusted function, the brightness blending mapping function corresponding to the first sub-image block is determined.
[0040] According to the preset curve restriction area, the brightness mixing mapping function is restricted by the interval amplitude to obtain the restricted post-mapping function corresponding to the first sub-image block. Then, the basic filtered brightness average function corresponding to the first sub-image block is fitted by the restricted post-mapping function and the multi-order target transformation function of the brightness values of all the first pixels in the first sub-image block.
[0041] The first adjusted function corresponding to the first sub-image block is:
[0042] C′(I b )=stLp*C(I b )+(1-stLp)I b ;
[0043] The approximate histogram distribution function corresponding to the first sub-image block is:
[0044] H(I b )=C′(I b +1)-C′(I b );
[0045] The brightness difference function before and after the first mapping corresponding to the first sub-image block is:
[0046]
[0047] The brightness guidance function corresponding to the first sub-image block is:
[0048]
[0049] The brightness difference function before and after the second mapping corresponding to the first sub-image block is:
[0050]
[0051] The mapping mixing coefficients corresponding to the first sub-image block are:
[0052]
[0053] The brightness blending mapping function corresponding to the first sub-image block is:
[0054] C″(I b )=α*C′(Ib )+(1-α)G(I b ).
[0055] As an optional implementation, in a second aspect of the present invention, the filtering module performs a spatial guided filtering operation on the basic filtered brightness averaging function to obtain the target filtered function corresponding to the first sub-image block, specifically including:
[0056] Based on the preset window parameters of the target window and the basic filtered brightness average function, calculate the window brightness average function corresponding to the first sub-image block within the target window and other first sub-image blocks.
[0057] Based on the basic filtered brightness average function and the window brightness average function, calculate the brightness variance parameter corresponding to the first sub-image block, and determine the brightness weighting coefficient corresponding to the first sub-image block based on the brightness variance parameter and the preset filtering coefficient.
[0058] The target filtered function corresponding to the first sub-image block is determined based on the brightness weighting coefficient, the basic filtered brightness average function, and the window-in-window brightness average function.
[0059] The average brightness function within the window is:
[0060]
[0061] H is the first side length parameter in the window parameters, L is the second side length parameter in the window parameters, h is the first side length index parameter of the window corresponding to the first sub-image block, and l is the second side length index parameter of the window corresponding to the first sub-image block. The basic filtered brightness averaging function corresponding to the first sub-image block;
[0062] And, the brightness variance parameter corresponding to the first sub-image block is:
[0063]
[0064] The brightness weighting coefficient corresponding to the first sub-image block is:
[0065]
[0066] Wherein, δ is the filtering coefficient;
[0067] The target filtered function corresponding to the first sub-image block is:
[0068]
[0069] As an optional implementation, in a second aspect of the present invention, the post-processing module performs a brightness mapping operation on the image block using the target filtered function corresponding to the first sub-image block to obtain the mapped image block. Specifically, this includes:
[0070] Based on the target filtered function corresponding to the first sub-image block, the multi-order target transformation function of the brightness value of each first pixel in the first sub-image block, and the low-frequency brightness component of each first pixel obtained in advance, calculate the initial brightness mapping value corresponding to each first pixel.
[0071] For each first pixel in the first sub-image block, the mixed brightness mapping value corresponding to the first pixel is calculated based on the initial brightness mapping value, low-frequency brightness component, and preset intensity coefficient. Then, the target brightness mapping value corresponding to the first pixel is calculated based on the mixed brightness mapping value, the residual value of the corresponding target second pixel, and a preset detail magnification factor. The target second pixel is the second pixel in the second sub-image block of the image block that has the same pixel coordinates as the first pixel.
[0072] Based on the target brightness mapping value corresponding to all the first pixels in the first sub-image block, a brightness mapping operation is performed on the image block to obtain the mapped image block.
[0073] Wherein, for each first pixel in the first sub-image block, the initial brightness mapping value corresponding to the first pixel is:
[0074]
[0075] I represents the low-frequency luminance component corresponding to the first pixel;
[0076] And, the blended brightness mapping value corresponding to the first pixel is:
[0077] I fus =(1-γ)*I eq +γ*I;
[0078] γ is the intensity coefficient;
[0079] And, the target brightness mapping value corresponding to the first pixel is:
[0080] I out =I fus +acc*LP;
[0081] acc is the detail magnification factor, and LP is the residual value of the second pixel of the target.
[0082] As an optional implementation, in the second aspect of the present invention, the post-processing module performs saturation processing on the mapped image blocks to obtain the target image blocks in the following specific ways:
[0083] Calculate the first saturation parameter of the image block and the second saturation parameter of the mapped image block, and calculate the saturation compensation gain parameter corresponding to the mapped image block based on the first saturation parameter, the second saturation parameter and the preset saturation enhancement coefficient.
[0084] Based on the blue difference chromaticity component parameters of the image block, determine the maximum blue difference compensation gain parameter corresponding to the mapped image block, and based on the red difference chromaticity component parameters of the image block, determine the maximum red difference compensation gain parameter corresponding to the mapped image block.
[0085] Based on the saturation compensation gain parameter, the maximum blue difference compensation gain parameter, and the maximum red difference compensation gain parameter, the compensation gain limit parameter corresponding to the mapped image block is determined, and based on the compensation gain limit parameter, the blue difference chromaticity component parameter, and the red difference chromaticity component parameter, the target blue difference compensation gain parameter and the target red difference compensation gain parameter corresponding to the mapped image block are determined.
[0086] Based on the target blue difference compensation gain parameter and the target red difference compensation gain parameter, the saturation processing operation is performed on the mapped image block to obtain the target image block;
[0087] The saturation compensation gain parameter corresponding to the mapped image block is:
[0088]
[0089] ACC satu S is the saturation enhancement coefficient. bf S is the first saturation parameter. af This refers to the second saturation parameter;
[0090] Furthermore, the compensation gain limiting parameter corresponding to the mapped image block is:
[0091] gain=Min(uv_gain, u_gain, v_gain);
[0092] u_gain is the maximum blue difference compensation gain parameter, and v_gain is the maximum red difference compensation gain parameter;
[0093] Furthermore, the target blue difference compensation gain parameter and the target red difference compensation gain parameter corresponding to the mapped image blocks are respectively:
[0094] U` = U*gain, V` = V*gain;
[0095] U is the blue chromaticity component parameter, and V is the red chromaticity component parameter.
[0096] A third aspect of the present invention discloses another image local dynamic contrast enhancement device, the device comprising:
[0097] Memory containing executable program code;
[0098] A processor coupled to the memory;
[0099] The processor calls the executable program code stored in the memory to execute the image local dynamic contrast enhancement method disclosed in the first aspect of the present invention.
[0100] The fourth aspect of the present invention discloses a computer storage medium storing computer instructions, which, when invoked, are used to execute the image local dynamic contrast enhancement method disclosed in the first aspect of the present invention.
[0101] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0102] In this embodiment of the invention, a brightness layering operation is performed on the original image to obtain a layered image; the layered image is then divided into blocks to obtain multiple image blocks; and a target filter is applied to the initial brightness averaging function corresponding to the first sub-image block in each image block. Subsequently, based on the target filtered function corresponding to the first sub-image block, brightness mapping and saturation processing are performed on the image blocks to obtain target image blocks. Thus, the contrast-enhanced image is determined based on all target image blocks. It is evident that implementing this invention enables local dynamic contrast enhancement of the image by performing brightness layering, block division, initial brightness averaging function filtering, and post-processing operations on the original image. This improves the image contrast enhancement effect, resulting in a natural image with low noise and superior color performance; simultaneously, it reduces computational complexity. Attached Figure Description
[0103] To more clearly illustrate the technical solutions in the embodiments of the present invention, 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 of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0104] Figure 1 This is a flowchart illustrating a method for enhancing local dynamic contrast of an image, as disclosed in an embodiment of the present invention.
[0105] Figure 2 This is a flowchart illustrating another method for enhancing local dynamic contrast of an image disclosed in an embodiment of the present invention.
[0106] Figure 3 This is a schematic diagram of the structure of an image local dynamic contrast enhancement device disclosed in an embodiment of the present invention;
[0107] Figure 4 This is a schematic diagram of another image local dynamic contrast enhancement device disclosed in an embodiment of the present invention;
[0108] Figure 5 This is a schematic diagram of a curve-restricted region disclosed in an embodiment of the present invention. Detailed Implementation
[0109] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0110] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or end that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or ends.
[0111] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0112] This invention discloses a method and apparatus for enhancing local dynamic contrast of images, which improves the contrast enhancement effect of images, makes the images appear natural, has less noise, and has superior color performance; at the same time, it reduces the computational complexity.
[0113] Example 1
[0114] Please see Figure 1 , Figure 1 This is a schematic flowchart of an image local dynamic contrast enhancement method disclosed in an embodiment of the present invention. Figure 1 The described image local dynamic contrast enhancement method can be applied to various digital images for local dynamic contrast enhancement, such as photographs, video frames, medical images, remote sensing images, scanned images, computer graphics, etc., and this invention does not limit the scope of the application. Optionally, this method can be implemented by an image contrast enhancement device, which can be integrated into an image processing device, such as a smart computer, smartphone, tablet, camera device, dashcam, etc., or it can be a local server or cloud server used to process the image local dynamic contrast enhancement process, and this invention does not limit the scope of the application. Figure 1 As shown, the image local dynamic contrast enhancement method may include the following operations:
[0115] 101. Perform a brightness layering operation on the original image to be enhanced to obtain the layered image.
[0116] In this embodiment of the invention, the layered image includes a base layer image and a residual layer image.
[0117] Furthermore, when the original image is a YUV type image, the brightness layering operation can be performed directly on the original image. However, when the original image is an RGB type image, it is necessary to perform YUV color space conversion to obtain a YUV type image, and then perform brightness layering operation on the YUV type image.
[0118] Furthermore, this brightness layering operation can be understood as performing an unsharpening mask operation on the YUV type image, that is, first blurring the YUV type image to obtain the base layer image. The blurring method can be selected from taking the average value of a fixed window, the value after Gaussian blurring within a fixed window, or other edge-preserving low-pass filtering methods, etc. Then, the blurred image (i.e., the base layer image) is subtracted from the original YUV type image to obtain the residual layer image. It should be noted that the base layer image can be used for local contrast enhancement, which can better balance the problem of noise amplification; while the residual layer image can be used for image detail restoration and enhancement.
[0119] 102. Perform block division on the layered image to obtain multiple image blocks corresponding to the layered image.
[0120] In this embodiment of the invention, after dividing the layered image into blocks, multiple image blocks can be obtained, namely, multiple first sub-image blocks corresponding to the base layer image and multiple second sub-image blocks corresponding to the residual layer. Each image block has corresponding first and second sub-image blocks; that is, each image block includes a first sub-image block corresponding to the base layer image and a second sub-image block corresponding to the residual layer image, and for each image block, the first and second sub-image blocks have a one-to-one correspondence.
[0121] Furthermore, this block operation can be understood as dividing the layered image into B*D image blocks. The specific number of blocks can be determined based on the input image's resolution, aspect ratio, and image processing requirements (such as contrast enhancement, image noise reduction, and color naturalness).
[0122] 103. For each image block, determine the initial brightness average function corresponding to the first sub-image block and the average texture parameter corresponding to the second sub-image block in the image block. Then, use the average texture parameter corresponding to the second sub-image block to perform a target filtering operation on the initial brightness average function corresponding to the first sub-image block to obtain the target filtered function corresponding to the first sub-image block.
[0123] In this embodiment of the invention, the target filtering operation includes a basic filtering operation and a spatial guided filtering operation, and the spatial guided filtering operation can be replaced by a mean filtering, bilateral filtering, or other filtering methods.
[0124] 104. For each image block, the image block is subjected to brightness mapping operation through the target filtering function corresponding to the first sub-image block to obtain the mapped image block, and the mapped image block is subjected to saturation processing operation to obtain the target image block.
[0125] In this embodiment of the invention, optionally, for each image block, brightness mapping and saturation processing operations can be performed directly on the image block, or the image block can first be upsampled and interpolated according to its resolution, such as bilinear interpolation, bicubic interpolation, or other non-fixed weight interpolation methods, to update the image block, and then brightness mapping and saturation processing operations can be performed on the image block.
[0126] 105. Based on the segmentation of all target images, determine the contrast-enhanced image corresponding to the original image.
[0127] In this embodiment of the invention, optionally, all the stitched target image blocks can be directly determined as the contrast-enhanced images corresponding to the original image, or all the target image blocks can be converted into RGB type image blocks first, and then all the stitched converted image blocks can be determined as the contrast-enhanced images corresponding to the original image.
[0128] As can be seen, implementing the embodiments of the present invention can achieve the local dynamic contrast enhancement process of the image by performing brightness layering, block division, filtering and post-processing operations of the initial brightness averaging function on the original image. While preserving image details, it improves the image contrast enhancement effect, making the image appear natural, with less noise and superior color performance, and also reduces computational complexity.
[0129] In an optional embodiment, determining the initial brightness averaging function corresponding to the first sub-image block in the image block in step 103 above includes:
[0130] For each first pixel contained in the first sub-image block in the image block, a multi-order orthogonal transformation function of the brightness value is determined based on the brightness value of the first pixel, and a multi-order average orthogonal transformation function of the brightness value is determined based on the multi-order orthogonal transformation function of the brightness value.
[0131] The multi-order average orthogonal transformation function of the brightness values of all first pixels is determined as the initial brightness averaging function corresponding to the first sub-image block in the image block.
[0132] In this optional embodiment, for each image block, the brightness information of its first sub-image block and the texture information of its second sub-image block are independently calculated. Specifically, for each first pixel contained in the first sub-image block, the multi-order orthogonal transformation function of the brightness value of the first pixel is:
[0133]
[0134] I b Let be the brightness value of the first pixel, K be the preset normalization constant (which can be understood as the normalization constant of the cosine orthogonal basis), and i be the target order index parameter of the brightness value of the first pixel, where the value of i ranges from [0, N], and N is the fitting order of the preset maximum orthogonal basis polynomial.
[0135] And, the average texture parameters corresponding to the second sub-image block are;
[0136]
[0137] T ΩLet Ω be the total number of pixels in the second sub-image block, and LP(x,y) be the residual value of the second pixel with coordinates (x,y) in the second sub-image block. stLp needs to be normalized to [0,1].
[0138] As can be seen, this optional embodiment can determine the initial brightness averaging function corresponding to the first sub-image block in each image block by determining the multi-order orthogonal transformation function of the brightness value of each first pixel contained in the first sub-image block. In this way, the reliability and accuracy of the analysis of the brightness information of the image block are improved, which in turn helps to improve the reliability and accuracy of the filtering of the initial brightness averaging function of the image block, thereby helping to improve the contrast enhancement effect of the image block.
[0139] In another optional embodiment, step 103 above, which involves performing a target filtering operation on the initial brightness averaging function corresponding to the first sub-image block using the average texture parameters corresponding to the second sub-image block to obtain the target filtered function corresponding to the first sub-image block, includes:
[0140] For each first pixel contained in the first sub-image block, an indefinite integral operation is performed on the multi-order orthogonal transformation function of the brightness value according to the multi-order orthogonal transformation function of the brightness value of the first pixel to obtain the multi-order target transformation function of the brightness value.
[0141] Based on the multi-order target transformation function of the brightness values of all first pixels in the first sub-image block, and the initial brightness averaging function corresponding to the first sub-image block, determine the cumulative probability distribution function corresponding to the first sub-image block;
[0142] Using the average texture parameters and cumulative probability distribution function corresponding to the second sub-image block, a basic filtering operation is performed on the initial brightness average function corresponding to the first sub-image block to obtain the basic filtered brightness average function corresponding to the first sub-image block. Then, a spatial domain guided filtering operation is performed on the basic filtered brightness average function to obtain the target filtered function corresponding to the first sub-image block.
[0143] In this optional embodiment, for each first pixel contained in the first sub-image block, the multi-order target transformation function for its brightness value is:
[0144]
[0145] And, the cumulative probability distribution function corresponding to the first sub-image block is:
[0146]
[0147] Let M be the initial brightness averaging function corresponding to the first sub-image block, and M be the maximum brightness value at the bit width corresponding to the first sub-image block. It should be noted that... Its essential representation is the histogram information of local image brightness.
[0148] Furthermore, M is the maximum brightness value under the bit width corresponding to the first sub-image block. It can be understood that if the first sub-image block is 8 bits, M = 255; if the first sub-image block is 10 bits, M = 1023.
[0149] Furthermore, typically, to speed up processing, I can... b Sampling is performed at certain intervals, meaning that it is not necessary to perfectly fit every gray level. For example, if the first sub-image block is 8 bits, the number of sampling points can be reduced to 4 bits (17 points) or 5 bits (33 points).
[0150] As can be seen, this optional embodiment can determine the cumulative probability distribution function corresponding to the first sub-image block through the multi-order orthogonal transformation function of the brightness values of all first pixels contained in the first sub-image block. Then, it can perform target filtering operation on the initial brightness average function corresponding to the first sub-image block through the average texture parameter corresponding to the second sub-image block and the cumulative probability distribution function. In this way, the filtering reliability and accuracy of the initial brightness average function corresponding to the first sub-image block are improved, which is conducive to preserving the texture information of the image block and making the details of the image block clearly displayed.
[0151] In another optional embodiment, the step of performing a basic filtering operation on the initial brightness average function corresponding to the first sub-image block using the average texture parameter and cumulative probability distribution function corresponding to the second sub-image block to obtain the basic filtered brightness average function corresponding to the first sub-image block includes:
[0152] Based on the average texture parameter value corresponding to the second sub-image block, the cumulative probability distribution function corresponding to the first sub-image block is adjusted by curve texture adjustment to obtain the first adjusted function corresponding to the first sub-image block;
[0153] Based on the first adjusted function, determine the approximate histogram distribution function corresponding to the first sub-image block, and calculate the brightness difference function before and after the first mapping corresponding to the first sub-image block based on the first adjusted function and the approximate histogram distribution function.
[0154] Based on the brightness difference function before and after the first mapping, the brightness guidance function corresponding to the first sub-image block is determined, and based on the brightness guidance function and the first adjusted function, the brightness difference function before and after the second mapping is determined for the first sub-image block.
[0155] Based on the brightness difference function before and after the first mapping and the brightness difference function before and after the second mapping, the mapping mixing coefficients corresponding to the first sub-image block are determined, and based on the mapping mixing coefficients, the brightness guiding function and the first adjusted function, the brightness mixing mapping function corresponding to the first sub-image block is determined.
[0156] Based on the preset curve restriction area, the brightness mixing mapping function is range-limited to obtain the restricted post-mapping function corresponding to the first sub-image block. Then, the basic filtered brightness averaging function corresponding to the first sub-image block is fitted by the restricted post-mapping function and the multi-order target transformation function of the brightness values of all first pixels in the first sub-image block.
[0157] In this optional embodiment, the basic filtering process includes curve texture adjustment, curve guidance adjustment, curve amplitude limiting, and LPF fitting operation.
[0158] Furthermore, the first adjusted function corresponding to the first sub-image block is:
[0159] C′(I b )=stLp*C(I b )+(1-stLp)I b ;
[0160] This curve texture adjustment process can make the enhancement effect of relatively flat areas of the image blocks weaker than that of textured areas, thereby reducing noise in flat areas.
[0161] Furthermore, the approximate histogram distribution function corresponding to the first sub-image block is:
[0162] H(I b )=C′(I b +1)-C′(I b ).
[0163] And, the brightness difference function before and after the first mapping corresponding to the first sub-image block is:
[0164]
[0165] And, the brightness guidance function corresponding to the first sub-image block is:
[0166]
[0167] And, the brightness difference function before and after the second mapping corresponding to the first sub-image block is:
[0168]
[0169] And, the mapping mixing coefficients corresponding to the first sub-image block are:
[0170]
[0171] And, the brightness blending mapping function corresponding to the first sub-image block is:
[0172] C″(I b )=α*C′(I b )+(1-α)G(I b ).
[0173] It should be noted that by guiding the adjustment process through curves, the brightness blending mapping function corresponding to the first sub-image block is determined, which ensures that the brightness of the mapping curve corresponding to the first sub-image block remains unchanged before and after mapping.
[0174] Furthermore, by imposing range-limited amplitude constraints on the luminance blending mapping function, the steepness of the mapping curve corresponding to the first sub-image block can be limited, and the restricted region of this curve can be as follows: Figure 5 As shown. In this closed quadrilateral region, y1=ax1 is the dark area pull-down limit line, a is the slope of the dark area pull-down limit line, and the value range is [0, 1]; y2=1-b(1-x2) is the bright area pull-down limit line, b is the slope of the bright area pull-down limit line, and the value range is [1, +∞]; y3=cx3 is the dark area pull-up limit line, c is the slope of the dark area pull-up limit line, and the value range is [1, +∞]; y4=1-d(1-x4) is the bright area pull-up limit line, d is the slope of the bright area pull-down limit line, and the value range is [0, 1].
[0175] Furthermore, the average brightness function after filtering corresponding to the first sub-image block can be fitted using the least squares method. The conversion process is as follows: As we know from the previous section, the expression for converting from LPF to the mapping curve is... Let A i represent The above expression can then be represented in matrix form as follows:
[0176] Q M×N ×A N×1 =C M×1
[0177] Where M represents the pixel gray level, N is the order of the orthogonal polynomial, and Q is the indefinite integral of the orthogonal transformation basis P mentioned earlier, the value of which is fixed within the domain. The above expression simplifies to:
[0178] Q×A=C.
[0179] Therefore, the problem is transformed into finding the corresponding A given C and Q. i In other words, this is a typical problem of solving a system of linear equations. For the above representation, multiplying both sides by Q...T ,have:
[0180] Q T QA = Q T C;
[0181] Among them, Q T Let Q be the transpose of matrix Q. T The result of Q is the pairwise square matrix. Therefore, solving for matrix A transforms into:
[0182] A = inv(Q) T Q)·Q T C.
[0183] Where inv(..) is the MATLAB matrix inverse function, if Q T If matrix Q is invertible, the result is the inverse matrix; if the matrix is not invertible, the result is the least squares result. Let W = inv(Q) T Q)·Q T The expression for converting the mapping curve C back to LPF is as follows:
[0184] LPF = W × C.
[0185] Since the transformation matrix W does not change over time, it can be calculated in advance and applied by looking up a table in practical applications. This completes the process. After completing the basic filtering, we will then proceed with spatial guided filtering.
[0186] As can be seen, this optional embodiment can adjust the cumulative probability distribution function corresponding to the first sub-image block based on the average texture parameter value corresponding to the second sub-image block, and then calculate the brightness difference function before and after the first mapping corresponding to the first sub-image block based on the obtained first adjusted function corresponding to the first sub-image block, thereby adjusting its brightness mapping to obtain the restricted post-mapping function corresponding to the first sub-image block, so as to fit the basic filtered average brightness function corresponding to the first sub-image block. In this way, the local texture features of the image can be dynamically responded to during the filtering process, reducing the loss of details or over-smoothing caused by traditional global filtering, thereby improving the detail preservation ability of complex texture areas; at the same time, it can also effectively maintain the consistency of the overall brightness distribution of the image, significantly improving visual comfort.
[0187] In another optional embodiment, a spatial guided filtering operation is performed on the basic filtered brightness averaging function to obtain the target filtered function corresponding to the first sub-image block, including:
[0188] Based on the preset window parameters of the target window and the average brightness function after basic filtering, calculate the average brightness function within the window of the first sub-image block within the target window and the other first sub-image blocks.
[0189] Based on the average brightness function after basic filtering and the average brightness function within the window, calculate the brightness variance parameter corresponding to the first sub-image block, and determine the brightness weighting coefficient corresponding to the first sub-image block based on the brightness variance parameter and the preset filtering coefficient.
[0190] The target filtered function corresponding to the first sub-image block is determined based on the brightness weighting coefficient, the basic filtered average brightness function, and the window-inclusive average brightness function.
[0191] In this optional embodiment, it can be understood as traversing the current first sub-image block and its surrounding H*L first sub-image blocks to implement filtering operations on multiple first sub-image blocks.
[0192] The average brightness function within the window is:
[0193]
[0194] H is the first side length parameter in the window parameters, L is the second side length parameter in the window parameters, h is the index parameter of the first side length of the window corresponding to the first sub-image block, and l is the index parameter of the second side length of the window corresponding to the first sub-image block. This is the basic filtered brightness averaging function corresponding to the first sub-image block.
[0195] And, the brightness variance parameter corresponding to the first sub-image block is:
[0196]
[0197] And, the brightness weighting coefficient corresponding to the first sub-image block is:
[0198]
[0199] Where δ is the filtering coefficient, the larger the value of δ, the stronger the filtering effect.
[0200] And, the target filtered function corresponding to the first sub-image block is:
[0201]
[0202] Furthermore, if the original image is a video frame image and the timing is not allowed, since the differences between frames in the video image are relatively small, this... It can also serve as the image of the next video frame.
[0203] As can be seen, this optional embodiment can adaptively adjust the filtering intensity based on the brightness distribution characteristics of local image regions by calculating the average brightness function within the target window. This allows the filtered function to more accurately match the brightness distribution characteristics of the original image, effectively avoiding the detail blurring problem caused by global filtering and enhancing the local contrast and edge details of the image. Simultaneously, through the linked calculation of the brightness variance parameter and the filtering coefficients, differentiated processing of different brightness distribution regions in the image is achieved. For example, a stronger smoothing filter is used in high-brightness variance regions to suppress noise, while the filtering intensity is reduced in low-variance regions to preserve detail and texture, thus achieving a dynamic balance between noise reduction and detail preservation. Furthermore, the computational process of this invention has low complexity, which helps ensure the real-time performance of image contrast enhancement.
[0204] In another optional embodiment, step 104 above, which involves performing a brightness mapping operation on the image block using the target filtered function corresponding to the first sub-image block to obtain the mapped image block, includes:
[0205] Based on the target filtered function corresponding to the first sub-image block, the multi-order target transformation function of the brightness value of each first pixel in the first sub-image block, and the low-frequency brightness component of each first pixel obtained in advance, calculate the initial brightness mapping value corresponding to each first pixel;
[0206] For each first pixel in the first sub-image block, the mixed brightness mapping value corresponding to the first pixel is calculated based on the initial brightness mapping value, low-frequency brightness component and preset intensity coefficient. The target brightness mapping value corresponding to the first pixel is calculated based on the mixed brightness mapping value corresponding to the first pixel, the residual value of the corresponding target second pixel and preset detail magnification coefficient.
[0207] Based on the target brightness mapping values corresponding to all first pixels in the first sub-image block, a brightness mapping operation is performed on the image block to obtain the mapped image block.
[0208] In this optional embodiment, the target second pixel is a second pixel contained in the second sub-image block of the image block that has the same pixel coordinates as the first pixel.
[0209] Furthermore, for each first pixel in the first sub-image block, the initial brightness mapping value corresponding to the first pixel is:
[0210]
[0211] I represents the low-frequency luminance component corresponding to the first pixel.
[0212] And, the blended luminance mapping value corresponding to the first pixel is:
[0213] I fus =(1-γ)*I eq +γ*I;
[0214] γ is the intensity coefficient.
[0215] And, the target brightness mapping value corresponding to the first pixel is:
[0216] I out =I fus +acc*LP;
[0217] acc is the detail magnification factor, and LP is the residual value of the second pixel of the target.
[0218] It should be noted that γ is an externally configured intensity coefficient that takes different values depending on the input low-frequency luminance (i.e., the low-frequency luminance component of the corresponding first pixel). This is achieved by combining the full equalization result I. eq To perform brightness intensity mixing output, obtain I fus This can effectively reduce over-enhancement of images. Furthermore, by using the accuracy (acc) detail magnification factor, image details can be appropriately reduced or enhanced.
[0219] As can be seen, this optional embodiment can further balance the global and local brightness mapping intensity of the image by using the target filtering function corresponding to the first sub-image block, the multi-order target transformation function of the pixel brightness value, the low-frequency brightness component of the pixel, and the introduced intensity coefficient, so as to ensure that the brightness transition of the image is natural and the layers are distinct. In addition, by further utilizing the residual value and detail magnification coefficient of the target second pixel, the image texture information can be enhanced in a targeted manner, so that the image still maintains sharpness after the brightness is improved, thus improving the visual effect of the image.
[0220] Example 2
[0221] Please see Figure 2 , Figure 2 This is a schematic flowchart of another image local dynamic contrast enhancement method disclosed in an embodiment of the present invention. Figure 2 The described image local dynamic contrast enhancement method can be applied to various digital images for local dynamic contrast enhancement, such as photographs, video frames, medical images, remote sensing images, scanned images, computer graphics, etc., and this invention does not limit the scope of the application. Optionally, this method can be implemented by an image contrast enhancement device, which can be integrated into an image processing device, such as a smart computer, smartphone, tablet, camera device, dashcam, etc., or it can be a local server or cloud server used to process the image local dynamic contrast enhancement process, and this invention does not limit the scope of the application. Figure 2 As shown, the image local dynamic contrast enhancement method may include the following operations:
[0222] 201. Perform a brightness layering operation on the original image to be enhanced to obtain a layered image; the layered image includes a base layer image and a residual layer image.
[0223] 202. Perform a block operation on the layered image to obtain multiple image blocks corresponding to the layered image; each image block includes a first sub-image block corresponding to the base layer image and a second sub-image block corresponding to the residual layer image.
[0224] 203. For each image block, determine the initial brightness average function corresponding to the first sub-image block and the average texture parameter corresponding to the second sub-image block in the image block. Then, use the average texture parameter corresponding to the second sub-image block to perform a target filtering operation on the initial brightness average function corresponding to the first sub-image block to obtain the target filtered function corresponding to the first sub-image block.
[0225] 204. For each image block, the image block is subjected to a brightness mapping operation through the target filtering function corresponding to the first sub-image block to obtain the mapped image block.
[0226] 205. For each image block, calculate the first saturation parameter of the image block and the second saturation parameter of the mapped image block, and calculate the saturation compensation gain parameter corresponding to the mapped image block based on the first saturation parameter, the second saturation parameter and the preset saturation enhancement coefficient.
[0227] In this embodiment of the invention, the saturation compensation gain parameter corresponding to the mapped image block is:
[0228]
[0229] ACC satu S is the saturation enhancement factor (which controls the color representation of an image). bf S is the first saturation parameter. af This is the second saturation parameter.
[0230] Furthermore, S bf With S af Both can be achieved through image segmentation and the RGB space conversion process of the mapped image segments, as well as the saturation calculation formula: This can be calculated.
[0231] It should also be noted that if the original image is a grayscale image, steps 205-209 are not required (i.e., no saturation processing is needed), and the contrast-enhanced image corresponding to the original image can be determined directly based on the blocks of all the mapped images after stitching; if the original image is a color image, steps 205-209 need to be performed.
[0232] 206. For each image block, determine the maximum blue difference compensation gain parameter corresponding to the mapped image block based on the blue difference chromaticity component parameters of the image block, and determine the maximum red difference compensation gain parameter corresponding to the mapped image block based on the red difference chromaticity component parameters of the image block.
[0233] In this embodiment of the invention, it should be noted that, in order to prevent the UV values after saturation enhancement from exceeding the limit (out of the bit width range), the saturation gain needs to be limited. Taking the V component of an image block as an example, the maximum red difference compensation gain parameter v_gain needs to satisfy the following constraint: 0≤V*v_gain+0.5≤1, that is... (V Red Difference Chromaticity Component Parameter), also known as the maximum red difference compensation gain parameter v_gain, takes the value of Similarly, the value of the maximum blue difference compensation gain parameter u_gain can be obtained.
[0234] 207. For each image block, determine the compensation gain limit parameter corresponding to the mapped image block based on the saturation compensation gain parameter, the maximum blue difference compensation gain parameter, and the maximum red difference compensation gain parameter. Also, determine the target blue difference compensation gain parameter and the target red difference compensation gain parameter corresponding to the mapped image block based on the compensation gain limit parameter, the blue difference chromaticity component parameter, and the red difference chromaticity component parameter.
[0235] In this embodiment of the invention, the compensation gain limiting parameter corresponding to the mapped image block is:
[0236] gain=Min(uv_gain, u_gain, v_gain);
[0237] u_gain is the maximum blue difference compensation gain parameter, and v_gain is the maximum red difference compensation gain parameter.
[0238] Furthermore, the target blue difference compensation gain parameters and target red difference compensation gain parameters corresponding to the mapped image blocks are as follows:
[0239] Uˋ=U*gain, Vˋ=V*gain;
[0240] U represents the blue chromaticity component parameter, and V represents the red chromaticity component parameter.
[0241] 208. For each image block, perform saturation processing on the mapped image block according to the target blue difference compensation gain parameter and the target red difference compensation gain parameter to obtain the target image block.
[0242] In this embodiment of the invention, it should be noted that the YUV color space has a shape that is narrow at both ends and wide in the middle. Therefore, the saturation space range varies considerably under different brightness levels. Furthermore, after local contrast enhancement, the brightness changes, and the original saturation also changes accordingly. Therefore, it is necessary to perform saturation compensation or enhancement based on the difference between the output brightness and the input brightness to maintain good image color performance.
[0243] 209. Based on the segmentation of all target images, determine the contrast-enhanced image corresponding to the original image.
[0244] In this embodiment of the invention, for other descriptions of steps 201-204 and 209, please refer to the detailed description of steps 101-105 in Embodiment 1. This embodiment of the invention will not repeat them.
[0245] As can be seen, implementing the embodiments of the present invention can compensate or enhance saturation by the difference between the output brightness and the input brightness of image blocks, which can maintain good color performance of image blocks, making the image effect of the final contrast-enhanced image more natural, reducing the situation where saturation changes unsuitably with brightness, thereby helping to further improve the visual effect of the contrast-enhanced image.
[0246] Example 3
[0247] Please see Figure 3 , Figure 3 This is a schematic diagram of the structure of an image local dynamic contrast enhancement device disclosed in an embodiment of the present invention. Figure 3 As shown, the image local dynamic contrast enhancement device may include:
[0248] The layering module 301 is used to perform brightness layering operations on the original image to be enhanced, so as to obtain a layered image; the layered image includes a base layer image and a residual layer image.
[0249] The segmentation module 302 is used to perform segmentation operations on the layered image to obtain multiple image blocks corresponding to the layered image; each image block includes a first sub-image block corresponding to the base layer image and a second sub-image block corresponding to the residual layer image.
[0250] The filtering module 303 is used to determine the initial brightness average function corresponding to the first sub-image block and the average texture parameter corresponding to the second sub-image block for each image block, and to perform a target filtering operation on the initial brightness average function corresponding to the first sub-image block through the average texture parameter corresponding to the second sub-image block to obtain the target filtered function corresponding to the first sub-image block.
[0251] The post-processing module 304 is used to perform a brightness mapping operation on each image block through the target filtering function corresponding to the first sub-image block to obtain the mapped image block, and to perform a saturation processing operation on the mapped image block to obtain the target image block.
[0252] The determination module 305 is used to determine the contrast-enhanced image corresponding to the original image based on the blocks of all target images.
[0253] It is evident that implementation Figure 3 The described image local dynamic contrast enhancement device can achieve the local dynamic contrast enhancement process of the image by performing brightness layering, block division, filtering and post-processing of the initial brightness averaging function on the original image. While preserving image details, it improves the image contrast enhancement effect, making the image appear natural, with low noise and excellent color performance, and also reduces the computational complexity.
[0254] In an optional embodiment, the filtering module 303 determines the initial brightness averaging function corresponding to the first sub-image block in the image block in the following specific ways:
[0255] For each first pixel contained in the first sub-image block in the image block, a multi-order orthogonal transformation function of the brightness value is determined based on the brightness value of the first pixel, and a multi-order average orthogonal transformation function of the brightness value is determined based on the multi-order orthogonal transformation function of the brightness value.
[0256] The multi-order average orthogonal transformation function of the brightness values of all first pixels is determined as the initial brightness averaging function corresponding to the first sub-image block in the image block.
[0257] In this optional embodiment, for each first pixel contained in the first sub-image block, the multi-order orthogonal transformation function of the brightness value of the first pixel is:
[0258]
[0259] I b Let be the brightness value of the first pixel, K be a preset normalization constant, and i be the target order index parameter of the brightness value of the first pixel, where i ranges from [0, N] and N is the preset fitting order of the maximum orthogonal basis polynomial.
[0260] And, the average texture parameters corresponding to the second sub-image block are;
[0261]
[0262] T Ω Let Ω be the total number of pixels in the second sub-image block, and LP(x,y) be the residual value of the second pixel with pixel coordinates (x,y) in the second sub-image block.
[0263] It is evident that implementation Figure 3 The described image local dynamic contrast enhancement device can determine the initial brightness averaging function corresponding to the first sub-image block in each image block by determining the multi-order orthogonal transformation function of the brightness value of each first pixel contained in the first sub-image block. In this way, the reliability and accuracy of the analysis of the brightness information of the image block are improved, which in turn helps to improve the reliability and accuracy of the subsequent filtering of the initial brightness averaging function of the image block, thereby improving the contrast enhancement effect of the image block.
[0264] In another optional embodiment, the filtering module 303 performs a target filtering operation on the initial brightness averaging function corresponding to the first sub-image block using the average texture parameters corresponding to the second sub-image block, specifically obtaining the target filtered function corresponding to the first sub-image block in the following ways:
[0265] For each first pixel contained in the first sub-image block, an indefinite integral operation is performed on the multi-order orthogonal transformation function of the brightness value according to the multi-order orthogonal transformation function of the brightness value of the first pixel to obtain the multi-order target transformation function of the brightness value.
[0266] Based on the multi-order target transformation function of the brightness values of all first pixels in the first sub-image block, and the initial brightness averaging function corresponding to the first sub-image block, determine the cumulative probability distribution function corresponding to the first sub-image block;
[0267] Using the average texture parameters and cumulative probability distribution function corresponding to the second sub-image block, a basic filtering operation is performed on the initial brightness average function corresponding to the first sub-image block to obtain the basic filtered brightness average function corresponding to the first sub-image block. Then, a spatial domain guided filtering operation is performed on the basic filtered brightness average function to obtain the target filtered function corresponding to the first sub-image block.
[0268] In this optional embodiment, the multi-order target transformation function for the brightness value is:
[0269]
[0270] And, the cumulative probability distribution function corresponding to the first sub-image block is:
[0271]
[0272] Let M be the initial brightness averaging function corresponding to the first sub-image block, and M be the maximum brightness value under the bit width corresponding to the first sub-image block.
[0273] It is evident that implementation Figure 3The described image local dynamic contrast enhancement device can determine the cumulative probability distribution function corresponding to the first sub-image block through a multi-order orthogonal transformation function of the brightness values of all first pixels contained in the first sub-image block. Then, it performs a target filtering operation on the initial brightness average function corresponding to the first sub-image block through the average texture parameter corresponding to the second sub-image block and the cumulative probability distribution function. In this way, the reliability and accuracy of filtering the initial brightness average function corresponding to the first sub-image block are improved, which helps to preserve the texture information of the image block and makes the details of the image block clearly displayed.
[0274] In another optional embodiment, the filtering module 303 performs a basic filtering operation on the initial brightness average function corresponding to the first sub-image block using the average texture parameter and cumulative probability distribution function corresponding to the second sub-image block, specifically obtaining the basic filtered brightness average function corresponding to the first sub-image block in the following ways:
[0275] Based on the average texture parameter value corresponding to the second sub-image block, the cumulative probability distribution function corresponding to the first sub-image block is adjusted by curve texture adjustment to obtain the first adjusted function corresponding to the first sub-image block;
[0276] Based on the first adjusted function, determine the approximate histogram distribution function corresponding to the first sub-image block, and calculate the brightness difference function before and after the first mapping corresponding to the first sub-image block based on the first adjusted function and the approximate histogram distribution function.
[0277] Based on the brightness difference function before and after the first mapping, the brightness guidance function corresponding to the first sub-image block is determined, and based on the brightness guidance function and the first adjusted function, the brightness difference function before and after the second mapping is determined for the first sub-image block.
[0278] Based on the brightness difference function before and after the first mapping and the brightness difference function before and after the second mapping, the mapping mixing coefficients corresponding to the first sub-image block are determined, and based on the mapping mixing coefficients, the brightness guiding function and the first adjusted function, the brightness mixing mapping function corresponding to the first sub-image block is determined.
[0279] Based on the preset curve restriction area, the brightness mixing mapping function is range-limited to obtain the restricted post-mapping function corresponding to the first sub-image block. Then, the basic filtered brightness averaging function corresponding to the first sub-image block is fitted by the restricted post-mapping function and the multi-order target transformation function of the brightness values of all first pixels in the first sub-image block.
[0280] In this optional embodiment, the first adjusted function corresponding to the first sub-image block is:
[0281] C′(I b)=stLp*C(I b )+(1-stLp)I b ;
[0282] The approximate histogram distribution function corresponding to the first sub-image block is:
[0283] H(I b )=C′(I b +1)-C′(I b );
[0284] The brightness difference function before and after the first mapping corresponding to the first sub-image block is:
[0285]
[0286] The brightness guidance function corresponding to the first sub-image block is:
[0287]
[0288] The brightness difference function before and after the second mapping corresponding to the first sub-image block is:
[0289]
[0290] The mapping mixing coefficients corresponding to the first sub-image block are:
[0291]
[0292] The brightness blending mapping function corresponding to the first sub-image block is:
[0293] C″(I b )=α*C′(I b )+(1-α)G(I b ).
[0294] It is evident that implementation Figure 3 The described image local dynamic contrast enhancement device can adjust the cumulative probability distribution function of the first sub-image block according to the average texture parameter of the second sub-image block. Then, based on the obtained first adjusted function of the first sub-image block, it calculates the brightness difference function before and after the first mapping of the first sub-image block, thereby adjusting its brightness mapping to obtain the restricted post-mapping function of the first sub-image block. This allows for fitting the basic filtered average brightness function of the first sub-image block. In this way, it can dynamically respond to the local texture features of the image during the filtering process, reducing the loss of details or over-smoothing caused by traditional global filtering, thereby improving the detail preservation ability of complex texture areas. At the same time, it can also effectively maintain the consistency of the overall brightness distribution of the image, significantly improving visual comfort.
[0295] In another optional embodiment, the filtering module 303 performs a spatial domain guided filtering operation on the basic filtered brightness averaging function to obtain the target filtered function corresponding to the first sub-image block. Specifically, this includes:
[0296] Based on the preset window parameters of the target window and the average brightness function after basic filtering, calculate the average brightness function within the window of the first sub-image block within the target window and the other first sub-image blocks.
[0297] Based on the average brightness function after basic filtering and the average brightness function within the window, calculate the brightness variance parameter corresponding to the first sub-image block, and determine the brightness weighting coefficient corresponding to the first sub-image block based on the brightness variance parameter and the preset filtering coefficient.
[0298] The target filtered function corresponding to the first sub-image block is determined based on the brightness weighting coefficient, the basic filtered average brightness function, and the window-inclusive average brightness function.
[0299] In this optional embodiment, the average brightness function within the window is:
[0300]
[0301] H is the first side length parameter in the window parameters, L is the second side length parameter in the window parameters, h is the index parameter of the first side length of the window corresponding to the first sub-image block, and l is the index parameter of the second side length of the window corresponding to the first sub-image block. The basic filtered brightness averaging function corresponding to the first sub-image block;
[0302] And, the brightness variance parameter corresponding to the first sub-image block is:
[0303]
[0304] The brightness weighting coefficient corresponding to the first sub-image block is:
[0305]
[0306] Where δ is the filter coefficient;
[0307] The target filtered function corresponding to the first sub-image block is:
[0308]
[0309] It is evident that implementation Figure 3The described image local dynamic contrast enhancement device can adaptively adjust the filtering intensity based on the brightness distribution characteristics of local image regions by calculating the average brightness function within the target window. This allows the filtered function to more accurately match the brightness distribution characteristics of the original image, effectively avoiding detail blurring caused by global filtering and enhancing local contrast and edge details. Simultaneously, through the linked calculation of the brightness variance parameter and the filtering coefficients, differentiated processing is achieved for different brightness distribution regions in the image. For example, a stronger smoothing filter is used in high-brightness variance regions to suppress noise, while the filtering intensity is reduced in low-variance regions to preserve detail and texture, thus achieving a dynamic balance between noise reduction and detail preservation. Furthermore, the computational process of this invention is low in complexity, which helps ensure the real-time performance of image contrast enhancement.
[0310] In another optional embodiment, the post-processing module 304 performs a brightness mapping operation on the image block using the target filtered function corresponding to the first sub-image block, and the method for obtaining the mapped image block specifically includes:
[0311] Based on the target filtered function corresponding to the first sub-image block, the multi-order target transformation function of the brightness value of each first pixel in the first sub-image block, and the low-frequency brightness component of each first pixel obtained in advance, calculate the initial brightness mapping value corresponding to each first pixel;
[0312] For each first pixel in the first sub-image block, the mixed brightness mapping value corresponding to the first pixel is calculated based on the initial brightness mapping value, low-frequency brightness component and preset intensity coefficient. The target brightness mapping value corresponding to the first pixel is calculated based on the mixed brightness mapping value corresponding to the first pixel, the residual value of the corresponding target second pixel and preset detail magnification coefficient.
[0313] Based on the target brightness mapping values corresponding to all first pixels in the first sub-image block, a brightness mapping operation is performed on the image block to obtain the mapped image block.
[0314] In this optional embodiment, the target second pixel is a second pixel contained in the second sub-image block of the image block that has the same pixel coordinates as the first pixel.
[0315] Wherein, for each first pixel in the first sub-image block, the initial brightness mapping value corresponding to the first pixel is:
[0316]
[0317] I represents the low-frequency luminance component corresponding to the first pixel;
[0318] And, the blended luminance mapping value corresponding to the first pixel is:
[0319] I fus =(1-γ)*I eq +γ*I;
[0320] γ is the strength coefficient;
[0321] And, the target brightness mapping value corresponding to the first pixel is:
[0322] I out =I fus +acc*LP;
[0323] acc is the detail magnification factor, and LP is the residual value of the second pixel of the target.
[0324] It is evident that implementation Figure 3 The described image local dynamic contrast enhancement device can further balance the brightness mapping intensity of the global and local images by using the target filtering function corresponding to the first sub-image block, the multi-order target transformation function of the pixel brightness value, the low-frequency brightness component of the pixel, and the introduced intensity coefficient, so as to ensure that the brightness transition of the image is natural and the layers are distinct. In addition, by further utilizing the residual value and detail magnification coefficient of the target second pixel, the image texture information can be enhanced in a targeted manner, so that the image still maintains sharpness after the brightness is enhanced, thus improving the visual effect of the image.
[0325] In another optional embodiment, the post-processing module 304 performs saturation processing on the mapped image blocks to obtain the target image blocks in the following specific ways:
[0326] Calculate the first saturation parameter of the image block and the second saturation parameter of the mapped image block, and calculate the saturation compensation gain parameter corresponding to the mapped image block based on the first saturation parameter, the second saturation parameter and the preset saturation enhancement coefficient.
[0327] Based on the blue difference chromaticity component parameters of the image blocks, determine the maximum blue difference compensation gain parameter corresponding to the mapped image blocks, and based on the red difference chromaticity component parameters of the image blocks, determine the maximum red difference compensation gain parameter corresponding to the mapped image blocks.
[0328] Based on the saturation compensation gain parameter, the maximum blue difference compensation gain parameter, and the maximum red difference compensation gain parameter, determine the compensation gain limit parameter corresponding to the mapped image block, and based on the compensation gain limit parameter, the blue difference chromaticity component parameter, and the red difference chromaticity component parameter, determine the target blue difference compensation gain parameter and the target red difference compensation gain parameter corresponding to the mapped image block.
[0329] Based on the target blue difference compensation gain parameters and the target red difference compensation gain parameters, saturation processing is performed on the mapped image blocks to obtain the target image blocks.
[0330] In this optional embodiment, the saturation compensation gain parameter corresponding to the mapped image block is:
[0331]
[0332] ACC satu S is the saturation enhancement coefficient. bf S is the first saturation parameter. af This is the second saturation parameter;
[0333] And, the compensation gain limiting parameters corresponding to the mapped image blocks are:
[0334] gain=Min(uv_gain, u_gain, v_gain);
[0335] u_gain is the maximum blue difference compensation gain parameter, and v_gain is the maximum red difference compensation gain parameter;
[0336] Furthermore, the target blue difference compensation gain parameters and target red difference compensation gain parameters corresponding to the mapped image blocks are as follows:
[0337] U` = U*gain, V` = V*gain;
[0338] U represents the blue chromaticity component parameter, and V represents the red chromaticity component parameter.
[0339] It is evident that implementation Figure 3 The described image local dynamic contrast enhancement device can compensate or enhance saturation by the difference between the output brightness and the input brightness of image blocks. It can maintain good color performance of image blocks, making the final contrast-enhanced image more natural and reducing the situation where saturation changes unsuitably with brightness, thereby helping to further improve the visual effect of the contrast-enhanced image.
[0340] Example 4
[0341] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of another image local dynamic contrast enhancement device disclosed in an embodiment of the present invention. For example... Figure 4 As shown, the image local dynamic contrast enhancement device may include:
[0342] Memory 401 storing executable program code;
[0343] Processor 402 coupled to memory 401;
[0344] The processor 402 calls the executable program code stored in the memory 401 to execute the steps in the image local dynamic contrast enhancement method described in Embodiment 1 or Embodiment 2 of the present invention.
[0345] Example 5
[0346] This invention discloses a computer storage medium storing computer instructions. When these computer instructions are invoked, they are used to execute the steps in the image local dynamic contrast enhancement method described in Embodiment 1 or Embodiment 2 of this invention.
[0347] Example 6
[0348] This invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to perform the steps in the image local dynamic contrast enhancement method described in Embodiment 1 or Embodiment 2.
[0349] The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0350] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part 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, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-Erasable Programmable Read-Only Memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0351] Finally, it should be noted that the image local dynamic contrast enhancement method and apparatus disclosed in the embodiments of the present invention are merely preferred embodiments of the present invention, and are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for enhancing the local dynamic contrast of an image, characterized in that, The method includes: A brightness layering operation is performed on the original image to be enhanced to obtain a layered image; the layered image includes a base layer image and a residual layer image. The layered image is divided into blocks to obtain multiple image blocks corresponding to the layered image; each image block includes a first sub-image block corresponding to the base layer image and a second sub-image block corresponding to the residual layer image; For each image block, the initial brightness average function corresponding to the first sub-image block and the average texture parameter corresponding to the second sub-image block are determined. The initial brightness average function corresponding to the first sub-image block is then subjected to target filtering operation using the average texture parameter corresponding to the second sub-image block to obtain the target filtered function corresponding to the first sub-image block. For each image block, a brightness mapping operation is performed on the image block using the target filtered function corresponding to the first sub-image block to obtain a mapped image block, and a saturation processing operation is performed on the mapped image block to obtain a target image block. Based on all the target image blocks, determine the contrast-enhanced image corresponding to the original image.
2. The image local dynamic contrast enhancement method according to claim 1, characterized in that, Determining the initial brightness averaging function corresponding to the first sub-image block in the image block includes: For each first pixel contained in the first sub-image block in the image block, a multi-order orthogonal transformation function of the brightness value is determined based on the brightness value of the first pixel, and a multi-order average orthogonal transformation function of the brightness value is determined based on the multi-order orthogonal transformation function of the brightness value. The multi-order average orthogonal transformation function of all the brightness values of the first pixel is determined as the initial brightness average function corresponding to the first sub-image block in the image block; Wherein, for each of the first pixels contained in the first sub-image block, the multi-order orthogonal transformation function of the brightness value of the first pixel is: I b Let be the brightness value of the first pixel, K be a preset normalization constant, and i be the target order index parameter of the brightness value of the first pixel, where i ranges from [0, N] and N is the preset fitting order of the maximum orthogonal basis polynomial. And, the average texture parameter value corresponding to the second sub-image block is; T Ω Let Ω be the total number of pixels in the second sub-image block, and LP(x,y) be the residual value of the second pixel with pixel coordinates (x,y) in the second sub-image block.
3. The image local dynamic contrast enhancement method according to claim 2, characterized in that, The step of performing a target filtering operation on the initial brightness averaging function corresponding to the first sub-image block using the average texture parameters corresponding to the second sub-image block to obtain the target filtered function corresponding to the first sub-image block includes: For each first pixel contained in the first sub-image block, an indefinite integral operation is performed on the multi-order orthogonal transformation function of the brightness value according to the multi-order orthogonal transformation function of the brightness value of the first pixel to obtain the multi-order target transformation function of the brightness value. Based on the multi-order target transformation function of the brightness values of all first pixels in the first sub-image block and the initial brightness averaging function corresponding to the first sub-image block, the cumulative probability distribution function corresponding to the first sub-image block is determined. Using the average texture parameter value corresponding to the second sub-image block and the cumulative probability distribution function, a basic filtering operation is performed on the initial brightness average function corresponding to the first sub-image block to obtain the basic filtered brightness average function corresponding to the first sub-image block. Then, a spatial domain guided filtering operation is performed on the basic filtered brightness average function to obtain the target filtered function corresponding to the first sub-image block. The multi-order target transformation function for the brightness value is: And, the cumulative probability distribution function corresponding to the first sub-image block is: Let M be the initial brightness averaging function corresponding to the first sub-image block, and M be the maximum brightness value under the bit width corresponding to the first sub-image block.
4. The image local dynamic contrast enhancement method according to claim 3, characterized in that, The step of performing a basic filtering operation on the initial brightness average function corresponding to the first sub-image block using the average texture parameter value corresponding to the second sub-image block and the cumulative probability distribution function to obtain the basic filtered brightness average function corresponding to the first sub-image block includes: Based on the average texture parameter value corresponding to the second sub-image block, the cumulative probability distribution function corresponding to the first sub-image block is subjected to curve texture adjustment to obtain the first adjusted function corresponding to the first sub-image block; Based on the first adjusted function, determine the approximate histogram distribution function corresponding to the first sub-image block, and calculate the brightness difference function before and after the first mapping corresponding to the first sub-image block based on the first adjusted function and the approximate histogram distribution function. Based on the brightness difference function before and after the first mapping, determine the brightness guidance function corresponding to the first sub-image block, and based on the brightness guidance function and the first adjusted function, determine the second brightness difference function before and after mapping corresponding to the first sub-image block. Based on the first and second mapping brightness difference functions, the mapping blending coefficients corresponding to the first sub-image block are determined, and based on the mapping blending coefficients, the brightness guiding function, and the first adjusted function, the brightness blending mapping function corresponding to the first sub-image block is determined. According to the preset curve restriction area, the brightness mixing mapping function is restricted by the interval amplitude to obtain the restricted post-mapping function corresponding to the first sub-image block. Then, the basic filtered brightness average function corresponding to the first sub-image block is fitted by the restricted post-mapping function and the multi-order target transformation function of the brightness values of all the first pixels in the first sub-image block. The first adjusted function corresponding to the first sub-image block is: C′(I b )=stLp*C(I b )+(1-stLp)I b ; The approximate histogram distribution function corresponding to the first sub-image block is: H(I b )=C′(I b +1)-C′(I b ); The brightness difference function before and after the first mapping corresponding to the first sub-image block is: The brightness guidance function corresponding to the first sub-image block is: The brightness difference function before and after the second mapping corresponding to the first sub-image block is: The mapping mixing coefficients corresponding to the first sub-image block are: The brightness blending mapping function corresponding to the first sub-image block is: C″(I b )=α*C′(I b )+(1-α)G(I b )。 5. The image local dynamic contrast enhancement method according to claim 3, characterized in that, The step of performing spatial guided filtering on the basic filtered brightness averaging function to obtain the target filtered function corresponding to the first sub-image block includes: Based on the preset window parameters of the target window and the basic filtered brightness average function, calculate the window brightness average function corresponding to the first sub-image block within the target window and other first sub-image blocks. Based on the basic filtered brightness average function and the window brightness average function, calculate the brightness variance parameter corresponding to the first sub-image block, and determine the brightness weighting coefficient corresponding to the first sub-image block based on the brightness variance parameter and the preset filtering coefficient. The target filtered function corresponding to the first sub-image block is determined based on the brightness weighting coefficient, the basic filtered brightness average function, and the window-in-window brightness average function. The average brightness function within the window is: H is the first side length parameter in the window parameters, L is the second side length parameter in the window parameters, h is the first side length index parameter of the window corresponding to the first sub-image block, and l is the second side length index parameter of the window corresponding to the first sub-image block. The basic filtered brightness averaging function corresponding to the first sub-image block; And, the brightness variance parameter corresponding to the first sub-image block is: The brightness weighting coefficient corresponding to the first sub-image block is: Wherein, δ is the filtering coefficient; The target filtered function corresponding to the first sub-image block is:
6. The image local dynamic contrast enhancement method according to claim 5, characterized in that, The step of performing a brightness mapping operation on the image block using the target filtered function corresponding to the first sub-image block to obtain the mapped image block includes: Based on the target filtered function corresponding to the first sub-image block, the multi-order target transformation function of the brightness value of each first pixel in the first sub-image block, and the low-frequency brightness component of each first pixel obtained in advance, calculate the initial brightness mapping value corresponding to each first pixel. For each first pixel in the first sub-image block, the mixed brightness mapping value corresponding to the first pixel is calculated based on the initial brightness mapping value, low-frequency brightness component, and preset intensity coefficient. Then, the target brightness mapping value corresponding to the first pixel is calculated based on the mixed brightness mapping value, the residual value of the corresponding target second pixel, and a preset detail magnification factor. The target second pixel is the second pixel in the second sub-image block of the image block that has the same pixel coordinates as the first pixel. Based on the target brightness mapping value corresponding to all the first pixels in the first sub-image block, a brightness mapping operation is performed on the image block to obtain the mapped image block. Wherein, for each first pixel in the first sub-image block, the initial brightness mapping value corresponding to the first pixel is: I represents the low-frequency luminance component corresponding to the first pixel; And, the blended brightness mapping value corresponding to the first pixel is: I fus =(1-γ)*I eq +γ*I; γ is the intensity coefficient; And, the target brightness mapping value corresponding to the first pixel is: I out =I fus +acc*LP; acc is the detail magnification factor, and LP is the residual value of the second pixel of the target.
7. The image local dynamic contrast enhancement method according to any one of claims 1-6, characterized in that, The step of performing saturation processing on the mapped image blocks to obtain target image blocks includes: Calculate the first saturation parameter of the image block and the second saturation parameter of the mapped image block, and calculate the saturation compensation gain parameter corresponding to the mapped image block based on the first saturation parameter, the second saturation parameter and the preset saturation enhancement coefficient. Based on the blue difference chromaticity component parameters of the image block, determine the maximum blue difference compensation gain parameter corresponding to the mapped image block, and based on the red difference chromaticity component parameters of the image block, determine the maximum red difference compensation gain parameter corresponding to the mapped image block. Based on the saturation compensation gain parameter, the maximum blue difference compensation gain parameter, and the maximum red difference compensation gain parameter, the compensation gain limit parameter corresponding to the mapped image block is determined, and based on the compensation gain limit parameter, the blue difference chromaticity component parameter, and the red difference chromaticity component parameter, the target blue difference compensation gain parameter and the target red difference compensation gain parameter corresponding to the mapped image block are determined. Based on the target blue difference compensation gain parameter and the target red difference compensation gain parameter, the saturation processing operation is performed on the mapped image block to obtain the target image block; The saturation compensation gain parameter corresponding to the mapped image block is: ACC satu S is the saturation enhancement coefficient. bf S is the first saturation parameter. af This refers to the second saturation parameter; Furthermore, the compensation gain limiting parameter corresponding to the mapped image block is: gain=Min(uv_gain, u_gain, v_gain); u_gain is the maximum blue difference compensation gain parameter, and v_gain is the maximum red difference compensation gain parameter; Furthermore, the target blue difference compensation gain parameter and the target red difference compensation gain parameter corresponding to the mapped image blocks are respectively: U` = U*gain, V` = V*gain; U is the blue chromaticity component parameter, and V is the red chromaticity component parameter.
8. An image local dynamic contrast enhancement device, characterized in that, The device includes: The layering module is used to perform brightness layering operations on the original image to be enhanced, resulting in a layered image; the layered image includes a base layer image and a residual layer image. The segmentation module is used to perform segmentation operations on the layered image to obtain multiple image blocks corresponding to the layered image; each image block includes a first sub-image block corresponding to the base layer image and a second sub-image block corresponding to the residual layer image; The filtering module is used to determine, for each image block, the initial brightness average function corresponding to the first sub-image block and the average texture parameter corresponding to the second sub-image block in the image block, and to perform a target filtering operation on the initial brightness average function corresponding to the first sub-image block using the average texture parameter corresponding to the second sub-image block to obtain the target filtered function corresponding to the first sub-image block. The post-processing module is used to perform a brightness mapping operation on each image block through the target filtering function corresponding to the first sub-image block to obtain a mapped image block, and to perform a saturation processing operation on the mapped image block to obtain a target image block. The determining module is used to determine the contrast-enhanced image corresponding to the original image based on all the target image blocks.
9. An image local dynamic contrast enhancement device, characterized in that, The device includes: Memory containing executable program code; A processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the image local dynamic contrast enhancement method as described in any one of claims 1-7.
10. A computer storage medium, characterized in that, The computer storage medium stores computer instructions, which, when invoked, are used to execute the image local dynamic contrast enhancement method as described in any one of claims 1-7.
Citation Information
Patent Citations
Global mapping table generation method and device applied to image enhancement
CN115034975A
Low-illumination video enhancement hardware implementation method based on FPGA (Field Programmable Gate Array)
CN115829956A