1. A computer-based method for compensating for affine distortions in handwriting recognition, comprising: performing orientation estimation on a handwriting sample to yield a set of likely characters; determining an estimated affine transform for the handwriting sample by applying a hidden Markov model (HMM) based minimax test to at least some of the set of likely characters; and compensating for one or more affine distortions of the handwriting sample by applying the estimated affine transform to at least some of the handwriting sample.