14.1 brightness constancy16385/s17/slides/14.1_brightness_constancy.pdf · brightness constancy...

39
Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University

Upload: others

Post on 04-Jun-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Brightness Constancy16-385 Computer Vision (Kris Kitani)

Carnegie Mellon University

Page 2: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Optical FlowProblem Definition

Assumptions

Brightness constancy

Small motion

Given two consecutive image frames, estimate the motion of each pixel

Page 3: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Brightness constancy

· · ·

(x(1), y(1))

(x(2), y(2))

(x(k), y(k))

Scene point moving through image sequence

Assumption 1

Page 4: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Brightness constancy

I(x, y, 1) I(x, y, 2)

· · ·

I(x, y, k)

(x(1), y(1))

(x(2), y(2))

(x(k), y(k))

Scene point moving through image sequence

Assumption 1

Page 5: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Brightness constancy

I(x, y, 1) I(x, y, 2)

· · ·

I(x, y, k)

(x(1), y(1))

(x(2), y(2))

Assumption:Brightness of the point will remain the same

(x(k), y(k))

Scene point moving through image sequence

Assumption 1

Page 6: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Brightness constancy

I(x, y, 1) I(x, y, 2)

· · ·

I(x, y, k)

(x(1), y(1))

(x(2), y(2))

Assumption:Brightness of the point will remain the same

I(x(t), y(t), t) = C

constant

(x(k), y(k))

Scene point moving through image sequence

Assumption 1

Page 7: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Small motion

I(x, y, t) I(x, y, t+ �t)

Assumption 2

Page 8: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Small motion

I(x, y, t)

(x, y)

(x+ u�t, y + v�t)

(x, y)

I(x, y, t+ �t)

Assumption 2

Page 9: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Small motion

I(x, y, t)

(x, y)

(x+ u�t, y + v�t)

(x, y)

(u, v) (�x, �y) = (u�t, v�t)Optical flow (velocities): Displacement:

I(x, y, t+ �t)

Assumption 2

Page 10: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Small motion

I(x, y, t)

(x, y)

(x+ u�t, y + v�t)

(x, y)

(u, v) (�x, �y) = (u�t, v�t)Optical flow (velocities): Displacement:

I(x+ u�t, y + v�t, t+ �t) = I(x, y, t)

… the brightness between two consecutive image frames is the same

I(x, y, t+ �t)

For a really small space-time step…

Assumption 2

Page 11: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

dI

dt

=@I

@x

dx

dt

+@I

@y

dy

dt

+@I

@t

= 0

total derivative partial derivative

Equality is not obvious. Where does this come from?

These assumptions yield the …

Brightness Constancy Equation

Page 12: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

dI

dt

=@I

@x

dx

dt

+@I

@y

dy

dt

+@I

@t

= 0

total derivative partial derivative

Where does this come from?

These assumptions yield the …

Brightness Constancy Equation

proof!

Page 13: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

I(x+ u�t, y + v�t, t+ �t) = I(x, y, t)For small space-time step, brightness of a point is the same

Page 14: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

I(x+ u�t, y + v�t, t+ �t) = I(x, y, t)For small space-time step, brightness of a point is the same

Insight:If the time step is really small,

we can linearize the intensity function

Page 15: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

I(x+ u�t, y + v�t, t+ �t) = I(x, y, t)

Multivariable Taylor Series Expansion (First order approximation, two variables)

f(x, y) ⇡ f(a, b) + f

x

(a, b)(x� a)� f

y

(a, b)(y � b)

Page 16: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

I(x+ u�t, y + v�t, t+ �t) = I(x, y, t)

Multivariable Taylor Series Expansion (First order approximation, two variables)

f(x, y) ⇡ f(a, b) + f

x

(a, b)(x� a)� f

y

(a, b)(y � b)

assuming small motionI(x, y, t) +

@I

@x

�x+@I

@y

�y +@I

@t

�t = I(x, y, t)

Page 17: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

I(x+ u�t, y + v�t, t+ �t) = I(x, y, t)

assuming small motionI(x, y, t) +

@I

@x

�x+@I

@y

�y +@I

@t

�t = I(x, y, t)

cancel terms

Multivariable Taylor Series Expansion (First order approximation, two variables)

f(x, y) ⇡ f(a, b) + f

x

(a, b)(x� a)� f

y

(a, b)(y � b)

fixed point

partial derivative

Page 18: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

I(x+ u�t, y + v�t, t+ �t) = I(x, y, t)

assuming small motionI(x, y, t) +

@I

@x

�x+@I

@y

�y +@I

@t

�t = I(x, y, t)

@I

@x

�x+@I

@y

�y +@I

@t

�t = 0 cancel terms

Multivariable Taylor Series Expansion (First order approximation, two variables)

f(x, y) ⇡ f(a, b) + f

x

(a, b)(x� a)� f

y

(a, b)(y � b)

Page 19: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

I(x+ u�t, y + v�t, t+ �t) = I(x, y, t)

assuming small motion

divide by

take limit

�t

�t ! 0

I(x, y, t) +@I

@x

�x+@I

@y

�y +@I

@t

�t = I(x, y, t)

@I

@x

�x+@I

@y

�y +@I

@t

�t = 0

Multivariable Taylor Series Expansion (First order approximation, two variables)

f(x, y) ⇡ f(a, b) + f

x

(a, b)(x� a)� f

y

(a, b)(y � b)

Page 20: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

I(x+ u�t, y + v�t, t+ �t) = I(x, y, t)

assuming small motion

@I

@x

dx

dt

+@I

@y

dy

dt

+@I

@t

= 0

divide by

take limit

�t

�t ! 0

I(x, y, t) +@I

@x

�x+@I

@y

�y +@I

@t

�t = I(x, y, t)

@I

@x

�x+@I

@y

�y +@I

@t

�t = 0

Multivariable Taylor Series Expansion (First order approximation, two variables)

f(x, y) ⇡ f(a, b) + f

x

(a, b)(x� a)� f

y

(a, b)(y � b)

Page 21: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

I(x+ u�t, y + v�t, t+ �t) = I(x, y, t)

assuming small motion

@I

@x

dx

dt

+@I

@y

dy

dt

+@I

@t

= 0

divide by

take limit

�t

�t ! 0

I(x, y, t) +@I

@x

�x+@I

@y

�y +@I

@t

�t = I(x, y, t)

@I

@x

�x+@I

@y

�y +@I

@t

�t = 0

Brightness Constancy Equation

Multivariable Taylor Series Expansion (First order approximation, two variables)

f(x, y) ⇡ f(a, b) + f

x

(a, b)(x� a)� f

y

(a, b)(y � b)

Page 22: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

@I

@x

dx

dt

+@I

@y

dy

dt

+@I

@t

= 0

Ix

u+ Iy

v + It

= 0 shorthand notation

rI>v + It = 0 vector form

Brightness Constancy Equation

(x-flow) (y-flow)

(1 x 2) (2 x 1)

Page 23: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Ix

u+ Iy

v + It

= 0

(putting the math aside for a second…)

What do the term of the brightness constancy equation represent?

Page 24: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Ix

u+ Iy

v + It

= 0

(putting the math aside for a second…)

What do the term of the brightness constancy equation represent?

Image gradients (at a point p)

Page 25: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Ix

u+ Iy

v + It

= 0

(putting the math aside for a second…)

What do the term of the brightness constancy equation represent?

flow velocities

Image gradients (at a point p)

Page 26: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Ix

u+ Iy

v + It

= 0

(putting the math aside for a second…)

What do the term of the brightness constancy equation represent?

flow velocities

temporal gradient

How do you compute these terms?

Image gradients (at a point p)

Page 27: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

spatial derivative

Ix

u+ Iy

v + It

= 0

I

x

=@I

@x

Iy =@I

@y

How do you compute …

Page 28: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

spatial derivative

Ix

u+ Iy

v + It

= 0

I

x

=@I

@x

Iy =@I

@y

Forward difference Sobel filter Scharr filter

How do you compute …

Page 29: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

spatial derivative temporal derivative

Ix

u+ Iy

v + It

= 0

I

x

=@I

@x

Iy =@I

@yIt =

@I

@t

Forward difference Sobel filter Scharr filter

How do you compute …

Page 30: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

spatial derivative temporal derivative

Ix

u+ Iy

v + It

= 0

I

x

=@I

@x

Iy =@I

@yIt =

@I

@t

Forward difference Sobel filter Scharr filter

How do you compute …

frame differencing

Page 31: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Frame differencing

1 1 1 1 11 1 1 1 11 10 10 10 101 10 10 10 101 10 10 10 101 10 10 10 10

1 1 1 1 11 1 1 1 11 1 1 1 11 1 10 10 101 1 10 10 101 1 10 10 10

0 0 0 0 00 0 0 0 00 9 9 9 90 9 0 0 00 9 0 0 00 9 0 0 0

It =@I

@tt t+ 1

(example of a forward difference)

- =

Page 32: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Example:1 1 1 1 11 1 1 1 11 10 10 10 101 10 10 10 101 10 10 10 101 10 10 10 10

1 1 1 1 11 1 1 1 11 1 1 1 11 1 10 10 101 1 10 10 101 1 10 10 10

y

x

y

x

- 0 0 0 -- 0 0 0 -- 9 0 0 -- 9 0 0 -- 9 0 0 -- 9 0 0 -

y

x

- - - - -0 0 0 0 00 9 9 9 9- 0 0 0 00 0 0 0 0- - - - -

y

x

I

x

=@I

@x

Iy =@I

@yIt =

@I

@t

t t+ 1

0 0 0 0 00 0 0 0 00 9 9 9 90 9 0 0 00 9 0 0 00 9 0 0 0

y

x

3 x 3 patch

-1 0 1

-1 0 1

Page 33: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

spatial derivative optical flow

Ix

u+ Iy

v + It

= 0

I

x

=@I

@x

Iy =@I

@y u =dx

dt

v =dy

dt

Forward difference Sobel filter Scharr filter

How do you compute …

temporal derivative

It =@I

@t

frame differencingHow do you compute this?

Page 34: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

spatial derivative optical flow

Ix

u+ Iy

v + It

= 0

I

x

=@I

@x

Iy =@I

@y u =dx

dt

v =dy

dt

Forward difference Sobel filter Scharr filter

How do you compute …

temporal derivative

It =@I

@t

frame differencingWe need to solve for this!(this is the unknown in the

optical flow problem)

Page 35: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

spatial derivative optical flow

Ix

u+ Iy

v + It

= 0

I

x

=@I

@x

Iy =@I

@y u =dx

dt

v =dy

dt

Forward difference Sobel filter Scharr filter

(u, v)Solution lies on a line

Cannot be found uniquely with a single constraint

How do you compute …

temporal derivative

It =@I

@t

frame differencing

Page 36: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Ix

u+ Iy

v + It

= 0

known

unknown

We need at least ____ equations to solve for 2 unknowns.

Page 37: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Ix

u+ Iy

v + It

= 0

known

unknown

Where do we get more equations (constraints)?

Page 38: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

Ix

u+ Iy

v + It

= 0

u

v

Solution lies on a straight line

The solution cannot be determined uniquely with a single constraint (a single pixel)

many combinations of u and v will satisfy the equality

Page 39: 14.1 Brightness Constancy16385/s17/Slides/14.1_Brightness_Constancy.pdf · Brightness Constancy 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University. Optical Flow Problem

spatial derivative optical flow temporal derivative

Ix

u+ Iy

v + It

= 0

I

x

=@I

@x

Iy =@I

@y u =dx

dt

v =dy

dtIt =

@I

@t

How can we use the brightness constancy equation to estimate the optical flow?