Update 1: LibJacket has been renamed to ArrayFire.
Update 2: Huang Chao-Hui was nice enough to port the LibJacket code mentioned here to ArrayFire – see his work here.
As one of my Computer Vision class projects, I decided to implement optical flow, because I wanted to learn more about optical flow, and also I wanted to code it on the GPU (because I love GPU programming!).
One of the more successful approaches to optical flow is total variation L1 regularization (TV-L1). Pock et al‘s An Improved Algorithm for TV-L1 Optical Flow [Paper] describes a clever duality based method to solving L1 regularization image optical flow. These [slides] offer a nice intro to variational methods and applications. Kudos to Pock et al and their work!
GPU4Vision hosts the reference MATLAB implementation: [download] of the algorithm in the above paper (bundled in their Matlab Toolbox). Having this as a reference, I chose to re-implement this code in LibJacket, because it makes porting MATLAB code into GPU C++ code incredibly easy!
While the ultimate goal is an OpenCL or CUDA custom implementation (coming here soon!), I decided to start with AccelerEyes LibJacket, because it super easy to translate from MATLAB M scripts to LibJacket C++ GPU code. I made use of what I learned earlier about combining LibJacket and OpenCV (see Image Processing with LibJacket and OpenCV) for this project.
Performance: Using the same configuration settings for both my LibJacket version and the MATLAB version, there is over an order of magnitude improvement in speed, making this fairly complex algorithm capapble of real-time performance.
It’s still a work in progress (a.k.a, probably still bugs), but I’m glad to share it as open source software! [source code] Enjoy!
Hello
I tried to download your source code but I could not. Can you send some sample codes to me?
Thanks
amir:
The link above to the optical_flow.cpp on Google Code seems to work for me. Regardless, here is another link to try http://code.google.com/p/mcclanahoochie/source/browse/cuda/tvl1_libjacket/ …
Simply download the 3 files (Makefile, readme.txt, optical_flow.cpp) into a folder, then place that folder in your libjacket/examples/ directory.
Thanks for your interest, and good luck!