A
A
aopil2020-11-01 22:02:22
PHP
aopil, 2020-11-01 22:02:22

How can image processing be improved?

I'm trying to read captcha with tesseract.
I process the image before sending it to tesseract.

original
5f9f04a4f3bae163675691.png


After processing
5f9f05810641e845840032.jpeg


Result: U4E2\.
I.e. does not recognize - 1

The code itself:
$image = new \Imagick('test.jpg');
$image->SharpenImage($radius = 5, $sigma = 1);
$image->gaussianBlurImage($radius = 2, $sigma = 1);
$brightness = 120;
$saturation = 100;
$hue = 60;
$image->modulateImage($brightness, $saturation, $hue);


Tell me, what else can be applied to recognize with a greater chance?

=========
According to the documentation, you can use whitelist, thereby restricting Tesseract to only look for letters/numbers, not symbols.
I tried it like this (as in the documentation):
echo (new TesseractOCR('img.png'))
    ->whitelist(range('a', 'z'), range(0, 9))
    ->run();

But for some reason he ignores these requirements ..

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question