Using static initialization method, you can stamp the link below to view the official document introduction
http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html# Application-development-with-static-initialization
If the project does not contain a JNI part, the simpler approach is:
1) write Off Opencvloader.initasync (Opencvloader.opencv_version_2_4_3, this, mloadercallback); Set the top of the statement directly to success.
public void Onresume () { super.onresume (); Mloadercallback.onmanagerconnected (loadercallbackinterface.success); Opencvloader.initasync (Opencvloader.opencv_version_2_4_3, this, mloadercallback); }
2) Adding a static method to the Activity class
static{ if (! Opencvloader.initdebug ()) { //handle initialization error } }
If there are other custom native libraries that need to be loaded, you can add the Else statement here:
static{ if (! Opencvloader.initdebug ()) { //handle initialization error }else{ system.loadlibrary ("my_jni_lib1"); System.loadlibrary ("My_jni_lib2");} }
Android Studio uses OPENCV to run the app without installing OPENCV Manager