Download ppt - Drag-and-drop Pasting

Transcript
Page 1: Drag-and-drop Pasting

1

Drag-and-drop Pasting

논문세미나

이성호

Page 2: Drag-and-drop Pasting

2

Introduction

Page 3: Drag-and-drop Pasting

3

Poisson image editing[Perez et al. 2003]

• 장점– 이음새 없는 이미지 합성에 효과적인 접근방법– 사용자가 지정한 경계조건 하에서 Poisson 방정식을 풂– 수학적으로 우아하고 사용하기 쉽다

• 단점– 사용자가 주의해서 경계를 설정해야 함 ( 그림 1)– 부자연스러운 번짐 효과가 나타남– Poissong image editing 을 하기 전에 목적 이미지를 고려하여

경계를 지정해야 함

Page 4: Drag-and-drop Pasting

4

Contributions

• Poisson image editing 하기 위한 경계 조건을 최적화하는 방법을 제안– 그림 1(e) 에서처럼 원본과 목적 이미지 구조를 상당부분 보전

• 목적 함수 제안– 최단 닫힌 경로 (shortest closed path) 알고리즘 이용– 사용자가 지정한 경계와 관심 물체 (object of interest) 간의

최적의 경계 조건을 찾음

• Blended guidance field – 최적화된 경계가 관심 물체를 가로지를 때 도입– Poisson 방정식에 alpha matte 로서 적용

Page 5: Drag-and-drop Pasting

5

관련 연구 (1/3)

• 이미지 매팅– 알파 채널을 이용해서 원본 이미지를 목적 이미지에 붙이는 것– 대부분의 기법은 trimap 을 요구함

• 알파 채널과 전경색을 분리하기 위함– [Berman et al. 2000; Ruzon and Tomasi 2000; Chuang et

al. 2001; Sun et al. 2004]

trimap

• [Smith and Blinn 1996; McGuire et al. 2005]– 환경을 제어하거나 특별한

장치를 도입– 매팅 문제에서 모호성을 감소

Page 6: Drag-and-drop Pasting

6

관련 연구 (2/3)

– 다해상도 스플라인 기법 [Burt and Adelson 1983]• 라플라시안 피라미드의 서로 다른 레벨을 인터폴레이션

– Poisson image editing [Perez et al. 2003]• 사용자가 지정한 경계조건에 의해 Poisson 방정식을 풂

– 그라디언트 영역에서 이미지 stitching [Levin et al. 2004; Jia and Tang 2005]

• 구조가 정렬되지 않은 데서 생기는 문제 해결• 색상 불일치를 교정

Page 7: Drag-and-drop Pasting

7

관련 연구 (3/3)

• Graph-cut textures [Kwatra et al. 2003]

– 한 이미지에서 여러 이미지 팻치를 얻음– Graph cuts 알고리즘 [Agarwala et al. 2004] 를

이용

• Interactive digital photomontage [Agarwala et al. 2004]

– 합성된 영역의 이음새를 최적화하기 위해 그래프컷 이용

– 나머지 artifact 를 제거하기 위해 Poisson image editing 사용

Page 8: Drag-and-drop Pasting

8

[Agarwala et al. 2004] 에서 향상된 점

• [Agarwala et al. 2004] 는 그래프 - 컷을 초기화하기 위해 몇 번의 스트록을 필요로 함– 얇은 부분에 대해서는 특히 주의해야 함– 우리 기법에선 필요 없음

• 우리 기법은 라플라스 방정식을 풀 때의 최소 에러에 기반한 경계 에너지를 최적화– 부드럽고 자연스러운 블렌딩 결과를 보임

• 원본 영역과 목적 영역이 색상과 구조에서 현격한 차이가 있을 경우에도 적용가능

– 우리 기법은 자세하고 투명한 구조도 제어할 수 있음

Page 9: Drag-and-drop Pasting

9

Optimal boundary

• 원본 이미지 fs

• 목적 이미지 ft

• 관심 영역 Ω0 을 경계조건으로 가이던스 필드 v=∇fs 를 최적화하면

• f 는 목적 이미지

• ∂Ω0 는 Ω0 의 경계

Page 10: Drag-and-drop Pasting

10

Poisson image editing

• f’=f- fs 라고 정의하면 v=∇fs 는 그라디언트이므로

• 라플라스 방정식으로 표현하면

Page 11: Drag-and-drop Pasting
Page 12: Drag-and-drop Pasting

12

최적 경계 추출

• 식 (2) 에서 이 상수일 때 는 0 이 됨

• 의 변화가 적도록 경계 조건을 정하면 합성 결과가 좋다

• 최적 경계– 관심 영역 Ω0 안쪽이면서 관심 물체 Ωobj 바깥

– 사용자들은 보통 Ωobj 을 세심하게 지정하고 싶어하지 않을 것– GrabCut[Rother et al. 2004] 나 Lazy Snapping[Li et al.

2004] 를 이용해 Ω0 로부터 Ωobj 을 생성– 본 논문에서는 GrabCut 을 이용

Page 13: Drag-and-drop Pasting

“GrabCut” — Interactive Foreground Extraction using Iterated Graph Cuts

13

Page 14: Drag-and-drop Pasting
Page 15: Drag-and-drop Pasting

15

Boundary energy minimization• 목적 함수

• k 는 결정돼야 할 상수

• 본 논문에서는 f(p) 는 {r, g, b} 컬러 공간의 벡터로 하고 , (f(p)-f(q)) 는 L2-norm 으로 실험

Page 16: Drag-and-drop Pasting

16

Iterative optimization

• 목적 함수를 최소화하는 ∂ Ω 와 k 를 동시에 구하는 것은 어려움

• 다음과 같이 반복적으로 최적화1. Ω 를 Ω0 로 초기화

2. 현재의 ∂ Ω 에 대해 최적인 k 를 아래처럼 구함

|∂Ω| 는 ∂ Ω 의 경계이므로 k 는 경계의 평균값3. 현재의 k 를 이용해 최적인 ∂ Ω 를 구함4. 연산 2 회 동안 식 (4) 가 줄어들지 않을 때까지 2 단계와 3 단계를

반복

• 식 (4) 는 단조 감소 함수이기 때문에 알고리즘은 반드시 수렴

Page 17: Drag-and-drop Pasting

17

Shortest closed-path algorithm• 이웃한 네 픽셀들과 서로 연결된 그래프 에서

최단 거리의 닫힌 경로를 찾는 문제

• 비용 함수

• 단일 물체의 경우– Ωobj 는 genus-0

– Ω0 \ Ωobj 는 genus-1

Page 18: Drag-and-drop Pasting

18

• ∂Ω 는 닫힌 곡선– 영역 Ω0 \ Ωobj 의 고리를 cut C 로 자름

• 그림 3(b)– 컷 C 의 한쪽에 있는 각 픽셀 p 에 대해 컷의 다른 쪽에 있는 모든

인접한 픽셀들과의 최단 거리를 구한다• 2D dynamic programming [Dijkstra 1959; Mortensen

and Barrett 1995] 를 이용• O(N), N 은 영역 안의 픽셀 수

– 픽셀 p 에서 시작한 최단거리 중 최소인 것을 Path(p) 로 정한다– 모든 p 에 대해 Path(p) 를 구하여 이 중 최소인 것을 최적해로

한다– 컷의 한쪽 픽셀이 M 개 있을 경우 O(MN) 이다

Page 19: Drag-and-drop Pasting

19

• 최적 경계가 컷 C 를 한번만 지나갈 경우– 앞의 알고리즘은 최적

• 자르는 방법– 컷 C 가 ∂ Ω 와 ∂ Ωobj 의 사이에 있는 두 픽셀을 가로지름– 여러 경우의 수가 존재– 가장 짧은 직선으로 자를 수 있는 곳을 자름

• By Euclidian distance• 장점

– 최적 경계가 컷을 한번 이상 지나갈 가능성을 줄임– M 이 적으므로 연산이 빠름

Page 20: Drag-and-drop Pasting

20

Fractional boundary

Page 21: Drag-and-drop Pasting

21

A blended guidance field

• Coverage mask M– 알파 블렌딩이 적용되어야 할 부분을 지정 (M(p)=1)– M 이 1 인 곳과 아닌 곳으로 분할됨– 각 영역에 개별적으로 블렌딩하면 영역의 인접 부분에서

불연속이 생김

• Φ={p|0<α(p)<1}– 부분적인 물체 경계를 나타냄– Ωobj 에 Coherence matting [Shum et al. 2004] 을 적용하여

구함

Page 22: Drag-and-drop Pasting
Page 23: Drag-and-drop Pasting

23

Blended guidance field

• v’=(v’x, v’y) 일 때 , 각 픽셀 p=(x, y) 에 대해

• v’y(x, y) 도 유사하게 구함

• 이제 다음의 식을 풀면 된다

Page 24: Drag-and-drop Pasting

24

마스크 M 을 생성하는 절차

• 각 세그먼트에서 벨트 Φ 와 ∂ Ω 가 교차하는 시작부분과 끝부분을 찾는다– 그림 5(c) 에서 빨간 점

• 빨간 점으로부터 벨트 Φ 의 반대쪽에서 가장 가까운 점을 찾는다– 노란 점

• 노란 점과 빨간 점을 이어서 생기는 영역 ( 녹색 부분 ) 이 {p|M(p)=1} 이고 , Φ∪Ω 인 나머지 영역이 M(p)=0 이다

Page 25: Drag-and-drop Pasting
Page 26: Drag-and-drop Pasting
Page 27: Drag-and-drop Pasting
Page 28: Drag-and-drop Pasting

• Figure 7: Motorcycle. (a) Source image. (b) Target image. (c) The user-drawn region on the source image is overlaid on the target image. (d) Poisson image editing result with the user-drawn region. The boundary intersects with salient structures in the target image. (e) Matte compositing result. The color of the motorcyclist does not match well with the target scene. (f) The optimized boundary and the binary coverage mask to preserve fractional boundary. The color code is the same as Figure 5 (d). (g) Our result. The object is naturally blended into the target image without unnatural blurring.

Page 29: Drag-and-drop Pasting

Figure 8: Chimney. (a) Source image and the user-specified region of interest. (b) The user-specified region on the source image is overlaid onto the target image. (c) Matte compositing result. Note the color of the chimney does not match well with the target scene. (e) The alpha matte computed by the matting method. (f) Poisson image editing result using mixing gradients in seamless cloning [Perez et

al. 2003]. (g) Zoom-in view of the mixing gradients result. It is noted that the unwanted tree branches and the occluded sea-line can be seen because of their

strong gradients.

Page 30: Drag-and-drop Pasting

(d) Optimized boundary and binary coverage mask. The color code is the

same as Figure5. (h) Our result. The chimney is

seamlessly blended with the target image without structure and color

mismatch.

Page 31: Drag-and-drop Pasting

Figure 9: Surfing. (a) Source and target images of surfers. (b) Poisson image editing result using the user-drawn boundary,

showing unnatural occlusion and other obvious artifacts. (c) The user-drawn strokes used to initialize graph-cut in [Agarwala et al. 2004], and the refined boundary from graph-cut. The thin parts of

the object, e.g., the arms of the surfer, are missing.

Page 32: Drag-and-drop Pasting

(d) Our optimized boundary where the object structures are faithfully preserved. (e) Our blending result. The two surfers look natural in the

final composite. The matte is applied around the surfboard to faithfully preserve the fractional boundary.

Page 33: Drag-and-drop Pasting

33

Conclusion and discussion• 편리한 이음새 없는 이미지 합성

• Poisson image editing 에서의 향상– 사용하기 편리함– 물체의 경계를 잘 보존

• 블렌드된 가이던스 필드를 도입

• Ωobj 와 α 를 계산하기 위해 GrabCut 과 image matting 을 이용– M=1 인 부분만 α 를 계산하면 되기 때문에 , 모든 영역에서

이미지 매팅을 할 필요는 없다

Page 34: Drag-and-drop Pasting

34

Future works

• Poisson image editing 의 번짐과 색상변경의 정도를 조사– 원본과 목적 이미지가 색상차가 많이 날 경우 Poisson 방정식은

원본 이미지의 색상을 변경시킴– 이 효과가 언제나 바람직한 것은 아님– 하얀 해변에 있는 개를 녹색 풀밭에 붙일 경우 , 개가 녹색이 됨

• 목적 이미지가 복잡한 구조를 가질 때 원본과 목적 이미지가 정확하게 맞지 않음– 경계를 잘 설정하더라도 해결되지 않는 문제– 경계 조건을 수정하면 해결될지도 모름


Recommended