OpenCV示范程序在Android6.0中运行出错(使用Android Studio)

    xiaoxiao2025-10-20  2

    目前OpenCV在Android6.0遇到两个问题:(我用的是OpenCV2.4.9)

    1、直接无法运行

    2、找不到OpenCV Manager

    第一个通常错误在于,出现三行可以追溯的OpenCV代码位置,点击第一个类AsyncServiceHelper

    找到方法 initOpenCV

    改为:

    public static boolean initOpenCV(String Version, final Context AppContext, final LoaderCallbackInterface Callback) { AsyncServiceHelper helper = new AsyncServiceHelper(Version, AppContext, Callback); Intent intent = new Intent("org.opencv.engine.BIND"); intent.setPackage("org.opencv.engine"); if (AppContext.bindService(intent, helper.mServiceConnection, Context.BIND_AUTO_CREATE)) { return true; } // if (AppContext.bindService(new Intent("org.opencv.engine.BIND"), // helper.mServiceConnection, Context.BIND_AUTO_CREATE)) // { // return true; // } else { AppContext.unbindService(helper.mServiceConnection); InstallService(AppContext, Callback); return false; } } 即可(注释部分为源代码),然后就可以运行了。

    问题2

    测试在Android5.0.1可以正常运行,而在Android5.1.1和Android6.0都无法运行(找不到Android Manager,让你下载,然而下载后没用,还在寻找解决方案中,有知道的小伙伴告诉我一声哈)

    在以下链接可以知道更多问题1的解决方案:

    http://stackoverflow.com/questions/28909811/issue-with-opencv-for-android-on-android-5-0-lollipop

    OpenCV Manager链接:http://docs.opencv.org/2.4.11/platforms/android/service/doc/index.html

    OpenCV4Android SDK链接:http://docs.opencv.org/2.4/doc/tutorials/introduction/android_binary_package/O4A_SDK.html#what-s-next

    转载请注明原文地址: https://ju.6miu.com/read-1303352.html
    最新回复(0)