dynobo / normcap

OCR powered screen-capture tool to capture information instead of images
https://dynobo.github.io/normcap/
Other
1.8k stars 91 forks source link

Normcap sometimes crashes trying to recognize Kanji/Hanzi #615

Open CookieDoodle opened 2 months ago

CookieDoodle commented 2 months ago

What happened?

I enabled Normcap to stay open in the system tray. But sometimes Normcap crahes trying to parse Kanji/Hanzi characters.

Initially, I thought it was just a problem with Chinese. But after trying to recognize both Japanese and Chinese text. And then converting the Japanese text to Hiragana (no Kanji characters) and comparing the crash rates between Japanese w/ Kanji and without. I realized the problem was with the Kanji characters in general.

The crashing happens around 40% of the time. It happens pretty consistently. (Chinese crashes more than Japanese, obviously.) And the crashing is not dependent on length of the text being parsed. Normcap can crash parsing one word or multiple paragraphs. It doesn't matter.

I don't know if it's certain characters that Normcap has issues with. As in, it fails to recognize a certain character and that's why it crashes. Though, I'm not sure if that it the case. Since if Normcap crashes the first time trying to recognize a word. If you try to recognize it again, it doesn't crash a second time.

Expected behavior: Normcap is supposed to stay open after parsing Japanese/Chinese text instead of the program closing.

How did you install NormCap?

FlatPak (Linux)

Operating System + Version?

SteamOS 3.5.17

[Linux only] Display Server (DS) + Desktop environment (DE)?

Wayland/KDE Plasma

Debug log output?*

11:22:16 - INFO    - normcap:49 - Start NormCap v0.5.4
11:22:16 - DEBUG   - normcap.gui.tray:77 - System info:
{'normcap_version': '0.5.4', 'python_version': '3.11.9', 'cli_args': '/app/bin/normcap -v debug', 'is_briefcase_package': False, 'is_flatpak_package': True, 'is_appimage_package': False, 'platform': 'linux', 'desktop_environment': <DesktopEnvironment.KDE: 2>, 'display_manager_is_wayland': False, 'pyside6_version': '6.6.1', 'qt_version': '6.6.1', 'qt_library_path': '/usr/share/runtime/lib/plugins, /app/lib/python3.11/site-packages/PySide6/Qt/plugins, /usr/bin', 'locale': 'DEFAULT', 'config_directory': PosixPath('/home/deck/.var/app/com.github.dynobo.normcap/config/normcap'), 'resources_path': PosixPath('/app/lib/python3.11/site-packages/normcap/resources'), 'tesseract_path': PosixPath('/app/bin/tesseract'), 'tessdata_path': PosixPath('/home/deck/.var/app/com.github.dynobo.normcap/config/normcap/tessdata'), 'envs': {'TESSDATA_PREFIX': '/app/share', 'LD_LIBRARY_PATH': ''}, 'screens': [Screen(left=0, top=0, right=1279, bottom=799, device_pixel_ratio=1.0, index=0, screenshot=None)]}
11:22:16 - DEBUG   - normcap.gui.settings:162 - Skip update of non existing setting (show_introduction: None)
11:22:16 - DEBUG   - normcap.gui.settings:162 - Skip update of non existing setting (cli_mode: False)
11:22:16 - DEBUG   - normcap.gui.settings:162 - Skip update of non existing setting (background_mode: False)
11:22:16 - DEBUG   - normcap.gui.settings:162 - Skip update of non existing setting (clipboard_handler: None)
11:22:16 - DEBUG   - normcap.gui.tray:394 - Another instance is already running. Sending capture signal.
11:22:16 - INFO    - normcap.gui.tray:610 - Exit normcap
11:22:16 - DEBUG   - normcap.gui.tray:611 - Debug images saved in /tmp/normcap
(deck@steamdeck ~)$ 

.0, index=0, screenshot=None)]}