Description
In this assignment you will implement the Lukas-Kanade algorithm and use it to compute the optical flow between two frames
- Choose two consecutive images from a video sequence. Convert images to grayscale.
- Smooth the two images using Gaussian filters.
- Calculate the spatial derivatives Ex = ∂E/∂x and Ey = ∂E/∂y
- Calculate the time gradient by the difference between consecutive frames, simplysubtracting the two frames as Et=I(x, y, t + 1) − I(x, y, t).
- Display the original image and the spatial and time gradients.
- Compute the flow vectors u and v. To compute these parameters, you need to select aneighborhood size and then solve the optical flow equation using points in the neighborhood.
[𝑢] = (𝐴𝑇𝐴)−1𝐴𝑇𝑏 𝑣
Where A is the spatial derivatives matrix and b is the negative of the matrix of time derivatives.
- Display the computed flow vectors over the original image.
- Discuss your results.