Discrete and Continuous Optimization for Motion Estimation