Tesseract
Содержание:
Notes
- Matila Ghyka, The geometry of Art and Life (1977), p.68
- This term can also mean a polycube made of four cubes
- Elte, E. L. (1912). The Semiregular Polytopes of the Hyperspaces. Groningen: University of Groningen. ISBN 1-4181-7968-X.
- , pp. 122-123, §7.2. illustration Fig 7.2C.
- , p. 12, §1.8 Configurations.
- Strictly, the hypercubes of 0 dimensions (a point) and 1 dimension (a line segment) are also radially equilateral.
- , p. 293.
- Coxeter, H. S. M., Regular Complex Polytopes, second edition, Cambridge University Press, (1991).
- Fowler, David (2010), «Mathematics in Science Fiction: Mathematics as Science Fiction», World Literature Today, 84 (3): 48–52, JSTOR
Проверка Tesseract OCR
Для того чтобы получить разумные результаты в Tesseract OCR нужно предварительно обработать цифровыми фильтрами поступающие изображения.
При использовании Tesseract рекомендуется:
- Использовать входные изображения с максимально высоким разрешением и DPI;
- Применение пороговых фильтров для выделения текста из фона;
- Максимально чёткое сегментирование переднего плана по сравнению с задним фоном, без пикселяции или деформаций символов.
- Применение коррекции текста к входному изображению для обеспечения правильного выравнивания текста.
Отклонения от этих рекомендаций могут привести к неправильным результатам OCR.
Теперь применим OCR к следующему изображению:

Запустим команду в терминале:
Tesseract правильно распознал текст «Testing Tesseract OCR» и распечатал его в терминале.
Other Platforms
Tesseract may work on more exotic platforms too. You can either try compiling it yourself, or take a look at the list of other projects using Tesseract.
Running Tesseract
Tesseract is a command-line program, so first open a terminal or command prompt. The command is used like this:
So basic usage to do OCR on an image called ‘myscan.png’ and save the result to ‘out.txt’ would be:
Or to do the same with German:
It can even be used with multiple languages traineddata at a time eg. English and German:
You can also create a searchable pdf directly from tesseract ( versions >=3.03):
More information about the various options is available in the Tesseract manpage.
Other Languages
Tesseract has been trained for , check for your language in the Tessdata repository.
It can also be trained to support other languages and scripts; for more details see TrainingTesseract.
Development
Also, it is free software, so if you want to pitch in and help, please do!
If you find a bug and fix it yourself, the best thing to do is to attach the patch to your bug report in the Issues List
Conclusion
Just as deep learning has impacted nearly every facet of computer vision, the same is true for character recognition and handwriting recognition. Deep learning based models have managed to obtain unprecedented text recognition accuracy, far beyond traditional feature extraction and machine learning approaches.
Tesseract performs well when document images follow the next guidelines:
- Clean segmentation of the foreground text from background
- Horizontally aligned and scaled appropriately
- High-quality image without blurriness and noise
The latest release of Tesseract 4.0 supports deep learning based OCR that is significantly more accurate. The OCR engine itself is built on a Long Short-Term Memory (LSTM) network, a kind of Recurrent Neural Network (RNN).
Tesseract is perfect for scanning clean documents and comes with pretty high accuracy and font variability since its training was comprehensive. I would say that Tesseract is a go-to tool if your task is scanning of books, documents and printed text on a clean white background.
Usage
use thiagoalessio\TesseractOCR\TesseractOCR;
echo (new TesseractOCR('text.png'))
->run();
use thiagoalessio\TesseractOCR\TesseractOCR;
echo (new TesseractOCR('german.png'))
->lang('deu')
->run();
Multiple languages
use thiagoalessio\TesseractOCR\TesseractOCR;
echo (new TesseractOCR('mixed-languages.png'))
->lang('eng', 'jpn', 'spa')
->run();
Inducing recognition
use thiagoalessio\TesseractOCR\TesseractOCR;
echo (new TesseractOCR('8055.png'))
->whitelist(range('A', 'Z'))
->run();
Breaking CAPTCHAs
Yes, I know some of you might want to use this library for the noble purpose
of breaking CAPTCHAs, so please take a look at this comment:
Tessellation
The tesseract, like all hypercubes, tessellates Euclidean space. The self-dual tesseractic honeycomb consisting of 4 tesseracts around each face has Schläfli symbol {4,3,3,4}. Hence, the tesseract has a dihedral angle of 90°.
The tesseract’s radial equilateral symmetry makes its tessellation the of equal-sized spheres, in any number of dimensions.
The tesseract itself can be decomposed into smaller polytopes. For instance, it can be triangulated into 4-dimensional simplices that share their vertices with the tesseract. It is known that there are 92487256 such triangulations and that the least number of 4-dimensional simplices in any of them is 16.
Image gallery
|
The tesseract can be unfolded into eight cubes into 3D space, just as the cube can be unfolded into six squares into 2D space. An unfolding of a polytope is called a net. There are 261 distinct nets of the tesseract. The unfoldings of the tesseract can be counted by mapping the nets to paired trees (a tree together with a perfect matching in its complement). |
|

Alternative projections
|
A 3D projection of a tesseract performing a about two orthogonal planes |
3D Projection of three tesseracts with and without faces |
Perspective with hidden volume elimination. The red corner is the nearest in 4D and has 4 cubical cells meeting around it. |
|
The tetrahedron forms the convex hull of the tesseract’s vertex-centered central projection. Four of 8 cubic cells are shown. The 16th vertex is projected to infinity and the four edges to it are not shown. |
Stereographic projection (Edges are projected onto the 3-sphere) |
2D orthographic projections
| Coxeter plane | B4 | B3 / D4 / A2 | B2 / D3 |
|---|---|---|---|
| Graph | |||
| Dihedral symmetry | |||
| Coxeter plane | Other | F4 | A3 |
| Graph | |||
| Dihedral symmetry | [12/3] |
OCR with Nanonets

The Nanonets OCR API allows you to build OCR models with ease. You do not have to worry about pre-processing your images or worry about matching templates or build rule based engines to increase the accuracy of your OCR model.
You can upload your data, annotate it, set the model to train and wait for getting predictions through a browser based UI without writing a single line of code, worrying about GPUs or finding the right architectures for your deep learning models. You can also acquire the JSON responses of each prediction to integrate it with your own systems and build machine learning powered apps built on state of the art algorithms and a strong infrastructure.
Using the GUI: https://app.nanonets.com/
You can also use the Nanonets-OCR API by following the steps below:
Step 1: Clone the Repo, Install dependencies
Step 2: Get your free API Key
Get your free API Key from

Step 3: Set the API key as an Environment Variable
Step 4: Create a New Model
Note: This generates a MODEL_ID that you need for the next step
Step 5: Add Model Id as Environment Variable
Note: you will get YOUR_MODEL_ID from the previous step
Step 6: Upload the Training Data
The training data is found in (image files) and (annotations for the image files)
Step 7: Train Model
Once the Images have been uploaded, begin training the Model
Step 9: Make Prediction
Once the model is trained. You can make predictions using the model
Ограничения Tesseract
К сожалению, этот синтетический пример достаточно далёк от реальности. Если распознаваемый текст плохо отделим от фона или он сильно пикселирован, то Tesseract скорее всего вернёт ошибочные результаты.
Tesseract лучше всего подходит для конвейерной обработки документов, в которых изображения сканируются, обрабатываются цифровыми фильтрами, а затем к ним применяется оптическое распознавание символов.
Следует отметить, что Tesseract не является готовым решением для OCR, которое сможет работать во всех приложениях обработки изображений и компьютерного зрения. Для сложных частных случаев необходимо применить методы извлечения признаков, машинное обучение и искусственный интеллект.
External links
|
Fundamental convex regular and uniform polytopes in dimensions 2–10 |
|||||
|---|---|---|---|---|---|
| I2(p) / | E6 / E7 / E8 / F4 / G2 | Hn | |||
| Regular polygon | Triangle | Square | p-gon | Hexagon | Pentagon |
| Uniform polyhedron | Tetrahedron | Octahedron • Cube | Demicube | Dodecahedron • Icosahedron | |
| Uniform 4-polytope | 5-cell | 16-cell • Tesseract | Demitesseract | 24-cell | 120-cell • 600-cell |
| Uniform 5-polytope | 5-simplex | 5-orthoplex • 5-cube | 5-demicube | ||
| Uniform 6-polytope | 6-simplex | 6-orthoplex • 6-cube | 6-demicube | • | |
| Uniform 7-polytope | 7-simplex | 7-orthoplex • 7-cube | 7-demicube | • • | |
| Uniform 8-polytope | 8-simplex | 8-orthoplex • 8-cube | 8-demicube | • • | |
| Uniform 9-polytope | 9-simplex | 9-orthoplex • 9-cube | 9-demicube | ||
| Uniform 10-polytope | 10-simplex | 10-orthoplex • 10-cube | 10-demicube | ||
| Uniform n-polytope | n-simplex | n-orthoplex • n-cube | n-demicube | 1k2 • 2k1 • k21 | n-pentagonal polytope |
| Topics: Polytope families • Regular polytope • List of regular polytopes and compounds |
Open Source OCR Tools
There are a lot of optical character recognition software available. I did not find any quality comparison between them, but I will write about some of them that seem to be the most developer-friendly.
Tesseract — an open-source OCR engine that has gained popularity among OCR developers. Even though it can be painful to implement and modify sometimes, there weren’t too many free and powerful OCR alternatives on the market for the longest time. Tesseract began as a Ph.D. research project in HP Labs, Bristol. It gained popularity and was developed by HP between 1984 and 1994. In 2005 HP released Tesseract as an open-source software. Since 2006 it is developed by Google.
google trends comparison for different open source OCR tools
OCRopus — OCRopus is an open-source OCR system allowing easy evaluation and reuse of the OCR components by both researchers and companies. A collection of document analysis programs, not a turn-key OCR system. To apply it to your documents, you may need to do some image preprocessing, and possibly also train new models. In addition to the recognition scripts themselves, there are several scripts for ground truth editing and correction, measuring error rates, determining confusion matrices that are easy to use and edit.
Ocular — Ocular works best on documents printed using a hand press, including those written in multiple languages. It operates using the command line. It is a state-of-the-art historical OCR system. Its primary features are:
- Unsupervised learning of unknown fonts: requires only document images and a corpus of text.
- Ability to handle noisy documents: inconsistent inking, spacing, vertical alignment
- Support for multilingual documents, including those that have considerable word-level code-switching.
- Unsupervised learning of orthographic variation patterns including archaic spellings and printer shorthand.
- Simultaneous, joint transcription into both diplomatic (literal) and normalized forms.
SwiftOCR — I will also mention the OCR engine written in Swift since there is huge development being made into advancing the use of the Swift as the development programming language used for deep learning. Check out blog to find out more why. SwiftOCR is a fast and simple OCR library that uses neural networks for image recognition. SwiftOCR claims that their engine outperforms well known Tessaract library.
In this blog post, we will put focus on Tesseract OCR and find out more about how it works and how it is used.
Резюме
В этой статье было продемонстрировано применение OCR движка tesseract с языком программирования Python. Что позволило нам применять алгоритмы OCR из собственных сценариев Python.
Самый большой недостаток связан с ограничениями самого Tesseract – он работает когда на переднем плане есть чрезвычайно чистые фрагменты текста. Кроме того, эти фрагменты должны быть как можно более высокого разрешения (DPI), а символы входного изображения не были подвергнуты «пикселированию» после сегментации.
OCR не является новой технологией, но по-прежнему является областью исследований в компьютерной науке, особенно при применении OCR к реальным изображениям. Глубокое обучение и сверточные нейронные сети (CNN), безусловно, позволяют получать более высокую точность, но до почти идеальной системы распознавания ещё очень далеко. Кроме того, сейчас предлагается много OCR приложений на разных сайтах, в которых применены лучшие из алгоритмов распознавания, но они являются коммерческими и требуют лицензирования для использования в собственных проектах.
Если ни Tesseract, ни сторонние сервисы не предоставят достаточной точности, то нужно переосмыслить свой набор данных и задуматься о обучении своего классификатора символов. Это особенно предпочтительно, если набор данных зашумлён и/или содержит очень специфические шрифты. Примеры конкретных шрифтов включают в себя цифры на кредитной карте, номера счета и номера маршрута, найденные в проездных билетах или стилизованный текст, используемый в графическом дизайне.
Training Tesseract on custom data
Tesseract 4.00 includes a new neural network-based recognition engine that delivers significantly higher accuracy on document images. Neural networks require significantly more training data and train a lot slower than base Tesseract. For Latin-based languages, the existing model data provided has been trained on about 400000 text lines spanning about 4500 fonts.
In order to successfully run the Tesseract 4.0 LSTM training tutorial, you need to have a working installation of Tesseract 4 and Tesseract 4 Training Tools and also have the training scripts and required trained data files in certain directories. Visit github repo for files and tools.
Tesseract 4.00 takes a few days to a couple of weeks for training from scratch. Even with all these new training data, therefore here are few options for training:
- Fine-tune — Starting with an existing trained language, train on your specific additional data. For example training on a handwritten dataset and some additional fonts.
- Cut off the top layer — from the network and retrain a new top layer using the new data. If fine-tuning doesn’t work, this is most likely the next best option. The analogy why is this useful, take for an instance models trained on ImageNet dataset. The goal is to build a cat or dog classifier, lower layers in the model are good at low-level abstraction as corners, horizontal and vertical lines, but higher layers in model are combining those features and detecting cat or dog ears, eyes, nose and so on. By retraining only top layers you are using knowledge from lower layers and combining with your new different dataset.
- Retrain from scratch — This is a very slow approach unless you have a very representative and sufficiently large training set for your problem. The best resource for training from scratch is following this github repo.
A guide on how to train on your custom data and create files can be found here, here and here.
We will not be covering the code for training using Tesseract in this blog post.
Appearances
| Appearances for Tesseract |
|---|
|
In chronological order:
|
Introduction
OCR = Optical Character Recognition. In other words, OCR systems transform a two-dimensional image of text, that could contain machine printed or handwritten text from its image representation into machine-readable text. OCR as a process generally consists of several sub-processes to perform as accurately as possible. The subprocesses are:
- Preprocessing of the Image
- Text Localization
- Character Segmentation
- Character Recognition
- Post Processing
The sub-processes in the list above of course can differ, but these are roughly steps needed to approach automatic character recognition. In OCR software, it’s main aim to identify and capture all the unique words using different languages from written text characters.
For almost two decades, optical character recognition systems have been widely used to provide automated text entry into computerized systems. Yet in all this time, conventional OCR systems have never overcome their inability to read more than a handful of type fonts and page formats. Proportionally spaced type (which includes virtually all typeset copy), laser printer fonts, and even many non-proportional typewriter fonts, have remained beyond the reach of these systems. And as a result, conventional OCR has never achieved more than a marginal impact on the total number of documents needing conversion into digital form.
Optical Character Recognition process (Courtesy)
Next-generation OCR engines deal with these problems mentioned above really good by utilizing the latest research in the area of deep learning. By leveraging the combination of deep models and huge datasets publicly available, models achieve state-of-the-art accuracies on given tasks. Nowadays it is also possible to generate synthetic data with different fonts using generative adversarial networks and few other generative approaches.
Optical Character Recognition remains a challenging problem when text occurs in unconstrained environments, like natural scenes, due to geometrical distortions, complex backgrounds, and diverse fonts. The technology still holds an immense potential due to the various use-cases of deep learning based OCR like
- building license plate readers
- digitizing invoices
- digitizing menus
- digitizing ID cards
In this blog post, we will try to explain the technology behind the most used Tesseract Engine, which was upgraded with the latest knowledge researched in optical character recognition. This article will also serve as a how-to guide/ tutorial on how to implement OCR in python using the Tesseract engine. We will be walking through the following modules:
- Tesseract OCR Features
- Preprocessing for OCR using OpenCV
- Running Tesseract with CLI and Python
- Limitations of Tesseract engine
Have an OCR problem in mind? Want to reduce your organisation’s data entry costs? Head over to Nanonets and build OCR models for free!
In popular culture
Since their discovery, four-dimensional hypercubes have been a popular theme in art, architecture, and science fiction. Notable examples include:
- «And He Built a Crooked House», Robert Heinlein‘s 1940 science fiction story featuring a building in the form of a four-dimensional hypercube. This and Martin Gardner’s «The No-Sided Professor,» published in 1946, are among the first in science fiction to introduce readers to the Moebius band, the Klein bottle, and the hypercube (tesseract).
- Crucifixion (Corpus Hypercubus), a 1954 oil painting by Salvador Dalí featuring a four-dimensional hypercube unfolded into a three-dimensional Latin cross.
- The Grande Arche, a monument and building near Paris, France, completed in 1989. According to the monument’s engineer, Erik Reitzel, the Grande Arche was designed to resemble the projection of a hypercube.
- Fez, a video game where one plays a character who can see beyond the two dimensions other characters can see, and must use this ability to solve platforming puzzles. Features «Dot,» a tesseract who helps you navigate the world and tells you how to use abilities, fitting the theme of seeing beyond human perception of known dimensional space.
The word tesseract was later adopted for numerous other uses in popular culture, including as a plot device in works of science fiction, often with little or no connection to the four-dimensional hypercube of this article. See Tesseract (disambiguation).
In popular culture
Since their discovery, four-dimensional hypercubes have been a popular theme in art, architecture, and science fiction. Notable examples include:
- «And He Built a Crooked House», Robert Heinlein‘s 1940 science fiction story featuring a building in the form of a four-dimensional hypercube. This and Martin Gardner’s «The No-Sided Professor,» published in 1946, are among the first in science fiction to introduce readers to the Moebius band, the Klein bottle, and the hypercube (tesseract).
- Crucifixion (Corpus Hypercubus), a 1954 oil painting by Salvador Dalí featuring a four-dimensional hypercube unfolded into a three-dimensional Latin cross.
- The Grande Arche, a monument and building near Paris, France, completed in 1989. According to the monument’s engineer, Erik Reitzel, the Grande Arche was designed to resemble the projection of a hypercube.
- Fez, a video game where one plays a character who can see beyond the two dimensions other characters can see, and must use this ability to solve platforming puzzles. Features «Dot,» a tesseract who helps you navigate the world and tells you how to use abilities, fitting the theme of seeing beyond human perception of known dimensional space.
The word tesseract was later adopted for numerous other uses in popular culture, including as a plot device in works of science fiction, often with little or no connection to the four-dimensional hypercube of this article. See Tesseract (disambiguation).
Установка пакета Tesseract для Python
Чтобы установить pytesseract воспользуемся менеджером пакетов Python pip. Также рекомендуется использовать виртуальную среду чтобы устанавливать свой набор пакетов для разных проектов. В данном случае virtualenv называется cv.
Затем установим Pillow (удобный клон PIL для Python) от которого зависит pytesseract.
Примечание: pytesseract не обеспечивает настоящей привязки к Python. Скорее, он является простой обёрткой для двоичного файла tesseract. Если познакомиться с проектом по подробнее, то станет ясно, что библиотека сохраняет изображение во временный файл на диске, а затем вызывает двоичный файл tesseract и полученный результат записывает в файл.
Рассмотрим код, который отделяет текст переднего плана от фона, а затем применим установленный pytesseract.
Знакомство с программой
Tesseract первоначально разработана Hewlett Packard в 1980-х годах, в 2005 году был опубликован её исходный код. В августе 2006 г. Google купил её и открыл исходные тексты под лицензией Apache 2.0 для последующей разработки.
Программное обеспечение Tesseract работает со многими естественными языками от английского (первоначально) до панджаби. С момента обновления в 2015 году он поддерживает более 100 письменных языков и содержит обучаемый код для других языков. Поддержка русского языка реализована подключением дополнительных модулей.
Первоначально программа была написана на C, в 1998 году была перенесена на C ++. У неё нет графического интерфейса, но есть сторонние программные проекты, которые обертывают Tesseract для предоставления графического интерфейса пользователя.
Tessellation
The tesseract, like all hypercubes, tessellates Euclidean space. The self-dual tesseractic honeycomb consisting of 4 tesseracts around each face has Schläfli symbol {4,3,3,4}. Hence, the tesseract has a dihedral angle of 90°.
The tesseract’s radial equilateral symmetry makes its tessellation the of equal-sized spheres, in any number of dimensions.
The tesseract itself can be decomposed into smaller polytopes. For instance, it can be triangulated into 4-dimensional simplices that share their vertices with the tesseract. It is known that there are 92487256 such triangulations and that the least number of 4-dimensional simplices in any of them is 16.
API
image
Define the path of an image to be recognized by .
$ocr = new TesseractOCR();
$ocr->image('/path/to/image.png');
$ocr->run();
imageData
Set the image to be recognized by from a string, with its size.
This can be useful when dealing with files that are already loaded in memory.
You can easily retrieve the image data and size of an image object :
//Using Imagick $data = $img->getImageBlob(); $size = $img->getImageLength(); //Using GD ob_start(); // Note that you can use any format supported by tesseract imagepng($img, null, ); $size = ob_get_length(); $data = ob_get_clean(); $ocr = new TesseractOCR(); $ocr->imageData($data, $size); $ocr->run();
executable
Define a custom location of the executable,
if by any reason it is not present in the .
echo (new TesseractOCR('img.png'))
->executable('/path/to/tesseract')
->run();
Returns the current version of .
echo (new TesseractOCR())->version();
availableLanguages
Returns a list of available languages/scripts.
foreach((new TesseractOCR())->availableLanguages() as $lang) echo $lang;
More info:
tessdataDir
Specify a custom location for the tessdata directory.
echo (new TesseractOCR('img.png'))
->tessdataDir('/path')
->run();
userWords
Specify the location of user words file.
This is a plain text file containing a list of words that you want to be
considered as a normal dictionary words by .
Useful when dealing with contents that contain technical terminology, jargon,
etc.
echo (new TesseractOCR('img.png'))
->userWords('/path/to/user-words.txt')
->run();
userPatterns
Specify the location of user patterns file.
If the contents you are dealing with have known patterns, this option can help
a lot tesseract’s recognition accuracy.
echo (new TesseractOCR('img.png'))
->userPatterns('/path/to/user-patterns.txt')
->run();
lang
Define one or more languages to be used during the recognition.
A complete list of available languages can be found at:
Tip from @daijiale: Use the combination
for proper recognition of Chinese.
echo (new TesseractOCR('img.png'))
->lang('lang1', 'lang2', 'lang3')
->run();
psm
Specify the Page Segmentation Method, which instructs how to
interpret the given image.
More info:
echo (new TesseractOCR('img.png'))
->psm(6)
->run();
Specify the OCR Engine Mode. (see )
echo (new TesseractOCR('img.png'))
->oem(2)
->run();
whitelist
This is a shortcut for .
echo (new TesseractOCR('img.png'))
->whitelist(range('a', 'z'), range(, 9), '-_@')
->run();
configFile
Specify a config file to be used. It can either be the path to your own
config file or the name of one of the predefined config files:
https://github.com/tesseract-ocr/tesseract/tree/master/tessdata/configs
echo (new TesseractOCR('img.png'))
->configFile('hocr')
->run();
setOutputFile
Specify an Outputfile to be used. Be aware: If you set an outputfile then
the option is ignored.
Tempfiles are written (and deleted) even if .
In combination with you are able to get the , or
files.
echo (new TesseractOCR('img.png'))
->configFile('pdf')
->setOutputFile('/PATH_TO_MY_OUTPUTFILE/searchable.pdf');
->run();
Shortcut for .
echo (new TesseractOCR('img.png'))
->digits()
->run();
Shortcut for .
echo (new TesseractOCR('img.png'))
->hocr()
->run();
Shortcut for .
echo (new TesseractOCR('img.png'))
->pdf()
->run();
Shortcut for .
echo (new TesseractOCR('img.png'))
->quiet()
->run();
Shortcut for .
echo (new TesseractOCR('img.png'))
->tsv()
->run();
Shortcut for .
echo (new TesseractOCR('img.png'))
->txt()
->run();
tempDir
Define a custom directory to store temporary files generated by tesseract.
Make sure the directory actually exists and the user running is allowed
to write in there.
echo (new TesseractOCR('img.png'))
->tempDir('./my/custom/temp/dir')
->run();
withoutTempFiles
Specify that should output the recognized text without writing to temporary files.
The data is gathered from the standard output of instead.
echo (new TesseractOCR('img.png'))
->withoutTempFiles()
->run();
Other options
Any configuration option offered by Tesseract can be used like that:
echo (new TesseractOCR('img.png'))
->config('config_var', 'value')
->config('other_config_var', 'other value')
->run();
Or like that:
echo (new TesseractOCR('img.png'))
->configVar('value')
->otherConfigVar('other value')
->run();
More info: https://github.com/tesseract-ocr/tesseract/wiki/ControlParams
Thread-limit
Sometimes, it may be useful to limit the number of threads that tesseract is
allowed to use (e.g. in this case).
Set the maxmium number of threads as param for the function:
echo (new TesseractOCR('img.png'))
->threadLimit(1)
->run();
Limitations of Tesseract
Tesseract works best when there is a clean segmentation of the foreground text from the background. In practice, it can be extremely challenging to guarantee these types of setup. There are a variety of reasons you might not get good quality output from Tesseract like if the image has noise on the background. The better the image quality (size, contrast, lightning) the better the recognition result. It requires a bit of preprocessing to improve the OCR results, images need to be scaled appropriately, have as much image contrast as possible, and the text must be horizontally aligned. Tesseract OCR is quite powerful but does have the following limitations.
Tesseract limitations summed in the list.
- The OCR is not as accurate as some commercial solutions available to us.
- Doesn’t do well with images affected by artifacts including partial occlusion, distorted perspective, and complex background.
- It is not capable of recognizing handwriting.
- It may find gibberish and report this as OCR output.
- If a document contains languages outside of those given in the -l LANG arguments, results may be poor.
- It is not always good at analyzing the natural reading order of documents. For example, it may fail to recognize that a document contains two columns, and may try to join text across columns.
- Poor quality scans may produce poor quality OCR.
- It does not expose information about what font family text belongs to.
Stereoscopic 3D projection of a tesseract (parallel view)