[Python] EasyOCR is not detecting Arabic letters in a license plate image

Discussão em 'Python' iniciado por Stack, Fevereiro 27, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to extract text from a Moroccan license plate using EasyOCR, but the Arabic letter in the middle is not being detected. Problem: When processing an image of a license plate, EasyOCR correctly detects the numbers but ignores the Arabic letter. For example, from this plate: Example Picture Example Picture

    • EasyOCR extracts:

    55474 48

    • instead of:

    55474 48 أ

    Code I am using:

    import easyocr
    import re

    def extract_text_with_easyocr(image_path, languages=['en']):
    reader = easyocr.Reader(languages)
    results = reader.readtext(image_path)

    extracted_text = ""
    for (_, text, _) in results:
    letters_digits_only = re.sub(r'[^\w\s\u0600-\u06FF]', '', text)
    extracted_text += letters_digits_only + " "
    return extracted_text.strip()

    image_path = "plate.jpg"
    text = extract_text_with_easyocr(image_path)
    print("Extracted text:", text)


    How can I improve the detection so that EasyOCR correctly extracts the Arabic letter along with the numbers ?

    Continue reading...

Compartilhe esta Página