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

Image too small to scale!! (2x36 vs min width of 3) #796

Closed
Melmacker opened this issue Jul 8, 2023 · 6 comments
Closed

Image too small to scale!! (2x36 vs min width of 3) #796

Melmacker opened this issue Jul 8, 2023 · 6 comments
Labels
dependency bug Valid bug where fixing is outside the scope of this repo

Comments

@Melmacker
Copy link

Tesseract.js version (version number for npm/GitHub release, or specific commit for repo)
npm, tesseract.min.js, version 4.1.1

These people have already done it, and they have done it better than I could ever describe:
tesseract-ocr/tesseract#3001
tesseract-ocr/tesseract#2890

@Balearica Balearica added the dependency bug Valid bug where fixing is outside the scope of this repo label Jul 8, 2023
@Balearica
Copy link
Member

Balearica commented Jul 8, 2023

Please describe when you've encountered this issue and how to replicate. Both issues you've linked state that this issue occurs when running a bash script to generate new training data, which is not something we support in Tesseract.js. Additionally, these issues indicate the problem was already solved in early 2021.

@Melmacker
Copy link
Author

Melmacker commented Jul 9, 2023

I use tesseract.min.js, in GTA5 third party application called FiveM, to detect some text on the screen.
What I can track down with my knowledge was that it happens when you enter an base 64 image string like attached.
base64imagestring.txt
image

@Balearica
Copy link
Member

Using the base 64 string you provided, I was able to replicate Tesseract.js printing this message.

Image too small to scale!! (2x36 vs min width of 3)
Line cannot be recognized!!

That being said, I do not believe this message being printed indicates a bug in Tesseract.js. Tesseract.js did not crash and recognition appeared to run as expected. As the message itself was produced by Tesseract (not Tesseract.js-specific code), editing the underlying code is outside of the scope of this project. Tesseract.js is intended to port Tesseract to run with JavaScript--we do not make changes to the Tesseract recognition engine. If you believe you found a bug with Tesseract, you should replicate using the main project and then report there.

If the core issue is simply that you are annoyed by messages from Tesseract being printed to the console, you can change this behavior by setting debug: true in the recognition output options. With this option, the text will instead be reported in the output object rather than printed to console.

worker.recognize(img1, undefined, {debug: true})

@Melmacker
Copy link
Author

Melmacker commented Jul 10, 2023

Thank you very much, but I have one last question. If I set the debug to true or false it doesn't change anything (it still spammed my console).
Tesseract.recognize(event.data.data, 'eng', {debug: true}).then(({ data: { text } }) => {do something});
I also tried two more unnatural method, but they didn't work for me either.
Tesseract.recognize(event.data.data, 'eng', {logger: m => {}}).then(({ data: { text } }) => {do something});
Tesseract.recognize(event.data.data, 'eng', {errorHandler: m => {}}).then(({ data: { text } }) => {do something});
Do you have another tip for me?

@Balearica
Copy link
Member

Balearica commented Jul 14, 2023

@Melmacker Tesseract.recognize does not contain an output argument, so adding {debug: true} does not do anything. The worker.recognize method contains an output argument that you would set to {debug: true}.

Tesseract.recognize is an extremely simple function that exists primarily for the sake of new users experimenting with Tesseract.js. To have full control and the best performance, you need to manage the worker objects directly. This is explained in the intro guide.

@Melmacker
Copy link
Author

Thank you verry much. Now I got it 😅
Keep up the good work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency bug Valid bug where fixing is outside the scope of this repo
Projects
None yet
Development

No branches or pull requests

2 participants