henrivain / TesseractOcrMaui

Tesseract wrapper for Windows, Android and iOS for .NET MAUI
Apache License 2.0
37 stars 4 forks source link

Tesseract with live camera #37

Open Mittchel opened 7 months ago

Mittchel commented 7 months ago

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 commented 7 months ago

I need more information

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

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

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