Setting Up Android with OpenCV [duplicate] - android

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
OpenCV on Android Using Eclipse
What is a good site that explains how to configure the Android SDK to build Android apps with OpenCV?

I set up an Android app with OpenCV yesterday.
There are two ways to go about it
Use OpenCV for Android
Use JavaCV
OpenCV for Android is more fully supported than JavaCV. Follow Google's instructions to install Eclipse, the Android SDK and NDK (don't forget the NDK! It is needed to run C++ code. Your apps will mysteriously crash without it). Afterwards, follow this tutorial to install openCV. Try out the sample applications.
Alternatively, you can try using JavaCV instead of OpenCV for Android. This means you won't need to setup the Android NDK. It also means you won't need to write any C++. I didn't try this. But I suspect it is easier. The downside is: it doesn't support everything OpenCV does.

Related

How to add javafx classes in an android project with Android Native classes in Android Studio?(Android Native Feature/views + some javafx class/views)

Hey guys I have read almost all of the questions & answers on how to use jfxmobile, or Gluon to wrap a javafx project with gradle and to run them also on an android device. Also I know that one could use Intellij IDEA for instance have a project that is based on javafx and also handle some android classes/methods using FXActivity.getInstance(). But I have an android app in android studio with many android native code, and now I want to add some other code that relates to my application but is in javafx and I want to add them as a separate feature on my android application (not a sepparate app per say); just add them in addition to other features that were developed before using android native code in android studio. The question that I have is that how could I join those javafx apps to as a different feature in my application? I have seen Kokos sample for javafxports, but there are some issues with the Android Manifest File for now and I can't run it also it is a project of almost 5 years ago and I am not sure if the same procedures apply today with many updates. I just want to know how hard it is to do as I wish (and mentioned above)? and is it doable or there might be many issues on the way and I am better off to code for about three months of worth development with android libraries? *Time is really important in this project.

Using OpenCV4Android or running openCV Python-based code?

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)

Android NDK in Android Studio [duplicate]

This question already has answers here:
How to configure NDK with Android Gradle plugin 0.7
(5 answers)
Android studio, gradle and NDK
(23 answers)
Closed 8 years ago.
Im trying to integrate lame lib in my application in order to record audio in mp3 format.
Today android don't support mp3 encoding natively however with some digging i have found that i can use lame lib but the problem is , lame lib is in c code.
after more reading i found out the only way to make it work correctly is to use the c code into my project compile it as a library useing NDK through JNI or something like that.
My problem is that i don't really understand all this NDK and JNI and most importantly i don't know how to run native code with ANDROID STUDIO! I when to this page and read a bit about it but still they don't mention there how to do it in android studio. i am really confuse here.
My questions are:
-Please how can I integrate NDK with ANDROID studio (as far as i have read some are more lucky because its easier with Eclipse which i dont use)
-Is there any other way to use or to import the lameLib into my project without NDK?
Thank you
There are two steps you need to take
1: Create the JNI wrappers
You should read about JNI. It's complicated. The best way to generate wrappers for a large project is to use Swig to auto generate them. I recommend following the swig android tutorial to learn swig. http://www.swig.org/Doc2.0/Android.html
2: Run ndk-build automatically in Android Studio
See my answer to another question for detailed instructions on how to set up ndk with Android Studio.

how to use tesseract OCR for windows XP for eclipse?

I am trying to develop my first OCR app using tesseract. I'm developing under Windows XP using Eclipse and targeting Android 2.1+
do i need cygwin?
do i need the android ndk?
--->Through vast research and consultation, I realize that you dont need cygwin or ndk either. But still, the code and procedure on Gautams blog gives error. I tried building the app and ended but with an application package file that does nothing but force closes when I press the "OCR!" button on the app. Any idea??
No, you do not need Cygwin.
Yes, you need to have the Android NDK installed.
Gautam's tutorial is the best tutorial for using Tesseract OCR on Android.

OpenCV on Android Using Eclipse

I'm having a hell of a time importing OpenCV into my Android project. I've already tried this tutorial:
http://opencv.itseez.com/doc/tutorials/introduction/android_binary_package/android_binary_package.html
and it did not work because Eclipse would not recognize the existing projects in the directory. So after much searching I came across this trunk:
https://code.ros.org/svn/opencv/trunk/opencv/
and was able to import it into my workspace in Eclipse. Eclipse now recognizes the sample projects, but now the problem is that there are no OpenCV library files. So all the calls to import different classes result in errors. Shouldn't there be a opencv.jar somewhere? I've seen various posts that mention having to build the library but unfortunately I don't have the slightest clue how to do that. I need something with step by step instructions. I'm running Windows 7 64-bit.
Thanks!
You should download the latest OpenCV 4 Android here:
http://opencv.org/downloads.html
And read these tutorials to get you started (in this order roughly):
Introduction into Android Development
OpenCV4Android SDK
Android Development with OpenCV
OpenCV4Android Reference
If you want to use OPEN CV in your android apps, for example if you need to read some strings from an image in your android and you are new in using OPEN CV. Then download the pre-built OpenCV library for Android from here:
http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.3/
After downloading, import OpenCV-2.3.1 into Eclipse using File-->Import...-->General-->Existing Project Into Workspace.
In your project's properties, Under Android, add the OpenCV2.3.1 library (press Add.. on the right and select OpenCV2.3.1).
Good luck!
You might want to take a look at this project: https://github.com/billmccord/OpenCV-Android
I was able to run opencv applications on my android phone with the help of this port.
installed the Win-superpack?
I recommend getting the latest .tar, extract and use it. Worked for me.
I posted about this on a duplicate question. Make sure you have the android NDK installed! Or, consider using JavaCV instead. It is much easier to install.

Categories

Resources