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

iOS #11

Closed
JTrotta opened this issue Apr 13, 2023 · 9 comments
Closed

iOS #11

JTrotta opened this issue Apr 13, 2023 · 9 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@JTrotta
Copy link

JTrotta commented Apr 13, 2023

Will you upgrade this library to use both Andorid & iOS?
Thank you

@JTrotta
Copy link
Author

JTrotta commented Apr 14, 2023

I read better the readme file. Do you accept pull request for iOS?

@henrivain
Copy link
Owner

henrivain commented Apr 14, 2023

Yes,
If you can build the libraries and add them to TesseractOcrMAUI/lib/iOS/[architechtures]/[libraries] with needed cpu architechtures the library should work with only small changes. You can find information from microsoft docs.

For other platforms I have built libraries form these repositories
tesseract
leptonica
libpng
libjpeg

Windows also needed
zlib

Use latest versions of these libraries.

I you want to add iOS support, please, fork the main branch. I don't have iOS devices myself, so I can't debug myself. I can still try to help if you have any problems.

@FerdiMarti
Copy link

FerdiMarti commented May 2, 2023

@JTrotta, I see you've already forked the project. Were you able to build the libraries for iOS and does it work for you?

I am currently struggling to build the libraries without errors.

Thanks!

@henrivain
Copy link
Owner

Hello @FerdiMarti,

As said I am not familiar with Apple devices and tools, so I can't probably help much, but here are some links.

Tessdoc

You have probably tried steps from tessdoc?

Instructions under title macOS with MacPorts seem to have possibility to work, at least Windows build had some similar steps.

You should be able to pass path parameters to ./configure so that you can point make install/library directory to folder of your choice.

Github actions

Check also macos test github action, it seems to build the library before running tests.

This action also builds with cmake.

My build experiences

I also had a lot of problems when building for Android, because up to date information was hard to find. Also Android was missing dependencies like google cpu features. I gathered my Windows and Android build commands to this repository. No macos or ios of course, but sometimes they might help.

Hope this has any help to you!

@FerdiMarti
Copy link

FerdiMarti commented May 9, 2023

Hi @henrivain,

Thank you for your help and great work with gathering the stuff for Android/ Windows!

After many hours of trying last week and looking into multiple build scripts, etc., I was able to build some smaller libraries including Leptonica, but I finally gave up at Tesseract itself. I have no trouble building it for MacOs, but I run into unfamiliar issues for iOS. It is the first time I ever built libraries myself and so I might need to read more about it.

The project I need it for is somewhat time critical atm and so I found a different way to solve my problem. Unfortunately, I can't put more work days into building Tesseract right now. I do want to revisit this in some weeks though, because most of the OCR libraries I find for iOS/ MAUI are commercial tools, even though they are probably built on Tesseract. It would be great to have a free, open-source alternative.

@CRebeloCSS
Copy link

Hi @henrivain,

Thank you for your help and great work with gathering the stuff for Android/ Windows!

After many hours of trying last week and looking into multiple build scripts, etc., I was able to build some smaller libraries including Leptonica, but I finally gave up at Tesseract itself. I have no trouble building it for MacOs, but I run into unfamiliar issues for iOS. It is the first time I ever built libraries myself and so I might need to read more about it.

The project I need it for is somewhat time critical atm and so I found a different way to solve my problem. Unfortunately, I can't put more work days into building Tesseract right now. I do want to revisit this in some weeks though, because most of the OCR libraries I find for iOS/ MAUI are commercial tools, even though they are probably built on Tesseract. It would be great to have a free, open-source alternative.

Would you be willing to share how you found a different way to solve your problem? I would like to use an OCR that allows for custom trained data for both iOS and Android devices and I am curious if your solution would allow for the functionality I require.

@FerdiMarti
Copy link

Hi @CRebeloCSS,
my use case involved 7-segment-displays and my initial plan was to use Tesseract with custom trained data as well. I realised, that even with custom trained data, Tesseract's accuracy is not that good for 7-segment-displays and preprocessing has to be handled by myself anyways. So now my approach is to parse the pixels and do my own detection. For these kind of displays, it's not as hard as other writing. I guess it could also be achieved with some kind of OpenVC processing.

@henrivain henrivain added enhancement New feature or request help wanted Extra attention is needed labels Sep 15, 2023
@ThomasMunch
Copy link

ThomasMunch commented Dec 15, 2023

Hi @henrivain
I think its great you started working on this iOS-branch - My project is for Android and later on for iPhone.
I have tried using the Tesseract-nuget (Not yours) and it work fine for my project but it only works in Windows.
For my project i found that running Tesseract with enginemode: EngineMode.TesseractOnly was better than default and Lstm.
Is it possible to add EngineMode (TesseractOnly, LstmOnly, TesseractAndLstm and Default)to your tesseractOcrMaui.EngineConfiguration?
Regards

@henrivain
Copy link
Owner

Support added in latest update v1.1.0

New supported runtimes

Platform Architechture
iOS emulator x86_64
iOS emulator Arm64
iOS physical device Arm64

To get started with iOS

Add package to your csproj with package reference

<PackageReference Include="TesseractOcrMaui" Version="1.1.0" />

Thanks to @sivanmg who helped with package iOS development

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants