Image preprocessing

191 views
Skip to first unread message

Lada Tylich

unread,
Aug 31, 2017, 9:56:21 AM8/31/17
to tesseract-ocr
Hi,

I am writing in referring to my recent post. I figured out I should stick to this. So far I have applied few times denoising with cv2.fastNlMeansDenoisingColored on colored image then binarization and scale with 2. Image I got is below with tesseract result: CFC I 2:. . gen:

Therefore I am looking for some way to exctract the area with a number (that with opposite contrast). According to tests I made (creating subsections by hand and applying tesseract on it), that could lead me to better result.

Could anyone please help me to figure this out and prepare this image for tesseract? 

Thanks in advance.
Scale_digits0-rotated.jpg

Art Rhyno.

unread,
Sep 4, 2017, 10:28:04 PM9/4/17
to tesser...@googlegroups.com

Hi Lada,

 

Since you are already using opencv, it might be an option for extracting the region based on shape. Adrian Rosebrock has an example of shape detection with opencv here [1]. I put together a simple example [2] in python that extracts the biggest rectangle, which would be the area with the number in the sample.

 

art

---

1. http://www.pyimagesearch.com/2016/02/08/opencv-shape-detection/

2. http://ink.ourdigitalworld.org/boxcrop.py

--
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/a7b1369c-af13-470f-8ac0-5a2e09028f2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lada Tylich

unread,
Sep 7, 2017, 7:28:06 AM9/7/17
to tesseract-ocr
Thank you. I got the rectangle with numbers from your example. But that was probably not strict enough for tesseract (probably due to the fact that the rectangle is not rectangle but it has sloping edges and I need rectangle that sticks to the most inner border point - to have just white background). Therefore I had to crop it by hand anyway to get the correct result... So now I am trying to get that by program.....

Lada Tylich

unread,
Sep 7, 2017, 8:24:16 AM9/7/17
to tesseract-ocr
aa_lregion-Binarized is what I 've got and the other one is what I need (cropped by hand).

aa_lregion-Binarized.png
aa_lregion_handfinal.png
Reply all
Reply to author
Forward
0 new messages