Introduction to Computer Graphics Image Processing (1) June 10, - - PowerPoint PPT Presentation

introduction to computer graphics image processing 1
SMART_READER_LITE
LIVE PREVIEW

Introduction to Computer Graphics Image Processing (1) June 10, - - PowerPoint PPT Presentation

Introduction to Computer Graphics Image Processing (1) June 10, 2020 Kenshi Takayama Todays topics Edge-aware image processing Gradient-domain image processing 2 Image smoothing using Gaussian Filter Smoothness parameter


slide-1
SLIDE 1

Introduction to Computer Graphics – Image Processing (1) –

June 10, 2020 Kenshi Takayama

slide-2
SLIDE 2

Today’s topics

  • Edge-aware image processing
  • Gradient-domain image processing

2

slide-3
SLIDE 3

Image smoothing using Gaussian Filter

  • Smoothness parameter 𝜏

3

𝜏 = 2 𝜏 = 5 𝜏 = 10 Original

slide-4
SLIDE 4

Equation of Gaussian Filter

  • 𝐽𝐪 represents pixel value of image 𝐽 at position 𝐪 = 𝑞", 𝑞# ∈ Ω
  • For given resolution e.g. 640×480, Ω ≔ 1, ⋯ , 640 × 1, ⋯ , 480
  • GF$[𝐽] represents filtered image with Gaussian parameter 𝜏 :
  • 𝐻' 𝑦 ≔ exp − (!

)'! ç Gaussian Kernel of radius 𝜏

4

𝑦 −𝜏 −2𝜏 −3𝜏 3𝜏 2𝜏 𝜏 𝐻! 𝑦

GF$ 𝐽 𝐪 ≔ ∑𝐫∈' 𝐻$ 𝐪 − 𝐫 𝐽𝐫 ∑𝐫∈' 𝐻$ 𝐪 − 𝐫 𝑋

𝐪

slide-5
SLIDE 5

Equation of Gaussian Filter

  • 𝐽𝐪 represents pixel value of image 𝐽 at position 𝐪 = 𝑞", 𝑞# ∈ Ω
  • For given resolution e.g. 640×480, Ω ≔ 1, ⋯ , 640 × 1, ⋯ , 480
  • GF$[𝐽] represents filtered image with Gaussian parameter 𝜏 :
  • 𝐻' 𝑦 ≔ exp − (!

)'! ç Gaussian Kernel of radius 𝜏

5

𝑦 −𝜏 −2𝜏 −3𝜏 3𝜏 2𝜏 𝜏 𝐻! 𝑦

GF$ 𝐽 𝐪 ≔ 1 𝑋

𝐪

4

𝐫∈'

𝐻$ 𝐪 − 𝐫 𝐽𝐫

slide-6
SLIDE 6

Implementing Gaussian Filter

  • 𝐻$ 3𝜏 ≈ 0 è Distant pixels can be ignored
  • For fixed size 𝑠 ≔ ceil 3𝜏 , precompute weights
  • n a (2𝑠 + 1)×(2𝑠 + 1) stencil

6

𝑦 −𝜏 −2𝜏 −3𝜏 3𝜏 2𝜏 𝜏 𝐻! 𝑦

http://people.csail.mit.edu/sparis/bf_course/

2𝑠 + 1 2𝑠 + 1

Stencil

slide-7
SLIDE 7

When kernel radius 𝜏 is very large

  • Direct computation takes a lot of time
  • Alternative: downsample è smooth with small 𝜏 è upsample

7

𝜏 = 20 𝜏 = 5 downsample upsample

slide-8
SLIDE 8

Detail Extraction & Enhancement

8

3× smoothed detail enhanced detail halos!

slide-9
SLIDE 9

When using edge-aware smoothing, ...

9

3× smoothed detail enhanced detail

slide-10
SLIDE 10

Edge-aware smoothing using Bilateral Filter

  • Two parameters
  • 𝜏/ : Range of smoothing w.r.t. pixel’s location
  • 𝜏0 : Range of smoothing w.r.t. pixel’s color

BF$!, $" 𝐽 𝐪 ≔ 1 𝑋

𝐪

4

𝐫∈'

𝐻$! 𝐪 − 𝐫 𝐻$" 𝐽𝐪 − 𝐽𝐫 𝐽𝐫

10

𝜏" = 32 𝜏" = 128 𝜏" = 512 Original In all cases, 𝜏# = 10

slide-11
SLIDE 11

Application of Bilateral Filter: Stylization

11

Real-time video abstraction [Winnemöller SIGGRAPH06]

slide-12
SLIDE 12

Application of Bilateral Filter: Tone Mapping

  • Range of each channel (24bit color image): 1~255
  • Range of light intensity in the real world: 1~105
  • High Dynamic Range image
  • Can be obtained by photographing with different exposure times

12

https://en.wikipedia.org/wiki/Tone_mapping Fast bilateral filtering for the display of high-dynamic-range images [Durand SIGGRAPH02]

Short exposure Long exposure

slide-13
SLIDE 13

Application of Bilateral Filter: Tone Mapping

13

γ correct. (𝑌 → 𝑌𝛿) details lost γ correct. HDR image Bilateral Filter details preserved

https://en.wikipedia.org/wiki/Tone_mapping Fast bilateral filtering for the display of high-dynamic-range images [Durand SIGGRAPH02]

slide-14
SLIDE 14

Naïve implementation of Bilateral Filter

1 𝑋

𝐪

4

𝐫∈'

𝐻$! 𝐪 − 𝐫 𝐻$" 𝐽𝐪 − 𝐽𝐫 𝐽𝐫

  • Recompute stencil for every

pixel location 𝐪 ∈ Ω è slow

  • (Basic Assignment)

14

slide-15
SLIDE 15

Another view toward Bilateral Filter

  • Define feature vector 𝐠𝐪 ≔

𝐪 "% , #𝐪 "' for pixel location 𝐪 and intensity 𝐽𝐪

  • Weight of Bilateral Filter is equivalent to

Gaussian kernel applied to Euclidean distance in the feature space

  • Bilateral Filter is equivalent to applying Gaussian Filter of radius 1

to sample points {𝐠𝐪} in the feature space è Simpler computation

15

𝐻!" 𝐪 − 𝐫 𝐻!# 𝐽𝐪 − 𝐽𝐫 = exp − 𝐪 − 𝐫 $ 2𝜏%

$

exp − 𝐽𝐪 − 𝐽𝐫

$

2𝜏&

$

= exp − 𝐠𝐪 − 𝐠𝐫

$

2 = 𝐻' 𝐠𝐪 − 𝐠𝐫

slide-16
SLIDE 16

Bilateral Grid [Paris06; Chen07]

  • Define 3D feature space as (X-coord, Y-coord, intensity),

map sample points {𝐠𝐪} to 3D grid

  • The larger 𝜏3 & 𝜏4, the coarser the grid è lower comput. cost

16

A Fast Approximation of the Bilateral Filter using a Signal Processing Approach [Paris ECCV06] Real-time edge-aware image processing with the bilateral grid [Chen SIGGRAPH07]

slide-17
SLIDE 17

Weight map generation using feature space

  • Various names: Edit Propagation, Matting, Segmentation
  • Solve Laplace equation
  • n Bilateral Grid

17

White scribble è constraint of weight=1 Black scribble è constraint of weight=0 Weight map Application: color adjustment

Real-time edge-aware image processing with the bilateral grid [Chen SIGGRAPH07]

slide-18
SLIDE 18

Weight map generation using feature space

18

Instant Propagation of Sparse Edits on Images and Videos [Li PG10] Bilateral Hermite Radial Basis Functions for Contour-based Volume Segmentation [Ijiri EG13]

https://www.youtube.com/watch?v=mL6ig_OaQAA

Interpolation using RBF [Li10] (Purpose: edit propagation for images/videos) Interpolation using Hermite RBF [Ijiri13] (Purpose: segmentation of CT volume)

slide-19
SLIDE 19

Extension to BF: Joint (Cross) Bilateral Filter

19

Digital Photography with Flash and No-Flash Image Pairs [Petschnigg SIGGRAPH04] Flash Photography Enhancement via Intrinsic Relighting [Eisemann SIGGRAPH04]

Photo A: without flash J Correct color L Noisy, blurred Photo F: with flash L Incorrect color J Less noisy, sharp

JBF'", '# 𝐵, 𝐺 𝐪 ≔ 1 𝑋

𝐪

8

𝐫∈8

𝐻'" 𝐪 − 𝐫 𝐻'# 𝐺

𝐪 − 𝐺 𝐫

𝐵𝐫

After applying JBF

slide-20
SLIDE 20

Extension to BF: Non-Local Means Filter

  • Define feature space by neighborhood vector 𝐨𝐪

representing 7×7 sub-image centered at 𝐪

20

A non local algorithm for image denoising [Buades CVPR05]

NLMF' 𝐽 𝐪 ≔ 1 𝑋

𝐪

8

𝐫∈8

𝐻' 𝐨𝐪 − 𝐨𝐫 𝐽𝐫

Noisy input Bilateral NL Means

slide-21
SLIDE 21

Extension to BF: Rolling Guidance Filter

21

Joint Bilateral Filter Guidance Input Output Original Input Gaussian Original Bilateral Rolling Guidance

Rolling Guidance Filter [Zhang ECCV14]

slide-22
SLIDE 22

Today’s topics

  • Edge-aware image processing
  • Gradient-domain image processing

22

slide-23
SLIDE 23

Scenario: insert source img. into destination img.

23

Poisson image editing [Perez SIGGRAPH03] Gradient Domain Manipulation Techniques in Vision and Graphics [Agrawal ICCV07 Course]

Simple copying L Boundary blurred L Gradient-domain processing J Source Dest.

slide-24
SLIDE 24

Scenario: generating panorama from several shots

24

Efficient gradient-domain compositing using quadtrees [Agarwala SIGGRAPH07]

Simple tiling Gradient-domain processing

slide-25
SLIDE 25

Simple case of 1D grayscale image

25

Offset Dest. Source

slide-26
SLIDE 26

2D case: offset by Laplace Membrane

26

Mean value coordinates [Floater CAGD03] Coordinates for instant image cloning [Farbman SIGGRAPH09]

  • Solve Laplace equation under

Dirichlet boundary condition

  • Fast approximation using

Mean Value Coordinates

https://www.youtube.com/watch?v=AXvPeuc-wRw

slide-27
SLIDE 27

Gradient-domain processing in general form (not just simple cloning)

27

slide-28
SLIDE 28

28

×2

||

Modify gradients arbitrarily!

Gradient-domain processing in general form (not just simple cloning)

slide-29
SLIDE 29

29

𝑔∗ 𝑕6 𝑔∗

Find 𝑔

9

that minimize 8

9

𝑔

9 − 𝑔 9:; − 𝑕9 )

subject to: 𝑔|<8 = 𝑔∗|<8

Ω

Find function 𝑔 such that its gradient closely matches user-specified target 𝑕(

Gradient-domain processing in general form (not just simple cloning)

slide-30
SLIDE 30
  • Basics of Gradient-domain image processing:

Find image 𝑔 whose gradient best matches user-specified target gradient field 𝐡 by solving Poisson equation

30

Find 𝑔

9

that minimize 8

9

𝑔

9 − 𝑔 9:; − 𝑕9 )

subject to: 𝑔|<8 = 𝑔∗|<8 Find 𝑔 𝑦, 𝑧 that minimizes F

(,> ∈8

𝛂𝑔 𝑦, 𝑧 − 𝐡(𝑦, 𝑧) ) subject to: 𝑔|<8 = 𝑔∗|<8

1D case 2D case

Solve Poisson equation: Δ𝑔 = 𝛂 ⋅ 𝐡 subject to: 𝑔|<8 = 𝑔∗|<8

slide-31
SLIDE 31

How to give target gradients: mixing

  • Copy source’s gradient only when its magnitude is larger

è smooth part of source won’t be copied

31

Poisson image editing [Perez SIGGRAPH03]

source dest. source dest. source dest.

slide-32
SLIDE 32

How to give target gradient: Edge Brush

  • Copy gradients along object silhouette,

paste along brush stroke

  • Real-time Poisson solver implemented on GPU

32

Real-time gradient-domain painting [McCann SIGGRAPH08] Code: http://graphics.cs.cmu.edu/projects/gradient-paint/gradient_paint.r2403.tar.gz

https://www.youtube.com/watch?v=9MGjrsPzFc4

Before After Before After

slide-33
SLIDE 33

How to give target gradient: modify original

33

Poisson image editing [Perez SIGGRAPH03]

Amplify/suppress within selected region è Local Tone Mapping Set to zero except where detected as edges è Stylization

slide-34
SLIDE 34

Extra: Gradient-domain geometry processing

34

slide-35
SLIDE 35

Gradient-domain geometry processing

35

Find 𝐰9 that minimize 8

9,? ∈@

𝑥9? 𝐰9 − 𝐰

? − 𝐟9? )

subject to: 𝐰A = 𝐰A

∗, 𝑑 ∈ 𝐽B

Mesh editing with poisson-based gradient field manipulation [Yu SIGGRAPH04] Laplacian surface editing [Sorkine SGP04] Interfaces and algorithms for the creation, modification, and optimization of surface meshes [Nealen PhD07]

Edge vector of original shape è target gradient A few constraints of vertex positions è boundary condition

Poisson equation

slide-36
SLIDE 36

Rotation of local region due to large deformation

  • Target gradient needs to be rotated as well
  • Non-linear relation
  • Optimal rotation difficult to find
  • Local-global optimization [Sorkine07]
  • Local step:

Fix vertex positions, compute local rotation using SVD

  • Global step:

Fix local rotations, compute vertex positions via Poisson equation

36

On linear variational surface deformation methods [Botsch TVCG08] As-rigid-as-possible surface modeling [Sorkine SGP07]

https://www.youtube.com/watch?v=ltX-qUjbkdc

Without rotation With rotation

slide-37
SLIDE 37

GeoBrush: Cloning brush for surface meshes

  • Split deformation into two steps:
  • 1. Rotation of local region

è Fast & approx. computation using cage-based method

  • 2. Accurate offset

è Adapt GPU-based Poisson solver (originally for image processing)

37

GeoBrush: Interactive Mesh Geometry Cloning [Takayama EG11]

https://www.youtube.com/watch?v=FPsccn_gG8E