K
K
Kerby12342020-11-26 20:23:44
Python
Kerby1234, 2020-11-26 20:23:44

How to do digit recognition in python?

Hello who is watching this thread.
I want to recognize numbers from captcha in python, advise me how to do it correctly, there are always 2 digits in the captcha, always blue, I used the code below, that's all I came to, I don't know what to do next (the second photo is what it turns out):
5fbfe47b83da7030851918.jpeg5fbfe48162191033207512.gif

from PIL import Image

im = Image.open("1.jfif")
im = im.convert("P")
im2 = Image.new("P",im.size,255)

im = im.convert("P")

temp = {}

for x in range(im.size[1]):
  for y in range(im.size[0]):
    pix = im.getpixel((y,x))
    temp[pix] = pix
    if pix == 174 or pix == 224: # Это код синего цвета и другого оттенка синего
      im2.putpixel((y,x),0)

im2.save("output.gif")

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2020-11-26
@hottabxp

from PIL import Image
from pytesseract import image_to_string

myText = image_to_string(Image.open("tmp/test.jpg"))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question