Presentation is loading. Please wait.

Presentation is loading. Please wait.

Multimedia Programming 16: Image Morphing

Similar presentations


Presentation on theme: "Multimedia Programming 16: Image Morphing"— Presentation transcript:

1 Multimedia Programming 16: Image Morphing
Departments of Digital Contents Sang Il Park

2 Outline Review: Interactive Image Morphing Matting and Compositing

3 Example: 삼각형간의 변형 B B’ ? T(x,y) C’ A C A’ Source Destination 두 2차원상의 삼각형 ABC 와 A’B’C’ 가 주어졌다면, (3개의 점) * (점당 x, y 좌표)  6개의 관계식 공간 상의 모든 점들의 위치를 변환시키는 변환 T 는 무엇? 결국 변환 T는 다음의 어파인 행렬로 표현 가능하다:

4 Interactive Image Morphing

5 마우스 콜백 사용하기 OpenCV에서는 사용자가 임의의 함수를 만들고 이를 마우스에 변화가 생겼을 때 호출되게 할 수 있다.
이를 위해서는 다음 2가지 일을 하여야 한다: 구현(Implementation) 마우스에 변화가 생겼을 때 무엇을 할 것인가?를 정의함. 등록(Registration) 위에 정의한 함수를 opencv에게 사용하겠다고 등록시킴. void yourFunction (int event, int x, int y, int flags, void *param); void cvSetMouseCallback(window_name, yourFunction)

6 Implementation OpenCV가 넘겨주는 메세지 어떤 마우스 관련 이벤트 종류인지 알려줌 Examples)
void yourFunction (int event, int x, int y, int flags, void *param); OpenCV가 넘겨주는 메세지 어떤 마우스 관련 이벤트 종류인지 알려줌 Examples) CV_EVENT_MOUSEMOVE (마우스가 움직임) CV_EVENT_LBUTTONDOWN (왼쪽버튼이 눌리고 있음) CV_EVENT_RBUTTONDOWN (오른버튼이 눌리고 있음) CV_EVENT_MBUTTONDOWN (중간버튼이 눌리고 있음) CV_EVENT_LBUTTONUP (왼쪽버튼이 올라가고 있음) CV_EVENT_RBUTTONUP (오른버튼이 올라가고 있음) CV_EVENT_MBUTTONUP (중간버튼이 올라가고 있음)

7 마우스를 이용한 이미지 변형 한 점을 선택하고 이동

8 마우스를 이용한 이미지 변형 한 점을 선택하고 이동

9 마우스를 이용한 이미지 변형 한 점을 선택하고 이동

10 선형 보간: Linear Interpolation
중간 위치에서의 변형량은 어떻게 될까? 1-α α 고정 ? 이동

11 마우스를 이용한 이미지 변형 한 점을 선택하고 이동

12 마우스를 이용한 이미지 변형 한 점을 선택하고 이동 ?

13 마우스를 이용한 이미지 변형 한 점을 선택하고 이동

14 이중 선형 보간: Bilinear interpolation
(x,y)에서의 변형량은?

15 마우스를 이용한 이미지 변형 한 점을 선택하고 이동 ?

16 Announcement 특강안내 강사: 김동현 시간: 11월 12일 (수요일) 아침 10시 30분 장소: 추후 공고 예정
새로운 인터넷 응용 분야와 기술들 강사: 김동현 DAUM 동영상개발 팀장 시간: 11월 12일 (수요일) 아침 10시 30분 장소: 추후 공고 예정

17 Matting & compositing

18 How does Superman fly? Super-human powers? OR
Image Matting and Compositing?

19 Image Compositing (영상합성)

20 Compositing Procedure (합성과정)
1. 스프라이트 만들기 (Sprite = Image + Mask Image (rmf) 2. 스프라이트를 배경과 합성하기 (투명도를 이용한 Iinear Interpolation) α

21 Compositing: Two Issues
1. 반투명 (Semi-transparent) 물체의 표현? 2. 픽셀이 물체보다 클 경우?

22 투명도 값: alpha channel 색 외에 또 다른 정보: 투명도
Image(R,G,B,alpha) Sprite! 빛이 얼마나 투과하는 가를 의미한다 (또는 물체가 한 픽셀을 얼마나 가리는 가를 의미): Alpha = 1: opaque object (complete coverage) Alpha = 0: transparent object (no coverage) 0<Alpha<1: semi-transparent (partial coverage) Example: alpha = 0.7 semi-transparency or Partial coverage

23 Compositing Procedure
1-α α

24 다중 합성: Multiple Compositing
1. 스프라이트 추출 (예: 포토샵의 Intelligent Scissors 활용) 2. 올바른 순서로 합성한다. (배경부터 차래 대로) Composite by David Dewey

25 Multiple Alpha Blending
So far we assumed that one image (background) is opaque. If blending semi-transparent sprites (the “A over B” operation): Icomp = aaIa + (1-aa)abIb acomp = aa + (1-aa)ab

26 “Pulling a Matte” Problem Definition: Hard problem
The separation of an image C into A foreground object image Co, a background image Cb, and an alpha matte a Co and a can then be used to composite the foreground object into a different image Hard problem Even if alpha is binary, this is hard to do automatically (background subtraction problem) For movies/TV, manual segmentation of each frame is infeasible Need to make a simplifying assumption…

27 Blue Screen

28 Blue Screen matting Most common form of matting in TV studios & movies
Petros Vlahos invented blue screen matting in the 50s. His Ultimatte® is still the most popular equipment. He won an Oscar for lifetime achievement. A form of background subtraction: Need a known background Compute alpha as SSD(C,Cb) > threshold Or use Vlahos’ formula: a = 1-p1(B-p2G) Hope that foreground object doesn’t look like background no blue ties!

29 The Ultimatte p1 and p2

30 Blue screen for superman?


Download ppt "Multimedia Programming 16: Image Morphing"

Similar presentations


Ads by Google