study Domain Transform for Edge-Aware Image and Video Processing

54
DOMAIN TRANSFORM FOR EDGE- AWARE IMAGE AND VIDEO PROC ESSING Eduardo S. L. Gastal and Manuel M. Oliveira Instituto de Inform´atica – UFRGS SIGGRAPH 2011 06/13/2022 Domain Transform

Transcript of study Domain Transform for Edge-Aware Image and Video Processing

Page 1: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

DOMAIN TRANSFORM FOR EDGE-AWARE IMAGE AND VIDEO PROCESSINGEduardo S. L. Gastal and Manuel M. Oliveira

Instituto de Inform´atica – UFRGS

SIGGRAPH 2011

Page 2: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

Edge-aware filter• e.g. Bilateral filter

• Weighting F of spacial distance and (color) range distance

Spacial distance is fixed.Fast

Range distance and kernel value has to be calculated Bottleneck !

How about L1 distance ?

How about replacing 2D filter with 1D vertical and horizontal filter ?

How to speed up?No way in most cases !

pq0

||PQ||1 = |xp-xq| + |yp-yq| , ||PQ||2= √((xp-xq)2+(yp-yq)2)

Page 3: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

Abstract• 1D filtering on transformed multiple-dimension domain

e.g. a case of 2D filter on a color image (XY, RGB)

This paper provides high quality edge-preserving smoothing after

• (x, RGB) ct(x). Apply 1D horizontal filter on ct(x)

• (y, RGB) ct(y). Apply 1D vertical filter on ct(y)

• Real-time at arbitrary scale

• Many applications of this real-time edge preserving filter • Depth-of-field effects, stylization, recoloring, colorization, detail

enhancement, and tone mapping.

Page 4: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

Contribution• Real-time high-quality edge aware filtering of image/video

based on a dimensionality reduction • Smoothing on ct(X,RGB) and ct(Y, RGB) ≡ edge preserving on 2D

color image

• Perform anisotropic edge-preserving on curves of 2D image manifold using 1D linear filters• Isotropic kernel on ct(x) ≡ anisotropic kernel on x

• 2D edge-preserving filter as a sequence of 1D linear filter

• The first real-time edge-preserving smoothing• Any scale kernel• Process time independent of the filter parameters• Can control kernel shape• Handle color image correctly

1D

Page 5: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

RELATED WORK

Page 6: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

It’s have been well known that …

2D Smoothing ≡ 1D Edge-preserving

However, replace 1D Bilateral with 2D Gaussian …. High Cost !

Page 7: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

2D Smoothing ≡ 1D Edge-preservingBilateral grid

[Chen et al. SIG07]

Gaussian KD-tree

[Adams et al. SIG09]

higher dimensional functions

Gaussian convolution

division

slicing

w i w

limited for small kernels, coarse problem not real-time

down-sample

Page 9: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

Edge-avoid Wavelets (EAW)• [Raanan Fatta SIG2009]

Constrain the size of the smoothing kernel to 2^n

translation-invariant trans. Edge-avoiding trans.

Edge-avoiding scaling func.

inversely related to the pixel difference.

Page 10: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

DOMAIN TRANSFORM

Page 11: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

Domain transform ct(u)

Smoothing on transformed domain Ωw ≡ Edge-preserving on Ω

Ωw is ct(u)

Page 12: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

I’

|I’|

Page 13: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

|I’|

ct(u) is accumulation of each L1 distance of (x, I(x))

Page 14: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

Domain Transform ct(u)

RG B

ct(u) : (u,I(u)) 1 : 1

ct(u) : (u,I(u)) 1 : 1

ct(u) is accumulation of each L1 distance of (u, I(u))

Page 15: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

Domain Transform ct(u)

RG B

ct(u) : (u,I(u)) 1 : 1

ct(u) : (u,I(u)) 1 : 1

ct(u) is accumulation of each L1 distance of (u, I(u))

Page 16: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

Ωw = ct(u)pq

Page 17: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

Ωw = ct(u)

edge edgeedgeedge

p

q

Page 18: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Smoothing Ωw ≡ Edge-preserving Ω

Ωw is ct(u)

WHY ?

Smoothing Ωw ≡ Edge-preserving Ω

Page 19: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Smoothing Ω can not preserve edge …

Smoothing Ωw ≡ Edge-preserving Ω

Page 20: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Smoothing Ωw ≡ Smoothing neighbors in L1

Sample Ωw uniformly ≡ sample more densely in high |I ’| (edge) Sample Ωw uniformly ≡ along curve in Ω ≡ adaptive kernel Ω |(spatial, color)|-1

L1

sample Ωw uniformly

sampling along the curve

Smoothing on Ω

Smoothing Ωw ≡ Edge-preserving Ω

Page 21: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Filter Attributes

Kernel size of Bilateral filter – σs, σr • σs

2 = variance of spatial kernel. σs radius of spatial kernel

• σr2

= variance of range kernel. σr radius of range kernel

large σs

σr

x

I

pkernel in Ωw

What do σs and σr mean in Ωw ?

Page 22: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Filter Attributes

Kernel size of Bilateral filter – σs, σr • σs

2 = variance of spatial kernel. σs radius of spatial kernel

• σr2

= variance of range kernel. σr radius of range kernel

small σs

σr

x

I

p

What do σs and σr mean in Ωw ?

kernel in Ωw

Page 23: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

Kernel size of Bilateral filter – σs, σr • σs

2 = variance of spatial kernel. σs radius of spatial kernel

• σr2

= variance of range kernel. σr radius of range kernel

small σs

σr

x

I

pscaled kernel in Ωw

|pq| L1 = |px-qx| + |pr-qr|

q non-scaled kernel in Ωw

Page 24: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Filter Attributes

Kernel size of Bilateral filter – σs, σr • σs

2 = variance of spatial kernel. σs radius of spatial kernel

• σr2

= variance of range kernel. σr radius of range kernel

large σs

σr

x

I

p

|pq| L1 = |px-qx| + |pr-qr|

scaled kernel in Ωw

non-scaled kernel in Ωw

Page 25: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Filter Attributes

Scaling Factors – σs, σr • σs

2 = variance of spatial kernel. σs radius of spatial kernel

• σr2 = variance of range kernel. σr radius of range kernel

• σH2 = variance of transformed domain kernel. σH radius of transformed

domain kernel

Page 26: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Filter Attributes

Relationship to σs, σr and I

no longer edge-preserving

unbounded smoothing as input

as input

σs

σr

x

I

Page 27: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

FILTERING IN THE TRANSFORMED DOMAINNormalized Convolution (NC)

Interpolated Convolution (IC)

Recursive Filtering (RF)

Page 28: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Filtering in Ωw

• Sample uniformly in Ωw is unnecessary

• It’s easy to determine who is neighbor in Ωw

I

I Ω

Ωw

p

ct(p)

ab

c

ab

c

ct(p)-ct(a) < r a is b’s neighborct(c)-ct(p) > r c is not b’s neighbor

Page 29: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Normalized Convolution (NC)

𝑡 (�̂� )=𝑐𝑡 (𝑝 )

𝑡 (�̂� )

moving-average [Dougherty 94]

[Knutsson and Westin 93]

r

Page 30: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Normalized Convolution (NC)

𝑡 (�̂� )=𝑐𝑡 (𝑝 )

moving-average [Dougherty 94]

[Knutsson and Westin 93]

why cost time can be independent on filter attributes ( or ) by moving average?

Bilateral : large costs much time NC : Tlarge σs is smilar to Tsmall σs

Σ I

Ω

√3𝜎𝑠0 √3𝜎𝑠1

Page 31: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Interpolated Convolution (IC)[Piroddi and Petrou 04]

continuous, not discrete !

Page 32: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

NC vs. IC

𝑡 (�̂� ) 𝑡 (�̂� )

Normalized convolution (NC) Interpolated convolution (IC) NC, IC

Page 33: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Recursive Filtering (RF)

a ∈ [0, 1] is a feedback coefficient

An infinite impulse response (IIR) with exponential decay

d a↗ ⇨ d 0 .. stop propagation and preserve edge

[Smith 07]

Page 34: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

FILTERING 2D SIGNALSReplacing 2D filter with multiple iterations of 1D vertical and horizontal filter

Page 35: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Filtering 2D signals

Filtering 2D Signals

• Is it possible to apply domain transform on (x,y) ? • ct(p) is the accumulated L1 distance along (p, I(p))

• Only exists in surface with zero Gaussian curvature [O’Neill 06]•

• Implementation• Several iterations

• Horizontal pass along each image row• Vertical pass along each image column

Page 36: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Filtering 2D signals

How to Determine #Iterations ? • Stripes are only present along the last filtered dimension

• The length of the stripes size of the filter in the last pass

1st iteration 2nd iteration

stripes

Halve σH at each iteration. Stop while σH is small enough

Page 37: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Filtering 2D signals σH = σs = 40, σr = 0.77

σH = σs = 50, σr = 0.5

2 itr.

Page 38: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

COMPARISON TO OTHER APPROACHES

Page 39: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Impulse ResponseCase : the left impulse without strong edge; the right impulse with strong edge

NC:Normalized convolution; IC:Interpolated convolution; RF:Recursive convolution; BF:Bilateral ; AD:Anisotropic Diffusion; WLS:Weighted Least Squares

The NC and IC filters have Gaussian-like response, similar to AD and BF.

Strong edges : IC ~ AD. NC has a higher response near strong edges : pixels near

edges have less neighbors in the same population, and will weight their contribution strongly.

Impulse : RF ~ WLS

#iteration = 3

Ωw

Ω

strong edge

Page 40: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Smooth Quality

Page 41: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Performance

Filtering on CPU

• 2.8 GHz Quad Core PC • 8GB memory• NC, RF by C++• IC in MATLAB

• 1M RGB * #3 = 0.16~0.06 sec.• 10 M RGB * #3 = 1.6 ~ 0.6 sec.

• Linearly with image size • Independent on σs or σr

• Faster than EAW, PLBF, CTBF

Filtering on GPU

• NVIDIA GeForce GTX280• CUDA

• 1M RGB * #3 = 0.007 sec.• Domain tx : 0.7 mx• Each iteration : 2 ms

Page 42: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Comparison

• Bilateral Grid [Chen et al. 07]• Faster than domain tx. • Luminance only• Due to down-sampling process, not possible for small

spatial and range kernel

• NVIDIA GeForce GTX280

This paper PLBF WLS

1M RGB * #3 = 0.007 sec

0.5 M RGB = 0.1 sec

1 M gray = 1sec

Page 43: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

REA-TIME APPLICATIONS OF EDGE-PRESERVING FILTER (EPF) Detail Manipulation Tone Mapping Stylization Joint Filtering Colorization Recoloring

Page 44: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Detail Manipulation

• EPF decomposes image into level-of-detail : J0, J1, .. Jk

• I = J0 , Di = Ji – Ji+1

input I using D0 by IC (σs=20, σr=.08) [Farbman et al. 08]

EAW by [Fattal 09]

Page 45: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Tone Mapping• Edge-aware tone mapping avoids haloing and artifacts due to compression• The compressed luminance channel Lc in HDR [Farbman et al. 08]

This paper (RF) WLS

12 msec on log-luminance by RF ! J1 : σs= 20, σr=0.33 J2 : σs= 50, σr=0.67 J3 : σs=100, σr=1.34

I = J0 , Di = Ji – Ji+1 μ is the mean of Blocal min B = 0local max B = 1

Page 46: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Stylization 1/2

• Abstract low-contrast region and preserving high-contrast features

edge + this edge-aware filtered image

NC filtering

Page 47: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Stylization 2/2

• Assign each output pixel a scaled version of the value of the normalization factor Kp in NC

0.11 Kp

Kp : #points in the moving windowsOn the edge : #point dark↘

On the smooth area : #point light↗

Page 48: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Joint Filtering• Alpha can be combined with other map to create some

localized or selective stylization

alpha map

Page 49: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Joint Filtering• Smooth image A based on the

edges information of image B simulate depth-of-field (DoF)

depth-of-field effect

𝑐𝑡 (𝑢)=∫0

𝑢

1+𝜎 𝑠

𝜎𝑟

|𝐵 ′ (𝑥)|𝑑𝑥

B is an alpha matte

Page 50: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023 Domain Transform

Joint FilteringCanny edge identifies edges

Page 51: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Colorization• Propagate user color S by blurring them using the edge

information

using this RF (σs=100, σr=.03) [Levin et al. 04]User color scribbles

𝐶𝑜𝑙𝑜𝑟𝑝=~𝑆(𝑝 )/~𝑁 (𝑝)

S : user scribbles N : normalization function : blurred S : blurred N

Page 52: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Recoloring

• Soft segmentation – region Ri defined by color Ci

𝐶𝑜𝑙𝑜𝑟𝑝=~𝑁𝑅𝑖 (𝑝 )/∑

𝑗

~𝑁𝑅𝑗 (𝑝)

Page 53: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Conclusions and Future Work• High-quality edge-preserving filtering of image and videos

in real time• First real-time edge-preserving filter on color image at arbitrary

scale • 1D smoothing filter on transformed domain ≡ Edge-preserving

filter • High quality 2D edge-preserving filtering by iterating 1D-filtering• independent of the filter parameters(σs, σr) (due to moving average)

• Future work• Edge-preserving applications

• Limitation• Not rotationally invariant

Page 54: study Domain Transform for Edge-Aware Image and Video Processing

04/12/2023

Q & A