Is it possible to use google tesseract OCR in android through NDK?
So I have some C++ code which uses tesseract OCR and now I don't want to move it to Android because it is connected with code that uses openCV and I have this in c++.
Many thanks for advice and links and how can I use it and build it.
It is most certainly possible to use the Tesseract OCR library in your own Android application through the NDK. However, you will have to compile the Tesseract library along with another library called Leptonica Image Processing Library and they take considerable amount of time to compile.
A guy named Robert Theis created a GitHub project (named tess-two) that would allow you to call the Tesseract API using Java through the Android Java Native Interface (JNI). You can read a bit more about that here.
I recommend you to follow this particular tutorial written by Gautam Gupta on how to set things up.
On the same page of that tutorial, there's also an explanatory comment giving you a step-by-step list of instructions you need to follow in order to configure the Tesseract OCR library with your Android application in Android Studio.
Edit: The comment URL doesn't always seem to go directly to the comment, so the comment to look for is from user Matz (April 21, 2015) and starts with "For ANDROID STUDIO developers, here’s what I did on my Windows 8.1 machine."
Related
I'm developing an Android app and I have to use the openCV library.
I was wondering if the openCV python sdk is equivalent to the openCV4Android? I already have some openCV code written in Python - everything that can be done using Python can also be accomplished with Java for Android?
Thanks.
Although I used OpenCV Java SDK for both Android and Java projects, I am not sure whether it supports all functionalities of python library. You can check which parts of the library is included in Java SDK from the documentation
If something is included but not have detailed description, you can check out c++/python equivalent for explanations.
OpenCVForAndroid usually only has the modules in the OpenCVMain repository:
https://github.com/opencv/opencv
If you want more than this, for example the OpenCV extra modules below, then you generally have to build from source. OpenCV extra modules
https://github.com/opencv/opencv_contrib
It is worth noting also that at the time of writing most of the official openCV Android documentation is based on using the Eclipse IDE, while most official Android documentation uses the newer Android Studio.
There are also two main ways to use OpenCV on Android - one is to use the Java SDK as you have noted and the other is to build your OpenCV functionality in c++ using the Android native NDE. The former is generally easier if the Java SDK covers the functionality you need.
I think it is fair to say that getting the latest release of OpenCV with the extra modules compiled and working with Android Studio is not trivial at this time - if you look on Stackoverflow you will see quite a few questions and discussions around this topic, for example look at this question and answers:
Reg. Adding OpenCV to Native C code through CMake on Android Studio
I'm planning to take a photo using the smartphone camera, then make some image processing. In case the Java SDK does not cover the functionality I need, a solution could also be sending the image to a remote server, do the processing (using Python) and send the processed image back to the application. Am I missing something? (of course I increase latency)
after a couple of weeks I have been unable to get the android set of tools to a functioning level with c++ before and have been given the opportunity of using a project tango, and though that sounds awesome and wondrous and would open a world of opportunity for working with VR... I feel like I am stuck at step -4. My understanding is limited, so bear with me.
I stumbled upon the PCL built for running algorithms on point cloud data, it was open source and appeared like a wonderful solution, it is written in C++ and I have a mild understanding of both c++ and java.
I have tried using Eclipse and the NDK and actually managed to get a project 'deployed' to the tango, however upon attempting to edit any file in the project, java or c++, it breaks and will never deploy again.
Now I am trying to use Android Studio, and after following about 5 conflicting tutorials on 'how to get C++/ndk working in android studio' I have yet to get a working environment.
So here is my question, and we can start at step one, any help is appreciated. How does one get c++ and the PCL working on a google project tango, is there a better way for someone of my skill level? The end result is a mapped 3d space with the project tango, with exportable data sets of manageable size. I have seen it done in demos on youtube, but thus far, like i said, I am stuck on step -4.
we are working on converting all project to android studio based, for now, here is the walk around to get you started:
Open Android Studio, import the project from the repo you just cloned.
Take the motion-tracking-jni-example as the example, copy tango-gl-render, tango-service-sdk, and third-party into the motion-tracking-jni-example/app/src.
Run ndk-build in the motion-tracking-jni-example/app/src/main folder.
ndk will generate the libs folder, rename it to jniLibs.
Go to Android Studio, in build.gradle(Module:app) file, add line 'sourceSets.main.jni.srcDirs = []' to the defaultConfig section.
Just click the run button in Android Studio.
What we did here is basically disabled the Android Stdio's JNI compile and manually built it using ndk.
Start with unity3d, its easy to get a working demo with a week with Unity3D.
And support is very good, documentation is top notch.
Hope this will help.
Tango NDK Tutorial Will help but the basic layout is
Setup a new project
Create your Java activity
Create a JNI file to bridge Java to the C++
Create your C++ logic
Setup your Makefiles and Gradle (probably the most annoying part)
I have been wondering if it is possible to use all the functions of opencv in android opencv. I am planning to do my PG project in android Open CV. Because i am familiar with android but not opencv. Is it possible to implement all the functions used in opencv (windows) to Android opencv?
Unfortunately, Java API doesn't provide access to all the functions as in the case of C++ API. First, I will discuss what all the toolkits that are needed for doing so and then how can we use the native(C / C++) in Android.
Toolkits Needed
To develop Android apps using OpenCV Library, we need the following tools (all of these are either Open Source or free software, or both) -
Eclipse with ADT Bundle (You can choose any other IDE like Android Studio)
OpenCV4Android (although, you can compile from source code, it is recommended for novice users to download the binaries.)
CygWin (Only for Windows, not needed on Linux or Mac)
Java JDK (JRE would not be sufficient)
Android Native Development Toolkit (NDK) (needed to run native C/C++ code)
You will need to set environment variables on your OS for the tools to correctly configure.
Alternatively, nVidia also provides a suite of developing tools — TADP. The advantage of TADP over the piece-by-piece method is that you don’t need to follow the often perplexing task of setting up the development environment. The default installation will download a lot of superfluous packages that are not needed (The download size can be greater than 2GB and on slow internet connections, it can turn into a prolonged activity.), rather select the packages manually at the time of download (A dialog box will appear, asking you to select either Complete, Custom or Manually.)
Using C/C++ code in Android
You can get access to native C/ C++ functionality in Android by
Here is the official OpenCV tutorial on setting up .
Also, Check out the Mixed Processing Sample in the Samples folder of Android4OpenCV folder. This example shows how you can pass an image and its grayscale equivalent to a native function and detect features on the image using FAST features detection.
Useful books and tutorials
There is not much study material right now, but I guess these 2 source are the best -
Android Application Programming with OpenCV by Packt
Publishing.
Sample programs in the OpenCV4Android folder.
Yes it is definitely possible to use all funtions in OpneCV on Android. But you have to note that OpenCV4Android includes 2 parts: the Java part and the native part.
In fact the Java part provides most of the functions of the OpenCV library. If you would like to have access to more functionalities and faster speed, then just go for native development. The .so library in the OpenCV SDK pack provides all native functions. In fact if you are familiar with native development, you could even directly use the OpenCV c++ library, just like how people use FFMPEG on android.
I am new to android and opencv,and I am going to develop a APP using this code with this link
here
http://geekoverdose.wordpress.com/category/computer-vision/
The sample project says that "you will have to get the opencv libraries precompiled" in here what I want to do for run this code correctly.please consider about this issue. in here it is wanted to consider about opencv installation for android or is there any special thing have to do? thank you
It will take a little more effort to "run this code" correctly. In short, JavaCV is a wrapper on top of OpenCV, and you have to compile the OpenCV and correctly move all the shared libraries (.so) to your Android development project etc. Like the original article suggested, you need to go to JavaCV homepage and read the installation instructions.
I have a rather simple question. I built the OpenCV library with the help of MacPorts. All the files are in my opt directory as they should be. I'd like to use the libopencv_core.2.2.0.dylib in my Android project in Eclipse. There is a method cvnorm() in that library which I want to use. I'm writing a simple little Android app which will need to use some of the methods from OpenCV. I can't seem to add this library to the project, it says it's invalid file type. Would appreciate any help you could give. Thanks!
There is a special OpenCV trunk for Android. Try this tutorial.
Even it's written for Windows, it worked like a charm in my MacBook Air.