A tone mapping method, device and computer storage medium

Through the tone mapping method, the scene brightness and local brightness and darkness levels are calculated, the mapping factor and compression ratio are determined, and the problem of displaying wide dynamic range video images on ordinary display devices is solved, and the effect of efficiently displaying wide dynamic range video images on low-cost hardware is achieved.

CN116051383BActive Publication Date: 2025-09-19ARKMICRO TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111260153.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-28
Publication Date
2025-09-19
Estimated Expiration
2041-10-28

AI Technical Summary

Technical Problem

Existing display devices have a limited dynamic display range and are unable to effectively display video images with a wide dynamic range. In particular, how to achieve clear display of local details on ordinary display devices while maintaining cost advantages.

Method used

The tone mapping method is used to calculate the scene brightness and local brightness and darkness levels, determine the local mapping factor and compression ratio, and directly map the RAW data in the Raw space to enhance local contrast and compress relatively large contrast to maintain image details.

Benefits of technology

The effect of displaying wide dynamic range video images on ordinary display devices is achieved at low hardware cost, the visibility and contrast of the image are maintained or enhanced, and the hardware implementation is simplified.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116051383B_ABST
    Figure CN116051383B_ABST
Patent Text Reader

Abstract

The present invention provides a tone mapping method and device, comprising: calculating the current scene brightness; selecting a local region where a current point resides and calculating the brightness relationship between the current point and surrounding points within the region to determine the brightness level of the current point; deriving a corresponding local mapping factor based on the brightness level of each point; calculating a mapping compression ratio using a preset rule based on the current scene brightness and the local mapping factor; and performing data mapping on RAW data based on the mapping compression ratio. This method is implemented directly in the Raw space, has low computational complexity, and is easy to implement in hardware. It can achieve excellent video image display effects at low hardware cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of image and video processing technology, and in particular to a tone mapping method, device and computer storage medium implemented on a Bayer color filter array. Background Art

[0002] In the real world, natural scenes have a very wide range of brightness. For example, the difference between midday sunlight and nighttime starlight can be as much as 10 brightness levels or more. However, printers and monitors have a dynamic display range of only two orders of magnitude at most. Currently, most display devices only support low dynamic range. High dynamic range displays are currently prohibitively expensive, making them unsuitable for the average consumer.

[0003] How to display wide dynamic range video images on ordinary display devices while maintaining cost advantages and ensuring that local details are clearly visible is a problem that needs to be solved urgently. Summary of the Invention

[0004] In view of this, the present invention provides a tone mapping method, device and computer storage medium to address the deficiencies of the prior art.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions:

[0006] An embodiment of the present invention provides a tone mapping method, comprising:

[0007] Calculate the current scene brightness;

[0008] Select the local area where the current point is located, and calculate the brightness value relationship between the current point and the surrounding points in the area to determine the brightness level of the current point;

[0009] The corresponding local mapping factor is obtained according to the brightness and darkness level of each point;

[0010] Calculate the mapping compression ratio using preset rules based on the current scene brightness and local mapping factor;

[0011] Perform data mapping on the RAW data according to the mapping compression ratio.

[0012] Furthermore, the local area where the current point is located is selected, and the brightness value relationship between the current point and the surrounding points in the area is counted to determine the brightness level of the current point. Specifically, the following steps are performed:

[0013] Select a statistical window of preset size with the current point as the center;

[0014] Calculate the brightness values ​​of all pixels in the statistical window;

[0015] The number of pixels H1 whose brightness value in the statistical window is greater than or equal to the brightness value of the current point plus the second preset value; the number L1 of pixels whose brightness value in the statistical window is less than or equal to the brightness value of the current point minus the second preset value; the number H2 of pixels whose brightness value in the statistical window is greater than the brightness value of the current point plus the first preset value and less than the brightness value of the current point plus the second preset value; the number L2 of pixels whose brightness value in the statistical window is greater than the brightness value of the current point minus the second preset value and less than the brightness value of the current point minus the first preset value; the first preset value is less than the second preset value;

[0016] The brightness level of the current point in the statistical window is determined based on the statistical number H1, H2, L1, and L2; when H2+H1-L2-L1>0, the current point is determined to be a dark point; when H1>Nth, the current point is determined to be a first-level dark point; when H1≤Nth, the current point is determined to be a second-level dark point; when H2+H1-L2-L1<0, the current point is determined to be a bright point; when L1>Nth, the current point is determined to be a first-level bright point; when L1≤Nth, the current point is determined to be a second-level bright point; Nth is the preset threshold value.

[0017] Furthermore, the brightness value Y of the current pixel is calculated using the following expression: Y(x, y) = [Raw(x, y) + Raw(x, y+1) + Raw(x+1, y) + Raw(x+1, y+1)] / 4.

[0018] Furthermore, when calculating the local mapping factor, when the current point is a secondary dark point or a secondary bright point, the value of (L1+L2-H1-H2) / 256 is used as the local mapping factor, and in other cases the local mapping factor is set to zero.

[0019] Furthermore, the mapping compression ratio is calculated using a preset rule according to the current scene brightness and the local mapping factor; specifically, the following steps are performed:

[0020] Calculate the compression factor Key = (a + b) / L based on the current scene brightness and local mapping factor s ; where L s is the current scene brightness; b is the local mapping factor; a is a preset constant;

[0021] Use the following expression Calculate the compression ratio, where Key is the compression factor; Sc(x,y) is the compression ratio; when L s When Lth is higher, X(x,y) takes the brightness value Y(x,y) of the pixel. s When ≤Lth, X(x,y) takes the RAW data Raw(x,y), where Lth is a preset empirical value.

[0022] Furthermore, the current scene brightness is calculated by weighting the scene brightness of the previous frame and the average of the RAW data of the previous frame.

[0023] An embodiment of the present invention further provides a tone mapping device, comprising:

[0024] Scene brightness calculation module, used to calculate the current scene brightness;

[0025] The brightness level determination module is used to select the local area where the current point is located and calculate the brightness value relationship between the current point and the surrounding points in the area to determine the brightness level of the current point;

[0026] A mapping factor determination module is used to obtain a corresponding local mapping factor according to the brightness level of each point;

[0027] A compression ratio calculation module is used to calculate the mapping compression ratio using a preset rule according to the current scene brightness and the local mapping factor;

[0028] The data mapping module is used to perform data mapping on the RAW data according to the mapping compression ratio.

[0029] Furthermore, the brightness and darkness level determination module further includes:

[0030] A statistical window selection module is used to select a statistical window of a preset size with the current point as the center;

[0031] Brightness value calculation module, used to calculate the brightness values ​​of all pixels in the statistical window;

[0032] The number statistics module is used to count the number of pixel points H1 in the window whose brightness value is greater than or equal to the brightness value of the current point plus the second preset value; count the number of pixel points L1 in the window whose brightness value is less than or equal to the brightness value of the current point minus the second preset value; count the number of pixel points H2 in the window whose brightness value is greater than the brightness value of the current point plus the first preset value and less than the brightness value of the current point plus the second preset value; count the number of pixel points L2 in the window whose brightness value is greater than the brightness value of the current point minus the second preset value and less than the brightness value of the current point minus the first preset value; the first preset value is less than the second preset value;

[0033] The comparison and judgment module is used to judge the brightness level of the current point in the statistical window according to the statistical number H1, H2, L1, and L2; when H2+H1-L2-L1>0, the current point is judged to be a dark point; when H1>Nth, the current point is judged to be a first-level dark point; when H1≤Nth, the current point is judged to be a second-level dark point; when H2+H1-L2-L1<0, the current point is judged to be a bright point; when L1>Nth, the current point is judged to be a first-level bright point; when L1≤Nth, the current point is judged to be a second-level bright point; Nth is the preset threshold value.

[0034] Furthermore, when the mapping factor determination module calculates the local mapping factor, when the current point is a secondary dark point or a secondary bright point, the value of (L1+L2-H1-H2) / 256 is used as the local mapping factor, and in other cases the local mapping factor is set to zero.

[0035] An embodiment of the present invention further provides a computer storage medium storing a computer program, wherein the computer program implements the above-mentioned tone mapping method when executed by a processor.

[0036] The tone mapping method provided by the present invention is directly implemented in the Raw space, has low computational complexity, is easy to implement in hardware, and can achieve excellent video image display effects at low hardware cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0038] Figure 1 A flowchart of a tone mapping method provided by an embodiment of the present invention;

[0039] Figure 2 Schematic diagram of a method for determining whether a current point is a very bright point, a relatively bright point, a median point, a relatively dark point, or a very dark point according to a first embodiment of the present invention;

[0040] Figure 3 A schematic structural diagram of a tone mapping device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0041] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0042] Figure 1 FIG2 is a flow chart of a tone mapping method provided by an embodiment of the present invention.

[0043] S1: Calculate the current scene brightness;

[0044] Tone mapping compresses the dynamic range of the input image so that it can be viewed on devices with limited display range, while also maintaining or even enhancing its visibility and contrast.

[0045] First, for visibility, we estimate the current scene brightness. Based on this, we map the image to an appropriate brightness range. For darker scenes, we use a faster-gain curve, while for brighter scenes, we use a slower-gain curve. This gain curve is the compression ratio that will be used later in this application. Different compression ratios are used for different scene brightnesses.

[0046] The current scene brightness can be calculated by weighting the mean of the RAW data of the previous frame and the scene brightness at the previous frame. In a specific embodiment, the current scene brightness is calculated as follows: As shown, L s (i) represents the scene brightness at the current moment, L s (i-1) represents the scene brightness at the previous frame, and L(i-1) represents the mean raw data value of the previous frame. m×n represents the pixel size of each frame. The weighting coefficient for both the scene brightness at the previous frame and the mean raw data value of the previous frame is 0.5.

[0047] S2: Select the local area where the current point is located and count the brightness values ​​of the current point and the surrounding points in the area to determine the brightness level of the current point.

[0048] The information within the local window where the current point is located is counted; when adjusting the pixel value of a certain point in the image, the spatial information of the point is taken into consideration at the same time, which can enhance the local smaller contrast and compress the relatively larger contrast, thereby maintaining almost all the visual detail information. In this embodiment, the current point is first statistically determined in its local space to be: very bright point (first-level bright point), relatively bright point (second-level bright point), median point, relatively dark point (second-level dark point), very dark point (first-level dark point).

[0049] The specific steps include:

[0050] S201: Select a statistical window of a preset size with the current point as the center. The statistical window can be 3*3, 5*5, 7*7 or other sizes. In this embodiment, 5*5 is preferred.

[0051] When the current point is an edge point and the statistical window cannot effectively contain the pixels of the image, a symmetrical filling method can be used to fill the statistical window with data.

[0052] S202: Calculate the brightness values ​​of all pixels in the statistical window.

[0053] Specifically, the luminance value Y of all pixel points within the statistical window is calculated using the following expression: Y(x, y) = [Raw(x, y) + Raw(x, y + 1) + Raw(x + 1, y) + Raw(x + 1, y + 1)] / 4.

[0054] S203: Count the number of pixel points H1 within the statistical window whose luminance value is greater than or equal to the luminance value of the current point plus the second preset value; count the number of pixel points L1 within the statistical window whose luminance value is less than or equal to the luminance value of the current point minus the second preset value; count the number of pixel points H2 within the statistical window whose luminance value is greater than the luminance value of the current point plus the first preset value and less than the luminance value of the current point plus the second preset value; count the number of pixel points L2 within the statistical window whose luminance value is greater than the luminance value of the current point minus the second preset value and less than the luminance value of the current point minus the first preset value; the first preset value is less than the second preset value.

[0055] Count the number of Y(x + dx, y + dy) ≥ Y(x, y) + th2 within the statistical window as H1; count the number of Y(x, y) + th1 < Y(x + dx, y + dy) < Y(x, y) + th2 within the statistical window as H2; count the number of Y(x, y) - th2 < Y(x + dx, y + dy) < Y(x, y) - th1 within the statistical window as L2; count the number of Y(x + dx, y + dy) ≤ Y(x, y) - th2 within the statistical window as L1.

[0056] The first preset value th1 and the second preset value th2 are related to the number of bits of the RAW data. In one embodiment, taking 12-bit Raw data as an example, th1 = 64 and th2 = 128.

[0057] In this embodiment, the data is classified according to the first preset value th1 and the second preset value th2 to obtain four data L1, L2, H1, and H2. Similarly, in other embodiments, the data can also be classified according to three different preset values ​​to obtain six data L1, L2, L3, H1, H2, and H3. That is, the number H1 of Y(x+dx, y+dy) ≥ Y(x, y)+th3 in the statistical window; the number H2 of Y(x, y)+th2 ≤ Y(x+dx, y+dy) < Y(x, y)+th3 in the statistical window; the number H3 of Y(x, y)+th1 ≤ Y(x+dx, y+dy) < Y(x, y)+th2 in the statistical window; the number L3 of Y(x, y)-th2 < Y(x+dx, y+dy) ≤ Y(x, y)-th1 in the statistical window; the number L2 of Y(x, y)-th3 < Y(x+dx, y+dy) ≤ Y(x, y)-th2 in the statistical window; the number L1 in the statistical window Y(x+dx, y+dy) ≤ Y(x, y)-th3. Similarly, the data can be classified according to n groups of different preset values ​​to obtain L1, L2, ... Ln, H1, H2, ... Hn, a total of 2n data.

[0058] S204: Determine the brightness level of the current point in the statistical window based on the counted numbers H1, H2, L1, and L2. When H2 + H1 - L2 - L1 > 0, the current point is determined to be a dark point. When H1 > Nth, the current point is determined to be a first-level dark point. When H1 ≤ Nth, the current point is determined to be a second-level dark point. When H2 + H1 - L2 - L1 < 0, the current point is determined to be a bright point. When L1 > Nth, the current point is determined to be a first-level bright point. When L1 ≤ Nth, the current point is determined to be a second-level bright point. Nth is a preset threshold value. The brightness of a first-level bright point is greater than that of a second-level bright point; the brightness of a first-level dark point is less than that of a second-level dark point. In other embodiments, a preset offset correction value may be added when determining the current dark point and bright point. For example, a dark point may be determined to be a dark point by satisfying the expression H2 + H1 - L2 - L1 > offset, where offset is a preset offset correction value. If the number of counted pixels exceeds 4. For example, if there are 6 points, the light and dark points can be determined by subtracting the sum of L1, L2, and L3 from the sum of H1, H2, and H3. The same applies to other situations.

[0059] like Figure 2As shown, based on the statistical number of points H1, H2, L1, L2, we can determine whether the current point in the local interval is a very bright point, a relatively bright point, a median point, a dark point, or a very dark point. First, we determine if H2+H1-L2-L1>0. If the condition holds, we then determine if H1>Nth. If so, the current point is a very dark point; otherwise, it is a relatively dark point. If H2+H1-L2-L1=0, the current point is a median point. If H2+H1-L2-L1<0, we then determine if L1>Nth. If the condition holds, the current point is a very bright point; otherwise, it is a relatively bright point.

[0060] The preset threshold value is related to the selected window size. When the statistical window is 5*5, Nth=12.

[0061] S3: Obtain the corresponding local mapping factor according to the brightness level of each point.

[0062] When calculating the local mapping factor, when the current point is a secondary dark point or a secondary bright point, the value of (L1+L2-H1-H2) / 256 is used as the local mapping factor, and in other cases the local mapping factor is set to zero.

[0063] The local mapping factor is as follows

[0064] When the current point is a darker point, the corresponding b(x, y) is negative; when the current point is a brighter point, the corresponding b(x, y) is positive; for other points, the corresponding b(x, y) is 0. In this way, the local small contrast of darker and brighter points will be enhanced, while the relatively large contrast of very bright and very dark points will be compressed. At the same time, a certain amount of noise can be suppressed in the median area.

[0065] S4: Calculate the mapping compression ratio using a preset rule according to the current scene brightness and the local mapping factor.

[0066] Calculate the compression factor Key = (a + b) / L based on the current scene brightness and local mapping factor s ; where L s is the current scene brightness; b is the local mapping factor; and a is a preset constant that controls the degree of image brightening. a is a constant around 1, for example, 0.8, 1.2, etc. Users can adjust and select appropriate values ​​based on the actual mapping effect.

[0067] Use the following expression Calculate the compression ratio, where Key is the compression factor; Sc(x,y) is the compression ratio; when L s When Lth is higher, X(x,y) takes the brightness value Y(x,y) of the pixel. s When ≤Lth, X(x,y) takes the RAW data Raw(x,y), where Lth is a preset empirical value.

[0068] According to the scene brightness L s Select the compression ratio calculation mode, when L s >Lth means the scene is brighter, press Calculate the compression ratio; on the contrary, when L s ≤Lth means the scene is dark, press Calculate the compression ratio. When the scene is bright, using the brightness value can make the image color more vivid. However, when the brightness is low, the noise is large, and using the brightness value will map a lot of color noise. Therefore, when the brightness is low, it is more appropriate to use RAW data.

[0069] S5: Perform data mapping on the RAW data according to the mapping compression ratio.

[0070] Finally, the compressed data is calculated according to the compression ratio: ldr(x,y)=Raw(x,y)*Sc(x,y).

[0071] Figure 3 FIG2 is a schematic diagram of the structure of a tone mapping device provided by an embodiment of the present invention. The tone mapping device includes: a scene brightness calculation module, a brightness level determination module, a mapping factor determination module, a compression ratio calculation module and a data mapping module.

[0072] The scene brightness calculation module is used to calculate the current scene brightness; the brightness level determination module is used to select the local area where the current point is located and calculate the relationship between the brightness values ​​of the current point and the surrounding points in the statistical area to determine the brightness level of the current point; the mapping factor determination module is used to derive the corresponding local mapping factor according to the brightness level of each point; the compression ratio calculation module is used to calculate the mapping compression ratio using preset rules based on the current scene brightness and the local mapping factor; the data mapping module is used to perform data mapping on the RAW data according to the mapping compression ratio.

[0073] The light and dark level determination module also includes:

[0074] A statistical window selection module is used to select a statistical window of a preset size with the current point as the center;

[0075] Brightness value calculation module, used to calculate the brightness values ​​of all pixels in the statistical window;

[0076] The number statistics module is used to count the number of pixel points H1 in the window whose brightness value is greater than or equal to the brightness value of the current point plus the second preset value; count the number of pixel points L1 in the window whose brightness value is less than or equal to the brightness value of the current point minus the second preset value; count the number of pixel points H2 in the window whose brightness value is greater than the brightness value of the current point plus the first preset value and less than the brightness value of the current point plus the second preset value; count the number of pixel points L2 in the window whose brightness value is greater than the brightness value of the current point minus the second preset value and less than the brightness value of the current point minus the first preset value; the first preset value is less than the second preset value;

[0077] The comparison and judgment module is used to judge the brightness level of the current point in the statistical window according to the statistical number H1, H2, L1, and L2; when H2+H1-L2-L1>0, the current point is judged to be a dark point; when H1>Nth, the current point is judged to be a first-level dark point; when H1≤Nth, the current point is judged to be a second-level dark point; when H2+H1-L2-L1<0, the current point is judged to be a bright point; when L1>Nth, the current point is judged to be a first-level bright point; when L1≤Nth, the current point is judged to be a second-level bright point; Nth is the preset threshold value.

[0078] It should be noted that the tone mapping device provided in the above embodiment, when performing tone mapping, is illustrated only by the division of the above-mentioned program modules. In actual applications, the above-mentioned processing can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program modules to complete all or part of the above-described processing. In addition, the tone mapping device provided in the above embodiment and the tone mapping method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment. The beneficial effects are the same as those of the method embodiment and are not further described here.

[0079] An embodiment of the present invention further provides a computer storage medium, which is a computer-readable storage medium having a computer program stored thereon. The computer program can be executed by a processor of a tone mapping device to complete the steps of the tone mapping method. The computer-readable storage medium can be a memory such as a ferromagnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface mount device, an optical disc, or a compact disc read-only memory (CD-ROM).

[0080] In the several embodiments provided by the present invention, it should be understood that the disclosed methods and intelligent devices can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0081] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A tone mapping method, characterized in that: include: Calculate the current scene brightness; Select the local area where the current point is located, count the brightness values ​​of the current point and the surrounding points in the area, and thus determine the brightness level of the current point; the brightness levels are divided into: first-level bright spots, second-level bright spots, median points, second-level dark spots, and first-level dark spots in descending order of brightness; the level division is specifically as follows: using the brightness value of the current point and at least two different preset values, the brightness interval is divided into at least four interval ranges A1, A2, A3, and A4 that are symmetrical with the current brightness value and range from small to large and do not overlap; count the brightness values ​​of all pixels in the local area with the current point as the center and which interval range they belong to; when the sum N1 of the number of points belonging to A1 and the number of points belonging to A2 is equal to the sum N2 of the number of points belonging to A3 and the number of points belonging to A4, the current point is classified as a median point; When N1 is less than N2, the current point is classified as a dark point. When the number of points belonging to A4 is greater than the preset threshold, the current point is classified as a first-level dark point, otherwise it is classified as a second-level dark point. When N1 is greater than N2, the current point is defined as a bright spot. When the number of pixels belonging to A1 is greater than the preset threshold, the current point is defined as a first-level bright spot, otherwise it is defined as a second-level bright spot. The corresponding local mapping factor is obtained according to the brightness level of each point. When the current point is a secondary dark point or a secondary bright point, the local mapping factor is calculated using a preset formula. In other cases, the local mapping factor is set to zero. Calculate the mapping compression ratio using preset rules based on the current scene brightness and local mapping factor; Perform data mapping on the RAW data according to the mapping compression ratio.

2. The tone mapping method according to claim 1, wherein: Select the local area where the current point is located, and count the brightness values ​​of the current point and the surrounding points in the area to determine the brightness level of the current point. Select a statistical window of preset size with the current point as the center; Calculate the brightness values ​​of all pixels in the statistical window; The number of pixels H1 whose brightness value in the statistical window is greater than or equal to the brightness value of the current point plus the second preset value; the number L1 of pixels whose brightness value in the statistical window is less than or equal to the brightness value of the current point minus the second preset value; the number H2 of pixels whose brightness value in the statistical window is greater than the brightness value of the current point plus the first preset value and less than the brightness value of the current point plus the second preset value; the number L2 of pixels whose brightness value in the statistical window is greater than the brightness value of the current point minus the second preset value and less than the brightness value of the current point minus the first preset value; the first preset value is less than the second preset value; The brightness level of the current point in the statistical window is determined based on the statistical number H1, H2, L1, and L2; when H2+H1-L2-L1>0, the current point is determined to be a dark point; when H1>Nth, the current point is determined to be a first-level dark point; when H1≤Nth, the current point is determined to be a second-level dark point; when H2+H1-L2-L1<0, the current point is determined to be a bright point; when L1>Nth, the current point is determined to be a first-level bright point; when L1≤Nth, the current point is determined to be a second-level bright point; Nth is the preset threshold value.

3. The tone mapping method according to claim 2, wherein: The brightness value Y of the current pixel is calculated using the following expression: Y(x,y)=[Raw(x,y)+Raw(x,y+1)+Raw(x+1,y)+Raw(x+1,y+1)] / 4.

4. The tone mapping method according to claim 2, wherein: When calculating the local mapping factor, when the current point is a secondary dark point or a secondary bright point, the value of (L1+L2-H1-H2) / 256 is used as the local mapping factor, and in other cases the local mapping factor is set to zero.

5. The tone mapping method according to claim 1, wherein: The mapping compression ratio is calculated using preset rules based on the current scene brightness and local mapping factors; specifically, the following steps are included: Calculate the compression factor Key = (a + b) / L based on the current scene brightness and local mapping factor s ; where L s is the current scene brightness; b is the local mapping factor; a is a preset constant; Use the following expression Calculate the compression ratio, where Key is the compression factor; Sc(x,y) is the compression ratio; when L s When Lth is higher, X(x,y) takes the brightness value Y(x,y) of the pixel. s When ≤Lth, X(x,y) takes the RAW data Raw(x,y), where Lth is a preset empirical value.

6. The tone mapping method according to claim 1, wherein: The current scene brightness is calculated by weighting the scene brightness of the previous frame and the average of the RAW data of the previous frame.

7. A tone mapping device, characterized in that include: Scene brightness calculation module, used to calculate the current scene brightness; A brightness level determination module is configured to select a local area where a current point is located and calculate the relationship between the brightness values ​​of the current point and surrounding points within the statistical area to determine the brightness level of the current point; the brightness levels are classified in descending order according to brightness as follows: a first-level bright spot, a second-level bright spot, a median point, a second-level dark spot, and a first-level dark spot; the level classification is specifically as follows: the brightness range is divided into at least four non-overlapping intervals A1, A2, A3, and A4 that are symmetrical with the current brightness value and range from small to large, based on the brightness value of the current point; the brightness values ​​of all pixels within the local area centered on the current point are counted and counted to which interval range they belong; when the sum N1 of the number of points belonging to A1 and the number of points belonging to A2 is equal to the sum N2 of the number of points belonging to A3 and the number of points belonging to A4, the current point is classified as a median point; When N1 is less than N2, the current point is classified as a dark point. When the number of points belonging to A4 is greater than the preset threshold, the current point is classified as a first-level dark point, otherwise it is classified as a second-level dark point. When N1 is greater than N2, the current point is defined as a bright spot. When the number of pixels belonging to A1 is greater than the preset threshold, the current point is defined as a first-level bright spot, otherwise it is defined as a second-level bright spot. A mapping factor determination module is used to derive the corresponding local mapping factor based on the brightness level of each point. When the current point is a secondary dark point or a secondary bright point, the local mapping factor is calculated using a preset formula; in other cases, the local mapping factor is set to zero. A compression ratio calculation module is used to calculate the mapping compression ratio using a preset rule according to the current scene brightness and the local mapping factor; The data mapping module is used to perform data mapping on the RAW data according to the mapping compression ratio.

8. The tone mapping device according to claim 7, wherein: The light and dark level determination module further includes: A statistical window selection module is used to select a statistical window of a preset size with the current point as the center; Brightness value calculation module, used to calculate the brightness values ​​of all pixels in the statistical window; The number statistics module is used to count the number of pixel points H1 in the window whose brightness value is greater than or equal to the brightness value of the current point plus the second preset value; count the number of pixel points L1 in the window whose brightness value is less than or equal to the brightness value of the current point minus the second preset value; count the number of pixel points H2 in the window whose brightness value is greater than the brightness value of the current point plus the first preset value and less than the brightness value of the current point plus the second preset value; count the number of pixel points L2 in the window whose brightness value is greater than the brightness value of the current point minus the second preset value and less than the brightness value of the current point minus the first preset value; the first preset value is less than the second preset value; The comparison and judgment module is used to judge the brightness level of the current point in the statistical window according to the statistical number H1, H2, L1, and L2; when H2+H1-L2-L1>0, the current point is judged to be a dark point; when H1>Nth, the current point is judged to be a first-level dark point; when H1≤Nth, the current point is judged to be a second-level dark point; when H2+H1-L2-L1<0, the current point is judged to be a bright point; when L1>Nth, the current point is judged to be a first-level bright point; when L1≤Nth, the current point is judged to be a second-level bright point; Nth is the preset threshold value.

9. The tone mapping device according to claim 8, wherein: When the mapping factor determination module calculates the local mapping factor, when the current point is a secondary dark point or a secondary bright point, the value of (L1+L2-H1-H2) / 256 is used as the local mapping factor, and in other cases the local mapping factor is set to zero.

10. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the tone mapping method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Mixed color gradation mapping and compression coefficient-based high dynamic range image reconstruction method

    CN103400342A

  • High dynamic range image compression method and device

    CN103916669A