Original Image
Original1
Original2
Original3
Original4
Local Tone mapping Process
Intensity Image
Base Image
Detail Image
Final Tone mapping + gamma correction
Result Comparison
Naive HDR
Weighted HDR
Tone mapping + Gamma Correction
As you can see Weighted HDR shows more details on the dark and white part and the Tone mapping results shows even more detail on the white and dark part
Matlab Code For Local Tone mapping
function img = LocalToneMapping(hdr)
img = double(hdr);
% Calculate the Intensity Image
% Based on https://en.wikipedia.org/wiki/Relative_luminance
I = 0.2126 * img(:,:,1) + 0.7152 * img(:,:,2) + 0.0722 * img(:,:,3);
% Get log domain Intensity
L = log2(I);
% Get base image
B = bilateralFilter(L);
% Get Detail image
D = L - B;
% Contrast reduction only on the base
maxb = max(B(:));
minb = min(B(:));
% Scale base image
s = 3/(maxb-minb);
ajtB = (B-maxb).*s;
O = 2.^(ajtB+D);
% Reconstruct Color Chanel
img(:,:,1) = O.*(img(:,:,1)./I);
img(:,:,2) = O.*(img(:,:,2)./I);
img(:,:,3) = O.*(img(:,:,3)./I);
% linearly scale to 0~1
img = linearScalImage(img);
% Apply gamma correction
img = img.^0.6;
[h,s,v] = rgb2hsv(img);
h = h.^1.2;
s = s.^1.1;
v = v.^0.7;
[rr, gg, bb] = hsv2rgb(h,s,v);
img(:,:,1) = rr;
img(:,:,2) = gg;
img(:,:,3) = bb;
end
Original Images
Original1
Original2
Original3
Original4
Original5
Original6
Recovered Log radiance image
recovered1
recovered2
recovered3
recovered4
recovered5
recovered6
The recovered log irradiance image of different shutter speed image looks the same. Because we are using the same camera and the only difference is the shutter speed(irradiance is the same), I*/exposure will put them all in the same exposure thus they look the same.
Estimated function G
Red
Green
Blue
HDR result
Naive avg
Weighted avg
Response Function
As you can see, the weighted HDR result shows more detail on the dark and white part while the the response function HDR has a color shift(compare to the naive HDR and weighted HDR) because we estimate the response function of the camera and re-mapping pixle values
Panoramic transformations
Normal
Reflection
Phi-The
Response Function HDR
Panoramic Image
For the Panoramic transformations, we first compute the normal image of the sphere and them compute the reflection image and finally compute the Theta Phi image and map the Theta Phi from the sphere coordinate to a rectengular Theta Phi coordinates.
Blend result
Objects
Without objects
Mask
Empty
With Objects