Rahal
Rahal

Reputation: 1

EasyOCR is not detecting Arabic letters in a license plate image

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

55474 48

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 ?

Upvotes: 0

Views: 37

Answers (0)

Related Questions