After Android Studio uses OpenCV, the APP can run without installing OpenCV Manager. androidopencv

Source: Internet
Author: User

After Android Studio uses OpenCV, the APP can run without installing OpenCV Manager. androidopencv
Reprinted from http://www.cnblogs.com/tail/p/4618790.html

The static initialization method is used. You can click 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 the JNI part, the simple method is:

1) log out OpenCVLoader. initAsync (OpenCVLoader. OPENCV_VERSION_2_4_3, this, mLoaderCallback); set it to SUCCESS directly on the statement.

public void onResume()    {        super.onResume();        mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);        //OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);    }

2) Add static methods to the Activity class

static{        if(!OpenCVLoader.initDebug()){            //handle initialization error        }    }

If other custom native libraries 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");        }}        

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.