Using OpenCV4Android or running openCV Python-based code? - android

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)

Related

Android Tesseract OCR with NDK (c++)

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."

Android Studio - Advisable Image Processing Library that works well with Android Studio

I feel like there is a necessity to ask this question because of the migration of Android Development from Eclipse to Android Studio. A good number of libraries (e.g. AChartEngine for Graphing in Android, among other graphing libraries for Android) also made their libraries available for Maven Dependencies in addition to the the old .jar file libraries that were used for Eclipse.
However, the situation is not the same for Image Processing Libraries as most of them are still using jars and are a bit of a trouble when you need to import them to Android Studio.
A famous open source library for image processing is OpenCV. I managed to import it to my Android Studio project thanks to some Stack Overflow answers. However, it seems as if statically initializing OpenCV for Android Studio is not that straightforward. Also, the import guide of OpenCV to Android Studio seem to be "outdated" as some of them call to create a folder under your "app" folder in Android Studio but I can't seem to make that. The case simply is that OpenCV requires a lot of work to import to Android Studio. Another issue is that there seems to be a lack of tutorial/guides on how to develop applications using OpenCV in Android.
Another Library I found was AndroidFastImageProcessing. It is another library for Image Processing that is available in Android but I can't import it to Android Studio as I needed Android Support Repository which wasn't available in Android Studio's SDK Manager (I only had the Support Library). And I am once again stunted in my progress as I can't seem to properly import an Image Processing Library Properly.
Now, I may be doing things wrong in importing - so if there's a new and updated way of importing OpenCV to Android Studio, kindly do place that in the answers, I'd be grateful. The same goes for AndroidFastImageProcessing - if there's a way to import it successfully in Android Studio, I'd love to know.
My main question is this: is there an Image Processing Library that can be easily imported to Android Studio? A tutorial/great documentation will merit plus points.
There are many native image processing libs available for android, but problem is lack of examples and tutorials , but you can certainly find many libs:
List of few most used :
1. AndroidJniBitmapOperations
2. javacv
3. Opencv
If u wanna work on NDK
https://github.com/julienr/libpng-android
by far best is JAVACV - a java wapper for native opancv, this is growing well and with few useful tutorials and bunch of documentation you can start image processing like me in javacv ;)
https://github.com/bytedeco/javacv

Difference Between opencv and Android opencv

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.

opencv libraries precompiled for javacv opencv android project

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.

Porting a C/C++ program into Android

I am attempting to put my C++ program onto an Android phone but have run into several problems with the library linking. It seems most of the useful information I find on this topic through google is outdated (motz) or simply does not account for the complexity of my program. I have been able to run simple C programs but fail when attempting to use libraries outside of Android's Bionic/libc.
So my questions are:
Is it possible to port pre-existing *.so libraries onto Android? If so, how could I do this without seg faulting?
Should I be using the CodeSourcery compiler (arm-none-linux-gnueabi-*)?
How can I work around the lack of a seperate pthread library?
Please help me out! Thanks.
-Scott
You can't use pre-existing *.so files because they need to be compiled for Android. In order to create an *.so for Android you need to use their NDK, which is already set up to build the correct format so you don't need to worry about arm-none-linux-gnueabi or anything. If you want to use a library that isn't available on Android you'll need to build it yourself using the NDK. I had to do this with the STL.
Please refer to the following :
Can i use the native libraries (installed in android stack) in my NDK application?
This should answer you some queries...

Categories

Resources