$30
OPTICAL FLOW
In this assignment you will implement the Lukas-Kanade algorithm and use it to compute the optical flow between two frames
1. Choose two consecutive images from a video sequence. Convert images to grayscale.
2. Smooth the two images using Gaussian filters.
3. Calculate the spatial derivatives Ex = ∂E/∂x and Ey = ∂E/∂y
4. Calculate the time gradient by the difference between consecutive frames, simply subtracting the two frames as Et=I(x, y, t + 1) − I(x, y, t).
5. Display the original image and the spatial and time gradients.
6. Compute the flow vectors u and v. To compute these parameters, you need to select a neighborhood 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.
7. Display the computed flow vectors over the original image.
8. Discuss your results.