Prashant Singh
Prashant Singh

Reputation: 3793

OpenCV support on Android

I have to do some object detection project on Android. So, I need to use openCV for that. However, to begin with, I wish to start with a "Hello World" kind of program in openCV on Android. For this, I followed the tutorial here. The sample code along with the openCV zip file works fine on Eclipse. However, when trying the same on an Android device, it asks for openCV library. Clearly, this is very hectic for any user. He wishes to have everything at a place.

Message from the device "OpenCV Manager Package was not found! Try to install it ?"

So, is there any way to include the openCV library also in my .apk file of my applications, so that everything works perfectly as soon as user installs my application. Since, I am new to Android, the question may seem vague to you. So, please comment, if I am unclear in asking the question.

Upvotes: 2

Views: 1496

Answers (2)

Infinity
Infinity

Reputation: 3875

As of now, you have to use Static Initialization. There is a tutorial about that on this page

http://docs.opencv.org/trunk/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html#application-development-with-static-initialization

Source: https://groups.google.com/forum/#!msg/android-opencv/dHfQsYTXovs/XnW_-8t53dIJ

The installation/initialization process will be improved in future.

Upvotes: 3

Morrison Chang
Morrison Chang

Reputation: 12121

You have two choices:

  1. Application Development with Static Initialization. That is listed at the bottom of the tutorial page. If you are modifying the OpenCV code base or need low level performance you'll have to learn about the Android NDK and JNI. The tutorial for using C++ and OpenCV follows on the next page: Using C++ OpenCV code with Android binary package.

  2. Use the OpenCV Manager app. There is a post in the OpenCV group: OpenCV 2.4.2 is out! which explains their decision to go the separate APK route. I thought the slide deck: Open CV Android Manager explained it well. Short version, make it a common library so that every app doesn't have the exact same code, also avoid the app having a ARM, x86, MIPS copy of OpenCV, and update OpenCV once for all apps when there is new code.

Upvotes: 1

Related Questions