Go to Opencvmanager method, can refer to this blog http://blog.csdn.net/yanzi1225627/article/details/27863615, can use, very good. I'm just doing a summary here, mark for myself.
In addition, refer to these two blog posts, can realize http://m.blog.csdn.net/blog/formcc_tjsd/25707775,http://m.blog.csdn.net/blog/wunghao8/38870047
First you have to import the OpenCV SDK
1. Import the OpenCV Library project file into your project directory.
I use this: OpenCV SDK path (OPENCV-2.4.8.2-TEGRA-SDK/SDK)
2. Refer to the Opencv4android SDK in your project
Two methods:
A. Directly import OpenCV jar package, use build Path->add library mode; (This method does not need to step 1)
B. Another way is to add android.library.reference.1= to the Project.Properties file. /.. /opencv-2.4.8.2-tegra-sdk/sdk/java (combined with step 1, direct reference)
3, the JNI partial modification
Add to Android.mk File: (critical section)
Include $ (clear_vars)
Opencv_camera_modules: = Off
Opencv_install_modules: = On
Opencv_lib_type: = SHARED
Include/home/ubuntu/nvpack/opencv-2.4.8.2-tegra-sdk/sdk/native/jni/opencv.mk
APPLICATION.MK files are the same as usual, as shown below
App_abi: = armeabi-v7a
App_platform: = android-19
App_stl: = gnustl_static
4, remove OpenCV dependence, if there are the following parts, should be removed
Private Baseloadercallback Mloadercallback = new Baseloadercallback (this) {
@Override
//.......
}
Opencvloader.initasync (Opencvloader.opencv_version_2_4_9, this, mloadercallback);
5. Add library (Key section)
static {
if (! Opencvloader.initdebug ()) {
LOG.I (TAG, "Opencvloader.initdebug () failed");
}else{
System.loadlibrary ("Opencv_java"); OpenCV's Library
System.loadlibrary ("Imageprocesslib"); Own Jin Compiled library
}
}
6. Compile and run
Go to Opencvmanager, most for reprint, only when you learn to use