optical flow horn schunck
play

Optical Flow: Horn-Schunck 16-385 Computer Vision (Kris Kitani) - PowerPoint PPT Presentation

Optical Flow: Horn-Schunck 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University Horn-Schunck Lucas-Kanade Optical Flow (1981) Optical Flow (1981) brightness constancy method of differences small motion smooth flow


  1. Optical Flow: Horn-Schunck 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University

  2. Horn-Schunck Lucas-Kanade Optical Flow (1981) Optical Flow (1981) brightness constancy method of differences small motion ‘smooth’ flow ‘constant’ flow (flow can vary from pixel to pixel) (flow is constant for all pixels) global method local method (dense) (sparse)

  3. Optical Flow (Problem definition) I ( x, y, t 0 ) I ( x, y, t ) Estimate the motion (flow) between these two consecutive images How is this different from estimating a 2D transform?

  4. Key Assumptions (unique to optical flow) Color Constancy (Brightness constancy for intensity images) Implication: allows for pixel to pixel comparison (not image features) Small Motion (pixels only move a little bit) Implication: linearization of the brightness constancy constraint

  5. Approach I ( x, y, t 0 ) I ( x, y, t ) Look for nearby pixels with the same color (small motion) (color constancy)

  6. Brightness constancy ( x + u δ t, y + v δ t ) ( x, y ) ( x, y ) I ( x, y, t ) I ( x, y, t + δ t ) ( 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 ) For a really small time step…

  7. Optical Flow Constraint equation I ( x + u δ t, y + v δ t, t + δ t ) = I ( x, y, t ) I ( x, y, t ) + ∂ I ∂ x δ x + ∂ I ∂ y δ y + ∂ I ∂ t δ t = I ( x, y, t ) ∂ I dt + ∂ I dt + ∂ I dx dy ∂ t = 0 ∂ x ∂ y I x u + I y v + I t = 0

  8. Solution lies on a straight line u I x u + I y v + I t = 0 v The solution cannot be determined uniquely with a single constraint (a single pixel)

  9. Where can we get an additional constraint?

  10. Horn-Schunck Lucas-Kanade Optical Flow (1981) Optical Flow (1981) brightness constancy method of differences small motion ‘smooth’ flow ‘constant’ flow (flow is smooth from pixel to pixel) (flow is constant for all pixels) global method local method

  11. Smoothness most objects in the world are rigid or deform elastically moving together coherently we expect optical flow fields to be smooth

  12. Key idea (of Horn-Schunck optical flow) Enforce brightness constancy Enforce smooth flow field to compute optical flow

  13. Key idea (of Horn-Schunck optical flow) Enforce brightness constancy Enforce smooth flow field to compute optical flow

  14. Enforce 
 brightness constancy I x u + I y v + I t = 0 For every pixel, � 2  I x u ij + I y v ij + I t min u,v

  15. Enforce 
 brightness constancy I x u + I y v + I t = 0 For every pixel, � 2  I x u ij + I y v ij + I t min u,v lazy notation for I x ( i, j )

  16. displacement of object Find the optical flow such that it satisfies: I y I x I t + = changes these changes these u v

  17. Key idea (of Horn-Schunck optical flow) Enforce brightness constancy Enforce smooth flow field to compute optical flow

  18. Enforce smooth flow field u i,j +1 u ( u i,j − u i +1 ,j ) 2 u ij u i − 1 ,j u i +1 ,j min u i,j − 1 u-component of flow

  19. u ( u i,j − u i +1 ,j ) 2 min Which flow field optimizes the objective? X X ( u ij − u i +1 ,j ) 2 ? ( u ij − u i +1 ,j ) 2 ij ij

  20. u ( u i,j − u i +1 ,j ) 2 min Which flow field optimizes the objective? big small

  21. Key idea (of Horn-Schunck optical flow) Enforce brightness constancy Enforce smooth flow field to compute optical flow bringing it all together…

  22. Horn-Schunck optical flow ⇢ � smoothness brightness constancy X min E s ( i, j ) + λ E d ( i, j ) u , v i,j weight

  23. HS optical flow objective function � 2  Brightness constancy E d ( i, j ) = I x u ij + I y v ij + I t Smoothness  � E s ( i, j ) = 1 ( u ij − u i +1 ,j ) 2 + ( u ij − u i,j +1 ) 2 + ( v ij − v i +1 ,j ) 2 + ( v ij − v i,j +1 ) 2 4 i, j + 1 i, j + 1 i, j + 1 i, j + 1 ( v ij − v i +1 ,j ) ( u ij − u i +1 ,j ) ( u ij − u i,j +1 ) ( v ij − v i,j +1 ) ij i + 1 , j ij i + 1 , j ij i + 1 , j i − 1 , j ij i + 1 , j i − 1 , j i − 1 , j i − 1 , j i, j − 1 i, j − 1 i, j − 1 i, j − 1 why not all four neighbors?

  24. How do we solve this minimization problem? ⇢ � X min E s ( i, j ) + λ E d ( i, j ) u , v i,j

  25. How do we solve this minimization problem? ⇢ � X min E s ( i, j ) + λ E d ( i, j ) u , v i,j Compute partial derivative, derive update equations (gradient decent!)

  26. Compute the partial derivatives of this huge sum! ( � 2 ) 1  �  ( u ij − u i +1 ,j ) 2 + ( u ij − u i,j +1 ) 2 + ( v ij − v i +1 ,j ) 2 + ( v ij − v i,j +1 ) 2 X + λ I x u ij + I y v ij + I t 4 ij smoothness term brightness constancy

  27. Compute the partial derivatives of this huge sum! ( � 2 ) 1  �  ( u ij − u i +1 ,j ) 2 + ( u ij − u i,j +1 ) 2 + ( v ij − v i +1 ,j ) 2 + ( v ij − v i,j +1 ) 2 X + λ I x u ij + I y v ij + I t 4 ij it’s not so bad… ∂ E = ∂ u kl how many u terms depend on k and l?

  28. Compute the partial derivatives of this huge sum! ( � 2 ) 1  �  ( u ij − u i +1 ,j ) 2 + ( u ij − u i,j +1 ) 2 + ( v ij − v i +1 ,j ) 2 + ( v ij − v i,j +1 ) 2 X + λ I x u ij + I y v ij + I t 4 ij it’s not so bad… ∂ E = ∂ u kl how many u terms depend on k and l? FOUR from smoothness ONE from brightness constancy

  29. Compute the partial derivatives of this huge sum! ( � 2 ) 1  �  ( u ij − u i +1 ,j ) 2 + ( u ij − u i,j +1 ) 2 + ( v ij − v i +1 ,j ) 2 + ( v ij − v i,j +1 ) 2 X + λ I x u ij + I y v ij + I t 4 ij it’s not so bad… ∂ E = 2( u kl − ¯ u kl ) + 2 λ ( I x u kl + I y v kl + I t ) I x ∂ u kl how many u terms depend on k and l? FOUR from smoothness ONE from brightness constancy

  30. Compute the partial derivatives of this huge sum! ( � 2 ) 1  �  ( u ij − u i +1 ,j ) 2 + ( u ij − u i,j +1 ) 2 + ( v ij − v i +1 ,j ) 2 + ( v ij − v i,j +1 ) 2 X + λ I x u ij + I y v ij + I t 4 ij i, j + 1 ( u ij − u i +1 ,j ) ( u 2 ij − 2 u ij u i +1 ,j + u 2 i +1 ,j ) ( u 2 ij − 2 u ij u i,j +1 + u 2 i,j +1 ) i − 1 , j ij i + 1 , j (variable will appear four times in sum) i, j − 1

  31. Compute the partial derivatives of this huge sum! ( � 2 ) 1  �  ( u ij − u i +1 ,j ) 2 + ( u ij − u i,j +1 ) 2 + ( v ij − v i +1 ,j ) 2 + ( v ij − v i,j +1 ) 2 X + λ I x u ij + I y v ij + I t 4 ij i, j + 1 ( u ij − u i +1 ,j ) ( u 2 ij − 2 u ij u i +1 ,j + u 2 i +1 ,j ) ( u 2 ij − 2 u ij u i,j +1 + u 2 i,j +1 ) i − 1 , j ij i + 1 , j (variable will appear four times in sum) i, j − 1 ∂ E = 2( u kl − ¯ u kl ) + 2 λ ( I x u kl + I y v kl + I t ) I x ∂ u kl ∂ E = 2( v kl − ¯ v kl ) + 2 λ ( I x u kl + I y v kl + I t ) I y ∂ v kl ⇢ � u ij = 1 short hand for ¯ u i +1 ,j + u i − 1 ,j + u i,j +1 + u i,j − 1 local average 4

  32. ∂ E = 2( u kl − ¯ u kl ) + 2 λ ( I x u kl + I y v kl + I t ) I x ∂ u kl ∂ E = 2( v kl − ¯ v kl ) + 2 λ ( I x u kl + I y v kl + I t ) I y ∂ v kl Where are the extrema of E?

  33. ∂ E = 2( u kl − ¯ u kl ) + 2 λ ( I x u kl + I y v kl + I t ) I x ∂ u kl ∂ E = 2( v kl − ¯ v kl ) + 2 λ ( I x u kl + I y v kl + I t ) I y ∂ v kl Where are the extrema of E? (set derivatives to zero and solve for unknowns u and v) (1 + λ I 2 x ) u kl + λ I x I y v kl = ¯ u kl − λ I x I t λ I x I y u kl + (1 + λ I 2 y ) v kl = ¯ v kl − λ I y I t

  34. ∂ E = 2( u kl − ¯ u kl ) + 2 λ ( I x u kl + I y v kl + I t ) I x ∂ u kl ∂ E = 2( v kl − ¯ v kl ) + 2 λ ( I x u kl + I y v kl + I t ) I y ∂ v kl Where are the extrema of E? (set derivatives to zero and solve for unknowns u and v) (1 + λ I 2 x ) u kl + λ I x I y v kl = ¯ u kl − λ I x I t λ I x I y u kl + (1 + λ I 2 y ) v kl = ¯ v kl − λ I y I t A x = b this is a linear system how do you solve this?

  35. ok, take a step back, why are we doing all this math?

  36. We are solving for the optical flow (u,v) given two constraints ( � 2 ) 1  �  ( u ij − u i +1 ,j ) 2 + ( u ij − u i,j +1 ) 2 + ( v ij − v i +1 ,j ) 2 + ( v ij − v i,j +1 ) 2 X + λ I x u ij + I y v ij + I t 4 ij smoothness brightness constancy We need the math to minimize this (back to the math)

  37. Partial derivatives of Horn-Schunck objective function E: ∂ E = 2( u kl − ¯ u kl ) + 2 λ ( I x u kl + I y v kl + I t ) I x ∂ u kl ∂ E = 2( v kl − ¯ v kl ) + 2 λ ( I x u kl + I y v kl + I t ) I y ∂ v kl Where are the extrema of E? (set derivatives to zero and solve for unknowns u and v) (1 + λ I 2 x ) u kl + λ I x I y v kl = ¯ u kl − λ I x I t λ I x I y u kl + (1 + λ I 2 y ) v kl = ¯ v kl − λ I y I t A x = b how do you solve this?

  38. (1 + λ I 2 x ) u kl + λ I x I y v kl = ¯ u kl − λ I x I t λ I x I y u kl + (1 + λ I 2 y ) v kl = ¯ v kl − λ I y I t x = A − 1 b = adj A det A b Recall

  39. (1 + λ I 2 x ) u kl + λ I x I y v kl = ¯ u kl − λ I x I t λ I x I y u kl + (1 + λ I 2 y ) v kl = ¯ v kl − λ I y I t x = A − 1 b = adj A det A b Recall Same as the linear system: { 1 + λ ( I 2 x + I 2 y ) } u kl = (1 + λ I 2 x )¯ u kl − λ I x I y ¯ v kl − λ I x I t (det A) { 1 + λ ( I 2 x + I 2 y ) } v kl = (1 + λ I 2 y )¯ v kl − λ I x I y ¯ u kl − λ I y I t (det A)

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend