2

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.

Prashant Singh
  • 3,725
  • 12
  • 62
  • 106
  • What is 'real time mobile' and who is asking for the openCV library? Is Eclipse asking for the openCV library and you are not adding it (as shown in the sample app in the tutorial). – Morrison Chang Sep 09 '12 at 04:51
  • 1
    Sorry, I meant , I checked it on an actual Android device. The device is asking – Prashant Singh Sep 09 '12 at 04:55
  • Try this: It is made for Android novices and has lots of screenshots: http://stackoverflow.com/a/35135495/5611377 – ssimm May 14 '16 at 12:18

2 Answers2

3

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.

Infinity
  • 3,695
  • 2
  • 27
  • 35
1

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.

Morrison Chang
  • 11,691
  • 3
  • 41
  • 77