I want to work on an Android project (under Eclipse) using Opencv, I've imported the Opencv library and it's associated samples to Eclipse, as explained here:
http://opencv.itseez.com/doc/tutorials/introduction/android_binary_package/android_binary_package.html.
I tested the samples and they work well. But when I create my new own Android project in Eclipse, it can't link Opencv which is placed in the same workspace as the project (i.e. error when I write import org.opencv.core.*).
Is there something that has to be done for a new project to be linked with Opencv (src and lib)?
I recomend you to download the OpenCV prebuild package and follow these instructions.
I don't know if you are going to use C++ for openCV and crosscompile with NDK and JNI library, but that way is quite easy to set up everything. If you need more help about how including C++ OpenCV codes in android projects I can check my codes. Good luck.
It sounds like you haven’t included the Open CV library’s in your new project.
I can’t remember the exact step to include libraries in projects but below are a couple of link that might help.
http://wiki.eclipse.org/FAQ_How_do_I_add_an_extra_library_to_my_project's_classpath%3F
Import Libraries in Eclipse?
Related
I have looked at Use prebuilt JNI library in Android Studio 3.1 and How to use .so in a second project in Android?. The first is trying to get a library file without headers working and the other seems to be focusing on a specific issue with his build (although there's some useful information there). I'm relatively new to app development and especially to native development on android. I've gotten a build with the JNI library and some c++ code working, but that seems to be just for building from source.
It's probably a simple answer, but I haven't been able to find documentation on this specifically in the android developers documentation. I'm interested in understanding the correct (or most conventional) place to put and way to use a precompiled library (module/lib/*.so and module/include/*.h) in an android project. Would I even need to use JNI or the NDK if the library is built with another build tool? Another project I have has a native library source object (*.so) in ./obj/local, ./libs, and in many other folders related to JNI. I'm guessing it would be somewhere in there, but I'd like to know what is conventional.
For some context, I'm trying to work with the essentia library. I have followed the guide on compiling for Android and have a build with the general hierarchy mentioned above (essentia/lib and essentia/include) that seems to be working.
so, I m a bit confused here. I have an opencv project which import an image and does something with it and gives output.So I want to use this project as one part in my android project.So how do I proceed. I have SDK, NDK openCV lib all installed. Any help would be great.
Compile your project with NDK as a static library.
Create a shared library with JNI entry point that takes the necessary inputs from Java and return the result to Java. Link it with your static lib and OpenCV.
Create a Java Android project that uses this shared library.
I am trying to get the OpenCV library working with android. I imported this library project into eclipse and made a new android project (the one I will develop) and just. I set the build path to include the OpenCV project in eclipse. However, when I run my new project, it says
[2014-10-13 19:41:57 - OpenCV Library - 2.4.10] Could not find OpenCV Library - 2.4.10.apk!
From what I understand, my new project should automatically pull in the library project and install it. I am wondering if I am missing any steps (because it doesn't seem to be pulling in the project)? Does it have to be the same target sdk? I am quite sure I followed all of the OpenCV installation guide and have no compile errors in the projects. Also if I load up the sample projects by directly installing the apks they seem to work fine. I even tried it with the OpenCV Manager app already installed but that didn't work either. Thanks for any help.
Just add the OpenCV library project as shown below, the problem will go.
Project -> Properties -> Android
and press OK.
You should check "Library" build option in Eclipse for OpenCV android project.(Not your project)
Clean your OpenCV library,build it again and check in OpenCv library->bin->opencv library -X.X.XX.jar if there is a file (X==> VERSION)(see picture).See this for .jar file. If this file does not exist then your library is not generated then check the video it might help This should help if your library is not built.
My personal experience:I wasn't able to generate the jar file for some reasons using OpenCv2.4.10 .If the same happens to you consider using OPENCVTEGRA library it works at least for me.
Answering 1st time. Hope this helps
I am new in android. I see a lot of android libraries out there like github.com but when I download them none of them are a *.jar file like this one:
NumberProgressBar
It seems that all these libraries are for android studio NOT eclipse (Am I correct? This is important).
My question is: How do I use these libraries in eclipse?
I tried to import the downloaded library as an android project and then mark it as "is library" and then add to my project, but that did not work.
That library is designed to be built with Gradle for Android (with or without Android Studio), producing an AAR.
Eclipse does not have native AAR support. I have published a recipe and a Ruby script to convert an AAR into a library project that Eclipse can use, though I have not tested it much.
Or, you can download the source code and attempt to reorganize it into an Eclipse-style library project.
I just downloaded it and add it as library project and everything looks fine. How do you do it, it's extremely simple. Let us know in which step you have a problem so we can figure out what is wrong.
You have to build the library first.
For your example, read the Readme file, section 'Build'.
I have developed an application for computer vision algorithms that uses Native C++ library like OpenCV to capture camera frame and do image processing. My whole implementation resides in a native function which is called through an activity.
Let's say:
public native int MYMETHOD(int width, int height,int[] rgba);
I also load my library like this:
static {
System.loadLibrary("MYNativeLIB");
}
Now my question is how can I deploy my application as a library package. Something deliverable that I can share it and the clients can import it to their project without installing any other libraries like OpenCV. Do I need to build a .so package?
I have read this article. But I do not know how can I link against OpenCV library as well.
Thanks for your help in advance.
You should have a look at the static initialization for OpenCV4andorid. You then can add the Open CV lib into your /libs directory of your Library project without the need to install any third party app when using it.
Have you created your project as a library? Maybe you could create a new project and port code with little effort. A very concise yet detailed explanation here:.
http://developer.android.com/tools/projects/projects-eclipse.html#SettingUpLibraryProject
First you need to compile c/c++ files using android-ndk detailed
explanation here
http://rathodpratik.wordpress.com/2013/03/24/build-cc-executables-for-android-using-ndk/
Then you can successfully run your android project.