logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
panpanda  
#1 Posted : Sunday, May 21, 2023 4:45:12 AM(UTC)
panpanda

Rank: Newbie

Groups: Registered
Joined: 5/21/2023(UTC)
Posts: 2
Poland
Location: Wrocław

Was thanked: 1 time(s) in 1 post(s)
I see a strong problem with recognizing number 9 and 4

I initialize this plugin with settings:
English language, and
oOCR.SetVariable("tessedit_char_whitelist", "0123456789.");

as you can see, I have a recognized image
Quote:
the program is set to recognize only the selected area, the frame in the picture is dynamically generated - this is exactly the area that is recognized
next to a number in a given color - recognition effect

1.png (40kb) downloaded 1 time(s).

and an original image
2.png (202kb) downloaded 2 time(s).

(which is very large and very legible, it is the result of a thyroid ultrasound examination with the Samsung HS-50 ultrasound machine)

does not recognize me the banal text 39, has a huge problem in recognizing 4, as numbers and as numbers

how can i improve the settings of the program, image?
the image is colorful, but as you can see, the numbers are slightly gray and the background is simply black

maybe somehow teach him these images, I have about 2,000 of these results...

another example:
3.png (43kb) downloaded 2 time(s).

Edited by user Sunday, May 21, 2023 4:49:09 AM(UTC)  | Reason: Not specified

panpanda  
#2 Posted : Sunday, May 21, 2023 5:32:22 AM(UTC)
panpanda

Rank: Newbie

Groups: Registered
Joined: 5/21/2023(UTC)
Posts: 2
Poland
Location: Wrocław

Was thanked: 1 time(s) in 1 post(s)
for the moment i managed to partially solve the problem by changing the original image to black and white
factor 165 works best for me

Bitmap bM = (Bitmap)System.Drawing.Image.FromFile(picture_path);
bM = make_bw(bM);
oOCR.GetTextFromImage(bM, Square(x1, x2, y1, y2));

public Bitmap make_bw(Bitmap original) /*from https://stackoverflow.co...ure-black-and-white-in-c*/
{

Bitmap output = new Bitmap(original.Width, original.Height);

for (int i = 0; i < original.Width; i++)
{

for (int j = 0; j < original.Height; j++)
{

Color c = original.GetPixel(i, j);

int average = ((c.R + c.B + c.G) / 3);

if (average < 165)
output.SetPixel(i, j, Color.Black);

else
output.SetPixel(i, j, Color.White);

}
}

return output;

}
thanks 1 user thanked panpanda for this useful post.
Paul Rayman on 5/23/2023(UTC)
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.