+ All Categories
Home > Documents > A Gentle Introduction to Bilateral Filtering and its Applications...

A Gentle Introduction to Bilateral Filtering and its Applications...

Date post: 18-Sep-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
31
A Gentle Introduction to Bilateral Filtering and its Applications A Gentle Introduction to Bilateral Filtering and its Applications “Fixing the Gaussian Blur”: the Bilateral Filter Sylvain Paris – MIT CSAIL
Transcript
Page 1: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

A Gentle Introductionto Bilateral Filteringand its Applications

A Gentle Introductionto Bilateral Filteringand its Applications

“Fixing the Gaussian Blur”: the Bilateral Filter

Sylvain Paris – MIT CSAIL

Page 2: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

Blur Comes from Averaging across EdgesBlur Comes from Averaging across Edges

*

*

*

input output

Same Gaussian kernel everywhere.

Page 3: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

Bilateral FilterNo Averaging across EdgesBilateral FilterNo Averaging across Edges

*

*

*

input output

The kernel shape depends on the image content.

[Aurich 95, Smith 97, Tomasi 98]

Page 4: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

space weight

not new

range weight

I

new

normalizationfactor

new

Bilateral Filter Definition:an Additional Edge TermBilateral Filter Definition:an Additional Edge Term

( ) ( )−− IIGG qpqp ||||||rs σσ∑

=SW qp

1 IIBF qp][

Same idea: weighted average of pixels.

Page 5: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

Illustration a 1D ImageIllustration a 1D Image

• 1D image = line of pixels

• Better visualized as a plot

pixelintensity

pixel position

Page 6: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

space

Gaussian Blur and Bilateral FilterGaussian Blur and Bilateral Filter

space rangenormalization

Gaussian blur

( ) ( )∑∈

−−=S

IIIGGW

IBFq

qqpp

p qp ||||||1][rs σσ

Bilateral filter[Aurich 95, Smith 97, Tomasi 98]

space

spacerange

p

p

q

q

( )∑∈

−=S

IGIGBq

qp qp ||||][ σ

Page 7: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

qqpp

Bilateral Filter on a Height FieldBilateral Filter on a Height Field

output input

( ) ( )∑∈

−−=S

IIIGGW

IBFq

qqpp

p qp ||||||1][rs σσ

pp

reproducedfrom [Durand 02]

Page 8: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

Space and Range ParametersSpace and Range Parameters

• space σs : spatial extent of the kernel, size of the considered neighborhood.

• range σr : “minimum” amplitude of an edge

( ) ( )∑∈

−−=S

IIIGGW

IBFq

qqpp

p qp ||||||1][rs σσ

Page 9: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

Influence of PixelsInfluence of Pixels

pp

Only pixels close in space and in range are considered.

space

range

Page 10: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

σs = 2

σr = 0.1 σr = 0.25σr = ∞

(Gaussian blur)

σs = 6

σs = 18

input

Exploring the Parameter SpaceExploring the Parameter Space

Page 11: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

σs = 2

σr = 0.1 σr = 0.25σr = ∞

(Gaussian blur)

σs = 6

σs = 18

input

Varying the Range ParameterVarying the Range Parameter

Page 12: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

input

Page 13: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

σr = 0.1

Page 14: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

σr = 0.25

Page 15: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

σr = ∞(Gaussian blur)

Page 16: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

σs = 2

σs = 6

σs = 18

σr = 0.1 σr = 0.25σr = ∞

(Gaussian blur)

input

Varying the Space ParameterVarying the Space Parameter

Page 17: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

input

Page 18: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

σs = 2

Page 19: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

σs = 6

Page 20: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

σs = 18

Page 21: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

How to Set the ParametersHow to Set the Parameters

Depends on the application. For instance:

• space parameter: proportional to image size– e.g., 2% of image diagonal

• range parameter: proportional to edge amplitude– e.g., mean or median of image gradients

• independent of resolution and exposure

Page 22: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

A FewMore Advanced

Remarks

A FewMore Advanced

Remarks

Page 23: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

Bilateral Filter Crosses Thin LinesBilateral Filter Crosses Thin Lines• Bilateral filter averages across

features thinner than ~2σs

• Desirable for smoothing: more pixels = more robust• Different from diffusion that stops at thin lines

close-up kernel

Page 24: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

Iterating the Bilateral FilterIterating the Bilateral Filter

• Generate more piecewise-flat images

• Often not needed in computational photo.

][ )()1( nn IBFI =+

Page 25: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

input

Page 26: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

1 iteration

Page 27: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

2 iterations

Page 28: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

4 iterations

Page 29: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

Bilateral Filtering Color ImagesBilateral Filtering Color Images

( ) ( )∑∈

−−=S

IIIGGW

IBFq

qqpp

p qp ||||||1][rs σσ

( ) ( )∑∈

−−=S

GGW

IBFq

qqpp

p CCCqp ||||||||1][rs σσ

For color images color difference

For gray-level images intensity difference

The bilateral filter isThe bilateral filter isextremely easy to adapt to your need.extremely easy to adapt to your need.

scalar

3D vector (RGB, Lab)

input

output

Page 30: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

Hard to ComputeHard to Compute

• Nonlinear

• Complex, spatially varying kernels– Cannot be precomputed, no FFT…

• Brute-force implementation is slow > 10min

( ) ( )∑∈

−−=S

IIIGGW

IBFq

qqpp

p qp ||||||1][rs σσ

Page 31: A Gentle Introduction to Bilateral Filtering and its Applications ...people.csail.mit.edu/sparis/bf_course/slides/03...A Gentle Introduction to Bilateral Filtering and its Applications

Questions?Questions?


Recommended