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

Tesseract with live camera #37

Open
Mittchel opened this issue Feb 14, 2024 · 1 comment
Open

Tesseract with live camera #37

Mittchel opened this issue Feb 14, 2024 · 1 comment

Comments

@Mittchel
Copy link

I've been trying this wrapper and it works perfectly with photos. Now I would like to start a live camera and use tesseract to OCR like the following: https://github.com/yushulx/dotnet-barcode-qr-code-sdk/blob/main/example/maui/Platforms/iOS/CaptureOutput.cs

The problem I am facing is that this wrapper supports PNG/JPG only and I'm getting InvalidImage error. I've tried to convert CGImage to UIImage and get the NSData as PNG. I'm not getting an error, but the text is not getting recognised.

How would one approach this situation?

@henrivain
Copy link
Owner

I need more information

Are you able to save the converted png/jpeg image byte buffer to file with png/jpeg file extension?

  • Do the bytes produce correct image
  • Are the characters clear in this saved image

What kind of words are you trying to recognize? (single word, sentences, single characters)

  • Page segmentation mode might change the recognized result if you are not looking for sentences

Your example code link

I am quite busy and with a quick look I am not really sure if I understand the code correctly.
Is this the process that is ran for every frame your camera captures? What camera library you are using to get the input?

My thoughts

I would look if the converted NSData can be saved as png/jpeg byte array and then recognized as image path.
If that works problem is probably not a problem with encoding.

It is very hard to say without an example. It would help if you could produce simple example project.

I am very busy for next like 4 weeks and might not be able to help very much. iOS is also a platform that I am not very familiar with and only have emulator with remote connection as my iOS development device. Remote connection causes very bad performance with emulator so live camera will make testing pain.

I will try to help the best I can, but it might not be very much.
You can ask @sivanmg if he is willing to help with iOS technical side. I know better the tesseract side and he knows iOS side.

Regards,
Henri

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

2 participants