Optical Flow
What is Optical Flow?
- Optical flow is the apparent motion of brightness patterns in a sequence of images.
- It arises from the relative motion between a camera and the scene.
- It’s represented as a field of 2D vectors, where each vector at pixel indicates the apparent displacement per unit time.
- : Horizontal component of the displacement.
- : Vertical component of the displacement.
Computing Optical Flow
Input and Output
- Input: A sequence of at least two images: .
- : intensity at pixel location and time
- : Image domain
- Output: A set of optical flow vectors for each pixel at each time point (except the last): .
Assumptions
- Brightness Constancy: The apparent intensity of a physical point remains constant over time. This is the core assumption. Mathematically: .
- Small Displacement: Points move only a small amount between consecutive frames. This allows for a linear approximation using the Taylor series.
Derivation of the Optical Flow Constraint Equation
-
Brightness Constancy: Start with the brightness constancy assumption: .
-
Taylor Series Expansion: Expand the right side using a first-order Taylor series: .
-
Substitution and Simplification: Substitute the expansion back into the brightness constancy equation and subtract from both sides: .
-
Divide by : .
-
Define and : Recognize that approaches (horizontal velocity) and approaches (vertical velocity) as approaches 0.
-
Optical Flow Constraint Equation (OFCE): .
- Often written as: , where , , and are the image gradients.
-
Dot Product Form:
The Aperture Problem
- The aperture problem refers to the inherent ambiguity in determining the motion of an edge when viewed through a small aperture (or locally within an image).
- Only the component of motion perpendicular to the edge (the normal flow) can be reliably determined. The component of motion parallel to the edge is ambiguous.
- The OFCE provides only one equation for two unknowns ( and ) at each pixel. This makes the problem underconstrained.
Solving the Optical Flow Problem: Methods
Because of the aperture problem, additional constraints are needed to solve for optical flow. Two main approaches are:
Horn & Schunck (Global Method)
-
Global Smoothness Constraint: Assumes that the optical flow field is smooth over the entire image. Adjacent pixels should have similar flow vectors.
-
Energy Minimization: Formulates the problem as minimizing an energy functional:
.
- : Data fidelity term (enforces the OFCE).
- : Smoothness term (penalizes large changes in and ). , etc.
- : Regularization parameter. Controls the trade-off between data fidelity and smoothness. Larger means smoother flow.
-
Discretization:
-
Digital Derivatives Approximation:
-
Boundary Condition:
- Set all image derivatives at the right-side or bottom boundary of the image are set to 0.
- Values of and at pixels that fall outside the image domain are set to 0.
-
Discrete Energy Functional:
-
-
Iterative Solution (Jacobi Method): The minimization is typically solved iteratively. A common approach is the Jacobi method:
-
Initialization: Initialize and (often to 0).
-
Iteration: For each pixel , update and using the following equations, while keeping the values at all other pixels fixed:
.
.
- and represent the average of the neighboring and values, respectively (e.g., ).
-
Convergence: Repeat the iteration until convergence (the change in and is small) or a maximum number of iterations is reached.
-
-
Jacobi’s method derivation:
- Consider
- can be expressed as where is a diagonal matrix.
- The solution vector can be obtained iteratively as:
Summary and Key Concepts
- Optical Flow: The apparent motion of brightness patterns.
- Brightness Constancy Assumption: The foundation of optical flow estimation.
- Optical Flow Constraint Equation (OFCE): . Relates image gradients to optical flow.
- Aperture Problem: The inherent ambiguity in determining motion along an edge.
- Underconstrained Problem: The OFCE alone is insufficient to solve for and .
- Regularization: Adding constraints (like smoothness) to solve the underconstrained problem.
- Horn & Schunck: A global method using a smoothness constraint.
- Lucas-Kanade: A local method assuming constant flow within a small neighborhood.
- Iterative Methods: Used to solve the optimization problems arising in optical flow estimation (e.g., Jacobi method).
- Taylor Series: Used for linear approximation of the brightness constancy.
This set of notes provides a structured, comprehensive, and exam-ready overview of optical flow, incorporating all the key concepts, equations, and methods from the provided PDFs. The use of MathJax, Mermaid.js, and Markdown formatting ensures clarity and ease of understanding.