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

tessedit_ocr_engine_mode in recognize options does not work #808

Closed
eyaler opened this issue Aug 23, 2023 · 5 comments · Fixed by #816
Closed

tessedit_ocr_engine_mode in recognize options does not work #808

eyaler opened this issue Aug 23, 2023 · 5 comments · Fixed by #816

Comments

@eyaler
Copy link

eyaler commented Aug 23, 2023

in version 4.1.1, setting tessedit_ocr_engine_mode in recognize options does not work, and you must set it in worker initialize

does not work:
r = await Tesseract.recognize(im, 'eng', {tessedit_ocr_engine_mode: 0})

works:

w = await Tesseract.createWorker()
await w.loadLanguage('eng')
await w.initialize('eng', 0)
r = await w.recognize(im)
@Balearica
Copy link
Member

I do not believe this behavior itself is a bug, as the Tesseract source code indicates that the tessedit_ocr_engine_mode is a parameter set at initialization. However, a types file in this repo does incorrectly indicate that this parameter can be set after initialization, so I think the actionable change here is to remove that.

tessedit_ocr_engine_mode: OEM

@Balearica
Copy link
Member

I removed the misleading option, so there should no longer be any indication that tessedit_ocr_engine_mode can be changed after initialization.

@eyaler
Copy link
Author

eyaler commented Aug 24, 2023

@Balearica thanks! ideally, trying to set init_only args after initialization should raise a warning or an exception instead of silently failing.

@Balearica
Copy link
Member

I think a warning could be helpful. I would not want to throw an exception since I do not think this is worth breaking existing code over--other users likely have this option set under the mistaken belief that it does something.

@Balearica
Copy link
Member

I added a warning message when users attempt to use setParameters to set an init-only parameter. Closing the issue as resolved.

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

Successfully merging a pull request may close this issue.

2 participants