Recently, while implementing Efficient Hierarchical Graph-Based Video Segmentation, I needed to compare different algorithms for computing dense optical flow. While there are several optical flow benchmarks available online, for example the Middlebury benchmark , the Sintel benchmark  or the KITTI benchmark , I wanted to visualize the results first. After some attempts to visualize 2-channel optical flow images using OpenCV, guided by this StackOverflow question, I finally wrote a simple OpenCV wrapper for the C code provided by the Sintel dataset . Note that the provided C code is based on imageLib, a lightweight C++ image library based on the StereoMatcher  code.
The code is available on GitHub:OpenCV Flow I/O on GitHub
The code can be compiled using CMake (tested on Ubuntu 12.04, 14.04 and 14.10) and is based on OpenCV and Boost.
$ cd flow-io-opencv $ mkdir build $ cd build $ cmake .. $ make
The provided command line tool can be used to convert
.flo files to
cv::FileStorage format and optionally visualize the optical flow files:
$ ./cli/cli --help Allowed options: --help produce help message --input-dir arg input directory --output-dir arg output directory --vis-dir arg visualize results in a separate directory
The wrapper can also be used to read
.flo files into a
cv::Mat or visualize optical flow available as 2-channel
cv::Mat flow = FlowIOOpenCVWrapper::read(flo_file); cv::Mat image = FlowIOOpenCVWrapper::flowToColor(flow);
The GitHub repository provides several frames on the
alley_1 sequence and figure 1 shows a visualization:
-  S. Baker, D. Scharstein, J. P. Lewis, S. Roth, M. J. Black, R. Szeliski. A Database and Evaluation Methodology for Optical Flow. International Journal of Computer Vision, volume 92, 2011.
-  D. J. Butler, J. Wulff, G. B. Stanley, M. J. Black. A naturalistic open source movie for optical flow evaluation. European Conference on Computer Vision, 2012.
-  M. Menze, A. Geiger. Object Scene Flow for Autonomous Vehicles. Conference on Computer Vision and Pattern Recognition, 2015.
-  D. Scharstein, R. Szeliski. A taxonomy and evaluation of dense two-frame stereo correspondence algorithms. Technical Report MSR-TR-2001-81, Microsoft Research, 2001.