问题OpenCV的Andr​​oid版在Android 5.0(棒棒糖)棒棒糖、问题、OpenCV、oid

2023-09-14 00:01:02 作者:〆仰望丶放肆的幸福

首先,没有OpenCV的样品在Nexus 6的Andr​​oid 5.0的工作。之后OpenCV的管理器的安装提示,我得到一个屏幕,说:没有找到,请重试。我后来安装的Andr​​oid工作室和进口OpenCV的模块,并写道,初始化OpenCV的一个基本程序。该应用程序崩溃扔在这篇文章中提到的错误:OpenCV服务意向一定要明确,安卓5.0棒棒糖。以下的建议后,我能得到一个提示下载OpenCV的经理,并成功安装OpenCV的经理。但是,当我返回到应用程序,我认为它未能获得库路径。 logcat中显示这些消息repeatedly-

First of all, none of the OpenCV samples work on Nexus 6 Android 5.0. After the OpenCV manager installation prompt, I get a screen that says 'Item not found, retry'. I later setup android studio and imported opencv module and wrote a basic program that initializes OpenCV. The app crashes throwing an error mentioned in this post : OpenCV Service Intent must be explicit, Android 5.0 Lolipop . After following the suggestions, I was able to get a prompt for downloading OpenCV manager and successfully installed OpenCV manager. But when I return to the application, I see that it fails to get library path. logcat shows these messages repeatedly-

 W/ContextImpl﹕ Implicit intents with startService are not safe: Intent { act=org.opencv.engine.BIND } android.content.ContextWrapper.bindService:538 org.opencv.android.AsyncServiceHelper.initOpenCV:24 org.opencv.android.OpenCVLoader.initAsync:44
 D/OpenCVManager/Helper﹕ Service connection created
 D/OpenCVManager/Helper﹕ Trying to get library path
 W/ContextImpl﹕ Implicit intents with startService are not safe: Intent { act=org.opencv.engine.BIND } android.content.ContextWrapper.bindService:538 org.opencv.android.AsyncServiceHelper.initOpenCV:24 org.opencv.android.OpenCVLoader.initAsync:44
 D/OpenCVManager/Helper﹕ Service connection created
 D/OpenCVManager/Helper﹕ Trying to get library path

我如何克服这个问题,并开始工作的OpenCV为Android上的棒棒糖?

How do I get over this issue and start working on OpenCV for Android on Lollipop?

推荐答案

我看到的最好的解决方法是更新的OpenCV的 AsyncServiceHelper 通过自己,而他们没有犯官方补丁。

The best workaround I saw is to update the OpenCV's AsyncServiceHelper by yourself while they don't commit a official fix.

您只需要添加一行。这是非常简单的。

You just have to add one line. It's very simple.

查找initOpenCV功能,并改变它是这样的:

Look for initOpenCV function and change it to be like that:

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;
    } else {
        AppContext.unbindService(helper.mServiceConnection);
        InstallService(AppContext, Callback);
        return false;
    }
}

希望能有所帮助。

Hope to help.

 
精彩推荐
图片推荐