22

i'm trying to run OpenCV Tutorial 1 - Add OpenCV with static initialization using this
i don't want a separate OpenCV Manager application installed) but i get an "OpenCV error: Cannot load info library for OpenCV."

I did the following things:

  1. added a libs folder with armeabi, armeabi-v7a, and x86 folders inside of it (from OpenCV-2.4.2-android-sdk/sdk/native/libs/)

  2. added the static {if (!OpenCVLoader.initDebug())} code just below private Sample1View mView;

  3. removed the below code

if (!OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_2, this, mOpenCVCallBack))

what seems to be the problem?

Girish Nair
  • 5,148
  • 5
  • 40
  • 61
Droidkie
  • 233
  • 1
  • 3
  • 8
  • I am also getting the same issue. Did you fix this? – Manoj Oct 09 '12 at 10:00
  • @Manoj sadly, no one has offered a fix for this yet. – Droidkie Oct 20 '12 at 02:47
  • 18
    I'm still confused as to why OpenCV maintainers think this should be a 'debug' setup. If a user downloads an app it seems unintuitive to then get them to download an app within the app. It should be the responsibility of the app provider what 3rd party library versions they use and test against as there's no guarantee that an updated version of OpenCV will work seamlessly with my app. – alex.p Apr 23 '14 at 13:11
  • Question seems to assume I know what code your talking about. I guess it's in an external site ... which is now gone :(. Include code here; don't reference it. ... Also, I don't think the linked question is a duplicate as indicated. Related, but not duplicate. ... So many questions marked as duplicate are not actually. – steve May 09 '23 at 16:15

4 Answers4

11

You should add the code:

mOpenCVCallBack.onManagerConnected(LoaderCallbackInterface.SUCCESS);

after:

if(!OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_2, this, mOpenCVCallBack)) 

If you remove:

if(!OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_2, this, mOpenCVCallBack))  

code block then nobody calls.

Hope it can help you.

vArDo
  • 4,408
  • 1
  • 17
  • 26
Qichao Chen
  • 166
  • 1
  • 10
4

I have the same problem, I have solved the problem by adding the following code at the first of my Activity class:

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

Also I added

mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);

before the line

OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback); 

and commented the line

OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);

Good luck.

user2874769
  • 97
  • 2
  • 6
1

The log message:

"OpenCV error: Cannot load info library for OpenCV."

shuld not worry you. At least in my app it tells me something like OpenCV libs init is OK afterwards.

In the sample code the CameraBridgeViewBase object gets enabled when the BaseLoaderCallback gets called. That happens when the async loading of the opencv library has finished. When you load the library statically, try adding a call to mOpenCVCameraView.enableView() in your onResume() method (after loading the lib of coourse).

mockfrog
  • 56
  • 4
0

initAsync() needs a callback to load opencv libs and your jni libs.

check the callback function and make it right in the if (!OpenCVLoader.initDebug()), not in the callback!

            if (!OpenCVLoader.initDebug()) {
            // Handle initialization error
              Log.i(TAG, "OpenCV load not successfully");
        } else {
            System.loadLibrary("mixed_sample");
            //System.loadLibrary("my_jni_lib2");

            InitFeature(width,height);

            mOpenCvCameraView.enableView();
        }

it works for the tutorial 2 in OCV4Android2.4.5.

flankechen
  • 1,225
  • 16
  • 31