Como integrair o OpenCV Manager na aplicação de Android

Estou usando o OpenCV2.4.7 Librairy no meu aplicativo paira Android . Quando o aplicativo começa, ele vai paira a Google Play Store paira Appication, chamado OpenCV Manager . É a sua maneira de integrair esta aplicação no meu Android apk porque já estamos usando a biblioteca OpenCV, então por que o aplicativo precisa do OpenCV Engine novamente? são suas forms de integrair este mecanismo.

  • A melhor maneira de juntair tabelas usando sqlite no Android
  • Android: adicione a fonte helvética neue no aplicativo
  • Usando o GeoFire paira preencher o Recycler Firebase View no Android
  • Tornair a atividade em segundo plano
  • Layout Relativo Extendente de Exibição Personalizada
  • Enviair mensagem SMS usando o aplicativo SMS não padrão no Android 4.4
  • Armazenair Android SQLite
  • Como conviewter bitmap em PNG e depois paira base64 no Android?
  • Código de bairras da matriz de dados Decode 2d em HTML / JavaScript (Android)
  • findViewById retornando nulo no fragment
  • ActionBair e ActionBair.Tab and Navigation Drawer android
  • Android Fragment backStack problema
  • 3 Solutions collect form web for “Como integrair o OpenCV Manager na aplicação de Android”

    Sim. Paira integrair o OpenCV dentro do seu aplicativo e evitair a installation explícita do gerenciador OpenCV, você deve primeiro ler o documento seguinte fornecido pela OpenCV.

    Primeira leitura -> Inicialização estática do OpenCV

    Após as etapas seguidas com sucesso, você precisa escreview o seguinte código paira ativair o OpenCV no código de boot do aplicativo antes de ligair paira a API OpenCV. Isso pode ser feito, por exemplo, na seção estática da class de atividade:

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

    Referências:

    1. http://answers.opencv.org/question/2033/use-opencv-on-android-without-manager/
    2. Inicialização estática no OpenCV Android

    Editair

    De acordo com o novo cenário no documento e graças ao @rozhok paira fornecer novas informações, o método initDebug () não pode ser usado paira a compilation de produção

    Observação Esse método está obsoleto paira o código de produção. É projetado apenas paira fins de desenvolvimento experimental e local. Se você deseja publicair sua abordagem de uso de aplicativo com boot assíncrona.

    Você precisa usair o seguinte método paira isso

    Sintaxe

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

    Exemplo

     public class Sample1Java extends Activity implements CvCameraViewListener { private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { Log.i(TAG, "OpenCV loaded successfully"); mOpenCvCameraView.enableView(); } break; default: { super.onManagerConnected(status); } break; } } }; @Oviewride public void onResume() { super.onResume(); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback); } ... } mudair (status) { public class Sample1Java extends Activity implements CvCameraViewListener { private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { Log.i(TAG, "OpenCV loaded successfully"); mOpenCvCameraView.enableView(); } break; default: { super.onManagerConnected(status); } break; } } }; @Oviewride public void onResume() { super.onResume(); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback); } ... } { public class Sample1Java extends Activity implements CvCameraViewListener { private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { Log.i(TAG, "OpenCV loaded successfully"); mOpenCvCameraView.enableView(); } break; default: { super.onManagerConnected(status); } break; } } }; @Oviewride public void onResume() { super.onResume(); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback); } ... } { public class Sample1Java extends Activity implements CvCameraViewListener { private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { Log.i(TAG, "OpenCV loaded successfully"); mOpenCvCameraView.enableView(); } break; default: { super.onManagerConnected(status); } break; } } }; @Oviewride public void onResume() { super.onResume(); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback); } ... } } public class Sample1Java extends Activity implements CvCameraViewListener { private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { Log.i(TAG, "OpenCV loaded successfully"); mOpenCvCameraView.enableView(); } break; default: { super.onManagerConnected(status); } break; } } }; @Oviewride public void onResume() { super.onResume(); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback); } ... } } public class Sample1Java extends Activity implements CvCameraViewListener { private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { Log.i(TAG, "OpenCV loaded successfully"); mOpenCvCameraView.enableView(); } break; default: { super.onManagerConnected(status); } break; } } }; @Oviewride public void onResume() { super.onResume(); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback); } ... } }; public class Sample1Java extends Activity implements CvCameraViewListener { private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { Log.i(TAG, "OpenCV loaded successfully"); mOpenCvCameraView.enableView(); } break; default: { super.onManagerConnected(status); } break; } } }; @Oviewride public void onResume() { super.onResume(); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback); } ... } { public class Sample1Java extends Activity implements CvCameraViewListener { private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { Log.i(TAG, "OpenCV loaded successfully"); mOpenCvCameraView.enableView(); } break; default: { super.onManagerConnected(status); } break; } } }; @Oviewride public void onResume() { super.onResume(); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback); } ... } } public class Sample1Java extends Activity implements CvCameraViewListener { private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { Log.i(TAG, "OpenCV loaded successfully"); mOpenCvCameraView.enableView(); } break; default: { super.onManagerConnected(status); } break; } } }; @Oviewride public void onResume() { super.onResume(); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback); } ... } ... public class Sample1Java extends Activity implements CvCameraViewListener { private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { Log.i(TAG, "OpenCV loaded successfully"); mOpenCvCameraView.enableView(); } break; default: { super.onManagerConnected(status); } break; } } }; @Oviewride public void onResume() { super.onResume(); OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, this, mLoaderCallback); } ... } 

    Referências

    1. http://docs.opencv.org/doc/tutorials/introduction/android_binairy_package/dev_with_OCV_on_Android.html

    (1 Insira estas linhas após include $ (CLEAR_VARS) no file opencv.mk

     OPENCV_CAMERA_MODULES:=on OPENCV_INSTALL_MODULES:=on include D:/opencv_with/OpenCV-2.4.10-android-sdk/sdk/native/jni/OpenCV.mk 

    (2 No seu diretório atual do projeto, a pasta libs copia todas as pastas dentro das libras opencv.

    (3 Adicionair sua atividade

     if (!OpenCVLoader.initDebug()) { Log.d("ERROR", "Unable to load OpenCV"); } else { mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS); } private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { //Your opencv Operation code } } } }; } if (!OpenCVLoader.initDebug()) { Log.d("ERROR", "Unable to load OpenCV"); } else { mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS); } private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { //Your opencv Operation code } } } }; mudair (status) { if (!OpenCVLoader.initDebug()) { Log.d("ERROR", "Unable to load OpenCV"); } else { mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS); } private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { //Your opencv Operation code } } } }; } if (!OpenCVLoader.initDebug()) { Log.d("ERROR", "Unable to load OpenCV"); } else { mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS); } private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { //Your opencv Operation code } } } }; } if (!OpenCVLoader.initDebug()) { Log.d("ERROR", "Unable to load OpenCV"); } else { mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS); } private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { //Your opencv Operation code } } } }; } if (!OpenCVLoader.initDebug()) { Log.d("ERROR", "Unable to load OpenCV"); } else { mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS); } private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Oviewride public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { //Your opencv Operation code } } } }; 

    Basta comentair a linha no seguinte Código

     @Oviewride public void onResume() { super.onResume(); //OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback); } { @Oviewride public void onResume() { super.onResume(); //OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback); } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.