Image dynamic range compression method and device based on nonlinear mapping, storage medium and computer device
Patent Information
- Application Number
- CN202610426995.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-02
- Publication Date
- 2026-10-09
AI Technical Summary
[0003]但是,目前动态范围压缩方法主要存在的问题是,将图像的高动态范围信息压缩到低动态范围时,容易出现正常曝光区域被损坏、过度曝光区域和欠曝光区域细节丢失以及饱和度下降等问题
[0018]本申请通过在对数域将图像中像素的亮度进行压缩,根据对数域图像中各个像素的像素值分布以及原始图像中各个像素的像素值与其像素均值的关系计算权重因子, 根据权重因子调整亮度压缩结果,以得到目标图像,实现将具有高动态范围的图像或视频帧,映射至低动态范围进行显示,尽可能的保留正常曝光区域对比度,提升欠曝光区域以及过曝光区域的可见性,同时增强了整体饱和度,尽可能的复原场景的真实内容。
Smart Images

Figure CN122887744A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and more specifically to an image dynamic range compression method and apparatus, storage medium, and computer equipment based on nonlinear mapping. Background Technology
[0002] The real-world scene visible to the human eye has a very large dynamic range, but existing image acquisition devices cannot capture all the brightness values of the real scene, and the range of images presented by display devices is even more limited. Currently, image acquisition devices generally use 12 bits to store image pixel values, that is, the pixel range is [0, 4095]. However, image display devices typically use 8 bits to store pixel information, that is, the pixel range of image display devices is [0, 255]. In order to make the acquired image as close as possible to the real scene, it is necessary to implement a mapping from high dynamic range to low dynamic range. This mapping process is called dynamic range compression.
[0003] However, the main problem with current dynamic range compression methods is that when compressing the high dynamic range information of an image to a low dynamic range, issues such as damage to normally exposed areas, loss of detail in overexposed and underexposed areas, and decreased saturation can easily occur. Summary of the Invention
[0004] The technical problem solved by this invention is to provide an image dynamic range compression method to improve the performance of image dynamic range compression and enhance the image display effect.
[0005] To address the aforementioned technical problems, in a first aspect, embodiments of the present invention provide an image dynamic range compression method based on nonlinear mapping. The image dynamic range compression method based on nonlinear mapping includes: acquiring an original image; determining the grayscale image and its logarithmic domain image of the original image; calculating the brightness compression result of each pixel based on the pixel value distribution of each pixel in the logarithmic domain image and the target dynamic range; calculating a weighting factor based on the pixel value distribution of each pixel in the logarithmic domain image and the relationship between the pixel value and the pixel mean of each pixel in the original image; and adjusting the brightness compression result according to the weighting factor to obtain a target image, wherein the target dynamic range of pixel brightness in the target image is lower than the original dynamic range of pixel brightness in the original image.
[0006] Optionally, the step of calculating the brightness compression result based on the pixel value distribution of each pixel in the logarithmic domain image and the target dynamic range includes: calculating at least one pixel statistical value for all pixels in the logarithmic domain image: maximum pixel value, minimum pixel value, and average pixel value; and, under the constraint of the target dynamic range, calculating the brightness compression result of each pixel based on the relationship between the pixel value of each pixel in the logarithmic domain image and the pixel statistical value.
[0007] Optionally, calculating the brightness compression result based on the relationship between the pixel value of each pixel in the logarithmic domain image and the pixel statistical value includes: responding to a pixel value less than or equal to the minimum pixel value, the brightness compression result of the pixel is 0; responding to a pixel value greater than the minimum pixel value and less than or equal to the average pixel value, the brightness compression result of the pixel is the product of a first parameter and a first difference value, where the first difference value is the ratio of a first difference between the pixel value and the minimum pixel value to a second difference between the average pixel value and the minimum pixel value; responding to a pixel value greater than the average pixel value and less than or equal to the maximum pixel value, the brightness compression result of the pixel is the sum of the products of the first parameter and the second parameter and a second difference value, where the second difference value is the ratio of a third difference between the pixel value and the average pixel value to a fourth difference between the average pixel value and the maximum pixel value; responding to a pixel value greater than the maximum pixel value, the brightness compression result of the pixel is the sum of the first parameter and the second parameter, where the first parameter and the second parameter are set based on the target dynamic range.
[0008] Optionally, the step of calculating the weighting factor based on the pixel value distribution of each pixel in the logarithmic domain image and the relationship between the pixel value of each pixel in the original image and its pixel mean includes: calculating a first factor based on the relationship between the pixel value of each pixel in the original image and its pixel mean; calculating a second factor based on the pixel value distribution of each pixel in the logarithmic domain image; and calculating the weighting factor with the first factor as the base and the second factor as the exponent.
[0009] Optionally, the step of calculating the second factor based on the pixel value distribution of each pixel in the logarithmic domain image includes: calculating at least one pixel statistical value for all pixels in the logarithmic domain image: maximum pixel value, minimum pixel value, and average pixel value; and calculating the second factor for each pixel based on the relationship between the pixel value of each pixel in the logarithmic domain image and the pixel statistical value.
[0010] Optionally, calculating the second factor for each pixel based on the relationship between the pixel value and the pixel statistics in the logarithmic domain image includes: 0 for a pixel value less than or equal to the minimum pixel value; 0 for a pixel value greater than the minimum pixel value and less than or equal to the average pixel value, where the brightness compression result of the pixel is the product of a third parameter and a first difference value, the first difference value being the ratio of the first difference between the pixel value and the minimum pixel value to the second difference between the average pixel value and the minimum pixel value; 0 for a pixel value greater than the average pixel value and less than or equal to the maximum pixel value, where the brightness compression result of the pixel is the sum of the products of the third parameter and the fourth parameter and the second difference value, the second difference value being the ratio of the third difference between the pixel value and the average pixel value to the fourth difference between the average pixel value and the maximum pixel value; and 0 for a pixel value greater than the maximum pixel value, where the brightness compression result of the pixel is the sum of the first parameter and the second parameter, the third parameter and the fourth parameter being preset values.
[0011] Optionally, calculating the first factor based on the relationship between the pixel value of each pixel in the original image and its pixel mean includes: calculating the ratio of the pixel value of each pixel in the original image to its pixel mean, as the first factor.
[0012] In a second aspect, this application discloses an image dynamic range compression device based on nonlinear mapping. The device includes: an acquisition module configured to acquire an original image; an image conversion module configured to determine the grayscale image and its logarithmic domain image of the original image; a compression module configured to calculate the brightness compression result of each pixel based on the pixel value distribution of each pixel in the logarithmic domain image and the target dynamic range; a weight calculation module configured to calculate a weight factor based on the pixel value distribution of each pixel in the logarithmic domain image and the relationship between the pixel value and the pixel mean of each pixel in the original image; and an adjustment module configured to adjust the brightness compression result according to the weight factor to obtain a target image, wherein the target dynamic range of pixel brightness in the target image is lower than the original dynamic range of pixel brightness in the original image.
[0013] This invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of any of the methods described above.
[0014] This invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the methods described above.
[0015] This invention also provides a chip, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the methods described above.
[0016] This invention also provides a computer program product that, when executed by a computer, implements the steps of any of the methods described above.
[0017] Compared with the prior art, the technical solution of the embodiments of the present invention has the following beneficial effects:
[0018] This application compresses the brightness of pixels in an image in the logarithmic domain, calculates a weighting factor based on the pixel value distribution of each pixel in the logarithmic domain image and the relationship between the pixel value of each pixel in the original image and its mean pixel value, and adjusts the brightness compression result according to the weighting factor to obtain the target image. This achieves the mapping of images or video frames with high dynamic range to low dynamic range for display, preserving the contrast of normally exposed areas as much as possible, improving the visibility of underexposed and overexposed areas, and enhancing the overall saturation, thus restoring the real content of the scene as much as possible. Attached Figure Description
[0019] Figure 1 This is a flowchart of an image dynamic range compression method based on nonlinear mapping provided in an embodiment of the present invention;
[0020] Figure 2 This is a schematic diagram of the structure of an image dynamic range compression system based on nonlinear mapping provided in an embodiment of the present invention;
[0021] Figure 3 This is a schematic diagram of the structure of a compression computing unit provided in an embodiment of the present invention;
[0022] Figure 4 This is a schematic diagram illustrating the relationship between compressed brightness and pixel values in a logarithmic domain image, provided by an embodiment of the present invention.
[0023] Figure 5 This is a schematic diagram illustrating the relationship between a second factor and pixel values in a logarithmic domain image, provided by an embodiment of the present invention.
[0024] Figure 6 This is a schematic diagram of the image dynamic range compression device based on nonlinear mapping provided in an embodiment of the present invention. Detailed Implementation
[0025] Currently, there are two types of mapping methods for high dynamic range to low dynamic range: linear mapping and non-linear mapping. Linear mapping refers to linearly and proportionally scaling the entire brightness range (from minimum value L_min to maximum value L_max) of a high dynamic range (HDR) image to the display range of a low dynamic range (LDR) device (typically 0-255).
[0026] However, the brightness distribution in real-world scenes or HDR images is typically extremely uneven. Most pixels are concentrated in a certain brightness range, while a few extremely bright pixels (such as the sun or lamplight) will increase the L_max. During linear compression, in order to accommodate these extremely bright pixels, most of the brightness ranges with rich details in the middle (such as the ground or faces) will be squeezed into a very narrow output range, resulting in extremely low contrast, a grayish, dull appearance, and a complete loss of detail in the entire image. Even a single "bad pixel" with extremely high brightness in the image can flatten the entire mapping curve, ruining the entire image.
[0027] Nonlinear mapping, on the other hand, employs a nonlinear, non-uniform compression function. Its core idea is to compress different brightness areas to varying degrees based on the characteristics of human vision (such as greater sensitivity to details in dark areas) and the image content itself.
[0028] This application uses a nonlinear mapping method to compress high dynamic range images to low dynamic range for display.
[0029] This application compresses the brightness of pixels in an image in the logarithmic domain, calculates a weighting factor based on the pixel value distribution of each pixel in the logarithmic domain image and the relationship between the pixel value of each pixel in the original image and its mean pixel value, and adjusts the brightness compression result according to the weighting factor to obtain the target image. This achieves the mapping of images or video frames with high dynamic range to low dynamic range for display, preserving the contrast of normally exposed areas as much as possible, improving the visibility of underexposed and overexposed areas, and enhancing the overall saturation, thus restoring the real content of the scene as much as possible.
[0030] The nonlinear mapping image dynamic range compression scheme provided in this application can be used for global high dynamic range compression of a scene, as well as for local high dynamic range brightness compression.
[0031] To make the above-mentioned objectives, features and beneficial effects of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0032] like Figure 1 As shown, the image dynamic range compression method may include steps 101 to 105.
[0033] In step 101, the original image is acquired. Specifically, it can be raw data, RGB image, or YUV data, etc. The original image can be an image with high dynamic range acquired by an image acquisition device.
[0034] In step 102, the grayscale image and its logarithmic domain image of the original image are determined.
[0035] In this embodiment, grayscale image can be obtained by converting the original image to grayscale. Converting the grayscale image from the grayscale domain to the logarithmic domain yields a logarithmic domain image.
[0036] It should be noted that any existing and implementable algorithm can be used for the specific grayscale processing algorithm or logarithmic transformation algorithm, and this application does not impose any restrictions on it.
[0037] In step 103, the brightness compression result of each pixel is calculated based on the pixel value distribution of each pixel in the logarithmic domain image and the target dynamic range.
[0038] This embodiment combines pixel value distribution to compress pixel values of pixels located in different brightness regions to varying degrees, in order to compress them to the target dynamic range. The target dynamic range can be set by the user and can be determined based on the bit depth of the image. For example, the target dynamic range can be [0, maxVal], where maxVal is the maximum value of the compressed image (i.e., the target image), maxVal = 2n-1, and n is the bit depth of the image output.
[0039] In step 104, a weighting factor is calculated based on the pixel value distribution of each pixel in the logarithmic domain image and the relationship between the pixel value of each pixel in the original image and its mean pixel value.
[0040] In step 105, the brightness compression result is adjusted according to the weighting factor to obtain the target image, where the target dynamic range of pixel brightness in the target image is lower than the original dynamic range of pixel brightness in the original image.
[0041] This embodiment combines pixel value distribution to adjust the pixel values of pixels located in different brightness areas to varying degrees. Furthermore, by analyzing the relationship between the pixel values of each pixel in the original image and its average pixel value, pixels in the original image can be included in the calculation, allowing color to participate in the correction. The pixel value range is compressed from a large range to a small range, resulting in richer colors, i.e., enhanced saturation.
[0042] like Figure 2 As shown, the image dynamic range compression system includes: a data input unit 201, a brightness calculation unit 202, a weight calculation unit 203, a compression calculation unit 204, a data adjustment calculation unit 205, and a data output unit 206.
[0043] The input to the data input unit 201 is a raw image with high dynamic range, which can be raw data, RGB image, or YUV data, denoted as Img. The raw image can be acquired by an image acquisition device.
[0044] The brightness calculation unit 202 is used to calculate the brightness of the original image Img, that is, to perform grayscale processing on the original image Img.
[0045] More specifically, the brightness calculation unit 202 may include four sub-units.
[0046] The first sub-unit is used for grayscale processing of the Raw image. For example, since the Raw image is single-channel, brightness cannot be directly extracted. Generally, a low-pass filter is applied to the Raw image, and the filtered result approximates its brightness. (Grayscale image) The specific calculation formula is shown in formula (1):
[0047] , (1)
[0048] The original image Img has a size of m×n. This represents the filter window.
[0049] With filter window Taking a size of 3×3 as an example, the filter window As shown in formula (2):
[0050] , (2)
[0051] The second sub-unit is for RGB image grayscale processing. RGB image grayscale calculation involves converting the RGB image from the RGB domain to the YUV domain, separating luminance and chrominance, and extracting luminance as the output of this unit. Commonly used calculation formulas are shown in formula (3):
[0052] , (3)
[0053] It should be noted that the conversion factor is 0.299. And 0.114 can be set according to the actual application scenario, as long as it conforms to the conversion rules, this application does not impose any restrictions on it.
[0054] The third sub-unit is used for grayscale processing of the YUV domain image. For a YUV domain image, the brightness Y is directly output as the pixel values of the grayscale image Yin.
[0055] The fourth subunit 203 is used to calculate the average value of the grayscale image Yin, Yin_mean. This calculation is performed on the entire image. For single-frame image processing, statistical processing can be performed on the spot. For video processing, the statistical calculation can be performed on the previous frame and used in the current frame, saving computation time and improving video processing efficiency.
[0056] The weight calculation unit 203 is used to calculate the weight factor used for dynamic range compression. It uses the calculation result Yin_mean from the fourth subunit 204 and the original image Img input from unit 101 to calculate the weight ratio.
[0057] In one specific embodiment, the weight calculation unit 203 may specifically include three sub-units, namely the fifth sub-unit, the sixth sub-unit, and the seventh sub-unit.
[0058] The fifth sub-unit is used to calculate the first factor of the raw image Img in the Raw domain. The raw image Img in the Raw domain has only one channel, so it can be calculated directly, as shown in formula (4):
[0059] , (4)
[0060] The sixth subunit is used to calculate the first factor of the original RGB domain image Img. The original RGB domain image Img has three channels, namely Red, Green, and Blue. The weight values of each channel need to be calculated separately. C is used as a uniform label. For details, please refer to formula (5):
[0061] , (5)
[0062] The seventh subunit is used to calculate the first factor of the original YUV domain image Img. The original RGB domain image Img has three channels, namely Y, Cb, and Cr. The value of the first factor needs to be calculated for each channel. C is used as a uniform label. For details, please refer to formula (6):
[0063] , (6)
[0064] The compression calculation unit 204 is used to calculate weights based on the output of the previous stage, i.e., the grayscale image, and includes four sub-units. The calculation flowchart is shown below. Figure 3 As shown.
[0065] The logarithmic calculation unit 301 is used to calculate the logarithmic domain image Ylog of the grayscale image. The base of the logarithm can be 2, 10, or the natural number e, which is not required. The calculation formula is shown in formula (7):
[0066] , (7)
[0067] The maximum-minimum value calculation unit 302 is configured to calculate the maximum and minimum values of the logarithmic domain image. According to the logarithmic domain image Ylog output by the logarithm calculation unit 401, at least one pixel statistical value of the image is calculated: the maximum value Ylog_max, the minimum value Ylog_min, and the average value Ylog_mean. This calculation is performed for the entire image. Instant statistical processing is sufficient for single-frame image processing; for video processing, statistical calculation can be performed on the previous frame for use by the current frame, which saves calculation time and improves video processing efficiency.
[0068] The compressed brightness calculation unit 303 is configured to calculate compressed brightness. Using the logarithmic domain image Ylog output by the logarithm calculation unit 301 and the calculation results of the maximum value Ylog_max, the minimum value Ylog_min, and the average value Ymean_log obtained by the maximum-minimum value calculation unit 302, the brightness compression result is calculated. This calculation can use any m (m>=1) thresholds among the three thresholds (i.e., the above-mentioned pixel statistical values), and a plurality of thresholds can also be added to obtain N thresholds, forming a polyline curve with N+1 segments, where N is a positive integer.
[0069] Taking three thresholds and four segments as an example, the calculation formula of compressed brightness Cout is shown in formula (8):
[0070] C , (8)
[0071] Wherein, Y1 and Y2 are register configuration parameters. The value ranges of Y1 and Y2 are [0, maxVal]; similarly, the value range of Cout is [0, maxVal], maxVal is the maximum value of the compressed image, maxVal=2n-1, and n is the number of bits output by the image. If the original image is in the Raw domain, C=Img; if the original image is in the RGB domain, C= ; if it is in the YUV domain, C=Y. The specific schematic diagram is shown in Figure 4 , wherein the abscissa represents the pixel value of pixels in the logarithmic domain image Ylog, and the ordinate represents the compressed brightness Cout.
[0072] It should be noted that Y1 and Y2 are externally configurable constants and are empirical values, which vary with the bit width of the input source. Y1<Y2 is preferred, which is not limited in the present application.
[0073] The weight calculation unit 304 is configured to calculate a second factor. It is configured to calculate a brightness compression result according to the calculation results Ylog_max, Ylog_min, and Ymean_log obtained by the maximum-minimum value calculation unit 302. This calculation can use any m (m>=1) thresholds among the three thresholds, and a plurality of thresholds can also be added, that is, N thresholds, to form a polyline curve with N+1 segments.
[0074] Taking a three-threshold four-segment line as an example, the formula for calculating the second factor r is shown in formula (9):
[0075] (9)
[0076] Where k1 and k2 are register configuration parameters, preferably, the value range of k1 and k2 can be set to [0.45, 0.65]. The upper and lower ranges can also be adjusted according to actual conditions, and this application does not impose any restrictions on this. A specific schematic diagram illustrating the relationship between the second factor and the pixel values in the logarithmic domain image is shown below. Figure 5 As shown in the figure. The horizontal axis represents the pixel value of the pixel in the logarithmic domain image Ylog, and the vertical axis represents the second factor r.
[0077] The data adjustment calculation unit is used to adjust the data based on the compression results and weighting factors. Specifically, it can include three sub-units.
[0078] The final weight calculation subunit is used to calculate the final weight factor `ratio_finial`, which is the compressed weight. The aforementioned embodiment calculated the first factor `ratio`, which is denoted as `ratio` regardless of whether the input is single-channel or three-channel. Here, the weight factor is obtained by applying brightness range to the `ratio`. Specifically, as shown in formula (10):
[0079] , (10)
[0080] The target image calculation subunit calculates the final output result. That is, the target image is calculated based on the weighting factor and the brightness compression result. Specifically, it is shown in formula (11):
[0081] , (11)
[0082] Where Img_out represents the target image, i.e., the data adjustment result. If the input is single-channel Raw data, then Img_out represents single-channel Raw data; if the input is three-channel RGB data, then Img_out represents three-channel RGB data; if the input is three-channel YUV data, then Img_out only represents the Y channel transformation result, and U / V is not transformed, but its value range needs to be adjusted synchronously. Assuming that before adjustment, Yin's value is [0, maxVal_in], then U / V's value is [-(maxVal_in+1) / 2, (maxVal_in-1) / 2]. After adjustment, the value range of U / V is [-(maxVal+1) / 2, (maxVal-1) / 2].
[0083] This calculation can enhance image color while compressing the data range, thus increasing saturation. Including the original pixels in the calculation inherently involves color correction; compressing the pixel value range from a large range to a small range results in richer colors, meaning increased saturation.
[0084] Furthermore, the image dynamic range compression system may also include a data output unit for outputting the target image.
[0085] Please see Figure 6 This invention also provides an image dynamic range compression device 60 based on nonlinear mapping, comprising:
[0086] The acquisition module 601 is configured to acquire the original image;
[0087] Image conversion module 602 is configured to determine the grayscale image and its logarithmic domain image of the original image;
[0088] Compression module 603 is configured to calculate the brightness compression result of each pixel based on the pixel value distribution of each pixel in the logarithmic domain image and the target dynamic range;
[0089] The weight calculation module 604 is configured to calculate the weight factor based on the pixel value distribution of each pixel in the logarithmic domain image and the relationship between the pixel value of each pixel in the original image and its pixel mean.
[0090] The adjustment module 605 is configured to adjust the brightness compression result according to the weighting factor to obtain the target image, wherein the target dynamic range of pixel brightness in the target image is lower than the original dynamic range of pixel brightness in the original image.
[0091] For more information on the working principle and operation mode of device 60, please refer to the above. Figures 1 to 5 The relevant descriptions of the methods described herein will not be repeated here.
[0092] Furthermore, this embodiment of the invention also discloses a storage medium storing a computer program thereon, wherein the computer program is executed by a processor to perform the technical solution of the method shown in the foregoing embodiments.
[0093] Furthermore, embodiments of the present invention also disclose a computer device, including a memory and a processor, wherein the memory stores a computer program capable of running on the processor, and the processor executes the technical solution of the method shown in the foregoing embodiments when running the computer program.
[0094] Specifically, in this embodiment of the invention, the processor can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.
[0095] It should also be understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced synchronous DRAM (ESDRAM), synchronous linked DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0096] It should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article indicates that the preceding and following related objects have an "or" relationship.
[0097] In the embodiments of this application, "multiple" refers to two or more.
[0098] The descriptions of "first," "second," etc., appearing in the embodiments of this application are for illustrative purposes and to distinguish the objects being described. They have no order and do not indicate any special limitation on the number of devices in the embodiments of this application, nor do they constitute any limitation on the embodiments of this application.
[0099] In this application, the term "connection" refers to various connection methods, such as direct connection or indirect connection, to achieve communication between devices. This application does not impose any limitations on this.
[0100] While the present invention has been disclosed above, it is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of the invention; therefore, the scope of protection of the present invention should be determined by the scope defined in the claims.
Claims
1. An image dynamic range compression method based on nonlinear mapping, characterized in that, The method includes: Obtain the original image; Determine the grayscale image and its logarithmic domain image corresponding to the original image; The brightness compression result of each pixel is calculated based on the pixel value distribution of each pixel in the logarithmic domain image and the target dynamic range. The weighting factor is calculated based on the pixel value distribution of each pixel in the logarithmic domain image and the relationship between the pixel value of each pixel in the original image and its mean pixel value. The brightness compression result is adjusted according to the weighting factor to obtain a target image, wherein the target dynamic range of pixel brightness in the target image is lower than the original dynamic range of pixel brightness in the original image.
2. The image dynamic range compression method according to claim 1, characterized in that, The step of calculating the brightness compression result based on the pixel value distribution of each pixel in the logarithmic domain image and the target dynamic range includes: Calculate at least one pixel statistic for all pixels in the logarithmic domain image: maximum pixel value, minimum pixel value, and average pixel value; Under the constraint of the target dynamic range, the brightness compression result of each pixel is calculated based on the relationship between the pixel value of each pixel in the logarithmic domain image and the pixel statistics.
3. The image dynamic range compression method according to claim 2, characterized in that, The step of calculating the brightness compression result based on the relationship between the pixel value of each pixel in the logarithmic domain image and the pixel statistics includes: In response to a pixel value being less than or equal to the minimum pixel value, the brightness compression result of that pixel is 0; In response to a pixel value being greater than the minimum pixel value and less than or equal to the average pixel value, the brightness compression result of the pixel is the product of a first parameter and a first difference value, where the first difference value is the ratio of the first difference between the pixel value and the minimum pixel value to the second difference between the average pixel value and the minimum pixel value. In response to a pixel value being greater than the average pixel value and less than or equal to the maximum pixel value, the brightness compression result of the pixel is the sum of the products of the first parameter and the second parameter and the second difference value, where the second difference value is the ratio of the third difference between the pixel value and the average pixel value to the fourth difference between the average pixel value and the maximum pixel value. In response to a pixel value greater than the maximum pixel value, the brightness compression result of the pixel is the sum of the first parameter and the second parameter, which are set based on the target dynamic range.
4. The image dynamic range compression method according to claim 1, characterized in that, The step of calculating the weighting factor based on the pixel value distribution of each pixel in the logarithmic domain image and the relationship between the pixel value of each pixel and its mean in the original image includes: The first factor is calculated based on the relationship between the pixel value of each pixel and its mean pixel value in the original image; The second factor is calculated based on the pixel value distribution of each pixel in the logarithmic domain image; The weighting factor is calculated using the first factor as the base and the second factor as the exponent.
5. The image dynamic range compression method according to claim 4, characterized in that, The calculation of the second factor based on the pixel value distribution of each pixel in the logarithmic domain image includes: Calculate at least one pixel statistic for all pixels in the logarithmic domain image: maximum pixel value, minimum pixel value, and average pixel value; The second factor of each pixel is calculated based on the relationship between the pixel value of each pixel in the logarithmic domain image and the pixel statistics.
6. The image dynamic range compression method according to claim 5, characterized in that, The step of calculating the second factor for each pixel based on the relationship between the pixel value of each pixel in the logarithmic domain image and the pixel statistics includes: In response to a pixel value being less than or equal to the minimum pixel value, the second factor of the pixel is 0; In response to a pixel value being greater than the minimum pixel value and less than or equal to the average pixel value, the brightness compression result of the pixel is the product of a third parameter and a first difference value, where the first difference value is the ratio of the first difference between the pixel value and the minimum pixel value to the second difference between the average pixel value and the minimum pixel value. In response to a pixel value being greater than the average pixel value and less than or equal to the maximum pixel value, the brightness compression result of the pixel is the sum of the products of the third parameter and the fourth parameter and the second difference value, where the second difference value is the ratio of the third difference between the pixel value and the average pixel value to the fourth difference between the average pixel value and the maximum pixel value. In response to a pixel value being greater than the maximum pixel value, the brightness compression result of the pixel is the sum of the first parameter and the second parameter, and the third parameter and the fourth parameter are preset values.
7. The image dynamic range compression method according to claim 4, characterized in that, The step of calculating the first factor based on the relationship between the pixel value of each pixel in the original image and its pixel mean includes: The ratio of the pixel value of each pixel in the original image to its pixel mean is calculated and used as the first factor.
8. An image dynamic range compression device based on nonlinear mapping, characterized in that, The device includes; The acquisition module is configured to acquire the raw image. An image conversion module is configured to determine the grayscale image and its logarithmic domain image of the original image; The compression module is configured to calculate the brightness compression result of each pixel based on the pixel value distribution of each pixel in the logarithmic domain image and the target dynamic range; The weight calculation module is configured to calculate a weight factor based on the pixel value distribution of each pixel in the logarithmic domain image and the relationship between the pixel value of each pixel in the original image and its pixel mean. The adjustment module is configured to adjust the brightness compression result according to the weighting factor to obtain a target image, wherein the target dynamic range of pixel brightness in the target image is lower than the original dynamic range of pixel brightness in the original image.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.