Skip to content

Instantly share code, notes, and snippets.

@githubutilities
Last active February 11, 2019 19:21
Show Gist options
  • Save githubutilities/b6a9062c27f43cc52d60 to your computer and use it in GitHub Desktop.
Save githubutilities/b6a9062c27f43cc52d60 to your computer and use it in GitHub Desktop.
Optical Character Recognition

Here is a list of OCR software:

  1. Ocrad

This also gets a JS version, but same as Ocrad, the result is not promising.

  1. GOCR

It got better result than Ocrad and 'so-called' more format support. You can use imagemagick to convert images to supported format

  1. tesseract

This is the most accurate and useful OCR software I found. For language support, download the language packs from here and place the extract data to share/testdata folder. e.g. download the chinese simplified pack and place it extracted data to /usr/local/Cellar/tesseract/3.02.02_3/share/tessdata folder, then run tesseract with -l chi_sim option(tesseract image.pdm out -l chi_sim).

I tried google homepage logo and it seems tesseract works better with .pnm format.

Improve qualities

  • Convert image to bitonal image
convert input.jpg -threshold 50% output.jpg
# add `-negate` option to invert the image
convert input.jpg -negate output.jpg

Read More

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment