1 of 39

Panoramas

CSC606: Intro Computer Vision

These slides are taken from Cornell university

2 of 39

From last time: Projection matrix

0

=

(in homogeneous image coordinates)

3 of 39

Back to panoramas

Can we use homographies to create a 360 degree panorama?

4 of 39

Idea: project images onto a common plane

mosaic projection plane

each image is warped with a homography

We’ll see what this homography means next

Can’t create a 360 panorama this way… we’ll fix this shortly

“Mosaic”

5 of 39

Creating a panorama

  • Basic Procedure
    • Take a sequence of images from the same position
      • Rotate the camera about its optical center
    • Compute transformation between second image and first
    • Transform the second image to overlap with the first
    • Blend the two together to create a mosaic
    • If there are more images, repeat

6 of 39

Geometric interpretation of mosaics

  • If we capture all 360º of rays, we can create a 360º panorama
  • The basic operation is projecting an image from one plane to another
  • The projective transformation is scene-INDEPENDENT
    • This depends on all the images having the same optical center

Image 1

Image 2

Optical Center

7 of 39

Image reprojection

  • Basic question
    • How to relate two images from the same camera center?
      • how to map a pixel from PP1 to PP2
  • Answer
    • Cast a ray through each pixel in PP1
    • Draw the pixel where that ray intersects PP2

PP2

PP1

8 of 39

What is the transformation?

Image 1

Image 2

Optical Center

How do we map points in image 2 into image 1?

image 1

image 2

3x3 homography

Step 1: Convert pixels in image 2 to rays in camera 2’s coordinate system.

Step 2: Convert rays in camera 2’s coordinates to rays in camera 1’s coordinates.

Step 3: Convert rays in camera 1’s coordinates to pixels in image 1’s coordinates.

intrinsics

extrinsics

(rotation only)

9 of 39

Can we use homography to create a 360 panorama?

10 of 39

These rays never hit the projection plane

Projection plane

Camera D

Cameras A, B, C

Answer: No

11 of 39

Panoramas

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

mosaic Projection Sphere

12 of 39

Spherical projection

    • Map 3D point (X,Y,Z) onto sphere

X

Y

Z

unit sphere

unwrapped sphere

    • Convert to spherical coordinates

Spherical image

    • Convert to spherical image coordinates
      • s defines size of the final image
        • often convenient to set s = camera focal length

13 of 39

Unwrapping a sphere

Credit: JHT’s Planetary Pixel Emporium

14 of 39

Spherical reprojection

  • Map image to spherical coordinates
    • need to know the focal length

f = 200 (pixels)

input

f = 800

f = 400

15 of 39

Aligning spherical images

  • Suppose we rotate the camera by θ about the vertical axis
    • How does this change the spherical image?

16 of 39

Aligning spherical images

  • Suppose we rotate the camera by θ about the vertical axis
    • How does this change the spherical image?
      • Translation by θ
    • This means that we can align spherical images by translation

17 of 39

Assembling the panorama

  • Stitch pairs together, blend, then crop

18 of 39

Problem: Drift

  • Error accumulation
    • small errors accumulate over time

19 of 39

Problem: Drift

  • Solution
    • add another copy of first image at the end
    • this gives a constraint: yn = y1
    • there are a bunch of ways to solve this problem
      • add displacement of (y1 – yn)/(n -1) to each image after the first
      • apply an affine warp: y’ = y + ax [you will implement this for P3]
      • 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)

20 of 39

Spherical panoramas

+

+

+

+

21 of 39

Different projections are possible

Cube-map

22 of 39

Blending

  • We’ve aligned the images – now what?

23 of 39

Blending

  • Want to seamlessly blend them together

24 of 39

Image Blending

25 of 39

Feathering

0

1

0

1

+

=

26 of 39

Effect of window size

0

1

left

right

0

1

27 of 39

Effect of window size

0

1

0

1

28 of 39

Good window size

0

1

“Optimal” window: smooth but not ghosted

    • Doesn’t always work...

29 of 39

Alpha Blending

Encoding blend weights: I(x,y) = (αR, αG, αB, α)

color at p =

Implement this in two steps:

1. accumulate: add up the (α premultiplied) RGBα values at each pixel

2. normalize: divide each pixel’s accumulated RGB by its α value

Q: what if α = 0?

see Blinn (CGA, 1994) for details:

Compositing, Part 1: Theory

I1

I2

I3

p

30 of 39

Poisson Image Editing

31 of 39

Some panorama examples

“Before SIGGRAPH Deadline” Photo credit: Doug Zongker

32 of 39

Some panorama examples

  • Every image on Google Streetview

33 of 39

Magic: ghost removal

M. Uyttendaele, A. Eden, and R. Szeliski. �Eliminating ghosting and exposure artifacts in image mosaics. �ICCV 2001

34 of 39

Magic: ghost removal

M. Uyttendaele, A. Eden, and R. Szeliski. �Eliminating ghosting and exposure artifacts in image mosaics. �ICCV 2001

35 of 39

Other types of mosaics

  • Can mosaic onto any surface if you know the geometry
    • See NASA’s Visible Earth project for some stunning earth mosaics

36 of 39

37 of 39

https://www.nasa.gov/centers/wallops/news/frozen_sos.html

38 of 39

Science on a Sphere

39 of 39

Questions?