GithubHelp home page GithubHelp logo

Comments (4)

mathiasimmer avatar mathiasimmer commented on May 16, 2024

Maybe I should add an example where the output is there same:
text2
gives:

Using pyocr tool 'Tesseract (C-API)'
l/Z
Using pyocr tool 'Tesseract (sh)'
l/Z

Which was more like what I would've expected. Ignore that the text is wrong; I know how to fix that, but at least the output is consistent.

from pyocr.

jflesch avatar jflesch commented on May 16, 2024

I observed a similar problems when making the tests. The output of libtesseract and tesseract (sh) are slightly different. Quite frankly I'm not sure where this difference comes from.

Currently, my main theory is that it comes from the way images are read:

  • with libtesseract, the input image is loaded by PIllow, turned into a raw image and then passed directly to libtesseract.
  • With tesseract (sh), Pillow read the image, save it back as a .bmp, then tesseract loads this .bmp using libleptonica and pass it raw to Tesseract.
    Maybe somewhere there is a slight difference in the way images are encoded / decoded that makes the OCR reacts differently.

from pyocr.

amitdo avatar amitdo commented on May 16, 2024

I don't know if it's related to this issue, but one difference between tesseract and libtesseract is the default psm. The default psm in tesseract is '3', while in libtesseract it's '6'.

https://github.com/tesseract-ocr/tesseract/blob/cdc35338c53a1af1fcb95473445f2aabfdb3f6d1/api/tesseractmain.cpp#L222

from pyocr.

jflesch avatar jflesch commented on May 16, 2024

Good point. It might explain the differences. I'll have a look later.

from pyocr.

Related Issues (20)

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.