Page 1 of 1

How i could make better this image for tesseract recognition?

Posted: 2017-03-16T16:40:47-07:00
by diegomage
Image


convert dIsuln.png -unsharp 0x10 A_blur_unsharp0.jpg
convert A_blur_unsharp0.jpg -negate -lat 10x10+10% -negate jx8MPc9_kuw2_lat10-0.png
convert jx8MPc9_kuw2_lat10-0.png -fill white -opaque "#00ff00" balloon_white0.gif
tesseract -psm 10 balloon_white0.gif scanned2.txt


I have a simple image but I dont know How i could make better
Image


this command output an E instead 2

Re: How i could make better this image for tesseract recognition?

Posted: 2017-03-16T16:49:58-07:00
by fmw42
The image is too small and too even colored to do OCR. There are limits to what you can do by way of character size in the image and how thick it is. Is it a 2 or a Z? How will OCR know, I a person cannot tell the difference. I doubt you can do anything to improve this to get the OCR to read it accurately. But I do not know that much about OCR. Perhaps someone else can advise

Re: How i could make better this image for tesseract recognition?

Posted: 2017-03-16T16:57:44-07:00
by diegomage
But there is a way to remove that little point

Re: How i could make better this image for tesseract recognition?

Posted: 2017-03-16T16:58:29-07:00
by diegomage
The small point on the upper left margin

Re: How i could make better this image for tesseract recognition?

Posted: 2017-03-16T16:59:22-07:00
by diegomage
for output this

Image

Re: How i could make better this image for tesseract recognition?

Posted: 2017-03-16T17:01:00-07:00
by diegomage
My command works when there are no such small points that interferes in the image

Re: How i could make better this image for tesseract recognition?

Posted: 2017-03-16T18:26:35-07:00
by diegomage
I see one of your command for filter blob but I dont know how use this
convert balloon_white0.gif -define connected-components:area-threshold=40 -connected-components 4 -threshold 0 jx8MPc9_kuw2_lat10_cc30.png

how I could use this Please help

Re: How i could make better this image for tesseract recognition?

Posted: 2017-03-16T19:04:52-07:00
by fmw42
try

Code: Select all

convert 1FY60.png -channel red -separate +channel -threshold 70% result.png

Re: How i could make better this image for tesseract recognition?

Posted: 2017-03-16T19:07:35-07:00
by diegomage
thanks ; but not works how expected however this command works better ;
convert balloon_white0.gif -colorspace gray -colors 2 +dither -type bilevel imageout.tif
convert imageout.tif -define connected-components:area-threshold=77 -connected-components -4 -auto-level hh

Re: How i could make better this image for tesseract recognition?

Posted: 2017-03-16T19:09:54-07:00
by diegomage
but output a image with another colors Image

Re: How i could make better this image for tesseract recognition?

Posted: 2017-03-16T19:29:30-07:00
by fmw42
Each image will likely be different and require different approaches. I do not know one universal solution.

Re: How i could make better this image for tesseract recognition?

Posted: 2017-03-16T21:34:17-07:00
by snibgo
Input: 1FY60.png
Image

This image has an object with a background that extends to the edges of the image. So we can remove the background by making transparent all pixels that are within a certain fuzz percentage of any edge pixel. For this image, 6% works fine.

Windows BAT syntax.

Code: Select all

call %PICTBAT%edgeColsTrans 1FY60.png 1fy_x1.png . 6
1fy_x1.png:
Image

Code: Select all

%IM%convert ^
  1fy_x1.png ^
  -background White -layers Flatten ^
  -fill Black +opaque White ^
  -resize 300%% ^
  1fy_x2.png
1fy_x2.png:
Image

Code: Select all

tesseract 1fy_x2.png 1fy_x2 -psm 10
This gives the expected result, "2".

Re: How i could make better this image for tesseract recognition?

Posted: 2017-03-17T15:30:25-07:00
by diegomage
very thank you this help me so much