-
Notifications
You must be signed in to change notification settings - Fork 751
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
Can the tesseract OCR run in Windows Phone 8 platform? #53
Comments
Hi Rsteng2, |
Hi Charlesw. |
The trouble here isn't so much the wrapper (what I've written) but the native tesseract-ocr library, which I don't believe would currently execute since it is built targeting x86 architecture. As I mentioned previously I can easily create a new target to generate a version of the wrapper that will execute on windows phone 8, assuming there isn't any compatibility issues. I think all Devscope has done, though I don't know for sure, is recompile the native tesseract library targeting windows phone system, or something similar. Unfortunately I don't have a windows 8 phone so can't really do this myself however would be happy to offer some assistance\help if you choose to take this on. The first place to look might be a guide to porting an existing (c++) windows app to windows phone and doing the same to tesseract sources. I'd also create a new github project to make it easier for others to give you a hand here If you choose to do this. |
I am not having windows phone by now as well, however i can test it on emulator, just that the emulator need quite high requirement... and I will be determined to learn how to port the library, thank you very much. Just that i am still an amature in programming, it will need some time.. |
please tell me what to do :/ i am also in this same trouble .... i need to use this ocr in windows phone 8 .. i tested it in my desktop app and it worked fine ... |
Just had a bit of a look into this and it seems that P/Invoke is NOT supported on Windows Phone 8 (Source). According to this the only way to work with an native library, like tesseract, is to build a Windows Runtime Component for that library using C++/CX. This is unfortunately a completely different approach to using P/Invoke and would be (almost) akin to starting again from scratch. |
Here's the bug report for that is preventing us from supporting WP8 if you want WP8 support please up vote this issue as I do not have the time to implement a Windows Runtime Component for tesseract. |
could you guide me what to do about this as i need tesseract in my fyp |
Based on what's written in https://connect.microsoft.com/VisualStudio/feedback/details/777333/add-dllimport-support-for-net-in-windows-phone-8 the quickest path would be to generate a WinPTR component that exposes the Tesseract C and Leptonica APIs like SharpDX has done (see: https://github.com/sharpdx/SharpDX/tree/master/Source/SharpDX.WP8). Unfortunately I can't really provide a step by step guide for you at this time as I'm not to sure exactly what is going to be required. However If you download the SharpDX source and spend some time tracing through what they've done hopefully you'll be able to replicate the same techniques for tesseract. If you have any specific questions feel free to ask. |
i just have to write a wrapper for all the interop classes i.e. baseapi , constants , leptonicaapi marshalhelper and windowslibraryloader ???? the rest needs to be left as it is ?? |
If you use the same approach as SharpDX then yes you'd need to write a wrapper in C++/CX to expose the function pointers that are used by the interop classes (baseapi etc) and then update those interop classes to use these function pointers instead of P/Invoke. You will also probably need to make some changes to the tesseract project itself to compile for the ARM architecture. |
will try my best :) thank you for your co-operation :) ... |
please correct if i am wrong .. i need to use the baseapi.h and baseapi.cpp files for making the windows runtime component ?? |
Hi Nabeelyaya If you get this working, please post your project source here, it would be appreciated. Thanks |
Yes you'll need to use the baseapi.h file, but not the cpp files directly. Basically I think you'll need to do something like this:
If I were you I'd probably attempt to just expose the API to get tesseract's version first as a proof of concept rather than trying to do the whole lot in one bit. |
can generate the static lib files :'( |
Sorry should have referred you to https://github.com/charlesw/tesseract-vs2012 which is a fork off https://github.com/jakesays/tesseract-vs2012. This is actually the projects used to build the current dlls provided with the distribution. I just had a quick play and was able to build some lib files targeting x86 just by changing the project configuration. Hopefully it is as easy to add a new configuration targeting Arm architecture, though I couldn't find a lot of documentation on how to do this. |
can you build arm architecture files for me plx ? i think in project poperties-> configuration ->linker ->advanced their is an attribute target machine .... you can change it to machine arm ... will it build the required files ???/ |
OK I'll give it a shot, no promises though :) |
I've created a new branch (win8) on https://github.com/charlesw/tesseract-vs2012 that contains a first attempt at porting the native tesseract libs over to windows phone 8. Unfortunately there are quite a few api changes that mean these libraries do not build when targeting the Windows Runtime. Most of the issues seem to originate in leptonica (I haven't gotten as far as tesseract itself) in that it has code to fire up other programs, normally for debugging purposes such as viewing the output if a debug flag is set, which is a no no when it comes to WRT. I think the next step is to selectively remove this code so leptonica compiles using the
Check out my last commit on the mentioned project to see some examples of how to do this. Unfortunately I don't have the time to take this any further at this time so I'll have to leave this up to you. Good luck!!! |
What version of vs are you using? If your using VS express you'll need VS Express 2013 for windows not windows desktop. This is required to build apps for windows store and thus windows phone 8. I'm not sure if vs 2012 or earlier can build this project type. |
This could also be another reason http://stackoverflow.com/questions/19413073/is-it-possible-to-create-a-windows-8-store-app-from-visual-studio-2013 |
i have vs 2012.. |
Sorry I don't have any libs I can provide you with that will work for Windows phone. As mentioned above you'll need to also make some source changes to get them compiling when targeting Windows Runtime. |
I've found tutorial for BlackBerry10 / iOS. However I doný know how to apply them for Windows Phone. Maybe somebody can help |
Sorry not to sure myself. |
Does anything change here With Windows10 Universal? Can we use this within a Universal app? |
@AmitBhatnagar24 Nothing really changes with win 10 universal apps, except maybe that it comes with its own OCR API from Microsoft. By the way I was able to get Tesseract to build as a winrt library by doing a few minor modifications and by removing all its dependencies except leptonica. Compressed images are being decompressed using WIC (Windows Image Component). You can take a look at it here if you are interested: https://github.com/yoisel/tesseract_winrt At this point it's just a proof of concept, so only the Debug/x86 configuration builds, but I do intend to complete the task in near future. |
Sweet :)
|
Since I successfully installed the tesseract OCR from the Nuget package manager in the Windows phone 8 app project, will it be able to run like normal? I ask this as i am still in the beginning stage of using the library, and i am still trying my best to solve some problem like "Error 1 The type or namespace name 'tesseract' could not be found (are you missing a using directive or an assembly reference?)". Truly thanks in advance.
The text was updated successfully, but these errors were encountered: