A method and device for high dynamic range image compression
By segmenting light and dark areas and dynamically compressing HDR images, combined with hierarchical processing of smoothing filters, the problem of halo artifacts and contrast in HDR image compression is solved, achieving better image detail retention and effect improvement.
Patent Information
- Application Number
- CN202011555911.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-23
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2040-12-23
AI Technical Summary
Existing HDR image compression methods are prone to problems such as halo artifacts, overexposure of bright areas, and low contrast in dark areas.
By acquiring a three-channel HDR image, perform bright and dark area segmentation calculations, use a smoothing filter to divide the image into a base layer and a detail layer, dynamically compress the light and dark areas on the base layer, and merge it into an LDR image of bright areas and dark areas. Then fusion is performed according to the segmentation matrix to generate a three-channel LDR image.
Effectively reduce halo artifacts, preserve image details, suppress over-brightness in bright areas, improve contrast in dark areas, and improve the overall effect of the image.
Smart Images

Figure CN112634384B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method and device for high dynamic range image compression. Background Art
[0002] Compared with low dynamic range (LDR) images, high dynamic range (HDR) images can provide a wider brightness range, and the visual effect of the image is closer to the real world. Since the dynamic range of images that can be displayed by current display devices is limited, most display devices cannot output HDR images. In order for display devices to display HDR images, the dynamic range of HDR images needs to be compressed, and the HDR images need to be converted into LDR images for output, making them closer to the human visual system.
[0003] Traditional HDR image compression methods mainly include automatic gain control, gamma correction and histogram equalization. Due to their simplicity, these methods usually cause problems such as overexposure, detail loss and noise amplification in the compressed LDR image. More advanced HDR image compression methods are dynamic range compression algorithms based on image layering, which specifically divide the image into a base layer and a detail layer, and then process the base layer and the detail layer separately and then recombine them. These methods can effectively ensure the integrity of image details, but are prone to problems such as halo artifacts, overexposure in bright areas and low contrast in dark areas.
[0004] Therefore, a better HDR image compression method needs to be proposed. Summary of the invention
[0005] In order to overcome the deficiencies of the above-mentioned prior art, the purpose of the present application is to provide a method and device for high dynamic range image compression, which can solve the problems existing in the existing HDR image compression scheme, such as easy generation of halo artifacts, overexposure of bright areas, and low contrast in dark areas.
[0006] To achieve the above and other purposes, the present application proposes a method for high dynamic range image compression, comprising the following steps:
[0007] Get three-channel HDR images;
[0008] Performing bright and dark area segmentation calculation on the three-channel HDR image to obtain a corresponding bright and dark area segmentation matrix;
[0009] Using a smoothing filter, the three-channel HDR image is divided into a base layer and a detail layer;
[0010] Dynamically compressing the base layer in bright and dark areas to obtain a compressed base layer in the bright area and a compressed base layer in the dark area;
[0011] Merging the detail layers into an LDR image of the bright area and an LDR image of the dark area according to the compressed base layer of the bright area and the compressed base layer of the dark area;
[0012] The LDR image of the bright area and the LDR image of the dark area are fused according to the bright-dark area segmentation matrix to obtain a corresponding three-channel LDR image.
[0013] Optionally, performing bright and dark area segmentation calculation on the three-channel HDR image to obtain a corresponding bright and dark area segmentation matrix includes:
[0014] Convert the three-channel HDR image into a brightness layer matrix;
[0015] Performing gamma domain conversion on the brightness layer matrix to obtain a brightness layer gamma domain matrix;
[0016] The brightness layer gamma domain matrix is normalized and mapped to a preset bit width to obtain a gamma domain average brightness value;
[0017] Performing pixel statistics on the gamma domain matrix of the brightness layer to obtain a global histogram of the brightness layer, wherein the global histogram includes the number of pixels corresponding to different pixel values;
[0018] A bright and dark area segmentation matrix is calculated according to the gamma domain average brightness value and the global histogram.
[0019] Optionally, the calculating the bright and dark area segmentation matrix according to the gamma domain average brightness value and the global histogram includes:
[0020] Accumulating pixels level by level on the global histogram to obtain a corresponding cumulative histogram;
[0021] According to the gamma domain average brightness value and the preset brightness parameter, the cumulative histogram is normalized to obtain a normalized cumulative histogram, wherein the normalized cumulative histogram includes percentages of corresponding pixels under different pixel values;
[0022] The gamma domain brightness value of each pixel in the three-channel HDR image is processed according to the normalized cumulative histogram to obtain a bright and dark area segmentation matrix.
[0023] Optionally, dividing the three-channel HDR image into a base layer and a detail layer using a smoothing filter includes:
[0024] Separating the three-channel HDR image into a three-channel brightness domain matrix, and performing gamma domain calculation on the three-channel brightness domain matrix to obtain a gamma domain matrix of the corresponding channel;
[0025] The gamma domain matrix of the corresponding channel is divided into a gamma domain base layer and a gamma domain detail layer using a smoothing filter.
[0026] Optionally, the dynamically compressing the bright and dark regions of the base layer to obtain a compressed base layer of the bright region and a compressed base layer of the dark region includes:
[0027] Perform brightness domain calculation on the gamma domain base layer to obtain a corresponding brightness domain base layer;
[0028] Performing bright area dynamic compression on the brightness domain base layer according to preset bright area compression parameters to obtain a compressed base layer of the bright area;
[0029] The dark area of the brightness domain base layer is dynamically compressed according to preset dark area compression parameters to obtain a compressed base layer of the dark area.
[0030] To achieve the above and other purposes, the present application provides a high dynamic range image compression device, comprising:
[0031] An HDR image input unit, used for acquiring a three-channel HDR image;
[0032] A bright and dark area segmentation matrix unit is used to perform bright and dark area segmentation calculation on the three-channel HDR image to obtain a corresponding bright and dark area segmentation matrix;
[0033] A dynamic range compression unit is used to use a smoothing filter to divide the three-channel HDR image into a base layer and a detail layer, dynamically compress the bright and dark regions of the base layer to obtain a compressed base layer of the bright region and a compressed base layer of the dark region, and merge the detail layers into an LDR image of the bright region and an LDR image of the dark region according to the compressed base layer of the bright region and the compressed base layer of the dark region;
[0034] a bright and dark area merging unit, configured to fuse the LDR image of the bright area and the LDR image of the dark area according to the bright and dark area segmentation matrix to obtain a corresponding three-channel LDR image;
[0035] The LDR image output unit is used to output the three-channel LDR image.
[0036] Optionally, the bright and dark area segmentation matrix unit includes a brightness layer calculation module, a gamma domain brightness calculation module, a histogram statistics module and a bright and dark area segmentation matrix calculation module, wherein:
[0037] The brightness layer calculation module is used to convert the three-channel HDR image into a brightness layer matrix;
[0038] The gamma domain brightness calculation module is used to perform gamma domain conversion on the brightness layer matrix to obtain a brightness layer gamma domain matrix; normalize the brightness layer gamma domain matrix and perform mapping processing on the preset bit width to obtain a gamma domain average brightness value;
[0039] The histogram statistics module is used to perform pixel statistics on the gamma domain matrix of the brightness layer to obtain a global histogram of the brightness layer, wherein the global histogram includes the number of pixels corresponding to different pixel values;
[0040] The bright and dark area segmentation matrix calculation module is used to calculate the bright and dark area segmentation matrix according to the gamma domain average brightness value and the global histogram.
[0041] Optionally, the bright and dark area segmentation matrix calculation module is specifically used for:
[0042] Accumulating pixels level by level on the global histogram to obtain a corresponding cumulative histogram;
[0043] According to the gamma domain average brightness value and the preset brightness parameter, the cumulative histogram is normalized to obtain a normalized cumulative histogram, wherein the normalized cumulative histogram includes percentages of corresponding pixels under different pixel values;
[0044] The gamma domain brightness value of each pixel in the three-channel HDR image is processed according to the normalized cumulative histogram to obtain a bright and dark area segmentation matrix.
[0045] Optionally, the dynamic range compression unit includes a gamma domain calculation module and a smoothing filter module, wherein:
[0046] The gamma domain calculation module is used to separate the three-channel HDR image into a three-channel brightness domain matrix, and perform gamma domain calculation on the three-channel brightness domain matrix to obtain a gamma domain matrix of the corresponding channel;
[0047] The smoothing filter module is used to divide the gamma domain matrix of the corresponding channel into a gamma domain base layer and a gamma domain detail layer using a smoothing filter.
[0048] Optionally, the dynamic range compression unit further includes a base layer dynamic range compression module and a detail layer merging module, wherein:
[0049] The base layer dynamic range compression module is used to perform brightness domain calculation on the gamma domain base layer to obtain a corresponding brightness domain base layer; perform bright area dynamic compression on the brightness domain base layer according to a preset bright area compression parameter to obtain a compressed base layer in the bright area; perform dark area dynamic compression on the brightness domain base layer according to a preset dark area compression parameter to obtain a compressed base layer in the dark area;
[0050] The detail layer merging module is used to merge the gamma domain detail layers into an LDR image of the bright area and an LDR image of the dark area according to the compressed base layer of the bright area and the compressed base layer of the dark area.
[0051] From the above, it can be seen that the present application provides a method and device for high dynamic range image compression, which can achieve the following beneficial effects: it can effectively reduce the halo artifacts generated in the image, preserve the complete image details, suppress the excessive brightness of the bright areas of the image, enhance the contrast of the dark areas, and further improve the overall effect of the image. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 It is a flowchart of a method for high dynamic range image compression provided in an embodiment of the present application.
[0053] Figure 2 It is a distribution diagram of a global histogram provided in an embodiment of the present application.
[0054] Figure 3 It is a schematic diagram of a normalized cumulative histogram provided in an embodiment of the present application.
[0055] Figure 4 It is a schematic diagram of several dynamic range compression curves provided in the embodiments of the present application.
[0056] Figure 5 It is a structural schematic diagram of a high dynamic range image compression device provided in an embodiment of the present application.
[0057] Figure 6 It is a structural schematic diagram of a bright and dark area division matrix unit provided in an embodiment of the present application.
[0058] Figure 7 It is a structural schematic diagram of a dynamic range compression unit provided in an embodiment of the present application. DETAILED DESCRIPTION
[0059] The following describes the implementation of the present application through specific examples and in combination with the accompanying drawings. Those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific examples, and the details in this specification can also be modified and changed in various ways based on different viewpoints and applications without departing from the spirit of the present application.
[0060] The present application proposes a method and device for high dynamic range HDR image compression, which can adaptively divide the bright and dark areas according to the image gamma domain information, and perform dynamic range compression according to the bright and dark areas respectively, so as to effectively reduce the halo artifacts generated in the image, ensure the complete image details, suppress the overbrightness of the bright area and enhance the contrast of the dark area, so as to further improve the overall effect of the image.
[0061] See also Figure 1 , is a flow chart of a method for high dynamic range image compression proposed in this application. Figure 1 The method shown includes the following implementation steps:
[0062] S101: Acquire a three-channel HDR image.
[0063] The HDR image involved in the present application is an input image in a high dynamic range mode, and the input image is a three-channel RGB image, where the three channels refer to an R channel, a G channel, and a B channel.
[0064] S102, performing bright and dark area segmentation calculation on the three-channel HDR image to obtain a corresponding bright and dark area segmentation matrix.
[0065] In order to prevent the original image (i.e., three-channel HDR image) from being overexposed in the highlight area after dynamic range compression, it is necessary to limit the highlight area after dynamic range compression. This application proposes to perform bright and dark area segmentation calculation on the three-channel HDR image to divide the original image into bright and dark areas and obtain the corresponding bright and dark area segmentation matrix, and then perform dynamic compression according to the bright and dark areas respectively, which can not only weaken the halo artifacts generated by the image, but also effectively suppress the over-brightness of the bright area and improve the contrast of the dark area.
[0066] As a possible implementation, the present application uses a brightness calculation formula to convert the three-channel HDR image into a brightness layer matrix, wherein the brightness calculation formula is specifically shown in the following formula (1):
[0067] Yin=0.2989×Rin+0.5870×Gin+0.1140×Bin Formula (1)
[0068] Among them, Yin is the brightness layer matrix, Rin is the matrix corresponding to the R channel in the three-channel HDR image, Gin is the matrix corresponding to the G channel in the three-channel HDR image, and Bin is the matrix corresponding to the B channel in the three-channel HDR image.
[0069] The brightness layer matrix Rin is further transformed into the gamma domain to obtain the brightness layer gamma domain matrix Gammain. Then Gammain is normalized to obtain the gamma domain average brightness value meanGamma, and after normalization, it is mapped to the preset bit width, for example, it is mapped to a 16-bit bit width, and the corresponding brightness layer gamma domain average brightness value Y_meanGamma is calculated. The specific calculation formula involved is shown in the following formula (2):
[0070]
[0071] Among them, gamma is a pre-configured gamma parameter, and the default value of 9.6 is usually selected. floor() is a mathematical function, which is used to round down.
[0072] Further, pixel statistics are performed on the brightness layer gamma domain matrix Gammain to obtain a global histogram Pdf of the brightness layer. The global histogram includes the number of pixels corresponding to different pixel values. For example, based on the 16-bit width brightness layer gamma domain matrix obtained above, the number of pixels corresponding to each pixel value in the 16-bit width of the brightness layer gamma domain matrix is counted to obtain a global histogram Pdf formed by the pixel distribution of the entire brightness layer gamma domain matrix. Figure 2 A possible distribution diagram of the global histogram is shown in FIG. Figure 2 , the horizontal axis represents the pixel value, and the vertical axis represents the number of pixels. Figure 2 The number of pixels (ie, the number of pixels) corresponding to different pixel values is shown.
[0073] Finally, the bright and dark area segmentation matrix Ftm is calculated based on the obtained gamma domain average brightness value and the global histogram Pdf of the brightness layer. Specifically, the present application uses the gamma domain average brightness value meanGamma as the segmentation point to segment the gamma domain matrix Gammain of the brightness layer of the image. The area where the pixel values are less than meanGamma is located is the dark area, and the area where the pixel values are greater than or equal to meanGamma is located is the bright area. Since the transition between the bright area and the dark area is not smooth, it is necessary to calculate the transition matrix of the bright and dark areas based on the global histogram Pdf, that is, the bright and dark area segmentation matrix Ftm.
[0074] In a specific embodiment, the present application performs pixel-by-pixel accumulation calculation on the global histogram Pdf to obtain the corresponding cumulative histogram Cdf. For example, the number of pixels corresponding to the pixel values 0, 1, and 2 in Pdf are 300, 300, and 200, respectively. The number of pixels corresponding to the pixel value 1 in Cdf is: 300+300=600, and the number of pixels corresponding to the pixel value 3 is: 300+300+200=800. The cumulative histogram Cdf is further normalized according to the gamma domain average brightness value meanGamma and the pre-configured brightness parameter Tr to obtain the normalized cumulative histogram Cdf_maxmin. Figure 3 A schematic diagram showing a possible normalized cumulative histogram is shown in FIG. Figure 3 , the horizontal axis represents the pixel value, and the vertical axis represents the percentage. Figure 3 The dotted line shown represents the dividing line between the bright and dark areas, and its corresponding pixel value is meanGamma. Figure 3 The percentage of pixels in the HDR image under each pixel value is shown. The value range of the brightness parameter Tr is [0, 1], and the default value is usually 0.5. The larger the Tr value, the stricter the segmentation of bright and dark areas. When Tr = 1, it means that the percentage of pixels less than meanGamma is all 0, and greater than or equal to meanGamma Figure 3 The curve shown starts to change gradually. When Tr = 0, it means that the pixel value is 0. Figure 3 The curve shown begins to change gradually. The calculation formula involved in the above normalization is shown in the following formula (3):
[0075]
[0076] Finally, the gamma domain brightness value of each pixel in the three-channel HDR image is processed according to the normalized cumulative histogram to obtain the bright and dark area segmentation matrix Ftm. Specifically, let li(x, y) be the gamma domain brightness value corresponding to the coordinate point / pixel point (x, y), then the calculation formula of the bright and dark area segmentation matrix Ftm is shown in the following formula (4):
[0077] Ftm(x,y)=1-Cdf_maxmin(li(x,y)) Formula (4)
[0078] S103: Use a smoothing filter to divide the three-channel HDR image into a base layer and a detail layer.
[0079] S104 , dynamically compressing the bright and dark regions of the base layer to obtain a compressed base layer of the bright region and a compressed base layer of the dark region.
[0080] This application uses a smoothing filter to divide the three-channel HDR image into a base layer and a detail layer, and then only performs dynamic range compression on the base layer. After this processing, the halo artifacts are correspondingly weakened. At the same time, this application performs dynamic range compression based on the bright and dark areas separately, which can effectively suppress the over-brightness of the bright area and improve the contrast of the dark area. In addition, the fully preserved detail layer can fully improve the image effect. Specifically:
[0081] This application separates the original three-channel HDR image into three brightness domain matrices Yin according to the R, G and B channels. k , and then the three brightness domain matrices Yin k Perform gamma domain calculation to obtain the gamma domain matrix Gammain of the corresponding channel k The specific calculation formula is shown in the following formula (5):
[0082] Gammain k =floor((Yin k / max(Yin)) 1 / gamma ×65536) Formula (5)
[0083] Where K represents R channel, G channel or B channel, Yin k Represents the brightness domain matrix on the K channel. Yin is the brightness layer matrix calculated by formula (1). Gamma is the pre-configured gamma parameter, which is consistent with the gamma configuration in the above formula (2). Gammain k It is the gamma domain matrix on the K channel.
[0084] Then use a smoothing filter to convert the gamma domain matrix Gammain of the corresponding channel k Divided into the gamma domain base layer GammaBase on the corresponding channel k and GammaDetail k . Among them, smoothing filtering is a relatively mature filtering algorithm, which can divide the gamma domain brightness matrix Gammain into a gamma domain base layer GammaBase and a gamma domain detail layer GammaDetail. Smoothing filtering includes but is not limited to mean filtering, bilateral filtering, least squares filtering, guided filtering, etc. Preferentially, this application uses a 5x5 smoothing filter obtained through testing, and the filter kernel of the smoothing filter FilterS is:
[0085]
[0086] Its GammaBase k and GammaDetail k The specific calculation formula is shown in formula (6):
[0087]
[0088] Further, according to the obtained gamma domain base layer, it is converted back to the brightness domain for dynamic compression. Traditional dynamic compression methods mainly include automatic gain control, gamma correction and histogram equalization. Due to their simplicity, these methods usually lead to problems such as overexposure, loss of details and noise amplification in the compressed image. The present application combines the average brightness value Y_meanGamma in the gamma domain of the brightness layer, and adaptively compresses the bright and dark areas of the image dynamically according to the preset bright / dark area compression parameters, so as to effectively solve the problems of too bright bright areas and too low contrast in dark areas of the image. Specifically, the present application converts the gamma domain base layer GammaBase k Perform brightness domain conversion calculation to obtain the corresponding brightness domain base layer YBase k Then, according to the average brightness value Y_meanGamma in the gamma domain and the preset bright area compression parameter σ_bright, the brightness domain base layer YBase k Perform dynamic compression on the bright area to obtain the compressed base layer Yc_bright of the bright area. According to the average brightness value Y_meanGamma in the gamma domain and the preset dark area compression parameter σ_dark, the brightness domain base layer YBase k The dark area is dynamically compressed to obtain the compressed base layer Yc_dark of the dark area. The calculation formula involved is shown in the following formula (7):
[0089]
[0090] Among them, Y_meanGamma is the average brightness value in the gamma domain calculated by the above formula (2). The above formula (7) can be used to calculate a relatively perfect S-shaped compression curve. The compression curve of the base layer in the brightness domain with different σ can be as follows: Figure 4 As shown. Figure 4 , the horizontal axis represents the pixel value in the gamma domain, which ranges from 0 to 65535, and the vertical axis represents the output result after dynamic compression, which ranges from 0 to 1. Figure 4 It can be seen that the larger σ is, the stronger the overexposure suppression of the bright area is, the higher the contrast is, but the compression of the dark area is too large; the smaller σ is, the better the contrast of the dark area is, and the bright area is more blurred. Therefore, in this application, the bright area will use a larger σ_bright for calculation, and the dark area will use a smaller σ_dark for calculation. Under normal circumstances, in order to enable the bright and dark areas of the image to be adaptively and dynamically compressed, σ_bright and σ_dark will be calculated using the following formula (8):
[0091]
[0092] S105 . Merge the detail layers into an LDR image of the bright area and an LDR image of the dark area according to the compressed base layer of the bright area and the compressed base layer of the dark area.
[0093] This application merges the detail layer back according to the compressed base layer Yc_bright of the bright area and the compressed base layer Yc_dark of the dark area to obtain the LDR (output) image of the bright area and the LDR (output) image of the dark area. Specifically, the gamma domain detail layer is first converted to the brightness domain to obtain the corresponding brightness domain detail layer; then the brightness domain detail layer is merged back using Yc_bright and Yc_dark. The specific calculation formula involved is shown in the following formula (9):
[0094]
[0095] S106 , fusing the LDR image of the bright area and the LDR image of the dark area according to the bright-dark area segmentation matrix to obtain a corresponding three-channel LDR image.
[0096] After obtaining the LDR images of the bright and dark areas of each channel, the present application fuses them according to the bright and dark area segmentation matrix Ftm calculated above to obtain the final output three-channel LDR image Yout k The specific calculation formula is shown in the following formula (10):
[0097] Yout k =Ftm×Yout_bright k +(1-Ftm)×Yout_dark k Formula (10)
[0098] Among them, Yout k Represents the LDR image corresponding to the output on the K channel.
[0099] By implementing the present application, it is possible to adaptively divide the bright and dark areas according to the image gamma domain information, and dynamically compress the bright and dark areas respectively. At the same time, a smoothing filter is used to stratify the image into a base layer and a detail layer, which can effectively reduce the halo artifacts generated in the image, maintain the complete image details, prevent image overexposure and detail loss, suppress overexposure of bright areas, and enhance the contrast of dark areas, thereby further improving the overall effect of the image.
[0100] See also Figure 5 , is a schematic diagram of the structure of a high dynamic range image compression device provided in an embodiment of the present application. Figure 5 The illustrated apparatus 500 comprises:
[0101] HDR image input unit 501, used to obtain a three-channel HDR image;
[0102] The bright and dark area segmentation matrix unit 502 is used to perform bright and dark area segmentation calculation on the three-channel HDR image to obtain a corresponding bright and dark area segmentation matrix;
[0103] A dynamic range compression unit 503 is used to use a smoothing filter to separate the three-channel HDR image into a base layer and a detail layer, perform dynamic compression of bright and dark areas on the base layer to obtain a compressed base layer of the bright area and a compressed base layer of the dark area, and merge the detail layers into an LDR image of the bright area and an LDR image of the dark area according to the compressed base layer of the bright area and the compressed base layer of the dark area;
[0104] A bright and dark area merging unit 504 is used to fuse the LDR image of the bright area and the LDR image of the dark area according to the bright and dark area segmentation matrix to obtain a corresponding three-channel LDR image;
[0105] The LDR image output unit 505 is used to output the three-channel LDR image.
[0106] See also Figure 6 A possible structural schematic diagram of a bright and dark area segmentation matrix unit 502 is shown, as shown in FIG. Figure 6 The bright and dark area segmentation matrix unit 502 shown may optionally include a brightness layer calculation module 5021, a gamma domain brightness calculation module 5022, a histogram statistics module 5023 and a bright and dark area segmentation matrix calculation module 5024, wherein:
[0107] The brightness layer calculation module 5021 is used to convert the three-channel HDR image into a brightness layer matrix;
[0108] The gamma domain brightness calculation module 5022 is used to perform gamma domain conversion on the brightness layer matrix to obtain a brightness layer gamma domain matrix; normalize the brightness layer gamma domain matrix and perform mapping processing on the preset bit width to obtain a gamma domain average brightness value;
[0109] The histogram statistics module 5023 is used to perform pixel statistics on the gamma domain matrix of the brightness layer to obtain a global histogram of the brightness layer, wherein the global histogram includes the number of pixels corresponding to different pixel values;
[0110] The bright and dark area segmentation matrix calculation module 5024 is used to calculate the bright and dark area segmentation matrix according to the gamma domain average brightness value and the global histogram.
[0111] Optionally, the bright and dark area segmentation matrix calculation module 5024 is specifically used for:
[0112] Accumulating pixels level by level on the global histogram to obtain a corresponding cumulative histogram;
[0113] According to the gamma domain average brightness value and the preset brightness parameter, the cumulative histogram is normalized to obtain a normalized cumulative histogram, wherein the normalized cumulative histogram includes percentages of corresponding pixels under different pixel values;
[0114] The gamma domain brightness value of each pixel in the three-channel HDR image is processed according to the normalized cumulative histogram to obtain a bright and dark area segmentation matrix.
[0115] See also Figure 7 A possible structural diagram of the dynamic range compression unit 503 is shown as follows: Figure 7 The dynamic range compression unit 503 shown may optionally include a gamma domain calculation module 5031, a smoothing filter module 5032, a base layer dynamic range compression module 5033 and a detail layer merging module 5034, wherein:
[0116] The gamma domain calculation module 5031 is used to separate the three-channel HDR image into a three-channel brightness domain matrix, and perform gamma domain calculation on the three-channel brightness domain matrix to obtain a gamma domain matrix of the corresponding channel;
[0117] The smoothing filter module 5032 is used to divide the gamma domain matrix of the corresponding channel into a gamma domain base layer and a gamma domain detail layer using a smoothing filter.
[0118] Optionally, the base layer dynamic range compression module 5033 is used to perform brightness domain calculation on the gamma domain base layer to obtain a corresponding brightness domain base layer; perform bright area dynamic compression on the brightness domain base layer according to a preset bright area compression parameter to obtain a compressed base layer in the bright area; perform dark area dynamic compression on the brightness domain base layer according to a preset dark area compression parameter to obtain a compressed base layer in the dark area;
[0119] The detail layer merging module 5034 is used to merge the gamma domain detail layers into an LDR image of the bright area and an LDR image of the dark area according to the compressed base layer of the bright area and the compressed base layer of the dark area.
[0120] By implementing the present application, it is possible to adaptively divide the bright and dark areas according to the image gamma domain information, and dynamically compress the bright and dark areas respectively. At the same time, a smoothing filter is used to stratify the image into a base layer and a detail layer, which can effectively reduce the halo artifacts generated in the image, maintain the complete image details, prevent image overexposure and detail loss, suppress overexposure of bright areas, and enhance the contrast of dark areas, thereby further improving the overall effect of the image.
[0121] The above embodiments are merely illustrative of the principles and effects of the present application, and are not intended to limit the present application. Any person skilled in the art may modify and change the above embodiments without violating the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be as set forth in the claims.
Claims
1. A method for high dynamic range image compression, characterized in that: include: Get three-channel HDR images; Performing bright and dark area segmentation calculation on the three-channel HDR image to obtain a corresponding bright and dark area segmentation matrix; Using a smoothing filter to divide the three-channel HDR image into a base layer and a detail layer; Dynamically compressing the base layer in bright and dark areas to obtain a compressed base layer in the bright area and a compressed base layer in the dark area; Merging the detail layers into an LDR image of the bright area and an LDR image of the dark area according to the compressed base layer of the bright area and the compressed base layer of the dark area; According to the bright-dark area segmentation matrix, the LDR image of the bright area and the LDR image of the dark area are merged to obtain a corresponding three-channel LDR image; The performing bright and dark area segmentation calculation on the three-channel HDR image to obtain the corresponding bright and dark area segmentation matrix comprises: Convert the three-channel HDR image into a brightness layer matrix; Performing gamma domain conversion on the brightness layer matrix to obtain a brightness layer gamma domain matrix; The brightness layer gamma domain matrix is normalized and mapped to a preset bit width to obtain a gamma domain average brightness value; Performing pixel statistics on the gamma domain matrix of the brightness layer to obtain a global histogram of the brightness layer, wherein the global histogram includes the number of pixels corresponding to different pixel values; A bright and dark area segmentation matrix is calculated according to the gamma domain average brightness value and the global histogram.
2. The method for high dynamic range image compression according to claim 1, characterized in that: The step of calculating the bright and dark area segmentation matrix according to the gamma domain average brightness value and the global histogram comprises: Accumulating pixels level by level on the global histogram to obtain a corresponding cumulative histogram; According to the gamma domain average brightness value and the preset brightness parameter, the cumulative histogram is normalized to obtain a normalized cumulative histogram, wherein the normalized cumulative histogram includes percentages of corresponding pixels under different pixel values; The gamma domain brightness value of each pixel in the three-channel HDR image is processed according to the normalized cumulative histogram to obtain a bright and dark area segmentation matrix.
3. The method for high dynamic range image compression according to claim 1, characterized in that: The step of using a smoothing filter to divide the three-channel HDR image into a base layer and a detail layer comprises: Separating the three-channel HDR image into a three-channel brightness domain matrix, and performing gamma domain calculation on the three-channel brightness domain matrix to obtain a gamma domain matrix of the corresponding channel; The gamma domain matrix of the corresponding channel is divided into a gamma domain base layer and a gamma domain detail layer using a smoothing filter.
4. The method for high dynamic range image compression according to claim 3, characterized in that: The step of dynamically compressing the base layer in bright and dark areas to obtain a compressed base layer in the bright area and a compressed base layer in the dark area comprises: Perform brightness domain calculation on the gamma domain base layer to obtain a corresponding brightness domain base layer; Performing bright area dynamic compression on the brightness domain base layer according to preset bright area compression parameters to obtain a compressed base layer of the bright area; The dark area dynamic compression is performed on the brightness domain base layer according to preset dark area compression parameters to obtain a compressed dark area base layer.
5. A device for high dynamic range image compression, characterized in that: include: An HDR image input unit, used for acquiring a three-channel HDR image; A bright and dark area segmentation matrix unit is used to perform bright and dark area segmentation calculation on the three-channel HDR image to obtain a corresponding bright and dark area segmentation matrix; A dynamic range compression unit is used to use a smoothing filter to divide the three-channel HDR image into a base layer and a detail layer, dynamically compress the bright and dark regions of the base layer to obtain a compressed base layer of the bright region and a compressed base layer of the dark region, and merge the detail layers into an LDR image of the bright region and an LDR image of the dark region according to the compressed base layer of the bright region and the compressed base layer of the dark region; a bright and dark area merging unit, configured to fuse the LDR image of the bright area and the LDR image of the dark area according to the bright and dark area segmentation matrix to obtain a corresponding three-channel LDR image; An LDR image output unit, used for outputting the three-channel LDR image; The bright and dark area segmentation matrix unit includes a brightness layer calculation module, a gamma domain brightness calculation module, a histogram statistics module and a bright and dark area segmentation matrix calculation module, wherein: The brightness layer calculation module is used to convert the three-channel HDR image into a brightness layer matrix; The gamma domain brightness calculation module is used to perform gamma domain conversion on the brightness layer matrix to obtain a brightness layer gamma domain matrix; normalize the brightness layer gamma domain matrix and perform mapping processing on the preset bit width to obtain a gamma domain average brightness value; The histogram statistics module is used to perform pixel statistics on the gamma domain matrix of the brightness layer to obtain a global histogram of the brightness layer, wherein the global histogram includes the number of pixels corresponding to different pixel values; The bright and dark area segmentation matrix calculation module is used to calculate the bright and dark area segmentation matrix according to the gamma domain average brightness value and the global histogram.
6. The high dynamic range image compression device according to claim 5, characterized in that: The bright and dark area segmentation matrix calculation module is specifically used for: Accumulating pixels level by level on the global histogram to obtain a corresponding cumulative histogram; According to the gamma domain average brightness value and the preset brightness parameter, the cumulative histogram is normalized to obtain a normalized cumulative histogram, wherein the normalized cumulative histogram includes percentages of corresponding pixels under different pixel values; The gamma domain brightness value of each pixel in the three-channel HDR image is processed according to the normalized cumulative histogram to obtain a bright and dark area segmentation matrix.
7. The high dynamic range image compression device according to claim 5, characterized in that: The dynamic range compression unit includes a gamma domain calculation module and a smoothing filter module, wherein: The gamma domain calculation module is used to separate the three-channel HDR image into a three-channel brightness domain matrix, and perform gamma domain calculation on the three-channel brightness domain matrix to obtain a gamma domain matrix of the corresponding channel; The smoothing filter module is used to divide the gamma domain matrix of the corresponding channel into a gamma domain base layer and a gamma domain detail layer using a smoothing filter.
8. The high dynamic range image compression device according to claim 7, characterized in that: The dynamic range compression unit further comprises a base layer dynamic range compression module and a detail layer merging module, wherein: The base layer dynamic range compression module is used to perform brightness domain calculation on the gamma domain base layer to obtain a corresponding brightness domain base layer; perform bright area dynamic compression on the brightness domain base layer according to a preset bright area compression parameter to obtain a compressed base layer in the bright area; perform dark area dynamic compression on the brightness domain base layer according to a preset dark area compression parameter to obtain a compressed base layer in the dark area; The detail layer merging module is used to merge the gamma domain detail layers into an LDR image of the bright area and an LDR image of the dark area according to the compressed base layer of the bright area and the compressed base layer of the dark area.
