views:

2699

answers:

6

Does anyone know of a c++ library for taking an image and performing image recognition on it such that it can find letters based on a given font and/or font height? Even one that doesn't let you select a font would be nice (eg: readLetters(Image image).

+5  A: 

While I cannot recommend one in particular, the term you are looking for is OCR (Optical Character Recognition).

Sparr
Thanks, that is helpful. Couldn't find anything on google with what I was using.
Zombies
+3  A: 

There is tesseract-ocr which is a professional library to do this.

From there web site

The Tesseract OCR engine was one of the top 3 engines in the 1995 UNLV Accuracy test. Between 1995 and 2006 it had little work done on it, but it is probably one of the most accurate open source OCR engines available

Damien
+1  A: 

I think what you want is Conjecture. Used to be the libgocr project. I haven't used it for a few years but it used to be very reliable if you set up a key.

sig11
A: 

I know where this is going... And I don't know if Stackoverflow should be helping people break CAPTCHA...

Alex
So by finding an OCR library I can now break captchas? Brilliant! I should have known it was so simple. $2k deals on paypal for broken captcha solutions aren't far now!!!
Zombies
+5  A: 

I've been looking into this a lot lately. Your best is simply Tesseract. If you need layout analysis on top of the OCR than go with Ocropus (which in turn uses Tesseract to do the OCR). Layout analysis refers to being able to detect position of text on the image and do things like line segmentation, block segmentation, etc.

I've found some really good tips through experimentation with Tesseract that are worth sharing. Basically I had to do a lot of preprocessing for the image.

  1. Upsize/Downsize your input image to 300 dpi.
  2. Remove color from the image. Grey scale is good. I actually used a dither threshold and made my input black and white.
  3. Cut out unnecessary junk from your image. For all three above I used netbpm (a set of image manipulation tools for unix) to get to point where I was getting pretty much 100 percent accuracy for what I needed.

If you have a highly customized font and go with tesseract alone you have to "Train" the system -- basically you have to feed a bunch of training data. This is well documented on the tesseract-ocr site. You essentially create a new "language" for your font and pass it in with the -l parameter.

The other training mechanism I found was with Ocropus using nueral net (bpnet) training. It requires a lot of input data to build a good statistical model.

In terms of invoking Tesseract/Ocropus are both C++. It won't be as simple as ReadLines(Image) but there is an API you can check out. You can also invoke via command line.

Ish
know of any good documentation for Ocropus.... espcially a c++ api.
Zombies
Unfortunately the best documentation is on their web site and by reading through the header files and LUA scripts they provide.
Ish
A: 

I have make a DLL based on tesseract-ocr to recognize image CAPTCHA.

My email/msn: [email protected]

yzm