Skip to content
Advertisement

EasyOCR Printing file details instead of text output only

I am trying to test out Easy OCR. Now when I run my code

path = "{image file}"
read = easyocr.Reader(['en'], gpu=True)
result = read.readtext(path)
print(result)

It outputs this

[([[887, 1], [975, 1], [975, 13], [887, 13]], 'Photoshop PSD hle', 0.7655935865739645), 
([[978, 2], [1022, 2], [1022, 10], [978, 10]], 'Jownioao', 0.2720053768871571), 
([[1044, 2], [1152, 2], [1152, 10], [1044, 10]], 'Resolution 1230x1024P}', 0.3419384126594147), 
([[1169, 2], [1274, 2], [1274, 10], [1169, 10]], 'uDsooradhics cor', 0.10438481226211914), 
([[285, 474], [980, 474], [980, 716], [285, 716]], 'TEXT', 0.999515175819397)]

Instead of just

([[285, 474], [980, 474], [980, 716], [285, 716]], 'TEXT', 0.999515175819397)]

I want to get an simple output but it seems it also prints the image details and such.

EDIT: Sorry I posted a wrong output. If anyone is wondering here’s the link of the photo

Advertisement

Answer

As it is explained in the repo: “The output will be in a list format, each item represents a bounding box, the text detected and confident level, respectively.”

You can set detail=0 for simpler output:

result = read.readtext(path, detail = 0)
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement