OCR

2008 Nov 18 at 16:17 » Tagged as :

I have never had much need for OCR but when an error popped with VirtualBox the other day and virtual box didn't allow me to share the clipboard from the guest to the host, I thought I would take a screen shot and then OCR the text. It would have been much easier to simply type it but that's not the way geeks do things. I learned that there are three popular products, Ocrad, Tesseract ang GOCR. All three can be installed with yum. The first one I tried was GOCR. It produced the following output:

Iease instaII the buiId and header fiIes for your current Linux XerneI he current XerneI version is Z.6.Z5-14.fc9.i686 robIems were found which wouId prevent the Guest Additions from instaIIing. Iease correct these probIems and try again.

Not very accurate is it? (please see the post on Qemu and VirtualBox to for the actual error message). But I am willing to forgive gocr because that white text on a black background is hard enough for even for humans to read and understand. That console font isn't the easiest font to read either.  The next suspect Ocrad simply refused to have anything at all to do with the image.

ocrad: bad magic number - not a pbm, pgm or ppm file.

It didn't fare any better when I saved the file as a pbm (earlier it was a png). It produced exactly nothing. yes nothing, the same thing that you are left with after taxes. So gocr inspite of it's innacuracies is actually doing a pretty decent job. Tesseract didn't like the png image and it liked the pbm even less. It wanted a tif file as input. After a lot of huffing and puffing it produced a single byte file as it's output.