Optical flow is the pattern of apparent motion of objects in a visual scene caused by the relative motion between an observer (an eye or a camera) and the scene. (Wikipedia).
Methods:
- Horn & Schunck
- Lucas & Kanade
- Lucas & Kanade Pyramidal
#include <of/LucasKanadeC2F.h>
double* buffa, buffb; // <- Read images values
// Encapsulate buffers
of::Image* imga = new of::Image(buffa, nlines, ncols);
of::Image* imgb = new of::Image(buffb, nlines, ncols);
// Create specific method implementation
of::OpticalFlow* of = new of::LucasKanadeC2F(imga, imgb);
// Run!
of->compute();
// Can export (u,v) to Optical Flow Middlebury (.flo) file format
of->save("uv.flo");
// Get (u, v) coordinates
of::Image* u = of->getU();
of::Image* v = of->getV();
// Kill 'Em All
delete of;
delete imga;
delete imgb;
- B.K.P. Horn and B.G. Schunck, "Determining optical flow." Artificial Intelligence, vol 17, pp 185–203, 1981
- B. D. Lucas and T. Kanade, "An iterative image registration technique with an application to stereo vision". Proceedings of Imaging Understanding Workshop, pages 121--130, 1981
- Bouguet, J.-Y., "Pyramidal Implementation of the Lucas Kanade Feature Tracker Description of the algorithm". Intel Corporation Microprocessor Research Labs, 2000
- Middlebury - Optical Flow Datasets