如何整合OpenCV的经理Android应用程序 [英] How to integrate OpenCV Manager in Android App

查看:189
本文介绍了如何整合OpenCV的经理Android应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的 OpenCV2.4.7库在我的 Android应用。当应用程序启动其进入谷歌Play商店作为器件的应用叫做 OpenCV的经理。是他们没有办法这个应用程序在我的Andr​​oid APK,因为我们已经使用了OpenCV库,为什么应用程序需要OpenCV的引擎再次整合?的是他们没有办法这款发动机集成。

I am using OpenCV2.4.7 Library in my Android app. When app starts its goes to Google Play store for Appication called OpenCV Manager. Is their any way to integrate this application in my Android apk because we already using OpenCV library so why app needs OpenCV Engine again? is their any way to integrate this engine.

推荐答案

是的。要集成OpenCV的应用程序里面,避免明确的安装OpenCV的经理,你需要先阅读下面的OpenCV中所提供的文档。

Yes. To integrate OpenCV inside your application, and avoid explicit installation of OpenCV manager, you need to first read following document provided by OpenCV.

首先阅读 - > <一个href="http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html#application-development-with-static-initialization"相对=nofollow>的OpenCV的静态初始化

First Read -> Static Initialization of OpenCV

在成功地遵循步骤,你需要编写以下code调用OpenCV的API之前,以使OpenCV的在你的应用程序初始化code。这是可以做到,例如,在活动类的静态部分:

After successfully followed steps, you need to write following code to enable OpenCV in your application initialization code before calling OpenCV API. It can be done, for example, in the static section of the Activity class:

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

参考文献:

  1. http://answers.opencv.org/question/2033/use-opencv-on-android-without-manager/
  2. 静态初始化上的OpenCV的Andr​​oid
  1. http://answers.opencv.org/question/2033/use-opencv-on-android-without-manager/
  2. Static Initialization on OpenCV Android

根据新方案的文件,并感谢@rozhok提供新的信息, initDebug()方法不能用于生产建设

Edit

As per new scenario in Document and thanks to @rozhok for providing new information, initDebug() method can't be used for production build

请注意此方法是pcated生产code德$ P $。它是专为只实验和地方发展的目的。如果你想要发布与异步初始化您的应用程序的使用方法。

Note This method is deprecated for production code. It is designed for experimental and local development purposes only. If you want to publish your app use approach with async initialization.

您需要使用下面的方法为

You need to use following method for that

语法

Syntax

static boolean initAsync(String Version, Context AppContext, LoaderCallbackInterface Callback)

示例

Example

public class Sample1Java extends Activity implements CvCameraViewListener {

    private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
        @Override
        public void onManagerConnected(int status) {
            switch (status) {
                case LoaderCallbackInterface.SUCCESS:
                {
                    Log.i(TAG, "OpenCV loaded successfully");
                    mOpenCvCameraView.enableView();
                } break;
                default:
                {
                    super.onManagerConnected(status);
                } break;
            }
        }
    };

    @Override
    public void onResume()
    {
        super.onResume();
        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback);
    }

    ...
}

引用

  1. <一个href="http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html" rel="nofollow">http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html

这篇关于如何整合OpenCV的经理Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆