From CS294-69 Image Manipulation and Computational Photography Fa11
Name: Hong Wu
Assignment: Assignment 2
Course: CS294-69, Fall 2011, UC Berkeley
Paper Implemented: Fast Bilateral Filtering for the Display of High-Dynamic-Range Images. Fredo Durand and Julie Dorsey. SIGGRAPH 2002. (pdf)
The goal of the above paper is to reduce the contrast of the image without losing detail of the object. The paper used bilateral filter to preserve the edge and applied down-sampling and up-sampling to accelerate the speed. The paper claimed users do not need to tune any parameters.
My implementation follow the guild line of author's website (link). For better explanation and understand. The comparison are based on the use of fast bilateral filter, no filter and gaussian filter.
We need to pay attention that the output image actually needs to be fine tuned. In the implementation, the program set a threshold for cutting the intensity which is very high but very rare, shown as Figure 2. All the intensities above the threshold are set to the threshold. By doing this, the range of the intensities will not be dominated by some rarely occurred intensities so that the image becomes brighter. The threshold in my implementation is set to 1.5
Some codes are as follows:
% input the image
input = hdrread('all_probes\indoor.hdr');
R = input(:,:,1); G = input(:,:,2); B = input(:,:,3);
r = R./intensity; g = G./intensity; b = B./intensity; intensity = log10(intensity);
% select the filter and deal with base image and detail image differently
base = bilateralFilter(intensity); % fast bilateral filter
%base = intensity; % no filter
%h = fspecial('gaussian',16,1); % gaussian filter
%base = imfilter(intensity, h);
detail = intensity - base;
targetContrast = log10(5);
compressionFactor = targetContrast/(max(base(:)) - min(base(:)));
log_abs_scale = max(base(:)) * compressionFactor;
output = base*compressionFactor+detail - log_abs_scale;
newR = r.*(10.^output); newG = g.*(10.^output); newB = b.*(10.^output);
% fine tune and recombine to RGB images
highcut = 1.5;
newR(newR>highcut) = highcut; newG(newG>highcut) = highcut; newB(newB>highcut) = highcut;
newR = uint8(newR/highcut*255); newG = uint8(newG/highcut*255); newB = uint8(newB/highcut*255);
output = cat(3, newR,newG,newB);
Figure 1 shows the result by using different filter. Gaussian filter is not good because it deal with background and detail information
Figure 1: From memorial.hdr (Left): Using Fast Bilateral Filtering. (Middle): Using No Filter. (Right): Using Gaussian Filter
Figure 2: Histogram of the memorial image after bilateral filtering. X axis is the intersity. Y axis is the number of pixel in the slot.
Figure 3: From Fog.hdr (Left): Using Fast Bilateral Filtering. (Middle): Using No Filter. (Right): Using Gaussian Filter
Figure 4: From indoor.hdr, the image uses Fast Bilateral Filtering.
Figure 5: From kitchen_probe.hdr, the image uses Fast Bilateral Filtering.