3 ms·
In 2006 over 2 months, I wrote an OCR (optical char recognition - turning images back into text) system in Lisp using macros. First it finds all 'features' by
by zandorg 17y ago
In 2006 over 2 months, I wrote an OCR (optical char recognition - turning images back into text) system in Lisp using macros.
First it finds all 'features' by traversing a 1-pixel wide representation of the text character's image. Then you describe which features you want to look for, in a macro language.
So (in layman's terms) , a 'c' is a top curve curving up, a lower curve curving down, and a stem at the left-hand side close to the left-hand of those curves. So 'c' would be about 3 rules, in this macro language.
It was fun but monstrously sluggish and I never got the 1-pixel wide algorithm (called skeletonisation) that I used, to work 100%.
One thing it did have going for it was you could identify really small font chars and even 10-pixel-high truetype fonts, as long as you normalise so each char is 60 pixels high.
I ported the system to C++ also in 2006 and had to write a simple Scheme-ish interpreter to turn the Lisp ruleset into C code.