naptha / tesseract.js

Pure Javascript OCR for more than 100 Languages 📖🎉🖥
http://tesseract.projectnaptha.com/
Apache License 2.0
34.91k stars 2.21k forks source link

Maximum call stack size exceeded #853

Closed RaenonX closed 2 months ago

RaenonX commented 10 months ago

Tesseract.js version (version number for npm/GitHub release, or specific commit for repo) v5.0.3

Describe the bug Unable to run. Console showing maximum call stack size exceeded.

To Reproduce Steps to reproduce the behavior:

const worker = await createWorker(
  'eng',
  OEM.DEFAULT,
  {
    errorHandler: (error) => {
      console.error('OCR Error', error);
    },
  },
);
await worker.setParameters({
  tessedit_char_blacklist: '$§',
  tessedit_char_whitelist: whitelistChars,
});

Images below show what's captured in F12. The 17435 and the regex part is my compiled code, I don't know where the octet-stream from, but it seems to

image image

In the image above that shows the console output, 2 0-height errors show (under 2 jsdelivr, the red bar) up immediately after the worker starts. the octet-stream one shows up about a minute later.


Image below was the target image to recognize.

image

Expected behavior No error.

Device Version:

This doesn't work:

This works:

Additional context Add any other context about the problem here.

Note

Balearica commented 10 months ago

I attempted to replicate this issue but was unable to do so. I used an iPhone SE 2020 v16.4, which was the closest device provided by Browserstack to what you describe. I recognized the provided image on the Tesseract.js demo site, and everything worked as intended.

I would have your friend try and recognize the image on the Tesseract.js demo site. This would help determine if the issue is specific to some settings used in your project, or if Tesseract.js consistently encounters issues on that particular device/software combination.

Balearica commented 2 months ago

I am closing this issue as the behavior could not be preproduced, including using the device/version at question. If somebody can provide an example of code that consistently fails with this message on iPhone, we can re-open.