JaidedAI / EasyOCR

Ready-to-use OCR with 80+ supported languages and all popular writing scripts including Latin, Chinese, Arabic, Devanagari, Cyrillic and etc.
https://www.jaided.ai
Apache License 2.0
24.46k stars 3.16k forks source link

OCR boxes: is there a way to sort boxes left to right #1274

Open PrathibhaPA opened 4 months ago

PrathibhaPA commented 4 months ago

Easyocr does a pretty good job in giving back bboxes. But recently I noticed that bboxes are not in order. I figured out that when the texts are slightly disoriented, the bbox for the text at the higher level is placed first in order. For example, this is my sample output:
image (box number is the index of each bbox) In this: Boxing order should have been: ([[25, 215], [97, 215], [97, 229], [25, 229]], 'Education:', 0.999906885180935), ([[134, 200], [286, 200], [286, 226], [134, 226]], 'BA in Psychology', 0.9998934803292433)]]) and when i concat I should get: Education: BA in psychology

But I actually get: ([[134, 200], [286, 200], [286, 226], [134, 226]], 'BA in Psychology', 0.9998934803292433), ([[25, 215], [97, 215], [97, 229], [25, 229]], 'Education:', 0.999906885180935))] and if concat the text: I get BA psychology Education: So I wanted to know if there is any way I can sort the bboxes left to right line by line.

alexb231 commented 2 months ago

i think setting paragraph = true in the readtext might do the trick here