MatchMove
Digital Visual Effects, Spring 2013
Tzu-Kuei Huang
(kuei@cmlab.csie.ntu.edu.tw)2013/4/24
Flowchart
+
Video
CGI Animation
=
Composite Video Input
Output
Matchmove is a technique of estimating camera parameters from an input video sequence so that computer generated imagery (CGI) could be seamlessly inserted into the sequence.
2
Flowchart (detailed)
Video
Blender
P5-P12
Image sequences
Calibration
Voodoo
P13-P17 Camera parameters
3D models
Blender Edit Pose/Position
P31-P35
Animation
Composit e
Blender
P36-P46
Load
Aid Design P18-P30
Output Video
3
Environment Setting
• Blender
– Version 2.6.2 http://download.blender.org/release/
– Using version 2.6.6 might get error while running python scripts
• Voodoo
– Version 1.2.0 http://www.viscoda.com/index.php/en/voodoo-download
• Other options
– Free: Blender + ICARUS
– Pay: boujou + 3D Max, boujou + Maya, …
4
Recipe: Get Image Sequence
• Open Blender
• Load video file:
– Change window type to “Video Sequence Editor”
– Select Add →Movie – Put the strip in Layer 1
• Do sequence:
– Frame
• Set number of frames and resolution of frames
• Choose output file type (Targa)
– Time interval: select start and end of the sequence – Choose output location
• Click “Animation” button
5
Step by Step: Get Image Sequence
Start up Blender
6
Step by Step: Get Image Sequence
7 2. Change to Video Sequence Editor
1. Click to change window type
Change window type
8
Step by Step: Get Image Sequence
Add video
Select
Add Movie
9
Step by Step: Get Image Sequence
Select input video
~
1. Select file directory
2. Select input file
3. Add
10
Step by Step: Get Image Sequence
Edit layers (Right click and drag, left click to set)
1. Delete unnecessary layer (audio)
2. Right-click to drag the strip to the “1st Frame” in Layer 1
11
Step by Step: Get Image Sequence
Do video setting
1. Set
a. Resolution
b. Start/End Frame
2. Set file types to Targa(TGA) 3. Modify output directory
12
Step by Step: Get Image Sequence
Render image sequence
Click Animation
You’ll see playing video and
increasing frame number
Finish!
You can find the image sequences in output directory
Back to flowchart
• Open Voodoo
• Open image sequence:
– Select File Open Sequence – Select the first frame
– Set Move Type to “free move”
• Track:
– Click Track button
• Export Python script:
– Select File Save Blender Python Script – Save .py file (Blender 2.5x and higher)
13
Recipe: Calibration
14
Step by Step: Calibration
Use Voodoo to load image sequence
Select
File Open Sequence
15
Step by Step: Calibration
Choose and set sequence
1. Select the first frame (ex: 0001.tga)
2. Select “free move”
(general moving of camera)
16
Step by Step: Calibration
Tracking features
Click “Track” button
17
Step by Step: Calibration
Save results to “Blender Python Script”
Select
File Save Blender Python Script
Select
“Blender 2.5x and higher”
Select “Export all”
Back to flowchart
18
Recipe: Import 3D Motions
• Open Blender
• Delete default objects
– Choose the object and press “Delete”
• Load Python Script
– Change Window Type to “Text Editor”
– Select Text Open Text Block
– Select the .py file (exported from Voodoo) – Click “Run Script”
(cont.)
19
Recipe: Import 3D Motions
(cont.)
• Load Background Images
– Change window type to “3D View”
– Select View Cameras Set Active Object as Active Camera – Load background images
– Set the parameters of background images – Change the view
• View View Persp / Ortho
• View Front
• Load models and edit their poses/motions in the video
20
Step by Step: Import 3D Motions
Delete default objects
Press “a” twice to select all objects, then press “Delete” on your keyboard
21
Step by Step: Import 3D Motions
Load python script
Change window type to
“Text Editor”
Select “Text Open Text Block”
Select the Python script exported by Voodoo
22
Step by Step: Import 3D Motions
Run script
1. Press “Run Script”
2. Return to “3D View”
23
Step by Step: Show Background Images
Select
“voodoo_render_cam”
Select Voodoo camera
24
Step by Step: Show Background Images
Show Property Panel
Turn on
“Properties” Panel
25
Step by Step: Show Background Images
Tick-off
“Background Images”
Press “Open”
Select
the first frame
Step by Step: Show Background Images
Change
background type
Select
“Image Sequence”
Set
1. Number of frames 2. Start frame (1)
Enable “Auto Refresh”
26
Step by Step: Show Background Images
Set resolution
Set
1. Number of frames
2. Resolution
27
Step by Step: Show Background Images
Set view
Switch view to
“View Persp/Ortho”
Switch view to
“Front”
28
Step by Step: Show Background Images
Set active camera
Set
Cameras Set Active Object as Camera
29
Step by Step: Show Background Images
Check background
You can drag here to see the camera motions
Make sure “voodoo_render_cam” is selected
30
Back to flowchart
Step by Step: Load Models
Load models
Select
File Import Wavefront
(you can also use other file format)
31
Step by Step: Load Models
Set poses / positions for models
You can set the transform of your objects to edit their positions and poses
32
33
Step by Step: Load Models
Fine tuning
This step needs lots of fine tuning
You can drag here to see whether your tuning is correct or not
(is the object located at the correct position?)
Step by Step: Set Animation
Set keyframes
1. Select the frame that you want to insert a key frame
2. Select
Object Animation Insert Keyframe..
3. Repeat multiple times
Frame 1
Frame 80
Frame 150
34
Step by Step: Set Animation
Fine tuning
You can fine-tune the
transformation of objects in a keyframe here
35 Back to flowchart
Recipe: Compositing
• Add image sequence
– Change window yype to “Video Sequence Editor”
– Select Add Images and select all images – Drag the strip to the “1st Frame” in Layer 1
• Add scene
– Select Add Scene
– Drag the scene strip to the “1st Frame” in Layer 2
• Set Scene
– Change scene property to “Alpha Over”
– Set parameters of frame and video
• Click “Animation”
36
Step by Step: Compositing
Set to Video Sequence Editor Add image sequence (Video Channel)
Select
Add Image
37
Step by Step: Compositing
This time, select all frames (Press A)
38
Step by Step: Compositing
Edit Video Layer (Right click and drag, left click to set)
Drag the strip to the
“1st Frame” in Layer 1
39
Step by Step: Compositing
Add scene layer
Select
Add Scene Scene
Edit scene layer (Right click and drag, left click to set)
Drag the strip to the
“1st Frame” in Layer 2
40
Step by Step: Compositing
Show Properties Panel
Select
View Properties
Select
Blend Alpha Over You will
see the Properties
Panel
Set Blend Type
41
Step by Step: Compositing
Select Premultiply
Enable!
Set scene camera Set scene camera to
“voodoo_render_cam”
42
Step by Step: Compositing
Check output setting again!
43
Step by Step: Compositing
Preview your video
Change the viewing type
44
Step by Step: Compositing
Select output format
File path
Press ! Finish !!
Oh yeah!!
Final Output
45 Back to flowchart
More Examples
• CSIE Robot
46
More Examples
47
More Examples
48
FAQ
• Voodoo會當掉!
– 拍攝的影片內容差異太大 – 調整tracking的方式
• 為什麼我在Blender中的Background和Feature沒辦法配合
– 記得要設定 Cameras Set Active Object as Camera
• 3D models的 位置/動作 好難調整…
– 你是對的!
– 多利用座標系相對位置以及不同視角會有幫助, 不過還是需要一些時間 – 設定動作時, 盡量避免大角度或大範圍的 interpolation, 多設一些 key
frames
• 為什麼最後做出來的動畫 Model 是黑的?
– 記得在場景裡加盞燈
• 我該去哪裡找3D models
– 網路上免費資源非常多!
– 例如: http://www.3dm3.com/modelsbank/
http://www.sharecg.com/
49
FAQ
調整設定
View controls
50
FAQ
• Use different views to adjust the positions and poses of objects
Camera view
Front view
Top view Set
view
51
FAQ
• Add lights
記得開燈!
Add Lamp
52
Document
• Blender official website
– http://www.blender.org/education-help/
• Voodoo document website
– http://www.viscoda.com/index.php/en/voodoo- manual