0

I'm trying to solve some semi simple CAPTCHA codes using Python3 on my Raspberry Pi 4. This is my current code.

from PIL import Image
from pytesseract import image_to_string

img=Image.open('/home/pi/Desktop/Captcha Code Tests/img.png')
text=image_to_string(img, lang='eng')
print(text)

This is one of the pictures I'm using (I downloaded a ton of CAPTCHAs from the specific website to help practice with)

img.png

When I print the results I get

TNF 5

Great! minus the space but that can be removed easily. my problem is it can only solve like every 15th code. Here are others it cant solve (they are all the same font I believe but some more warped than others).

img (1).png

img (2).png

img (3).png

img (4).png

Any help at all would be greatly appreciated. I've downloaded a bunch of them, if its even an option I don't mind having to make a library to help it learn from, just don't know how.

Thanks in advance!


EDIT 1:

So on closer inspection of the CAPTCHAs, it appears all of the codes are warped the same way. Like they were ran through a wave filter. The 1st and 3rd characters are always rotated to the right, and the 2nd and 4th characters are rotated to the left. Is there a way to run them through a filter to reverse this? I'm wanting the end result to be 100% automated. This picture shows a little better what I mean. Warp Correction Picture Thanks again!

Nazim Kerimbekov
  • 4,712
  • 8
  • 34
  • 58
Michael
  • 7
  • 3

0 Answers0