A regularized spectral algorithm for Hidden Markov Models with applications in computer vision