Lesen Sie den arabischen Text in Python mit Easyocal

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Lesen Sie den arabischen Text in Python mit Easyocal

by Anonymous » 14 Jul 2025, 14:57

Ich habe ein Problem damit, den Text auf Arabisch zu lesen. Ich habe einige Verarbeitung und Kontrast durchgeführt, aber der Text ist nicht vollständig lesbar. < /P>

Code: Select all

!pip install easyocr
!pip install --upgrade easyocr opencv-python

import easyocr
import cv2
from matplotlib import pyplot as plt
from google.colab import files
import numpy as np
from PIL import Image
uploaded = files.upload()
image_path = next(iter(uploaded))

image = Image.open(image_path)
image = np.array(image)

plt.imshow(image)
plt.axis("off")
plt.show()

def test_easyocr_basic(image):
reader = easyocr.Reader(['en', 'ar'])
result = reader.readtext(image)

img_draw = image.copy()
for i, (bbox, text, prob) in enumerate(result, start=1):
print(f"{i}. [{prob:.2f}] {text}")
top_left = tuple(map(int, bbox[0]))
bottom_right = tuple(map(int, bbox[2]))
cv2.rectangle(img_draw, top_left, bottom_right, (0, 255, 0), 2)
plt.figure(figsize=(10, 10))
plt.imshow(cv2.cvtColor(img_draw, cv2.COLOR_BGR2RGB))
plt.axis("off")
plt.show()

test_easyocr_basic(image)

Top