Bilateral Filtering
Introduction to Digital Image Processing1051.782
Carl Salvaggio
Chester F. Carlson Center for Imaging ScienceCollege of Science
Rochester Institute of Technology
Spring Quarter 2009-2010
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
Noise Reduction
I Noise typically presents itself in imagery as a random,high-frequency, uncorrelated modulation in the signal level
I Typical methods for noise removal areI Spatial filtering with a blur kernelI Frequency domain filtering with a lowpass filterI Nonlinear filtering using a statistical filter such as the median
filter
I All of these method reduce the appearance of noise in theimage, but at the expense of other high-frequencyinformation, most notably edge detail
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
Traditional Approaches
Original Image
Original Image + N(0, 10) Gaussian Filter (σ = 5) Median Filter (10x10)
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
Bilateral Filtering for Gray and Color Images
“Bilateral filtering smooths images while preserving edges, bymeans of a nonlinear combination of nearby image values. Themethod is noniterative, local, and simple. It combines gray levelsor colors based on both their geometric closeness and theirphotometric similarity, and prefers near values to distant values inboth domain and range. In contrast with filters that operate onthe three bands of a color image separately, a bilateral filter canenforce the perceptual metric underlying the CIE-Lab color space,and smooth colors and preserve edges in a way that is tuned tohuman perception. Also, in contrast with standard filtering,bilateral filtering produces no phantom colors along edges in colorimages, and reduces phantom colors where they appear in theoriginal image.”[Tomasi & Manduchi, 1998]
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
The Idea - Spatial Domain
A lowpass spatial domain filter applied to a multiband image f(x)produces a multiband response image as follows
h(x) =1
kd(x)
∫ ∞−∞
∫ ∞−∞
f(ξ)c(ξ, x)dξ (1)
where c(ξ, x) is a measure of geometric closeness between theneighborhood center x and a nearby point ξ. The normalizationfactor kd(x) is given by
kd(x) =
∫ ∞−∞
∫ ∞−∞
c(ξ, x)dξ (2)
If the filter is shift-invariant, c(ξ, x) is only a function of the vectordifference ξ − x and kd(x) is a constant.
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
The Idea - Range Domain
Range (brightness) domain filtering is carried out similarly as
h(x) =1
kr (x)
∫ ∞−∞
∫ ∞−∞
f(ξ)s(f(ξ), f(x))dξ (3)
where s(f(ξ), f(x)) measures the photometric (brightness)similarity between the pixel at the neighborhood center and that ofa nearby point ξ.
The normalization factor in this case is
kr (x) =
∫ ∞−∞
∫ ∞−∞
s(f(ξ), f(x))dξ (4)
Note that the normalization factor in the range filtering case isdependent on the image f and as such nonlinear.
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
The Idea - Bilateral Filter
Bilateral filtering simultaneously combines the spatial and rangedomain filters
h(x) =1
k(x)
∫ ∞−∞
∫ ∞−∞
f(ξ)c(ξ, x)s(f(ξ), f(x))dξ (5)
where the normalization factor is
k(x) =
∫ ∞−∞
∫ ∞−∞
c(ξ, x)s(f(ξ), f(x))dξ (6)
This process replaces the pixel at x with an average ofphotometric/radiometric similar and nearby pixel values.
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
The Gaussian Case
The most common implementation of bilateral filtering utilizes theshift-invariant Gaussian filter for both the closeness, c(ξ, x), andthe similarity, s(f(ξ), f(x)) functions. These filters are Gaussianfunctions of the Euclidean distance between their arguments.
For the closeness function we have
c(ξ, x) = e− 1
2
“d(ξ,x)σd
”2
(7)
where d(ξ, x) is the Euclidean distance between x and ξ
d(ξ, x) = d(ξ − x) = ‖ξ − x‖ (8)
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
The Gaussian Case (continued)
Analogously we have the similarity function
s(ξ, x) = e− 1
2
“δ(f(ξ),f(x))
σr
”2
(9)
where δ(φ, f) is the Euclidean distance between two suitableintensity measures φ and f, namely
δ(φ, f) = δ(φ− f) = ‖φ− f‖ (10)
which in the greyscale image case could simply involve imageintensity values.
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
The Gaussian Case (continued)
Current Neighborhood Closeness Filter Similarity Filter Bilateral Filter
f(ξ) c(ξ, x) = e− 1
2
„d(ξ,x)σd
«2
s(ξ, x) = e− 1
2
„δ(f(ξ),f(x))
σr
«2
c(ξ, x)s(ξ, x)
σd = 5, σr = 50
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
Bilateral Filter Visualization
Row 192Row 128Row 127
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
σd = 1
σd = 3
σd = 5
σd = 10
σr = 10 σr = 30 σr = 50 σr = 100 σr = 300
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
Color Image Filtering
When filtering true color images, the range/similarity filter is bestdefined in a CIE-Lab color space where Euclidean distance isproportional to perceptible color changes.
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
RGB to CIE-Lab Conversion
This is a two-step process. First the RGB color triplet needs to beconverted to tristimulus values as
R =
{ (R+0.055
1.055
)2.4if R > 0.04045
R12.92 otherwise
G =
{ (G+0.055
1.055
)2.4if G > 0.04045
G12.92 otherwise
B =
{ (B+0.055
1.055
)2.4if B > 0.04045
B12.92 otherwise
(11)
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
RGB to CIE-Lab Conversion (continued)
and XYZ
=
0.4124564 0.3575761 0.18043750.2126729 0.7151522 0.07217500.0193339 0.1191920 0.9503041
R
G
B
(12)
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
RGB to CIE-Lab Conversion (continued)
Second, the tristimulus values need to be converted to CIE-Labspace (with reference to a particular illuminant) as
L = 116f
(Y
Yreference
)− 16
a = 500
[f
(X
Xreference
)− f
(Y
Yreference
)]b = 200
[f
(Y
Yreference
)− f
(Z
Zreference
)](13)
where
f (x) =
{x
13 if x > 0.008856
7.787x + 16116 otherwise
(14)
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
RGB to CIE-Lab Conversion (continued)
and the white reference tristimulus values for several differentstandard illuminants are given in the following table
Illuminant Xreference Yreference Zreference
D65 (daylight)* 95.0430 100.0000 108.8801A (tungsten) 109.8490 100.0000 35.5825
F2 (cool white fluorescent) 99.1858 100.0000 67.3938F11 (narrow band fluorescent) 100.9610 100.0000 64.3506
F7 (daylight fluorescent) 95.0416 100.0000 108.7489F8 (daylight fluorescent) 96.4274 100.0000 82.4211
* typically used for RGB values on an standard display
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
Example
Original σd = 10, σr = 1 (CIE L*a*b*)
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
Example - Iterative Application
Original σd = [5, 5, 5], σr = [1, 1, 1] (CIE L*a*b*)
Carl Salvaggio Introduction to Digital Image Processing
Bilateral Filtering
References
Tomasi, C. & Manduchi, R. (1998).In Proceedings of the 1998 IEEE International Conferenceon Computer Vision IEEE, Bombay, India.
Carl Salvaggio Introduction to Digital Image Processing