GithubHelp home page GithubHelp logo

dash00 / pytesser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from robindavid/pytesser

0.0 2.0 0.0 6 KB

Python wrapper for the tesseract OCR engine. The module is based on OpenCV

Python 100.00%

pytesser's Introduction

Pytesser

Python wrapper for the tesseract OCR engine. The module is based on OpenCV.

Informations

There is already multiples tesseract python modules, but none of them satisfied me. This one is different on the following point:

  • All the classes are put in the same file and all inessential class are removed
  • Use OpenCV instead of PIL (to really an advantage because PIL as far more widespread, but better fit my needs ;))
  • Use subprocess.communicate instead of subprocess.wait to avoid any output in the shell or in the programs that use the module.
  • Management of the differents languages via the option '-l' because the original pytesser use the default language which is english. By this way the detection of french for instance is totally inacurrate.
  • Management of of the pagesegmode, which allow to modify the behavior of tesseract if we want for instance to detect only one character, a word or a line.
  • The code is far more straightforward (my opinion)

How to use it ?

There is to ways to use it. Either you give it a filename, either directly an IplImage. For a filename you can do:

import pytesser
txt = pytesser.image_to_string("myimage.jpg") #By default language is eng, and page seg mode auto

#To give specifify parameters:
txt = pytesser.image_to_string("myimage.jpg","fra",pytesser.PSM_SINGLE_WORD) #Analyse image as a single french word

Or you can directly give it an IplImage like this:

image = cv.LoadImage("myimage.jpg")
txt = pytesser.iplimage_to_string(image) 

Or give it a mat:

image = cv2.imwrite("myimage.jpg")
txt = pytesser.mat_to_string(image) 

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.