image inpainting - seunghoonseunghoon.net/imageinpainting.pdf · “region filling and object...

28
Image Inpainting Seunghoon Park Microsoft Research Asia Visual Computing 06/30/2011

Upload: others

Post on 29-May-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Image Inpainting

Seunghoon Park Microsoft Research Asia

Visual Computing

06/30/2011

Page 2: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Contents

• Background

• Previous works

• Two papers

– Space-Time Completion of Video (PAMI’07)*1+

– PatchMatch: A Randomized Correspondence Algorithm for Structural Image Editing (SIGGRAPH’09)*2+

6/30/2011 Seunghoon Park 2

Page 3: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Result #1 Result #2

Goal: Fill in hole region in a ‘visually plausible’ way

What is inpainting?

6/30/2011 Seunghoon Park 3

Hole region

Page 4: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Previous work

• Partial Differential Equations (PDE) based (Bertalmio et al.[1])

– Limited to small gap

6/30/2011 Seunghoon Park 4

Page 5: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Previous work

• Exempler(or Patch) based(Criminisi et al.[4])

– Discontinuity in case of complex structures (e.g. curves or T(or X) conjunctions)

6/30/2011 Seunghoon Park 5

Page 6: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

The first paper

• Space-Time Completion of Video (PAMI’07)*1+

6/30/2011 Seunghoon Park 6

Input Output

Mask samples

Page 7: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

• : Input image

• : Hole region

• : Source region

• Fill in such that the resulting image will have as much global visual coherence with

Problem definition

6/30/2011 Seunghoon Park 7

IH

I

HIS \

H*

I

S

Page 8: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Completion as a global optimazation

• Maximizing a global objective function

qp

IpS

*VWsimSI

*

, max )Coherence(q

image Resulting : *

I

region Source : S

y x,qp point pixel : ,

and around centered windowssized-fixed : , qpVWqp

,2

2

,

qVpWd

eVWsimqp

2

),(

),(),( ) ,(

yx

qpqpyxVyxWVWd

6/30/2011 Seunghoon Park 8

Page 9: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Coherence maximization

• Two local conditions

1. All windows … containing p appear in the source region S:

2. All those … agree on the color value c at location p:

)()( pVpVcji

ii

p

iVWSV ,

1

pW

k

pW

1V

kV

6/30/2011 Seunghoon Park 9

Page 10: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Iterative Scheme

• Search 1. Let be all windows such that

2. Find maximizing similarity measure

6/30/2011 Seunghoon Park 11

k

i

i

pW

1

i

pWp

SV i

Page 11: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Iterative Scheme

• Vote

– Let be the appropriate colors

6/30/2011 Seunghoon Park 12

Mi

i

p

Mi

ii

pc

c

iiVc

ii

p

i

p

i

pVWsim , where,

algorithmShift - Meanfrom modehighest theis M

constant fixed:, ormdistTransfi

Page 12: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Iterative Scheme

• Update – Repeated for every hole pixels

• Multiple iterations until converged

6/30/2011 Seunghoon Park 13

Page 13: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Problems

• Sensitive to filling order

– Which pixels should be filled first?

– Priority(C*D) introduced by Criminisi et al.[4]

6/30/2011 Seunghoon Park 14

Only confidence Only data

Confidence

Data

Page 14: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Problems

• Expensive nearest neighbor search

– Use approximate NN search to speed up

6/30/2011 Seunghoon Park 15

NN search

rest Total

Time[s] 383.95 0.743 384.693

Percentage[%] 99.8 0.2 100

During 1 iteration

Page 15: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Results

6/30/2011 Seunghoon Park 16

Page 16: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

The second paper

• PatchMatch: A Randomized Correspondence Algorithm for Structural Image Editing (SIGGRAPH’09)*2+

6/30/2011 Seunghoon Park 17

Page 17: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Video

6/30/2011 Seunghoon Park 18

Page 18: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Problem definition

6/30/2011 Seunghoon Park 19

Correspondence Nearest Neighbor(NN) Field

Page 19: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

PatchMatch algorithm

1. Initialization

– Assign random values to the NN-field

6/30/2011 Seunghoon Park 20

Page 20: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

PatchMatch algorithm

2. Propagation

6/30/2011 Seunghoon Park 22

A B

above left, current, minarg),(D

yxf

Page 21: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

3. Random search

Box width: α2w Box width: 1 pixel Box width: αw Box width: w(image width)

PatchMatch algorithm

6/30/2011 Seunghoon Park 23

Page 22: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Results

• Compare against the most popular method: kd-tree with approximate nearest neighbor matching

6/30/2011 Seunghoon Park 24

Time [s] Memory [MB]

Megapixels PatchMatch kd-tree PatchMatch kd-tree

0.1 0.68 15.2 1.7 33.9

0.2 1.54 37.2 3.4 68.9

0.35 2.65 87.7 5.6 118.3

Page 23: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Results

• Application to image reshuffling

6/30/2011 Seunghoon Park 25

Page 24: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Results

• Application to image inpainting

6/30/2011 Seunghoon Park 26

Page 25: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Summary

• Global coherence optimization

– An unified idea used to complete hole regions in both image and video

• Propagation and random search • Accelerate the nearest neighbor search based on patches

6/30/2011 Seunghoon Park 30

Page 26: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

Q & A

6/30/2011 Seunghoon Park 31

Page 27: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

References

[1] M. Bertalmio, G. Sapiro, V. Caselles and C. Ballester, “Image Inpainting”, Proceedings of the 27th annual conference on Computer graphics and interactive techniques, 2000, 417-424

[2] Y. Wexler, E. Shechtman and M. Irani, “Space-Time Completion of Video”, IEEE Transactions on Pattern Analysis and Machine Intelligence, 2007, 29, 463 -476

[3] C. Barnes, E. Shechtman, A. Finkelstein and D. B. Goldman, “PatchMatch: A Randomized Correspondence Algorithm for Structural Image Editing”, ACM Transactions on Graphics (Proc. SIGGRAPH), 2009, 28, 24:1-24:11

[4] A. Criminisi, P. Perez and K. Toyama “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing, 2004, 13, 1200 -1212

6/30/2011 Seunghoon Park 32

Page 28: Image Inpainting - Seunghoonseunghoon.net/ImageInpainting.pdf · “Region Filling and Object Removal by Exemplar-Based Image Inpainting” IEEE Transactions on Image Processing,

References

[5] J. Sun, L. Yuan, J. Jia & H.-Y. Shum

“Image Completion with Structure Propagation”

ACM Transactions on Graphics (SIGGRAPH), 2005, 24, 861-868

[6] J. Hays and A. A. Efros “Scene Completion Using Millions of Photographs” ACM Transactions on Graphics (SIGGRAPH), 2007, 26

[7] C. Barnes, E. Shechtman, D. B. Goldman & A. Finkelstein “The Generalized PatchMatch Correspondence Algorithm” European Conference on Computer Vision, 2010

6/30/2011 Seunghoon Park 33