Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dark Background - works in demo #1379

Open
Gianfilippo980 opened this issue Feb 19, 2025 · 2 comments
Open

Dark Background - works in demo #1379

Gianfilippo980 opened this issue Feb 19, 2025 · 2 comments

Comments

@Gianfilippo980
Copy link

Te image that I need to OCR looks like this (it is a time indication):

Image

Of course, I tested it in the demo and it works flawlessly:

Image

Then I installed the software on my Raspberry Pi and I can't get it to replicate the results:

Python 3.11.2 (main, Nov 30 2024, 21:22:50) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import easyocr
>>> reader = easyocr.Reader(['en'])
Neither CUDA nor MPS are available - defaulting to CPU. Note: This module is much faster with a GPU.
>>> reader.readtext('zona_orario.png')
[([[np.int32(21), np.int32(3)], [np.int32(43), np.int32(3)], [np.int32(43), np.int32(21)], [np.int32(21), np.int32(21)]], '0', np.float64(0.9998962906071398)), ([[np.int32(55), np.int32(5)], [np.int32(89), np.int32(5)], [np.int32(89), np.int32(21)], [np.int32(55), np.int32(21)]], 'GED', np.float64(0.0))]
>>> reader.readtext('zona_orario.png', allowlist='0123456789')
[([[np.int32(21), np.int32(3)], [np.int32(43), np.int32(3)], [np.int32(43), np.int32(21)], [np.int32(21), np.int32(21)]], '0', np.float64(0.9999812842291114)), ([[np.int32(55), np.int32(5)], [np.int32(89), np.int32(5)], [np.int32(89), np.int32(21)], [np.int32(55), np.int32(21)]], '77', np.float64(0.012275525823156254))]
>>> reader.readtext('zona_orario.png', allowlist='0123456789', mag_ratio=3)
[([[np.int32(54), np.int32(3)], [np.int32(88), np.int32(3)], [np.int32(88), np.int32(20)], [np.int32(54), np.int32(20)]], '13', np.float64(0.999999915706304))]
>>> reader.readtext('zona_orario.png', allowlist='0123456789', mag_ratio=2)
[([[np.int32(21), np.int32(5)], [np.int32(42), np.int32(5)], [np.int32(42), np.int32(20)], [np.int32(21), np.int32(20)]], '0', np.float64(0.9999947547981378)), ([[np.int32(54), np.int32(5)], [np.int32(89), np.int32(5)], [np.int32(89), np.int32(20)], [np.int32(54), np.int32(20)]], '2', np.float64(0.03254324029984801))]
>>> reader.readtext('zona_orario.png', allowlist='0123456789', mag_ratio=2.5)
[([[np.int32(55), np.int32(4)], [np.int32(89), np.int32(4)], [np.int32(89), np.int32(19)], [np.int32(55), np.int32(19)]], '77', np.float64(0.011731833376220437))]
>>> reader.recognize('zona_orario.png', allowlist='0123456789')
[([[0, 0], [94, 0], [94, 25], [0, 25]], '77', np.float64(0.01394686076874571))]
>>> 

As you can see, if I set a higher magnification the minutes are read correctly, but then the hours are not. Any advice?

@Gianfilippo980 Gianfilippo980 changed the title Dark Background Dark Background - works in demo Feb 19, 2025
@Gianfilippo980
Copy link
Author

Gianfilippo980 commented Feb 19, 2025

By the way, I c drew the boxes that were parsed in the first attempt, and those look pretty good, just like the ones in the demo:

Image

@Gianfilippo980
Copy link
Author

Gianfilippo980 commented Feb 19, 2025

Inverting the colors doesn't seem to help:

Image

>>> reader.recognize('orario_invertito.png', allowlist='0123456789.')
[([[0, 0], [94, 0], [94, 25], [0, 25]], '77', np.float64(0.013375049105307402))]
>>> reader.readtext('orario_invertito.png', allowlist='0123456789.')
[([[np.int32(55), np.int32(5)], [np.int32(89), np.int32(5)], [np.int32(89), np.int32(21)], [np.int32(55), np.int32(21)]], '77', np.float64(0.010336355524602742))]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant