-1

How do you make easyocr return only numbers? There's no clear documentation that I can look that up. I was wondering if anyone would know.

c0nfluks
  • 53
  • 5
  • Maybe an option would be to get everything and filter out only the numbers using regex or something else? – M B Jul 17 '22 at 04:30
  • The point is not to extract only numbers from everything it throws at me. The point is to force the OCR to recognize numbers instead of "taking the shortest route" in returning a letter or symbol. – c0nfluks Jul 17 '22 at 04:41
  • You should try asking your question in the repo page itself https://github.com/JaidedAI/EasyOCR – M B Jul 17 '22 at 04:44
  • Can you define what you mean by `numbers`? There's no support for it directly as far as I understand. – Zabir Al Nazi Jul 17 '22 at 04:50
  • Normally easyocr returns (box coordinates, relevant text and confidence score). I can't understand what you mean by number?.. May be you printed object instead of enumerate the object for detection. – Berlin Benilo Jul 17 '22 at 07:11
  • At details=0, you get an output. I want easyOCR to only detect numbers. There's no other words more simple than the word "number" to describe that I want numbers to be returned... – c0nfluks Jul 18 '22 at 01:29

1 Answers1

0
result = reader.readtext(image, allowlist='0123456789')
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
  • This answer was reviewed in the [Low Quality Queue](https://stackoverflow.com/help/review-low-quality). Here are some guidelines for [How do I write a good answer?](https://stackoverflow.com/help/how-to-answer). Code only answers are **not considered good answers**, and are likely to be downvoted and/or deleted because they are **less useful** to a community of learners. It's only obvious to you. Explain what it does, and how it's different / **better** than existing answers. – Trenton McKinney Aug 30 '22 at 17:07