Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Tesseract OCR library (iOS) cannot recognize text at all?

Tags:

I'm trying to use Tesseract OCR library in my iOS application. I downloaded tesseract-ios library from github and when I tried to recognize a simple text image I got garbage instead. Here is an image of what I tried to recognize:

enter image description here

I got unreadable text:

T0I1101T0W KIR1 H1I1101T0W KIR1 H1I1101T0W CIBEPS H1 ES PBHY P306 EHH11 133I R1 11335 11I1H1 19 13S SYIL 3B19 M H300H1911 H1113 AIR1 J1 OIII 3I9SH5H133IS 13V9 I1 Q1H211 E015 19 W331 H1 111SW

Why Tesseract can't recognise even simple image? Here is code which I used to instantiate Tesseract:

Tesseract* tesseractObject = [[Tesseract alloc] initWithDataPath:@"tessdata" language:@"eng"]; [tesseractObject setVariableValue:@"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" forKey:@"tessedit_char_whitelist"]; [tesseractObject setImage:image]; [tesseractObject recognize]; NSLog(@"RECOGNISED= %@" , [tesseractObject recognizedText]); 

Here is my project structure:

enter image description here

I added English testdata folder by reference. So what am I doing wrong? How can I fix this?

like image 756
MainstreamDeveloper00 Avatar asked Jun 18 '13 12:06

MainstreamDeveloper00


People also ask

Why is the Tesseract OCR not accurate?

Inevitably, noise in an input image, non-standard fonts that Tesseract wasn't trained on, or less than ideal image quality will cause Tesseract to make a mistake and incorrectly OCR a piece of text.

How do I use Tesseract to read text from an image?

Create a Python tesseract script Create a project folder and add a new main.py file inside that folder. Once the application gives access to PDF files, its content will be extracted in the form of images. These images will then be processed to extract the text.

How accurate is Tesseract OCR?

Combinations of the first three preprocessing actions are said to boost the accuracy of Tesseract 4.0 from 70.2% to 92.9%.

Is Tesseract and Tesseract OCR same?

Tesseract is an open source text recognition (OCR) Engine, available under the Apache 2.0 license. It can be used directly, or (for programmers) using an API to extract printed text from images.


2 Answers

Make sure you have the latest tessdata file from Google code

http://code.google.com/p/tesseract-ocr/downloads/list

This will provide you with a list of tessdata files that you need to download and include in your app if you haven't already. In your case you will need tesseract-ocr-3.02.eng.tar.gz as you are looking for the English language files

The following article will show you where you need to install it. I read through this tutorial when I built my first Tesseract project and found it really useful

http://lois.di-qual.net/blog/install-and-use-tesseract-on-ios-with-tesseract-ios/

like image 32
Adam Richardson Avatar answered Oct 05 '22 06:10

Adam Richardson


You are using the option tessedit_char_whitelist with the value "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" which limits the character recognition to this list only. However the image that you want to process contains lower case characters, if you want to use this option you will have to include lower cases char too.

[tesseractObject setVariableValue:@"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" forKey:@"tessedit_char_whitelist"]; 
like image 129
Médéric Petit Avatar answered Oct 05 '22 08:10

Médéric Petit