Summary of the invention
The purpose 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 exist in the existing method.
The technical scheme that the present invention adopts does, a kind of high dynamic range image tone mapping method is implemented according to following steps:
Step 1 is obtained 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 is carried out multiple dimensioned WLS filtering to L, estimates multiple dimensioned illumination component L
k, k=1 wherein, 2 ..., with " halation " phenomenon of avoiding the strong place of light and shade contrast to produce, it is expressed as:
L
k=WLS(L,λ
k),
Wherein operator WLS () representes 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, can confirm its value according to the experiment situation usually;
Step 3 adopts multiple dimensioned Retinex method to recover the brightness composition of high dynamic range images, that is:
Wherein N represents yardstick number, ω
kBe the weight coefficient of different scale, and
Step 4 is to R
LGet index, obtain 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 carries out normalization, obtains R
2, that is:
M wherein
sBe R
1After middle pixel value sorts from small to large, the R that 1% pixel place is corresponding
1Value; m
lBe R
1After middle pixel value sorts from small to large, the R that 99% pixel place is corresponding
1Value;
Step 6 adopts the self-adaptation adjustment function to R
2Regulate, and its gray-scale value is mapped to the scope of [0,255], that is:
Wherein, regulate the image that parameter b can obtain different bright-dark degrees, the span of b is [0.5,1.0];
Step 7 is introduced index control saturation degree, adopts following computing formula, carries out color recovery, promptly accomplishes the high dynamic range image 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 " halation " problem that exists in the tone map process preferably; Through removing two extreme 1% gray level and adopting the self-adaptation adjustment function, make image after the tone map have contrast height, characteristics that the details display effect is good, can on the low-dynamic range display device, can reproduce high dynamic range images better.
Embodiment
Through embodiment the present invention is elaborated below.
High dynamic range image tone mapping method of the present invention, implement according to following steps:
Step 1 is obtained 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 is carried out multiple dimensioned WLS filtering to L, estimates multiple dimensioned illumination component L
k, k=1 wherein, 2 ..., with " halation " phenomenon of avoiding the strong place of light and shade contrast to produce, it is expressed as:
L
k=WLS(L,λ
k),
Wherein operator WLS () representes 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, confirm its value according to the experiment situation usually.
For multiple dimensioned WLS filtering, it specifically is calculated as:
L
k=(I+λ
kL
g)
-1L,
Wherein, I is a unit matrix, λ
kBe scale factor, L
gFor:
D wherein
x, D
yBe respectively the level and the vertical direction difference factor, 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 the image border, and span is 1.0-1.8; Parameter l=log (L+0.000001), constant ε value is 0.00001, mainly is 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
kBe the weight coefficient of different scale, and
Step 4, the R that step 3 is obtained
LGet index, obtain 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 carries out normalization, obtains R
2, that is:
Wherein, m
sBe R
1After middle pixel value sorts from small to large, the R that 1% pixel place is corresponding
1Value; m
lBe R
1After middle pixel value sorts from small to large, the R that 99% pixel place is corresponding
1Value;
Step 6 adopts the 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 regulating parameter b can obtain the image of different bright-dark degrees, and the span of b is [0.5,1.0];
Step 7 is introduced index control saturation degree, adopts following computing formula, carries out color recovery:
Promptly accomplish the high dynamic range image tone mapping.
Embodiment 1
High dynamic range image tone mapping method of the present invention, implement through following steps and concrete parameter:
Step 1 reads high dynamic range images, is the data of the rgb format of integer with the data-switching of its floating type, calculates the luminance picture L of this high dynamic range images then
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 is carried out multiple dimensioned WLS filtering to L, estimates multiple dimensioned illumination component L
k(k=1,2, L), with " halation " phenomenon of avoiding the strong place of light and shade contrast to produce.It can be expressed as:
L
k=WLS(L,λ
k),
Wherein operator WLS () representes 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, confirm its value according to the experiment situation usually.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 specifically is calculated as: L
k=(I+ λ
kL
g)
-1L,
Wherein I is a unit matrix, λ
kBe scale factor, L
gFor:
Wherein, D
x, D
yBe respectively the level and the vertical direction difference factor, 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 got α=1.5 in the present embodiment.
Step 3 adopts multiple dimensioned Retinex method to recover the brightness composition of high dynamic range images, that is:
ω wherein
kBe 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.Take
Step 4 is to R
LGet index, obtain 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 carries out normalization, obtains R
2, that is:
M wherein
sBe R
1After middle pixel value sorts from small to large, the R that 1% pixel place is corresponding
1Value; m
lBe R
1After middle pixel value sorts from small to large, the R that 99% pixel place is corresponding
1Value;
Step 6 adopts the 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 is introduced index control saturation degree, adopts following computing formula, in the present embodiment, gets s=12.2.
Carry out color recovery, can accomplish the high dynamic range image tone mapping.
Fig. 1 is that the embodiment of the invention 1 is handled the high dynamic range images that the back shows.For the effect of the inventive method is described better; Fig. 2 adopts existing method; Promptly handle the high dynamic range images that the back shows based on the high dynamic range image tone mapping method of Retinex; Fig. 3 is that comparison diagram is amplified in the part of Fig. 1 and Fig. 2, and wherein the first half of Fig. 3 is the partial enlarged drawing at the black surround position among Fig. 1, and the Lower Half of Fig. 3 is the partial enlarged drawing at the black surround position among Fig. 2.Can contrast from Fig. 3 and to find out, adopt the inventive method to compare, can remove " halation " phenomenon that high dynamic range image tone mapping back exists better with existing method based on Retinex.What be worth explanation is, the inventive method and existing method are colored images to what handle, limit owing to declare the requirement of text, and institute's drawings attached has become gray-scale map and shown, its " halation " phenomenon does not have coloured image true to nature.
High dynamic range image tone mapping method of the present invention, to " halation " phenomenon that is prone in the localization tone mapping method produce, through WLS Filtering Estimation illumination component, " halation " phenomenon that can avoid the strong place of light and shade contrast to produce; Through removing the gray level at two extreme 1% places, prevent under-exposure and generation overexposure, adopt the self-adaptation adjustment function that the light and shade of image is regulated, make image after the tone map have contrast height, characteristics that the details display effect is good.