57

Are there any free OCR libraries that work with PHP or Python on a Linux server? The idea is to be able to upload an image and pull out characters from it, or allow users to "draw characters", and parse them out of said image.

Moshe
  • 57,511
  • 78
  • 272
  • 425

2 Answers2

31

Since you're on a Linux box, I would highly recommend Google's open source project ocropus.

It's not PHP, but I think it will be your best option. Of course you can call it from within PHP via exec. Its mature and has a lot of options. From the project site:

The OCRopus engine is based on two research projects: a high-performance handwriting recognizer developed in the mid-90's and deployed by the US Census bureau, and novel high-performance layout analysis methods.

There is also another open source project, tesseract. I've used this in the past as well and have been pleased with the results. Includes training, limiting your alphabet, etc.

nategood
  • 11,807
  • 4
  • 36
  • 44
  • Thanks for the pointer. I'll let you know how they go. Thanks! – Moshe Jan 31 '10 at 12:45
  • Still haven't gotten to it yet... It was for a client who needed to put the project on the back burner for a while... – Moshe Feb 16 '10 at 02:13
5

Have you seen phpOCR classes of Andrey Kucherenko ? http://www.phpclasses.org/package/2874-PHP-Recognize-text-objects-in-graphical-images.html It's an old article but may help you.

Dwight
  • 157
  • 2
  • 12
Daniel D
  • 79
  • 1
  • 4
  • if it actually works, it seems to do a simple match(so i suppose letters would have to be identical with the "learned" ones). But it might do the trick in some situations, and seems like a nice starting point to develop something on top of it. – Quamis Jan 18 '11 at 12:25