Tag Archives: Lucas–Kanade

Computing OpticalFlow with OpenCV

There are two main approaches for computing optical flow, computing optical flow for all pixel or computing optical flow for corners.

1. Computing optical flow for all pixel

2. Computing optical flow for corners

 

 

Lucas–Kanade method optical flow with MATLAB

In this tutorial, I will show you how to estimate optical flow based on Lucas–Kanade method.  This project has the following scripts: Optical_flow_estimation, myFlow, myWarp, computeColor, flowToColor.

The myFlow does the main job, it gets two images and a window length (patch length) and a threshold for accepting the optical flow.  In the following, you see the myFlow.  You can uncomment figure function calls to see output result of each step. The other scripts are just for visualization. you can access the code and image in my Github repository.

 

first image

second image

estimated optical flow

color map of optical flow