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.




