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

目前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


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值