The Conditional Lucas-Kanade Algorithm (ECCV 2016)
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

The Conditional Lucas & Kanade Algorithm

Chen-Hsuan Lin, Rui Zhu, and Simon Lucey
European Conference on Computer Vision (ECCV), 2016


We provide the MATLAB code for planar image alignment experiments.
If you find our code useful for your research, please cite

  title={The Conditional Lucas \& Kanade Algorithm},
  author={Lin, Chen-Hsuan and Zhu, Rui and Lucey, Simon},
  booktitle={European Conference on Computer Vision (ECCV)},
  organization={Springer International Publishing}


You would need to first compile MTIMESX ( This is required for fast computation for optimizing Conditional LK. Please follow the instructions in the MATLAB File Exchange to compile this library.

Running the code

To train the linear regressors, run runTrain under the matlab directory.
Run runTest to evaluate the trained regressors. There is also a number of different parameters that can be adjusted for the experiment in setParams.m.

The nonlinear optimization methods we provide include:

  • Levenberg-Marquardt using the MATLAB built-in lsqnonlin function
  • Gauss-Newton with GPU support
  • Levenberg-Marquardt with GPU support
  • Vanilla gradient descent
  • Limited-memory BFGS (LBFGS)

(new) We have additionaly included support using the minFunc library ( if you wish to use LBFGS for optimization (nice if you have limited RAM). Other optimization methods in minFunc are also compatible.
We did not use minFunc for our experiments, but if you wish to use it, please place the minFunc_2012 directory in the repository root and follow the instructions to compile.

We also provide a script visualizeGradients.m to help visualize the learned gradients. You would need imdisp ( to run this script.

Please contact me ( if you have any questions!