Android Studio uses OPENCV to run the app without installing OPENCV Manager

Source: Internet
Author: User

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

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.