Giter Club home page Giter Club logo

pytesser's Introduction

Introduction:
============
PyTesser is an Optical Character Recognition module for Python. It takes 
as input an image or image file and outputs a string.

PyTesser uses the Tesseract OCR engine (an Open Source project at Google), 
converting images to an accepted format and calling the Tesseract 
executable as an external script. A Windows executable is provided 
along with the Python scripts. The scripts should work in Linux as well. 

PyTesser:
http://code.google.com/p/pytesser/
Tesseract:
http://code.google.com/p/tesseract-ocr/


Dependencies:
=============
PIL is required to work with images in memory. PyTesser has been tested with Python 2.4 in Windows XP. 
http://www.pythonware.com/products/pil/


Installation:
==============
PyTesser has no installation functionality in this release.  Extract pytesser.zip
into directory with other scripts.  Necessary files are listed in File Dependencies below.  


Usage:
================================
>>> from pytesser import *
>>> im = Image.open('phototest.tif')
>>> text = image_to_string(im)
>>> print text
This is a lot of 12 point text to test the
ocr code and see if it works on all types
of file format.
The quick brown dog jumped over the
lazy fox. The quick brown dog jumped
over the lazy fox. The quick brown dog
jumped over the lazy fox. The quick
brown dog jumped over the lazy fox.

>>> try:
... 	text = image_file_to_string('fnord.tif', graceful_errors=False)
... except errors.Tesser_General_Exception, value:
... 	print "fnord.tif is incompatible filetype.  Try graceful_errors=True"
... 	print value
... 	
fnord.tif is incompatible filetype.  Try graceful_errors=True
Tesseract Open Source OCR Engine
read_tif_image:Error:Illegal image format:Compression
Tessedit:Error:Read of file failed:fnord.tif
Signal_exit 31 ABORT. LocCode: 3  AbortCode: 3

>>> text = image_file_to_string('fnord.tif', graceful_errors=True)
>>> print "fnord.tif contents:", text
fnord.tif contents: fnord

>>> text = image_file_to_string('fonts_test.png', graceful_errors=True)
>>> print text
12 pt
And Arnazwngw few dwscotheques provwde jukeboxes
Tames Amazmgly few dnscotheques pmvxde Jukeboxes
24 pt:
Arial: Amazingly few discotheques
provide jul<ebo><es.
Courier: Ama zimgly few
discotheque S provide
j u k e b ox e S .
Times: Amazingly few discotheques provide
jukeboxes.


File Dependencies:
============================================
pytesser.py	Main module for importing
util.py		Utility functions used by pytesser.py
errors.py	Interprets exceptions thrown by Tesseract
tesseract.exe	Executable called by pytesser.py
tessdata/	Resources used by tesseract.exe

pytesser's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.