A knowledge-based approach to recognize unconstrained handwritten numerals