cse 152, spring 2017 introduction to computer …6 cse 152, spring 2017 introduction to computer...

9
1 CSE 152, Spring 2017 Introduction to Computer Vision Motion Introduction to Computer Vision CSE 152 Lecture 12 CSE 152, Spring 2017 Introduction to Computer Vision Announcements Homework 3 is due today, 11:59 PM • Reading: – Section 10.6.1: Optical Flow and Motion – Section 10.6.2: Flow Models – Introductory Techniques for 3-D Computer Vision, Trucco and Verri Chapter 8: Motion CSE 152, Spring 2017 Introduction to Computer Vision Continuous Motion Consider a video camera moving continuously along a trajectory (rotating & translating). How do points in the image move? What does that tell us about the 3-D motion & scene structure? CSE 152, Spring 2017 Introduction to Computer Vision Motion “When objects move at equal speed, those more remote seem to move more slowly.” - Euclid, 300 BC CSE 152, Spring 2017 Introduction to Computer Vision Simplest Idea for video processing Image Differences Given image I(u,v,t) and I(u,v, t+t), compute I(u,v, t+t) - I(u,v,t). This is partial derivative: At object boundaries, is large and is a cue for segmentation Does not indicate which way objects are moving t I t I CSE 152, Spring 2017 Introduction to Computer Vision Background Subtraction Gather image I(x,y,t 0 ) of background without objects of interest (perhaps computed over average over many images). At time t, pixels where |I(x,y,t)-I(x,y,t 0 )| > are labeled as coming from foreground objects Raw Image Foreground region

Upload: others

Post on 17-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSE 152, Spring 2017 Introduction to Computer …6 CSE 152, Spring 2017 Introduction to Computer Vision Solving for flow • We can measure • We want to solve for • One equation,

1

CSE 152, Spring 2017 Introduction to Computer Vision

Motion

Introduction to Computer Vision

CSE 152

Lecture 12

CSE 152, Spring 2017 Introduction to Computer Vision

Announcements

• Homework 3 is due today, 11:59 PM

• Reading:– Section 10.6.1: Optical Flow and Motion

– Section 10.6.2: Flow Models

– Introductory Techniques for 3-D Computer Vision, Trucco and Verri

• Chapter 8: Motion

CSE 152, Spring 2017 Introduction to Computer Vision

Continuous Motion

• Consider a video camera moving continuously along a trajectory (rotating & translating).

• How do points in the image move?

• What does that tell us about the 3-D motion & scene structure?

CSE 152, Spring 2017 Introduction to Computer Vision

Motion

“When objects move at equal speed,those more remote seem to movemore slowly.”

- Euclid, 300 BC

CSE 152, Spring 2017 Introduction to Computer Vision

Simplest Idea for video processingImage Differences

• Given image I(u,v,t) and I(u,v, t+t), compute I(u,v, t+t) - I(u,v,t).

• This is partial derivative:

• At object boundaries, is large and is a cue for segmentation

• Does not indicate which way objects are moving

t

I

t

I

CSE 152, Spring 2017 Introduction to Computer Vision

Background Subtraction

• Gather image I(x,y,t0) of background without objects of interest (perhaps computed over average over many images).

• At time t, pixels where |I(x,y,t)-I(x,y,t0)| > are labeled as coming from foreground objects

Raw Image Foreground region

Page 2: CSE 152, Spring 2017 Introduction to Computer …6 CSE 152, Spring 2017 Introduction to Computer Vision Solving for flow • We can measure • We want to solve for • One equation,

2

CSE 152, Spring 2017 Introduction to Computer Vision

The Motion FieldWhere in the image did a point move?

Down and left

CSE 152, Spring 2017 Introduction to Computer Vision

The Motion Field

CSE 152, Spring 2017 Introduction to Computer Vision

What causes a motion field?

1. Camera moves (translates, rotates)

2. Objects in scene move rigidly

3. Objects articulate (pliers, humans, animals)

4. Objects bend and deform (fish)

5. Blowing smoke, clouds

CSE 152, Spring 2017 Introduction to Computer Vision

Is motion estimation inherent in humans?Demo

http://michaelbach.de/ot/cog-hiddenBird/index.html

CSE 152, Spring 2017 Introduction to Computer Vision

Rigid Motion and the Motion Field

CSE 152, Spring 2017 Introduction to Computer Vision

Rigid Motion: General Case

Position and orientation of a rigid bodyRotation Matrix & Translation vector

Rigid Motion:Velocity Vector: T

Angular Velocity Vector: (or )

P

pTp

p

Page 3: CSE 152, Spring 2017 Introduction to Computer …6 CSE 152, Spring 2017 Introduction to Computer Vision Solving for flow • We can measure • We want to solve for • One equation,

3

CSE 152, Spring 2017 Introduction to Computer Vision

General Motion

y

x

z

f

v

u

y

x

z

z

y

x

z

f

v

u2

v

u

z

z

y

x

z

f

pTp Substitute where p=(x,y,z)T

CSE 152, Spring 2017 Introduction to Computer Vision

Motion Field Equation

• T: Components of 3-D linear motion• Angular velocity vector• (u,v): Image point coordinates• Z: depth• f: focal length

f

v

f

uvuf

Z

fTvTv

f

u

f

uvvf

Z

fTuTu

xyzx

yz

yxzy

xz

2

2

CSE 152, Spring 2017 Introduction to Computer Vision

f

v

f

uvuf

Z

fTvTv

f

u

f

uvvf

Z

fTuTu

xyzx

yz

yxzy

xz

2

2

Pure Translation

CSE 152, Spring 2017 Introduction to Computer Vision

Forward Translation & Focus of Expansion[Gibson, 1950]

CSE 152, Spring 2017 Introduction to Computer Vision

Pure Translation

Radialabout FOE

Parallel( FOE point at infinity)

TZ = 0Motion parallel to image plane

CSE 152, Spring 2017 Introduction to Computer Vision

Pure Rotation: T=0

• Independent of Tx Ty Tz

• Independent of Z• Only function of (u,v), f and

f

v

f

uvuf

Z

fTvTv

f

u

f

uvvf

Z

fTuTu

xyzx

yz

yxzy

xz

2

2

Page 4: CSE 152, Spring 2017 Introduction to Computer …6 CSE 152, Spring 2017 Introduction to Computer Vision Solving for flow • We can measure • We want to solve for • One equation,

4

CSE 152, Spring 2017 Introduction to Computer Vision

Rotational MOTION FIELDThe “instantaneous” velocity of points in an image

PURE ROTATION

= (0,0,1)T

CSE 152, Spring 2017 Introduction to Computer Vision

Pure translation and pure rotation:Motion Field on Sphere

CSE 152, Spring 2017 Introduction to Computer Vision

Motion Field Equation: Estimate Depth

If T, and f are known or measured, then for each image point (u,v), one can solve for the depth Z given measured motion (du/dt, dv/dt) at (u,v).

f

v

f

uvuf

Z

fTvTv

f

u

f

uvvf

Z

fTuTu

xyzx

yz

yxzy

xz

2

2

CSE 152, Spring 2017 Introduction to Computer Vision

Optical Flow

CSE 152, Spring 2017 Introduction to Computer Vision

Optical Flow:Where do pixels move to?

CSE 152, Spring 2017 Introduction to Computer Vision

Estimating the motion field from images

1. Feature-based (Sect. 8.4.2 of Trucco & Verri)

1. Detect (corner-like) features in an image

2. Search for the same features nearby (feature tracking)

2. Differential techniques (Sect. 8.4.1)

Page 5: CSE 152, Spring 2017 Introduction to Computer …6 CSE 152, Spring 2017 Introduction to Computer Vision Solving for flow • We can measure • We want to solve for • One equation,

5

CSE 152, Spring 2017 Introduction to Computer Vision

Problem Definition: Optical Flow

• How to estimate pixel motion from image H to image I?

– Find pixel correspondences

• Given a pixel in H, look for nearby pixels of the same color in I

• Key assumptions– color constancy: a point in H looks “the same” in image I

• For grayscale images, this is brightness constancy

– small motion: points do not move very farCSE 152, Spring 2017 Introduction to Computer Vision

Optical Flow Motion Field

Motion field exists but no optical flow No motion field but shading changes

CSE 152, Spring 2017 Introduction to Computer Vision

Definition of optical flow

OPTICAL FLOW = apparent motion of brightness patterns

Ideally, the optical flow is the projection of the three-dimensional velocity vectors on the image

CSE 152, Spring 2017 Introduction to Computer Vision

Optical Flow Constraint Equation

1. Assume brightness of patch remains same in both images:

2. Assume small motion: (Taylor expansion of LHS up to first order)

),( yx

),( tvytux

ttime tttime ),( yx

Optical Flow: Velocities ),( vu

Displacement:

),(),( tvtuyx

I(x u t,y v t,t t) I(x, y,t)

I(x, y, t) xI

xy

I

yt

I

t I(x, y,t)

CSE 152, Spring 2017 Introduction to Computer Vision

Optical Flow Constraint Equation

),( yx

),( tvytux

ttime tttime ),( yx

Optical Flow: Velocities ),( vu

Displacement:

),(),( tvtuyx

x

t

I

xy

t

I

yI

t 0

3. Subtracting I(x,y,t) from both sides and dividing by t

4. Assume small interval, this becomes:

dx

dt

I

x

dy

dt

I

yI

t 0

CSE 152, Spring 2017 Introduction to Computer Vision

Mathematical formulation

[Note change of notation: image coordinates now (x,y), not (u,v)]

I (x,y,t) = brightness at image point (x,y) at time t

Optical flow constraint equation :

0

t

I

dt

dy

y

I

dt

dx

x

I

dt

dI

Consider scene (or camera) to be moving, so x(t), y(t)

),,(),,( tyxItttdt

dyyt

dt

dxxI

Brightness constancy assumption:

0dt

dI

Page 6: CSE 152, Spring 2017 Introduction to Computer …6 CSE 152, Spring 2017 Introduction to Computer Vision Solving for flow • We can measure • We want to solve for • One equation,

6

CSE 152, Spring 2017 Introduction to Computer Vision

Solving for flow

• We can measure

• We want to solve for

• One equation, two unknowns

Optical flow constraint equation :

0

t

I

dt

dy

y

I

dt

dx

x

I

dt

dI

t

I

y

I

x

I

,,

dt

dy

dt

dx,

CSE 152, Spring 2017 Introduction to Computer Vision

y

II x

y

II y

t

IIt

Measurements

dt

dxu

dt

dyv

Flow vector

The component of the optical flow in the direction of the image gradient.

CSE 152, Spring 2017 Introduction to Computer Vision

Optical Flow Constraint

CSE 152, Spring 2017 Introduction to Computer Vision

Apparently an aperture problem

CSE 152, Spring 2017 Introduction to Computer Vision

What is the correspondence of P & P’

Contour plots of image intensity in two images

CSE 152, Spring 2017 Introduction to Computer Vision

Two ways to get flow

1. Think globally, and regularize over image

2. Look over window and assume constant motion in the window

Page 7: CSE 152, Spring 2017 Introduction to Computer …6 CSE 152, Spring 2017 Introduction to Computer Vision Solving for flow • We can measure • We want to solve for • One equation,

7

CSE 152, Spring 2017 Introduction to Computer Vision

02),(

02),(

tyxy

tyxx

IvIuIIdv

vudE

IvIuIIdu

vudE

CSE 152, Spring 2017 Introduction to Computer Vision

CSE 152, Spring 2017 Introduction to Computer Vision

Edge

– large gradients, all the same– large 1, small 2

CSE 152, Spring 2017 Introduction to Computer Vision

Low texture region

– gradients have small magnitude– small 1, small 2

CSE 152, Spring 2017 Introduction to Computer Vision

High textured region

– gradients are different, large magnitudes– large 1, large 2

CSE 152, Spring 2017 Introduction to Computer Vision

Some variants

• Iterative refinement

• Coarse to fine (image pyramids)

• Local/global motion models

• Robust estimation

Page 8: CSE 152, Spring 2017 Introduction to Computer …6 CSE 152, Spring 2017 Introduction to Computer Vision Solving for flow • We can measure • We want to solve for • One equation,

8

CSE 152, Spring 2017 Introduction to Computer Vision CSE 152, Spring 2017 Introduction to Computer Vision

Revisiting the small motion assumption

• Is this motion small enough?– Probably not—it’s much larger than one pixel (2nd order terms dominate)

– How might we solve this problem?

CSE 152, Spring 2017 Introduction to Computer Vision CSE 152, Spring 2017 Introduction to Computer Vision

CSE 152, Spring 2017 Introduction to Computer Vision

image Iimage J

Gaussian pyramid of image J Gaussian pyramid of image I

image Iimage J

Coarse-to-fine optical flow estimation

run iterative L-K

run iterative L-K

warp & upsample

.

.

.

CSE 152, Spring 2017 Introduction to Computer Vision

Page 9: CSE 152, Spring 2017 Introduction to Computer …6 CSE 152, Spring 2017 Introduction to Computer Vision Solving for flow • We can measure • We want to solve for • One equation,

9

CSE 152, Spring 2017 Introduction to Computer Vision

Multi-resolution Lucas Kanade Algorithm

CSE 152, Spring 2017 Introduction to Computer Vision

CSE 152, Spring 2017 Introduction to Computer Vision

Motion Model Example: Affine Motion

CSE 152, Spring 2017 Introduction to Computer Vision

Next Lecture

• Tracking

• Reading:– Chapter 11: Tracking