• 沒有找到結果。

Image stitching

N/A
N/A
Protected

Academic year: 2022

Share "Image stitching"

Copied!
68
0
0

加載中.... (立即查看全文)

全文

(1)

Image stitching

Digital Visual Effects, Spring 2006 Yung-Yu Chuang

2005/3/22

with slides by Richard Szeliski, Steve Seitz, Matthew Brown and Vaclav Hlavac

(2)

Image stitching

• Stitching = alignment + blending geometrical

registration

photometric registration

(3)

Applications of image stitching

• Video stabilization

• Video summarization

• Video compression

• Video matting

• Panorama creation

(4)

Video summarization

(5)

Video compression

(6)

Object removal

input video

(7)

Object removal

remove foreground

(8)

Object removal

estimate background

(9)

Object removal

background estimation

(10)

Panorama creation

(11)

Why panorama?

• Are you getting the whole picture?

– Compact Camera FOV = 50 x 35°

(12)

Why panorama?

• Are you getting the whole picture?

– Compact Camera FOV = 50 x 35°

– Human FOV = 200 x 135°

(13)

Why panorama?

• Are you getting the whole picture?

– Compact Camera FOV = 50 x 35°

– Human FOV = 200 x 135°

– Panoramic Mosaic = 360 x 180°

(14)

Panorama examples

• Like HDR, it is a topic of computational

photography, seeking ways to build a better camera mostly in software.

• Panorama mode in consumer cameras

• Mars:

http://www.panoramas.dk/fullscreen3/f2_mars97.html

• Earth:

http://earthobservatory.nasa.gov/Newsroom/BlueMarble/

(15)

A pencil of rays contains all views

real

camera synthetic

camera

Can generate any synthetic camera view

as long as it has the same center of projection!

(16)

Mosaic as an image reprojection

mosaic projection plane

• The images are reprojected onto a common plane

• The mosaic is formed on this plane

• Mosaic is a synthetic wide-angle camera

(17)

Changing camera center

• Does it still work? synthetic PP PP1

PP2

(18)

Planar scene (or far away)

• PP3 is a projection plane of both centers of projection, so we are OK!

• This is how big aerial photographs are made

PP1

PP3

PP2

(19)

Motion models

• Parametric models as the assumptions on the relation between two images.

(20)

2D Motion models

(21)

Motion models

Translation

2 unknowns

Affine

6 unknowns

Perspective

8 unknowns

3D rotation

3 unknowns

(22)

Cylindrical panorama

1. Take pictures on a tripod (or handheld) 2. Warp to cylindrical coordinate

3. Compute pairwise alignments

4. Fix up the end-to-end alignment 5. Blending

6. Crop the result and import into a viewer

(23)

A case study: cylindrical panorama

• What if you want a 360° field of view?

mosaic projection cylinder

(24)

Cylindrical panoramas

• Steps

Reproject each image onto a cylinder Blend

Output the resulting mosaic

(25)

Taking pictures

Kaidan panoramic tripod head

(26)

Translation model

(27)

Map 3D point (X,Y,Z) onto cylinder

Cylindrical projection

X Y

Z

unit cylinder

unwrapped cylinder

Convert to cylindrical coordinates

cylindrical image

Convert to cylindrical image coordinates

(28)

f = 180 (pixels)

Cylindrical reprojection

f = 380 f = 280

Image 384x300

top-down view Focal length – the dirty secret…

(29)

A simple method for estimating f

Or, you can use other software, such as AutoStich, to help.

(30)

Distortion

• Radial distortion of the image

Caused by imperfect lenses

Deviations are most noticeable for rays that pass through the edge of the lens

No distortion Pin cushion Barrel

(31)

Radial correction

• Correct for “bending” in wide field of view lenses

(32)

Input images

(33)

Cylindrical warping

(34)

Blending

• Why blending: parallax, lens distortion, scene motion, exposure difference

(35)

Blending

(36)

Blending

(37)

Blending

(38)

Assembling the panorama

• Stitch pairs together, blend, then crop

(39)

Problem: Drift

• Error accumulation

small errors accumulate over time

(40)

Problem: Drift

• Solution

add another copy of first image at the end

there are a bunch of ways to solve this problem

add displacement of (y1 yn)/(n -1) to each image after the first

compute a global warp: y’ = y + ax

run a big optimization problem, incorporating this constraint

best solution, but more complicated known as “bundle adjustment”

(x1,y1)

copy of first image

(xn,yn)

(41)

End-to-end alignment and crop

(42)

Viewer: panorama

++

++

++ ++

example: http://www.cs.washington.edu/education/courses/cse590ss/01wi/projects/project1/students/dougz/index.html

(43)

Viewer: texture mapped model

example: http://www.panoramas.dk/

(44)

Determine pairwise alignment?

• Feature-based methods: only use feature points to estimate parameters

• We will study the “Recognising panorama”

paper published in ICCV 2003

• Run SIFT for each image, find feature matches.

(45)

Determine pairwise alignment?

• P’=Mp, where M is a transformation matrix, p and p’ are feature matches

• It is possible to use more complicated models such as affine or perspective

• Avoid impact of outliers

(46)

RANSAC

• RANSAC = Random Sample Consensus

• an algorithm for robust fitting of models in the presence of many data outliers

• Compare to robust statistics

• Given N data points xi, assume that mjority of them are generated from a model with

parameters Θ, try to recover Θ.

(47)

RANSAC algorithm

Run k times:

(1) draw n samples randomly

(2) fit parameters Θ with these n samples (3) for each of other N-n points, calculate

its distance to the fitted model, count the number of inlier points, c

Output Θ with the largest c

How many times?

How big?

Smaller is better

How to define?

Depends on the problem.

(48)

How to determine k

p: probability of real inliers

P: probability of success after k trials

k

p

n

P = 1 − ( 1 − )

n samples are all inliers a failure

failure after k trials

) 1

log(

) 1

log(

p

n

k P

= −

293 0.5

6

97 0.6

6

35 0.5

3

k p

n for P=0.99

(49)

Example: line fitting

(50)

n=2

(51)

Model fitting

(52)

Measure distances

(53)

Count inliers

c=3

(54)

Another trial

c=3

(55)

The best model

c=15

(56)

RANSAC for Homography

(57)

RANSAC for Homography

(58)

RANSAC for Homography

(59)

Applications of panorama in VFX

• Background plates

• Image-based lighting

(60)

Spiderman 2 (background plate)

(61)

Troy (image-based lighting)

http://www.cgnetworks.com/story_custom.php?story_id=2195&page=4

(62)

Project #2 Image stitching

• Assigned: 3/26

• Due: 11:59pm 4/23

• Work in pairs

(63)

Reference software

• Autostitch

http://www.cs.ubc.ca/~mbrown/autostitch/autostitch.html

• Many others are available online.

(64)

Tips for taking pictures

• Common focal point

• Rotate your camera to increase vertical FOV

• Tripod

• Fixed exposure?

(65)

Bells & whistles

• Recognizing panorama

• Bundle adjustment

• Handle dynamic objects

• Better blending techniques

(66)

Artifacts

• Take your own pictures and generate a stitched image, be creative.

http://www.cs.washington.edu/education/courses/cse590ss/01wi/projec ts/project1/students/allen/index.html

(67)

Submission

• You have to turn in your complete source, the executable, a html report and an artifact.

• Report page contains:

description of the project, what do you learn, algorithm, implementation details, results, bells and whistles…

• Artifacts must be made using your own program.

(68)

Reference

• Richard Szeliski, Image Alignment and Stitching, unpublished draft, 2005.

• R. Szeliski and H.-Y. Shum. Creating full view panoramic image mosaics and texture-mapped models, SIGGRAPH 1997, pp251-258.

• M. Brown, D. G. Lowe, Recognising Panoramas, ICCV 2003.

參考文獻

相關文件

12 Panoramic image shows the typical “moth-eaten” pattern of bone destruction, areas of rarefaction, sequestrum formation, and a periosteal reaction at the inferior border of

Figure 1.5 Some consumer applications of computer vision: (a) image stitching: merging different views (Szeliski and Shum 1997) c 1997 ACM; (b) exposure bracketing: merging

Use images to adapt a generic face model Use images to adapt a generic face model. Creating

• The scene with depth variations and the camera has movement... Planar scene (or a

• Richard Szeliski, Image Alignment and Stitching: A Tutorial, Foundations and Trends in Computer Graphics and Computer Vision, 2(1):1-104, December 2006. Szeliski

• Richard Szeliski, Image Alignment and Stitching: A Tutorial, Foundations and Trends in Computer Graphics and Computer Vision, 2(1):1-104, December 2006. Szeliski

• The scene with depth variations and the camera has movement... Planar scene (or a

It is required to do radial distortion correction for better stitching results. correction for better