Ask Your Question

OpenCV for Android: development on Android device

asked 2012-11-09 09:51:51 -0500

rics gravatar image

updated 2012-12-21 07:08:21 -0500

I know from previous experience that starting Android OpenCV development is relatively complex including the installation and configuration of several tools.

I was wondering if it is possible to develop OpenCV Android applications on an Android device itself (with a sufficient screen size and possibly a keyboard). There are development environments for Android like AIDE, there is OpenCV Manager so at first sight it does not seem impossible.

If it is possible please tell me how. If not then is it a planned future direction?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-12-28 07:39:58 -0500

rics gravatar image

updated 2013-02-12 03:33:24 -0500

Yes, it is possible. I could build and run applications both with and without native parts. I have slightly modified two of my already working Eclipse-based sample applications and successfully built them in AIDE.

Surprisingly the native case was easier. As AIDE is compatible with Eclipse projects I have just synced the native application from my Dropbox and after rebuilding everything was working fine.

In the case of non-native part the opencv-2.3.1.jar (the version what I use) and the libraries were not in the synced project so AIDE could not find the OpenCV functions. Copying the jar to libs and extending the classpath with this jar was enough to compile without problem. (However it creates error in the laptop in Eclipse because of the duplicate reference but that is another issue.) The make the project run it is important to add all the native libraries to libs/<target_arch> directory as the static initialization description suggests (step 3). After that the non-native project was working fine as well.

As it is clear from static initialization I have not used OpenCV Manager so far.


Similar solution applies to async initialization when OpenCV Manager is used to access OpenCV libraries externally installed in the target system.

As a first step I installed the OpenCV Manager and the appropriate OpenCV library for my tablet. (It is just some Google Play clicks.) Using a correctly installed OpenCV-2.4.3 on my desktop first I made a copy of both java and native samples in my Dropbox. Then I configured them to work with Eclipse as it is described in the above document and I tested the deploy on my tablet. To get the source on the tablet I copied the test projects with AIDE's "Sync with Dropbox" feature. I created the libs directory in the project root (as above with opencv-2.3.1) and then copied the <OpenCV->/sdk/java/bin/java.jar into it.


I could successfully build tutorial-2, tutorial-3, color-blob-detection, and face-detection in AIDE and run all of them.

A disadvantage of the native version is that the native source cannot be build from AIDE. May be a C++ compiler for Android can help although I have not tried it.

edit flag offensive delete link more

Question Tools


Asked: 2012-11-09 09:51:51 -0500

Seen: 3,011 times

Last updated: Feb 12 '13