Optical flow and stereo vision both try to estimate dense correspondence from each pixel in one image to matching pixel in another image.
For optical flow, the two images are taken from the same camera, but at different points in time, and optical flow is a 2D vector field.For stereo vision, the two images are the same scene taken by a left camera and a right camera, and horizontally aligned after rectification, so the disparity is only horizontal in one direction.
To obtain a good result, an energy is always defined including one data term that measures matching cost and one smoothness term that measures the smoothness of the result. After having read several papers, I find that an variational approach via Euler–Lagrange are used to solve optical flow problem. and disparity estimation is tackled by markov random field.
I hope to understand the reason behind it.