OpenCV on Android Using Eclipse - android

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.

Related

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

Add android eclipse library to unity3d project

I have an android library in the form of an eclipse project that I want to integrate with unity3d. I know I can make a jar from eclipse and drop it in unity's plugins/android folder. However as I understand it that necessarily strips out the resources from the project.
If I export the unity game to an eclipse project, I can right-click and add the android project as a library. However I don't like this approach because it doesn't fit with our current automation process - which basically just script's unity's build dialog.
I'd like a way to tell unity that I want this eclipse project linked as an android library on export. Does anyone know a way to do that, or how to pack the resources into the jar or another way of getting this stuff to talk?
One possible way to go is using Unity's Build Player Pipeline. Depending on the platform you are working on you then have to set up a shell script or do your stuff in C#.
It's some year ago that I were a Java/Eclipse expert as I am working on iOS now. The Android Developers page shows some way to manipulate projects via command line.
Maybe the better way to go is using Eclipse switches like --import (s. 1st answer in Create an Eclipse project on the command line? and the link provided) but on the other hand I can't find the switch in the help pages.
Well, not really a bounty answer but maybe some inspiration :-)
The only real answer I've found is that in 4.2, you can drop an eclipse project in plugins/android and it will be linked correctly. Just have to hang on I suppose. :-/

Android AOSP project import into eclipse

So, this is not like other problems. I have basically one question
Android project build system uses the Android.mk files.
Is there any eclipse plugin out there that parses through the mk files and allows me to load those projects into eclipse ? essentially import Android.mk file project...
You can import the whole Android sources into eclipse. The instructions are here. Then you should make some modifications (for instance, include android-common_intermediates/javalib.jar instead of google-common_intermediates/javalib.jar) and you will have possibility to develop in eclipse.
Eclipse separates Android sources to several projects by itself(I think according to classpath entries). If you want to change this behavior you should look in this direction.
If you have tried eclipse instructions at Android source site, you probably would know by now that it leaves lot of details to imagination.
One thing you need to keep in mind is that AOSP build doesn't work with eclipse. As long as you build your code from terminal and use eclipse to edit/browse/debug purposes, you will have more productive sessions.
The article at Using Eclipse to browse/edit Android platform code explains this in step by step.

Importing OpenCV in Android Eclipse Project

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.

Android NDK with Visual Studio

I'd like to build some native libraries for android using the NDK (native development kit), but i'd like to use Visual Studio 2010 to do it. I've googled quite a bit but haven't found any information on it. Does anyone have any experience with this and know the steps necessary to make this happen? I have CYGWin installed, made sure i get Make (per the NDK instructions), but i'm not really sure of the next steps in terms of setting up the project, compiler in visual studio, etc.
If anyone knows of any write-ups, tutorials, or links to sample projects, that would be awesome, as there isn't much on google yet.
thanks!
Here's another solution, which integrates the NDK fully within Visual Studio. No makefiles. It behaves like a proper Win32 project:
Here's an excellent blog post about how you can configure your environment to debug android NDK code using Visual Studio.
Visual Studio is officially not supported.
Some problems (but not limited to):
MSVS cannot create the proper ARM binaries
Android makefiles (.mk) are not supported by MSVS
There are however, third party solutions:
vs-android
VisualGDB
You might want to check out DS-5 as well, though it's not Visual Studio.
The answer depends on what kind of integration you require.
To just build the native Android code from Visual Studio you can create a new Makefile project, and make it run ndk-build.cmd when you press "build". If you would like to get the error messages mapped as well, you will need to parse the output of ndk-build.cmd and convert it to a format that Visual Studio can udnerstand.
If you want to debug your native Android code from Visual Studio, you will need a third party tool that will control ndk-gdb on behalf of Visual Studio and provide workarounds for several bugs (e.g. rebind breakpoints when libraries are loaded).
You can try our VisualGDB for Android tool that does exactly that - creates projects that wrap ndk-build and controls NDK debugger on behalf of Visual Studio. If you need more information, there is a step-by-step tutorial available.
I have not found a direct clean solution, here is my workaround.
I develop my native code on VS as a static library, and use some test project to try it as a console aplication.
When it is ok, from cygwin I use a little bash script that copies all needed files to the jni folder and launch the standard android ndk make command. (also copy some file to assets folder when needed), producing the executable in the right folder.
To use the pthreads I have linked my projects to pthreads-win32.
The only files I do not compile in VS are the jni code.
I hope this can help you.
There's also a couple of other third party alternatives for developing ANdroid apps with VS in addition to those above. There is the open source dot42 located at http://www.dot42.com and Remobjects, http://www.remobjects.com , which allows you to program in c#, Pascal, and Swift. I have played with the trial of Remobjects and am now starting to play around with dot42.
My use of the remobjects trial allowed me to recreate in c# the first five chapter projects in the textbook of the Android course I took. I haven't had the same success with dot42 so far but I need to find some time to really give it a chance.

Categories

Resources