To find optical flow, you first pick out a collection of sample points in frame A. What constitutes a good sample point depends on your specific algorithm, although generally speaking you pick "corners". In OpenCV, you can easily do this by calling cvGoodFeaturesToTrack().
You then search for those same sample points in the successive frame B, and end up with a collection of vectors that probably represent the motion of each point. Using OpenCV, this is usually done with cvCalcOpticalFlowPyrLK().
This is very cool, thanks for that. Can we run this on a GPU? If not, how feasible would dense optical flow running on cpu be in terms of speed to convert short non-hd videos?
Optical Flow is a method for determining the movement between two or more frames of video. This data is then used for morphing the frames into one another, or moving the underlying vertexes of the textures from one position to the next.