Geometric methods for optical character recognition