Summary of the invention
The object of this invention is to provide a kind of high dynamic range image tone mapping method, solved " halation " and the imperfect problem of display effect that in existing method, exist.
The technical solution used in the present invention is, a kind of high dynamic range image tone mapping method is implemented according to following steps:
Step 1, obtains the luminance picture L of high dynamic range images
in, and the formation log-domain luminance picture L that takes the logarithm, R wherein, G, B are respectively the red, green, blue color value of each pixel of high dynamic range images, and it is calculated as:
L
in=0.299R+0.587G+0.114B,
L=log(L
in+0.00001);
Step 2, carries out multiple dimensioned WLS filtering to L, estimates multiple dimensioned illumination component L
k, k=1 wherein, 2 ..., to avoid comparison of light and shade strongly to locate " halation " phenomenon producing, it is expressed as:
L
k=WLS(L,λ
k),
Wherein operator WLS () represents to carry out WLS filtering, λ
krepresent scale factor, its value has determined illumination component image L
klevel and smooth degree, increase λ
k, will make level and smooth degree increase, conventionally can determine its value according to experiment situation;
Step 3, adopts multiple dimensioned Retinex method to recover the brightness composition of high dynamic range images, that is:
Wherein N represents yardstick number, ω
kfor the weight coefficient of different scale, and
Step 4, to R
lfetching number, obtains R
1, that is: R
1=exp (R
l);
Step 5, cancellation R
1two extreme 1% gray level, prevents under-exposure and generation overexposure, and is normalized, and obtains R
2, that is:
M wherein
sr
1after middle pixel value sorts from small to large, 1% the corresponding R in pixel place
1value; m
lr
1after middle pixel value sorts from small to large, 99% the corresponding R in pixel place
1value;
Step 6, adopts self-adaptation adjustment function to R
2regulate, and its gray-scale value is mapped to the scope of [0,255], that is:
Wherein, regulate parameter b can obtain the image of different bright-dark degrees, the span of b is [0.5,1.0];
Step 7, introduces index and controls saturation degree, adopts following computing formula, carries out color recovery, completes high dynamic range image tone mapping:
Its Exponential s is for controlling saturation degree, R
out, G
out, B
outbe respectively the red, green, blue color value that high dynamic range images finally obtains after tone mapping.
The invention has the beneficial effects as follows, adopt multiple dimensioned WLS wave filter to estimate the illumination component of high dynamic range images, overcome preferably " halation " problem existing in tone mapping process; By removing two extreme 1% gray level and adopting self-adaptation adjustment function, make the image after tone mapping have the advantages that contrast is high, details display effect is good, can on low-dynamic range display device, can reproduce better high dynamic range images.
Embodiment
Below by embodiment, the present invention is described in detail.
High dynamic range image tone mapping method of the present invention, according to following steps, implement:
Step 1, obtains the luminance picture L of high dynamic range images
in, and the formation log-domain luminance picture L that takes the logarithm, R wherein, G, B are respectively the red, green, blue color value of each pixel of high dynamic range images, and it is calculated as:
L
in=0.299R+0.587G+0.114B,
L=log(L
in+0.00001);
Step 2, carries out multiple dimensioned WLS filtering to L, estimates multiple dimensioned illumination component L
k, k=1 wherein, 2 ..., to avoid comparison of light and shade strongly to locate " halation " phenomenon producing, it is expressed as:
L
k=WLS(L,λ
k),
Wherein operator WLS () represents to carry out WLS filtering, λ
krepresent scale factor, its value has determined illumination component image L
klevel and smooth degree, increase λ
k, will make level and smooth degree increase, conventionally according to experiment situation, determine its value.
For multiple dimensioned WLS filtering, it is specifically calculated as:
L
k=(I+λ
kL
g)
-1L,
Wherein, I is unit matrix, λ
kfor scale factor, L
gfor:
D wherein
x, D
ybe respectively horizontal and vertical direction differential sampling parameter, T represents transpose of a matrix, A
x, A
ybe diagonal matrix, its diagonal entry is respectively a
x,p(L), a
y,p(L), it is calculated as:
Wherein parameter alpha is used for representing to control the sensitivity of smoothing process to image border, and span is 1.0-1.8; Parameter l=log (L+0.000001), constant ε value is 0.00001, is mainly in order to prevent that denominator from being zero situation appearance.
Step 3, adopts multiple dimensioned Retinex method to recover the brightness composition of high dynamic range images, that is:
N represents scale parameter, generally gets 3 yardsticks.
ω wherein
kfor the weight coefficient of different scale, and
Step 4, the R that step 3 is obtained
lfetching number, obtains R
1, that is: R
1=exp (R
l);
Step 5, cancellation R
1two extreme 1% gray level, prevents under-exposure and generation overexposure, and is normalized, and obtains R
2, that is:
Wherein, m
sr
1after middle pixel value sorts from small to large, 1% the corresponding R in pixel place
1value; m
lr
1after middle pixel value sorts from small to large, 99% the corresponding R in pixel place
1value;
Step 6, adopts self-adaptation adjustment function to R
2regulate, and its gray-scale value is mapped to the scope of [0,255], that is:
wherein, the numerical value of adjusting parameter b can obtain the image of different bright-dark degrees, and the span of b is [0.5,1.0];
Step 7, introduces index and controls saturation degree, adopts following computing formula, carries out color recovery:
Complete high dynamic range image tone mapping,
Its Exponential s is for controlling saturation degree, R
out, G
out, B
outbe respectively the red, green, blue color value that high dynamic range images finally obtains after tone mapping.
Embodiment 1
High dynamic range image tone mapping method of the present invention, by following steps and design parameter, implement:
Step 1, reads high dynamic range images, the data of its floating type is converted to the data of the rgb format of integer, then calculates the luminance picture L of this high dynamic range images
in, and the formation log-domain luminance picture L that takes the logarithm, it is calculated as:
L
in=0.299R+0.587G+0.114B,
L=log(L
in+0.00001),
Step 2, carries out multiple dimensioned WLS filtering to L, estimates multiple dimensioned illumination component L
k(k=1,2, L), to avoid comparison of light and shade strongly to locate " halation " phenomenon producing.It can be expressed as:
L
k=WLS(L,λ
k),
Wherein operator WLS () represents to carry out WLS filtering, λ
krepresent scale factor, its value has determined illumination component image L
klevel and smooth degree, increase λ
k, will make level and smooth degree increase, conventionally according to experiment situation, determine its value.In the present embodiment, adopt three yardsticks, i.e. k=1,2,3, get λ
1=1, λ
2=5, λ
3=25.
For multiple dimensioned WLS filtering, it is specifically calculated as: L
k=(I+ λ
kl
g)
-1l,
Wherein I is unit matrix, λ
kfor scale factor, L
gfor:
Wherein, D
x, D
ybe respectively horizontal and vertical direction differential sampling parameter, A
x, A
ybe diagonal matrix, its diagonal entry is respectively a
x,p(L), a
y,p(L), it is calculated as:
Wherein parameter alpha in the present embodiment, is got α=1.5.
Step 3, adopts multiple dimensioned Retinex method to recover the brightness composition of high dynamic range images, that is:
ω wherein
kfor the weight coefficient of different scale, and
in the present embodiment, get 3 yardsticks, get accordingly ω
1=0.25, ω
2=0.5, ω
3=0.25.Get
Step 4, to R
lfetching number, obtains R
1, that is: R
1=exp (R
l);
Step 5, cancellation R
1two extreme 1% gray level, prevents under-exposure and generation overexposure, and is normalized, and obtains R
2, that is:
M wherein
sr
1after middle pixel value sorts from small to large, 1% the corresponding R in pixel place
1value; m
lr
1after middle pixel value sorts from small to large, 99% the corresponding R in pixel place
1value;
Step 6, adopts self-adaptation adjustment function to R
2regulate, and its gray-scale value is mapped to the scope of [0,255], that is:
regulate parameter b in the present embodiment, get b=0.78.
Step 7, introduces index and controls saturation degree, adopts following computing formula, in the present embodiment, gets s=1/2.2.Carry out color recovery, can complete high dynamic range image tone mapping.
Its Exponential s is for controlling saturation degree, R
out, G
out, B
outbe respectively the red, green, blue color value that high dynamic range images finally obtains after tone mapping.
Fig. 1 is the high dynamic range images showing after the embodiment of the present invention 1 is processed.For the effect of the inventive method is described better, Fig. 2 adopts existing method, the high dynamic range images that the high dynamic range image tone mapping method based on Retinex shows after processing, Fig. 3 is that comparison diagram is amplified in the part of Fig. 1 and Fig. 2, wherein the first half of Fig. 3 is the partial enlarged drawing at the black surround position in Fig. 1, and the Lower Half of Fig. 3 is the partial enlarged drawing at the black surround position in Fig. 2.From Fig. 3, can contrast and find out, adopt the inventive method to compare with the existing method based on Retinex, can remove better " halation " phenomenon existing after high dynamic range image tone mapping.What deserves to be explained is, the inventive method and existing method are colored images for what process, owing to declaring the requirement of text, limit, and institute's drawings attached has become gray-scale map and shown, its " halation " phenomenon does not have coloured image true to nature.
The tone mapping method of high dynamic range images of the present invention, for " halation " phenomenon easily producing in localization tone mapping method, estimates illumination component by WLS filtering, can avoid comparison of light and shade strongly to locate " halation " phenomenon producing; By removing the gray level at two extreme 1% places, prevent under-exposure and generation overexposure, adopt self-adaptation adjustment function to regulate the light and shade of image, make the image after tone mapping have the advantages that contrast is high, details display effect is good.