Generalised Discriminative Optimisation Algorithms for Augmented Reality: Theory and Practice.