Pre-processing for images with uneven illumination

1,099 views
Skip to first unread message

Robert T

unread,
Jan 4, 2012, 8:14:05 PM1/4/12
to tesseract-ocr
I'm developing an open source Android app that uses Tesseract 3.01 for
OCR by passing Tesseract images captured by a phone or tablet camera.

The OCR is working adequately for small segments of text--like a few
words--but uneven illumination seems to lower the recognition quality
with larger text input. Because the input comes from the device
camera, there's a lot of shadows and glare.

Right now I'm not doing any pre-processing using binarization/
thresholding, I'm just passing a grayscale Pix to Tesseract. In
general, how should I pre-process images to improve recognition
quality? Is there a way to specify settings for Tesseract's internal
thresholding using TessBaseAPI::SetVariable()?

Arno Teigseth

unread,
Jan 5, 2012, 11:03:37 AM1/5/12
to tesser...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/01/12 20:14, Robert T wrote:
> I'm developing an open source Android app that uses Tesseract 3.01
> for OCR by passing Tesseract images captured by a phone or tablet
> camera.
>
> The OCR is working adequately for small segments of text--like a
> few words--but uneven illumination seems to lower the recognition
> quality with larger text input. Because the input comes from the
> device camera, there's a lot of shadows and glare.

Hi I had the same problem - took pictures of all the pages in a book,
and had trouble with this.

Tried out

http://www.fmwconcepts.com/imagemagick/textcleaner/index.php

and that worked well.

just ran
"./textcleaner badimg.jpg goodimg.jpg"

and that was it :D


for auto-recognition, deskewing etc I ran unpaper

http://unpaper.berlios.de/


This made it possible to OCR 1500 pages basically without much trouble :D

my 2 cents :)

best
Arno
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8FydkACgkQEMIGVCc8BjALEQCff/n4acxqfL9J5ZrCNLPrJxYx
FcIAn1w6/ZVPax2UyMXeC4rSZztsFfqZ
=gP0W
-----END PGP SIGNATURE-----

Sven Pedersen

unread,
Jan 5, 2012, 12:41:31 PM1/5/12
to tesser...@googlegroups.com
Thanks, Arno! That looks like a very well designed script.
--Sven

Luxur

unread,
Feb 9, 2014, 4:20:06 AM2/9/14
to tesser...@googlegroups.com, robert....@gmail.com
Hi , were you able to use the scripts in your android app ? am trying to do same but can't find a way . Thanks

Andreas Romeyke

unread,
Feb 14, 2014, 11:57:17 AM2/14/14
to tesser...@googlegroups.com, robert....@gmail.com
 Hello Robert,


Am Donnerstag, 5. Januar 2012 02:14:05 UTC+1 schrieb Robert T:
 
The OCR is working adequately for small segments of text--like a few
words--but uneven illumination seems to lower the recognition quality
with larger text input. Because the input comes from the device
camera, there's a lot of shadows and glare.


The contrast must be normalized. You could do this via local adaptive binarization algorithms. Please check http://art1pirat.blogspot.de/2013/06/binarisierung.html for some examples (in german, but  good starting point).

With best regards

Andreas

Aung Si Min Htet

unread,
May 25, 2016, 10:47:37 AM5/25/16
to tesseract-ocr, sven.p...@gmail.com
Dear Arno, I have been searching for how to implement or run ImageMagick bash script on android code. Can you please guide me on how to run the script. I am new to both ImageMagick and bash script. I will be really thankful if anyone can help me.

Allistair

unread,
May 25, 2016, 2:27:26 PM5/25/16
to tesser...@googlegroups.com
If you want to deal with uneven lighting then you should rather look at thresholding techniques. I had good success with an Android app using Tesseract and OpenCV and using a configuration of Otsu thresholding. More at http://docs.opencv.org/3.1.0/d7/d4d/tutorial_py_thresholding.html

--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To post to this group, send email to tesser...@googlegroups.com.
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/20462c69-3100-41a5-9b50-a520d1c2aff6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages