Lecture’14:’’ Tracking’mo3on’features’’...

72
Lecture 14 - Fei-Fei Li Lecture 14: Tracking mo3on features – op3cal flow Dr. Juan Carlos Niebles Stanford AI Lab Professor FeiFei Li Stanford Vision Lab 5Nov15 1

Transcript of Lecture’14:’’ Tracking’mo3on’features’’...

Page 1: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Lecture  14:    Tracking  mo3on  features    

–  op3cal  flow  

Dr.  Juan  Carlos  Niebles  Stanford  AI  Lab  

 Professor  Fei-­‐Fei  Li  Stanford  Vision  Lab  

5-­‐Nov-­‐15  1  

Page 2: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

What  we  will  learn  today?  

•  Introduc3on  •  Op3cal  flow  •  Feature  tracking  •  Applica3ons  •  (Supplementary)  Technical  note  

5-­‐Nov-­‐15  2  

Reading:  [Szeliski]  Chapters:  8.4,  8.5    [Fleet  &  Weiss,  2005]  hZp://www.cs.toronto.edu/pub/jepson/teaching/vision/2503/op3calFlow.pdf  

Page 3: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

From  images  to  videos  •  A  video  is  a  sequence  of  frames  captured  over  3me  •  Now  our  image  data  is  a  func3on  of  space  (x,  y)  and  3me  (t)  

5-­‐Nov-­‐15  3  

Page 4: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Mo3on  es3ma3on  techniques  

•  Op3cal  flow  –  Recover  image  mo3on  at  each  pixel  from  spa3o-­‐temporal  

image  brightness  varia3ons  (op3cal  flow)  

•  Feature-­‐tracking  –  Extract  visual  features  (corners,  textured  areas)  and  “track”  

them  over  mul3ple  frames  

5-­‐Nov-­‐15  4  

Page 5: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Picture  courtesy  of  Selim  Temizer  -­‐  Learning  and  Intelligent  Systems  (LIS)  Group,  MIT    

Op3cal  flow  

Vector  field  func3on  of  the  spa3o-­‐temporal  image  brightness  varia3ons    

5-­‐Nov-­‐15  5  

Page 6: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Feature-­‐tracking  

Courtesy  of  Jean-­‐Yves  Bouguet  –  Vision  Lab,  California  Ins3tute  of  Technology  

5-­‐Nov-­‐15  6  

Page 7: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Feature-­‐tracking  

Courtesy  of  Jean-­‐Yves  Bouguet  –  Vision  Lab,  California  Ins3tute  of  Technology  

5-­‐Nov-­‐15  7  

Page 8: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Op3cal  flow  •  Defini3on:  op3cal  flow  is  the  apparent  mo3on  of  brightness  paZerns  in  the  image  

•  Note:  apparent  mo3on  can  be  caused  by  ligh3ng  changes  without  any  actual  mo3on  –  Think  of  a  uniform  rota3ng  sphere  under  fixed  ligh3ng  vs.  a  sta3onary  sphere  under  moving  illumina3on  

GOAL:  Recover  image  mo3on  at  each  pixel  from  op3cal  flow  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  8  

Page 9: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Es3ma3ng  op3cal  flow  

•  Given  two  subsequent  frames,  es3mate  the  apparent  mo3on  field  u(x,y),  v(x,y)  between  them  

•  Key  assump3ons  •  Brightness  constancy:    projec3on  of  the  same  point  looks  the  same  in  

every  frame  •  Small  mo9on:    points  do  not  move  very  far  •  Spa9al  coherence:  points  move  like  their  neighbors  

I(x,y,t–1) I(x,y,t)

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  9  

technical

note

Page 10: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

I(x +u, y+ v, t) ≈ I(x, y, t −1)+ Ix ⋅u(x, y)+ Iy ⋅ v(x, y)+ It

•  Brightness  Constancy  Equa3on:  I(x, y, t −1) = I(x +u(x, y), y+ v(x, y), t)

Linearizing  the  right  side  using  Taylor  expansion:  

The  brightness  constancy  constraint  

I(x,y,t–1) I(x,y,t)

0≈+⋅+⋅ tyx IvIuIHence,  

Image  deriva3ve  along  x  

→∇I ⋅ u v[ ]T + It = 0I(x +u, y+ v, t)− I(x, y, t −1) = Ix ⋅u(x, y)+ Iy ⋅ v(x, y)+ It

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  10  

technical

note

Page 11: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

•  How  many  equa3ons  and  unknowns  per  pixel?  

The  component  of  the  flow  perpendicular  to  the  gradient  (i.e.,  parallel  to  the  edge)  cannot  be  measured  

edge  

(u,v)  

(u’,v’)  

gradient  

(u+u’,v+v’)  

If  (u,  v  )  sa3sfies  the  equa3on,    so  does  (u+u’,  v+v’  )  if    

• One  equa3on  (this  is  a  scalar  equa3on!),  two  unknowns  (u,v)  

∇I ⋅ u ' v '[ ]T = 0

Can  we  use  this  equa3on  to  recover  image  mo3on  (u,v)  at  each  pixel?  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  11  

The  brightness  constancy  constraint  techn

ical

note

∇I ⋅ u v[ ]T + It = 0

Page 12: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

The  aperture  problem  

Actual  mo9on  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  12  

Page 13: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

The  aperture  problem  

Perceived  mo9on   Source:  Silvio  Savarese  

5-­‐Nov-­‐15  13  

Page 14: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

The  barber  pole  illusion  

hZp://en.wikipedia.org/wiki/Barberpole_illusion   Source:  Silvio  Savarese  

5-­‐Nov-­‐15  14  

Page 15: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

The  barber  pole  illusion  

hZp://en.wikipedia.org/wiki/Barberpole_illusion   Source:  Silvio  Savarese  

5-­‐Nov-­‐15  15  

Page 16: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 16  

*  From

 Marc  Po

llefeys  COMP  256  20

03  

Aperture  problem  cont’d  

5-­‐Nov-­‐15  

Page 17: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Solving  the    ambiguity…  

•  How  to  get  more  equa3ons  for  a  pixel?  •  Spa9al  coherence  constraint:      •         Assume  the  pixel’s  neighbors  have  the  same  (u,v)  

–  If  we  use  a  5x5  window,  that  gives  us  25  equa3ons  per  pixel  

B.  Lucas  and  T.  Kanade.  An  itera3ve  image  registra3on  technique  with  an  applica3on  to  stereo  vision.  In  Proceedings  of  the  Interna6onal  Joint  Conference  on  Ar6ficial  Intelligence,  pp.  674–679,  1981.  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  17  

technical

note

Page 18: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

•  Overconstrained  linear  system:  

Lucas-­‐Kanade  flow  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  18  

technical

note

Page 19: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

•  Overconstrained  linear  system  

The  summa3ons  are  over  all  pixels  in  the  K  x  K  window  

Least  squares  solu3on  for  d  given  by  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  19  

Lucas-­‐Kanade  flow  technical

note

Page 20: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Condi3ons  for  solvability  – Op3mal  (u,  v)  sa3sfies  Lucas-­‐Kanade  equa3on  

Does  this  remind  anything  to  you?  

When  is  This  Solvable?  •  ATA  should  be  inver3ble    •  ATA  should  not  be  too  small  due  to  noise  

–  eigenvalues  λ1  and  λ  2  of  ATA  should  not  be  too  small  •  ATA  should  be  well-­‐condi3oned  

–   λ  1/  λ  2  should  not  be  too  large  (λ  1  =  larger  eigenvalue)  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  20  

technical

note

Page 21: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

•  Eigenvectors  and  eigenvalues  of  ATA  relate  to  edge  direc3on  and  magnitude    •  The  eigenvector  associated  with  the  larger  eigenvalue  points  in  

the  direc3on  of  fastest  intensity  change  •  The  other  eigenvector  is  orthogonal  to  it  

M  =  ATA  is  the  second  moment  matrix  !  (Harris  corner  detector…)  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  21  

technical

note

Page 22: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Interpre3ng  the  eigenvalues  

λ1

λ2

“Corner” λ1 and λ2 are large, λ1 ~ λ2

λ1 and λ2 are small “Edge” λ1 >> λ2

“Edge” λ2 >> λ1

“Flat” region

Classifica3on  of  image  points  using  eigenvalues  of  the  second  moment  matrix:  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  22  

technical

note

Page 23: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Edge  

–   gradients  very  large  or  very  small  –   large λ1,  small  λ2  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  23  

technical

note

Page 24: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Low-­‐texture  region  

–   gradients  have  small  magnitude  –   small λ1,  small  λ2  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  24  

technical

note

Page 25: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

High-­‐texture  region  

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

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  25  

technical

note

Page 26: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

What  we  will  learn  today?  

•  Introduc3on  •  Op3cal  flow  •  Feature  tracking  •  Applica3ons  •  (Supplementary)  Technical  note  

5-­‐Nov-­‐15  26  

Page 27: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

What  are  good  features  to  track?  

•  Can  measure  “quality”  of  features  from  just  a  single  image  

•  Hence:  tracking  Harris  corners  (or  equivalent)  guarantees  small  error  sensi3vity!  

à    Implemented  in  Open  CV  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  27  

Page 28: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

•  Key  assump3ons  (Errors  in  Lucas-­‐Kanade)  

•  Small  mo9on:    points  do  not  move  very  far  

•  Brightness  constancy:    projec3on  of  the  same  point  looks  the  same  in  every  frame  

•  Spa9al  coherence:  points  move  like  their  neighbors  

Recap  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  28  

Page 29: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Revisi3ng  the  small  mo3on  assump3on  

•  Is  this  mo3on  small  enough?  –  Probably  not—it’s  much  larger  than  one  pixel  (2nd  order  terms  dominate)  –  How  might  we  solve  this  problem?  

* Fr

om K

hurr

am H

assa

n-S

hafiq

ue C

AP

5415

Com

pute

r Vis

ion

2003

5-­‐Nov-­‐15  29  

Page 30: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Reduce  the  resolu3on!  

* Fr

om K

hurr

am H

assa

n-S

hafiq

ue C

AP

5415

Com

pute

r Vis

ion

2003

5-­‐Nov-­‐15  30  

Page 31: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Source:  Silvio  Savarese  

image I image H

Gaussian  pyramid  of  image  1   Gaussian  pyramid  of  image  2  

image  2  image  1   u=10 pixels

u=5 pixels

u=2.5 pixels

u=1.25 pixels

Coarse-­‐to-­‐fine  op3cal  flow  es3ma3on  

5-­‐Nov-­‐15  31  

Page 32: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

image I image J

Gaussian  pyramid  of  image  1  (t)   Gaussian  pyramid  of  image  2  (t+1)  

image  2  image  1  

Coarse-­‐to-­‐fine  op3cal  flow  es3ma3on  

run  itera3ve  L-­‐K  

run  itera3ve  L-­‐K  

warp  &  upsample  

.  

.  

.  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  32  

Page 33: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Op3cal  Flow  Results  

* Fr

om K

hurr

am H

assa

n-S

hafiq

ue C

AP

5415

Com

pute

r Vis

ion

2003

5-­‐Nov-­‐15  33  

Page 34: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Op3cal  Flow  Results  

* Fr

om K

hurr

am H

assa

n-S

hafiq

ue C

AP

5415

Com

pute

r Vis

ion

2003

•   hZp://www.ces.clemson.edu/~stb/klt/  •   OpenCV  

5-­‐Nov-­‐15  34  

Page 35: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

•  Key  assump3ons  (Errors  in  Lucas-­‐Kanade)  

•  Small  mo9on:    points  do  not  move  very  far  

•  Brightness  constancy:    projec3on  of  the  same  point  looks  the  same  in  every  frame  

•  Spa9al  coherence:  points  move  like  their  neighbors  

Recap  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  35  

Page 36: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Reminder:  Gestalt  –  common  fate  

5-­‐Nov-­‐15  36  

Page 37: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Mo3on  segmenta3on  •  How  do  we  represent  the  mo3on  in  this  scene?  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  37  

Page 38: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

•  Break  image  sequence  into  “layers”  each  of  which  has  a  coherent  (affine)  mo3on  

Mo3on  segmenta3on  J.  Wang  and  E.  Adelson.  Layered  Representa3on  for  Mo3on  Analysis.  CVPR  1993.  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  38  

Page 39: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

•  Subs3tu3ng  into  the  brightness  constancy  equa3on:  

yaxaayxvyaxaayxu

654

321

),(),(

++=

++=

0≈+⋅+⋅ tyx IvIuI

Affine  mo3on  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  39  

technical

note

Page 40: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

0)()( 654321 ≈++++++ tyx IyaxaaIyaxaaI

•  Subs3tu3ng  into  the  brightness  constancy  equa3on:  

yaxaayxvyaxaayxu

654

321

),(),(

++=

++=

•     Each  pixel  provides  1  linear  constraint  in  6  unknowns  

[ ] 2∑ ++++++= tyx IyaxaaIyaxaaIaErr )()()( 654321!

•  Least  squares  minimiza3on:  

Affine  mo3on  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  40  

technical

note

Page 41: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

How  do  we  es3mate  the  layers?  •  1.  Obtain  a  set  of  ini3al  affine  mo3on  hypotheses  

–  Divide  the  image  into  blocks  and  es3mate  affine  mo3on  parameters  in  each  block  by  least  squares  •  Eliminate  hypotheses  with  high  residual  error  

•       Map  into  mo3on  parameter  space  •       Perform  k-­‐means  clustering  on  affine  mo3on  parameters  

– Merge  clusters  that  are  close  and  retain  the  largest  clusters  to  obtain  a  smaller  set  of  hypotheses  to  describe  all  the  mo3ons  in  the  scene  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  41  

technical

note

Page 42: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

How  do  we  es3mate  the  layers?  •  1.  Obtain  a  set  of  ini3al  affine  mo3on  hypotheses  

–  Divide  the  image  into  blocks  and  es3mate  affine  mo3on  parameters  in  each  block  by  least  squares  •  Eliminate  hypotheses  with  high  residual  error  

•       Map  into  mo3on  parameter  space  •       Perform  k-­‐means  clustering  on  affine  mo3on  parameters  

– Merge  clusters  that  are  close  and  retain  the  largest  clusters  to  obtain  a  smaller  set  of  hypotheses  to  describe  all  the  mo3ons  in  the  scene  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  42  

technical

note

Page 43: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

How  do  we  es3mate  the  layers?  •  1.  Obtain  a  set  of  ini3al  affine  mo3on  hypotheses  

–  Divide  the  image  into  blocks  and  es3mate  affine  mo3on  parameters  in  each  block  by  least  squares  •  Eliminate  hypotheses  with  high  residual  error  

•       Map  into  mo3on  parameter  space  •       Perform  k-­‐means  clustering  on  affine  mo3on  parameters  

– Merge  clusters  that  are  close  and  retain  the  largest  clusters  to  obtain  a  smaller  set  of  hypotheses  to  describe  all  the  mo3ons  in  the  scene  

2.  Iterate  un3l  convergence:  • Assign  each  pixel  to  best  hypothesis  

– Pixels  with  high  residual  error  remain  unassigned  

• Perform  region  filtering  to  enforce  spa3al  constraints  • Re-­‐es3mate  affine  mo3ons  in  each  region  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  43  

technical

note

Page 44: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Example  result  

J. Wang and E. Adelson. Layered Representation for Motion Analysis. CVPR 1993. Source:  Silvio  Savarese  

5-­‐Nov-­‐15  44  

Page 45: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

What  we  will  learn  today?  

•  Introduc3on  •  Op3cal  flow  •  Feature  tracking  •  Applica3ons  •  (Supplementary)  Technical  note  

 

5-­‐Nov-­‐15  45  

Page 46: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Uses  of  mo3on  

•  Tracking  features  •  Segmen3ng  objects  based  on  mo3on  cues  •  Learning  dynamical  models  •  Improving  video  quality  

– Mo3on  stabiliza3on  –  Super  resolu3on  

•  Tracking  objects  •  Recognizing  events  and  ac3vi3es  

5-­‐Nov-­‐15  46  

Page 47: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Es3ma3ng  3D  structure  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  47  

Page 48: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Segmen3ng  objects  based  on  mo3on  cues  

•  Background  subtrac3on  –  A  sta3c  camera  is  observing  a  scene  –  Goal:  separate  the  sta3c  background  from  the  moving  foreground  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  48  

Page 49: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

•  Mo3on  segmenta3on  –  Segment  the  video  into  mul3ple  coherently  moving  objects  

Segmen3ng  objects  based  on  mo3on  cues  

S.  J.  Pundlik  and  S.  T.  Birchfield,  Mo3on  Segmenta3on  at  Any  Speed,  Proceedings  of  the  Bri3sh  Machine  Vision  Conference    (BMVC)  2006  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  49  

Page 50: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Z.Yin  and  R.Collins,  "On-­‐the-­‐fly  Object  Modeling  while  Tracking,"  IEEE  Computer  Vision  and  PaIern  Recogni6on  (CVPR  '07),  Minneapolis,  MN,  June  2007.    

Tracking  objects  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  50  

Page 51: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Synthesizing  dynamic  textures  

5-­‐Nov-­‐15  51  

Page 52: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 52  

Super-­‐resolu3on  

Example:  A  set  of  low  quality  images  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  

Page 53: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 53  

Super-­‐resolu3on  

Each  of  these  images  looks  like  this:  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  

Page 54: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 54  

Super-­‐resolu3on  

The  recovery  result:  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  

Page 55: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

D. Ramanan, D. Forsyth, and A. Zisserman. Tracking People by Learning their Appearance. PAMI 2007.

Tracker

Recognizing  events  and  ac3vi3es  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  55  

Page 56: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Juan  Carlos  Niebles,  Hongcheng  Wang  and  Li  Fei-­‐Fei,  Unsupervised  Learning  of  Human  Ac9on  Categories  Using  Spa9al-­‐Temporal  Words,  (BMVC),  Edinburgh,  2006.    

Recognizing  events  and  ac3vi3es  

5-­‐Nov-­‐15  56  

Page 57: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Crossing  –  Talking  –  Queuing  –  Dancing  –  jogging    

W.  Choi  &    K.  Shahid  &  S.  Savarese  WMC  2010  

Recognizing  events  and  ac3vi3es  

Source:  Silvio  Savarese  

5-­‐Nov-­‐15  57  

Page 58: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

W.  Choi,  K.  Shahid,  S.  Savarese,  "What  are  they  doing?  :  Collec3ve  Ac3vity  Classifica3on  Using  Spa3o-­‐Temporal  Rela3onship  Among  People",  9th  Interna3onal  Workshop  on  Visual  Surveillance  (VSWS09)  in  conjuc3on  with  ICCV  09  

5-­‐Nov-­‐15  58  

Page 59: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

Op3cal  flow  without  mo3on!  

5-­‐Nov-­‐15  59  

Page 60: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li

What  we  have  learned  today?  

•  Introduc3on  •  Op3cal  flow  •  Feature  tracking  •  Applica3ons  •  (Supplementary)  Technical  note  

 

5-­‐Nov-­‐15  60  

[Fleet  &  Weiss,  2005]  hZp://www.cs.toronto.edu/pub/jepson/teaching/vision/2503/op3calFlow.pdf  

Reading:  [Szeliski]  Chapters:  8.4,  8.5    

Page 61: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 5-­‐Nov-­‐15  61  

technical

note

Fleet  &

 Weiss,  2005  

Page 62: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 5-­‐Nov-­‐15  62  

technical

note

Fleet  &

 Weiss,  2005  

Page 63: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 5-­‐Nov-­‐15  63  

technical

note

Fleet  &

 Weiss,  2005  

Page 64: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 5-­‐Nov-­‐15  64  

technical

note

Fleet  &

 Weiss,  2005  

Page 65: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 5-­‐Nov-­‐15  65  

technical

note

Fleet  &

 Weiss,  2005  

Page 66: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 5-­‐Nov-­‐15  66  

technical

note

Fleet  &

 Weiss,  2005  

Page 67: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 5-­‐Nov-­‐15  67  

technical

note

Fleet  &

 Weiss,  2005  

Page 68: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 5-­‐Nov-­‐15  68  

technical

note

Fleet  &

 Weiss,  2005  

Page 69: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 5-­‐Nov-­‐15  69  

technical

note

Fleet  &

 Weiss,  2005  

Page 70: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 5-­‐Nov-­‐15  70  

technical

note

Fleet  &

 Weiss,  2005  

Page 71: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 5-­‐Nov-­‐15  71  

technical

note

Fleet  &

 Weiss,  2005  

Page 72: Lecture’14:’’ Tracking’mo3on’features’’ –op3cal’flow’vision.stanford.edu/.../lecture14_optical_flow_cs131.pdfFei-Fei Li Lecture 14 - Lecture’14:’’ Tracking’mo3on’features’’

Lecture 14 - Fei-Fei Li 5-­‐Nov-­‐15  72  

technical

note

Fleet  &

 Weiss,  2005