I\'m developing an android app that uses opencv libraries which is opencv manager app. It requires opencv manager to be installed previously, I want to integrate the opencv
1 - Add the OpenCV library project to your workspace ( Use menu File -> Import -> Existing project in your workspace.)
2 - In application project add a reference to the OpenCV Java SDK in Project -> Properties -> Android -> Library -> Add select OpenCV Library - 2.4.8.
3 - Add a folder and name it "jni"
4 - Add an Android.mk file into jni folder. Its body should look like below:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# OpenCV
OPENCV_CAMERA_MODULES:=on
OPENCV_INSTALL_MODULES:=on
OPENCV_LIB_TYPE:=STATIC
include ../../sdk/native/jni/OpenCV.mk
5 - Add an Application.mk file into jni folder. Its body should look like below:
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi-v7a
APP_PLATFORM := android-9
6 - Add this to your Activity
static {
if (!OpenCVLoader.initDebug()) {
// Handle initialization error
}
}
7 - In case you have added following code to your Activity, comment out OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_8, this, mLoaderCallback); You don't need to load OpenCV on resume event any more.
@Override
public void onResume() {
super.onResume();
//OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_8, this, mLoaderCallback);
}
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
//OpenCV loaded successfully
break;
default:
super.onManagerConnected(status);
break;
}
}
};
Have a look at this too: http://docs.opencv.org/trunk/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html#application-development-with-static-initialization
Got another solution by installing open Cv from my app by using this lib AutoInstaller