Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I choose between Tesseract and OpenCV? [closed]

I recently came across Tesseract and OpenCV. It looks like Tesseract is a full-fledged OCR engine and OpenCV can be used as a framework to create an OCR application/service.

I tried using Tesseract on some of my images and its accuracy seems decent. Later, I came across a very simple tutorial on using OpenCV to perform OCR using Python and was impressed. In a few minutes, I finished training the system and its accuracy was good. But of course, taking this approach means I need to train my system extensively using a large training set.

My specific questions are the following:

  • How does one choose between Tesseract and using OpenCV to build a custom OCR app?
  • There are training datasets available for Tesseract for different languages. Does OpenCV have something similar so that I don't have to start ground up to achieve OCR?
  • Which one is better for a wanna-be commercial application?

Any suggestions?

like image 581
Legend Avatar asked Jul 15 '12 06:07

Legend


People also ask

Does Tesseract use OpenCV?

Using Tesseract with OpenCV's EAST detector makes for a great combination. Tesseract, a highly popular OCR engine, was originally developed by Hewlett Packard in the 1980s and was then open-sourced in 2005. Google adopted the project in 2006 and has been sponsoring it ever since.

Which OCR is best in Python?

Pytesseract or Python-tesseract is an OCR tool for python that also serves as a wrapper for the Tesseract-OCR Engine. It can read and recognize text in images and is commonly used in python ocr image to text use cases.

How do you OCR with Tesseract and OpenCV and Python?

Interfacing with Tesseract via the Python programming language. Localizing and detecting text in images using both OpenCV and Tesseract. Using OpenCV and image processing techniques to improve OCR accuracy. Using machine learning to denoise our images for better OCR accuracy.

Which is better Tesseract or EasyOCR?

Tesseract is preferable for CPU wheras EasyOCR for GPU machine. Tesseract works better on character level, while EasyOCR does a better job on words.


4 Answers

  • Tesseract is an OCR engine. It's used, worked on and funded by Google specifically to read text from images, perform basic document segmentation and operate on specific image inputs (a single word, line, paragraph, page, limited dictionaries, etc.).

  • OpenCV, on the other hand, is a computer vision library that includes features that let you perform some feature extraction and data classification. You can create a simple letter segmenter and classifier that performs basic OCR, but it is not a very good OCR engine (I've made one in Python before from scratch. It's really inaccurate for input that deviates from your training data).

If you want to get a basic understanding of how hard OCR is, try OpenCV. Tesseract is for real OCR.

like image 78
Blender Avatar answered Oct 19 '22 20:10

Blender


I am the author of that digit recognition tutorial you mentioned, and I would say, that is no way substitute for tesseract.

Tesseract is a really good OCR engine, may be the best OpenSource OCR engine.

The tutorial you mentioned is just a try, to understand most simple working of OCR.

So, if you are looking for OCR app, I would recommend you to use OpenCV for preprocessing the image and then apply tesseract engine.

like image 35
Abid Rahman K Avatar answered Oct 19 '22 21:10

Abid Rahman K


The two can be complementary. If you read the paper on OpenCV: https://github.com/tesseract-ocr/docs/blob/master/tesseracticdar2007.pdf

It highlights that "Since HP had independently-developed page layout analysis technology that was used in products, (and therefore not released for open-source) Tesseract never needed its own page layout analysis. Tesseract therefore assumes that its input is a binary image with optional polygonal text regions defined."

This type of task can be performed by OpenCV and the resulting image handed off to Tesseract. You can find a sample of this type of code in the Git repo: https://github.com/Itseez/opencv_contrib/tree/master/modules/text/samples The samples use Tesseract APIs to do image to text conversion.

like image 38
user2957542 Avatar answered Oct 19 '22 20:10

user2957542


OpenCV is a library for CV, used to analyze and process images in general. Tesseract is a library for OCR, which is a specialized subset of CV that's dedicated to extracting text from images.

From OpenCV.org

.....used to detect and recognize faces, identify objects, classify human actions in videos, track camera movements, track moving objects, extract 3D models of objects, produce 3D point clouds from stereo cameras, stitch images together to produce a high resolution image of an entire scene, find similar images from an image database, remove red eyes from images taken using flash, follow eye movements, recognize scenery and establish markers to overlay it with augmented reality, etc

From Tesseract Github:

.....can be used directly, or (for programmers) using an API to extract typed, handwritten or printed text from images. It supports a wide variety of languages.

like image 4
Aniruddha Varma Avatar answered Oct 19 '22 19:10

Aniruddha Varma