CS-465 Computer Vision

Similar documents
CS 565 Computer Vision. Nazar Khan PUCIT Lectures 15 and 16: Optic Flow

COMPUTER VISION > OPTICAL FLOW UTRECHT UNIVERSITY RONALD POPPE

Mariya Zhariy. Uttendorf Introduction to Optical Flow. Mariya Zhariy. Introduction. Determining. Optical Flow. Results. Motivation Definition

Motion. 1 Introduction. 2 Optical Flow. Sohaib A Khan. 2.1 Brightness Constancy Equation

CS 4495 Computer Vision Motion and Optic Flow

Optic Flow and Basics Towards Horn-Schunck 1

Dense Image-based Motion Estimation Algorithms & Optical Flow

VC 11/12 T11 Optical Flow

Leow Wee Kheng CS4243 Computer Vision and Pattern Recognition. Motion Tracking. CS4243 Motion Tracking 1

The 2D/3D Differential Optical Flow

CS6670: Computer Vision

Lucas-Kanade Motion Estimation. Thanks to Steve Seitz, Simon Baker, Takeo Kanade, and anyone else who helped develop these slides.

Matching. Compare region of image to region of image. Today, simplest kind of matching. Intensities similar.

Capturing, Modeling, Rendering 3D Structures

Horn-Schunck and Lucas Kanade 1

Line, edge, blob and corner detection

Visual Tracking (1) Feature Point Tracking and Block Matching

Peripheral drift illusion

Motion Estimation. There are three main types (or applications) of motion estimation:

Lecture 16: Computer Vision

Feature Tracking and Optical Flow

Optical Flow-Based Motion Estimation. Thanks to Steve Seitz, Simon Baker, Takeo Kanade, and anyone else who helped develop these slides.

Feature Tracking and Optical Flow

EE795: Computer Vision and Intelligent Systems

ELEC Dr Reji Mathew Electrical Engineering UNSW

Motion Estimation (II) Ce Liu Microsoft Research New England

CS231A Section 6: Problem Set 3

International Journal of Advance Engineering and Research Development

Visual Tracking (1) Tracking of Feature Points and Planar Rigid Objects

CS664 Lecture #18: Motion

Finally: Motion and tracking. Motion 4/20/2011. CS 376 Lecture 24 Motion 1. Video. Uses of motion. Motion parallax. Motion field

Real-Time Optic Flow Computation with Variational Methods

Notes 9: Optical Flow

Ninio, J. and Stevens, K. A. (2000) Variations on the Hermann grid: an extinction illusion. Perception, 29,

EECS 556 Image Processing W 09

Augmented Reality VU. Computer Vision 3D Registration (2) Prof. Vincent Lepetit

CS4495 Fall 2014 Computer Vision Problem Set 5: Optic Flow

Comparison Between The Optical Flow Computational Techniques

Lecture 16: Computer Vision

Ruch (Motion) Rozpoznawanie Obrazów Krzysztof Krawiec Instytut Informatyki, Politechnika Poznańska. Krzysztof Krawiec IDSS

Motion and Optical Flow. Slides from Ce Liu, Steve Seitz, Larry Zitnick, Ali Farhadi

Multiple Combined Constraints for Optical Flow Estimation

MASTER THESIS. Optical Flow Features for Event Detection. Mohammad Afrooz Mehr, Maziar Haghpanah

Overview. Video. Overview 4/7/2008. Optical flow. Why estimate motion? Motion estimation: Optical flow. Motion Magnification Colorization.

Lecture 19: Motion. Effect of window size 11/20/2007. Sources of error in correspondences. Review Problem set 3. Tuesday, Nov 20

EE795: Computer Vision and Intelligent Systems

Multi-stable Perception. Necker Cube

CUDA GPGPU. Ivo Ihrke Tobias Ritschel Mario Fritz

Visual Tracking. Image Processing Laboratory Dipartimento di Matematica e Informatica Università degli studi di Catania.

Hand-Eye Calibration from Image Derivatives

Comparison between Optical Flow and Cross-Correlation Methods for Extraction of Velocity Fields from Particle Images

SURVEY OF LOCAL AND GLOBAL OPTICAL FLOW WITH COARSE TO FINE METHOD

Image processing and features

Visual Tracking. Antonino Furnari. Image Processing Lab Dipartimento di Matematica e Informatica Università degli Studi di Catania

SIFT: SCALE INVARIANT FEATURE TRANSFORM SURF: SPEEDED UP ROBUST FEATURES BASHAR ALSADIK EOS DEPT. TOPMAP M13 3D GEOINFORMATION FROM IMAGES 2014

Chapter 10 Image Segmentation. Yinghua He

Announcements. Edges. Last Lecture. Gradients: Numerical Derivatives f(x) Edge Detection, Lines. Intro Computer Vision. CSE 152 Lecture 10

Comparison of Feature Detection and Matching Approaches: SIFT and SURF

Part II: Modeling Aspects

Event-based Computer Vision

Autonomous Navigation for Flying Robots

Motion Estimation and Optical Flow Tracking

Technion - Computer Science Department - Tehnical Report CIS

Motion and Tracking. Andrea Torsello DAIS Università Ca Foscari via Torino 155, Mestre (VE)

Visual motion. Many slides adapted from S. Seitz, R. Szeliski, M. Pollefeys

Announcements. Edge Detection. An Isotropic Gaussian. Filters are templates. Assignment 2 on tracking due this Friday Midterm: Tuesday, May 3.

Marcel Worring Intelligent Sensory Information Systems

Computer Vision Lecture 20

Computer Vision for HCI. Topics of This Lecture

Image Processing. BITS Pilani. Dr Jagadish Nayak. Dubai Campus

LOCAL-GLOBAL OPTICAL FLOW FOR IMAGE REGISTRATION

Corner Detection. Harvey Rhody Chester F. Carlson Center for Imaging Science Rochester Institute of Technology

Computer Vision 2. SS 18 Dr. Benjamin Guthier Professur für Bildverarbeitung. Computer Vision 2 Dr. Benjamin Guthier

CSE 252A Computer Vision Homework 3 Instructor: Ben Ochoa Due : Monday, November 21, 2016, 11:59 PM

extracted occurring from the spatial and temporal changes in an image sequence. An image sequence

EE 264: Image Processing and Reconstruction. Image Motion Estimation I. EE 264: Image Processing and Reconstruction. Outline

Optical Flow Estimation with CUDA. Mikhail Smirnov

Computer Vision Lecture 20

Optical flow and tracking

Visual Tracking (1) Pixel-intensity-based methods

Automatic Image Alignment (direct) with a lot of slides stolen from Steve Seitz and Rick Szeliski

Computational Optical Imaging - Optique Numerique. -- Single and Multiple View Geometry, Stereo matching --

Spatial track: motion modeling

Computer Vision I. Announcement. Corners. Edges. Numerical Derivatives f(x) Edge and Corner Detection. CSE252A Lecture 11

Motion Analysis. Motion analysis. Now we will talk about. Differential Motion Analysis. Motion analysis. Difference Pictures

Optical Flow. Adriana Bocoi and Elena Pelican. 1. Introduction

High Accuracy Optical Flow Estimation Based on a Theory for Warping

Particle Tracking. For Bulk Material Handling Systems Using DEM Models. By: Jordan Pease

Towards the completion of assignment 1

Lecture 20: Tracking. Tuesday, Nov 27

Part 3: Image Processing

Revisiting Lucas-Kanade and Horn-Schunck

FACE DETECTION AND TRACKING AT DIFFERENT ANGLES IN VIDEO USING OPTICAL FLOW

Chapter 3 Image Registration. Chapter 3 Image Registration

Tracking Weather Storms using 3D Doppler Radial Velocity Information

Edge Detection. CS664 Computer Vision. 3. Edges. Several Causes of Edges. Detecting Edges. Finite Differences. The Gradient

Lecture 7: Most Common Edge Detectors

Feature Based Registration - Image Alignment

Computer Vision for HCI. Motion. Motion

The Lucas & Kanade Algorithm

Transcription:

CS-465 Computer Vision Nazar Khan PUCIT 9. Optic Flow

Optic Flow Nazar Khan Computer Vision 2 / 25

Optic Flow Nazar Khan Computer Vision 3 / 25

Optic Flow Where does pixel (x, y) in frame z move to in frame z + 1? [ ] [ ] [ ] x x u y = + y v We want to find the displacement vector (u, v) T pixel. for every Input: image sequence I (x, y, z), where (x, y) specifies the location and z denotes time/frame number Goal: displacement vector field of the image structures: optic flow (u(x, y, z), v(x, y, z)) Such correspondence problems are key problems in computer vision. Nazar Khan Computer Vision 4 / 25

Grey Value Constancy Assumption Corresponding pixels should have the same grey value. Thus, the optic flow between frame z and z +1 should satisfy I (x + u, y + v, z + 1) = I (x, y, z) = I (x, y, z) + ui x (x, y, z) + vi y (x, y, z) + 1I z (x, y, z) I (x, y, z) = I x (x, y, z)u + I y (x, y, z)v + I z (x, y, z) 0 assuming (u, v) is a small displacement. Linearized optic flow constraint (OFC) I x u + I y v + I z = 0 where location (x, y, z) is implied. Nazar Khan Computer Vision 5 / 25

How good are the assumptions? We have made two assumptions 1. Gray value constancy 2. Small displacements (since we use first-order Taylor series approximation) Both assumptions are (almost) true in surprisingly many scenarios. 1. Gray values do not change much between consecutive 1 frames. 2. Objects do not move too much between consecutive frames. For large displacements, image pyramid can be used. 1 For a video recorded at 25 frames per second (fps), consecutive frames are only 1 seconds apart. 24 Nazar Khan Computer Vision 6 / 25

Aperture Problem Complete Flow Normal Flow No Flow When seen through an aperture, true movement cannot be determined. Only the component of movement normal to edge direction can be determined. Nazar Khan Computer Vision 7 / 25

Normal Flow The OFC is one equation in two unknowns (infinite solutions). Can be written as [ ] T u I + I v z = 0 Adding any flow component orthogonal to image gradient does not affect the OFC. ([ ] ) T [ ] T u +k I u I + I v z = I +k I T I v = = 0 [ ] T u I + I v z } {{ } + I z 0 Nazar Khan Computer Vision 8 / 25

Normal Flow I I (u, v) (u n, v n ) I I [ un v n ] ([ ] u = I ) I v I I = I z I ( [ u I I v] I + Iz = 0 ) = 1 [ ] Ix I z Ix 2 + Iy 2 I y I z Only the component of flow in the direction of the gradient I can be computed. Since gradient is normal to the edge direction, this flow vector is called the normal flow. To compute a better estimate of optic flow, we need to make some assumptions. Nazar Khan Computer Vision 9 / 25

Local Optic Flow Method of Lucas & Kanade Lucas & Kanade make the following assumption: Pixels around (i, j) all have the same displacement (u, v). For 3 3 neighbourhoods, this gives 9 OFCs all having the same 2 unknowns (u, v). The optimal unknown displacement minimizes the sum-squared-error E(u, v) = 1 2 N ij (I x u + I y v + I z ) 2 Nazar Khan Computer Vision 10 / 25

Local Optic Flow Method of Lucas & Kanade Setting E u E = 0 and v [ N ij I 2 x = 0 yields a linear system N ij I x I y N ij I x I y N ij I 2 y ] [u ] = v [ ] N ij I x I z N ij I y I z Replacing the sums by Gaussian averaging yields [ Gρ Ix 2 ] [ ] [ ] G ρ I x I y u Gρ I G ρ I x I y G ρ Iy 2 v = x I z G ρ I y I z }{{} A (1) Notice the re-appearance of the structure tensor which now serves as the system matrix. Previously, we used it for corner detection. Flow vector can be found if rank(a) = 2. Nazar Khan Computer Vision 11 / 25

Local Optic Flow Method of Lucas & Kanade If rank(a) = 0, no gradients exist in the neighbourhood. So no optic flow can be computed. If rank(a) = 1, gradient vectors over all pixels in the neighbourhood are identical. Only normal flow can be computed. [ ] un = 1 [ ] Ix I z v n Ix 2 + Iy 2 I y I z To save computations, avoid computing rank. trace(a) = A 11 + A 22 0 = rank(a) = 0 trace(a) 0 and det(a) = A 11 A 22 A 2 12 0 = rank(a) = 1 Nazar Khan Computer Vision 12 / 25

Lucas & Kanade Algorithm Input: Frames I 1 and I 2. Parameters: 1) Noise smoothing scale σ, 2) Gradient smoothing scale ρ, 3) Thresholds τ trace and τ det. 1. Compute Gaussian derivatives at noise smoothing scale σ I x = Gσ x I 1 and I y = Gσ y I 1 2. Compute temporal derivative I z = I 2 I 1. 3. Compute the products I 2 x I 2 y I x I y I x I z and I y I z 4. Smooth the products at gradient smoothing scale ρ G ρ I 2 x G ρ I 2 y G ρ I x I y G ρ I x I z and G ρ I y I z and construct the linear system in (1) at every pixel. Nazar Khan Computer Vision 13 / 25

Lucas & Kanade Algorithm 5. For every pixel, solve the linear system conditioned on the rank. if A 11 + A 22 < τ trace rank(a)=0 so no flow else if A 11 A 22 A 2 12 < τ det rank(a)=1 so normal flow else rank(a)=2 so complete optic flow Nazar Khan Computer Vision 14 / 25

Visualising Displacement Vectors The HSV Color Space Each color is represented by 3 values 1. Hue or shade as an angle from 0 to 360. 2. Saturation or strength of the color 3. Value or brightness Figure: The HSV color space. Taken from http://reilley4color.blogspot.com/ 2016/05/munsell-hue-circle.html. Nazar Khan Computer Vision 15 / 25

Visualising Displacement Vectors Figure: Vector angle represented by hue/shade of color and vector magnitude represented by the saturation/strength of color. HSV color space is useful for such a mapping. H(x, y) = θ(x, y), S(x, y) = u(x, y) 2 + v(x, y) 2 and V (x, y) = constant. Nazar Khan Computer Vision 16 / 25

Lucas & Kanade Figure: Left to right: frame 1, frame 2, flow classification and false color visualization of optic flow vectors. For flow classification: white = optic flow, gray = normal flow and black = no flow. Integration scale was ρ = 1. Author: N. Khan (2015) Nazar Khan Computer Vision 17 / 25

Lucas & Kanade Figure: Left to right: frame 1, frame 2, flow classification and false color visualization of optic flow vectors. For flow classification: white = optic flow, gray = normal flow and black = no flow. Increasing the integration scale ρ to 4 fills up pixels with no flow using values from neighbouring pixels having normal or complete optic flow. Author: N. Khan (2015) Nazar Khan Computer Vision 18 / 25

Lucas & Kanade Summary Advantages Simple and fast method. Requires only two frames (low memory requirements). Good value for money: results often superior to more complicated approaches. Disadvantages Problems at locations where the local constancy assumption is violated: flow discontinuities and non-translatory motion (e.g. rotation). Local method that does not compute the flow field at all locations. Next we study a global method that produces dense flow fields (i.e., at every pixel). Nazar Khan Computer Vision 19 / 25

Variational Method of Horn & Schunck At some given time z the optic flow field is determined as minimising the function (u(x, y), v(x, y)) T of the energy functional E(u, v) = 1 (I x u + I y v + I z ) 2 +α ( u 2 + v 2) 2 }{{}}{{} x,y data term smoothness term Has a unique solution that depends continuously on the image data. Global method since optic flow at (x, y) depends on all pixels in both frames. Notation Alert! u and v are 2D arrays of the same size as the frame but they are also used to refer to a pixel location. Nazar Khan Computer Vision 20 / 25

Variational Method of Horn & Schunck Regularisation parameter α > 0 determines smoothness of the flow field. α 0 yields the normal flow. The larger the value of α, the smoother the flow field. Dense flow fields due to filling-in effect: At locations, where no reliable flow estimation is possible (small I ), the smoothness term dominates over the data term. This propagates data from the neighbourhood. No additional threshold parameters necessary. Nazar Khan Computer Vision 21 / 25

Functionals and Calculus of Variations Since u is a function, E(u, v) is a function of a function. A function of a function is also called a functional. Normal calculus can optimize functions f (x) by requiring d dx f x = 0. Functionals are optimized via calculus of variations. Optimizer of an energy functional E(u, v) = x,y F (x, y, u, v, u x, u y, v x, v y ) must satisfy the so-called Euler-Lagrange equations x F ux + y F uy F u = 0 x F vx + y F vy F v = 0 with some boundary conditions. Nazar Khan Computer Vision 22 / 25

Functionals and Calculus of Variations For our energy functional E(u, v), F = 1 2 (I xu + I y v + I z ) 2 + α 2 with partial derivatives F u = I x (I x u + I y v + I z ) F v = I y (I x u + I y v + I z ) ( u 2 x + u 2 y + v 2 x + v 2 y ) F ux F uy F vx F vy = αu x = αu y = αv x = αv y Nazar Khan Computer Vision 23 / 25

Functionals and Calculus of Variations So the Euler-Lagrange equations can be written as α(u xx + u yy ) I x (I x u + I y v + I z ) = 0 α(v xx + v yy ) I y (I x u + I y v + I z ) = 0 After writing out the first and second order derivatives α h 2 (u j u i ) I xi (I xi u i + I yi v i + I zi ) = 0 j N i α h 2 (v j v i ) I yi (I xi u i + I yi v i + I zi ) = 0 j N i where h is the grid size (usually 1). Two equations for every pixel. Can be written as a sparse but very large linear system Bx = d. Size of B will be 69GB for a 256 256 image! Nazar Khan Computer Vision 24 / 25

Functionals and Calculus of Variations All of the above boils down to a very simple iterative scheme α ( ) h 2 j N i u (k) j I xi I yi v (k) i + I zi u (k+1) i = v (k+1) i = α h 2 N i + I 2 xi α ( ) h 2 j N i v (k) j I yi I xi u (k) i + I zi α h 2 N i + I 2 xi with k = 0, 1, 2,... and an arbitrary initialisation (e.g. zero vector). Nazar Khan Computer Vision 25 / 25