python – Phone number recognition in the picture

Question:

How can you recognize the phone number in the picture?

Answer:

For example pytesseract :

from PIL import Image
import pytesseract

import io
import requests

image_bytes = requests.get('http://placehold.it/200x100').content
image = Image.open(io.BytesIO(image_bytes))
text = pytesseract.image_to_string(image)
print(text)  # 200x100
Scroll to Top