Ask Your Question
0

android opencv template matching error

asked 2016-04-02 10:10:53 -0600

nadia gravatar image

updated 2016-04-02 11:10:29 -0600

I found this code and when i run it a lot of errors occured.

04-02 17:04:42.614: D/PhoneWindow(9887): FMB installDecor mIsFloating : false 04-02 17:04:42.614: D/PhoneWindow(9887): FMB installDecor flags : 8454400 04-02 17:04:42.614: D/OpenCV/StaticHelper(9887): Trying to get library list 04-02 17:04:42.624: E/OpenCV/StaticHelper(9887): OpenCV error: Cannot load info library for OpenCV 04-02 17:04:42.624: D/OpenCV/StaticHelper(9887): Library list: "" 04-02 17:04:42.624: D/OpenCV/StaticHelper(9887): First attempt to load libs 04-02 17:04:42.624: D/OpenCV/StaticHelper(9887): Trying to init OpenCV libs 04-02 17:04:42.624: D/OpenCV/StaticHelper(9887): Trying to load library opencv_java3 04-02 17:04:42.624: D/OpenCV/StaticHelper(9887): Cannot load library "opencv_java3" 04-02 17:04:42.624: W/System.err(9887): java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.match-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libopencv_java3.so" 04-02 17:04:42.624: W/System.err(9887): at java.lang.Runtime.loadLibrary(Runtime.java:366) 04-02 17:04:42.624: W/System.err(9887): at java.lang.System.loadLibrary(System.java:989) 04-02 17:04:42.624: W/System.err(9887): at org.opencv.android.StaticHelper.loadLibrary(StaticHelper.java:64) 04-02 17:04:42.624: W/System.err(9887): at org.opencv.android.StaticHelper.initOpenCVLibs(StaticHelper.java:95) 04-02 17:04:42.624: W/System.err(9887): at org.opencv.android.StaticHelper.initOpenCV(StaticHelper.java:39) 04-02 17:04:42.624: W/System.err(9887): at org.opencv.android.OpenCVLoader.initDebug(OpenCVLoader.java:77) 04-02 17:04:42.624: W/System.err(9887): at com.example.match.MainActivity.onCreate(MainActivity.java:23) 04-02 17:04:42.624: W/System.err(9887): at android.app.Activity.performCreate(Activity.java:6374) 04-02 17:04:42.624: W/System.err(9887): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) 04-02 17:04:42.624: W/System.err(9887): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2752) 04-02 17:04:42.624: W/System.err(9887): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2873) 04-02 17:04:42.624: W/System.err(9887): at android.app.ActivityThread.access$900(ActivityThread.java:181) 04-02 17:04:42.624: W/System.err(9887): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1482) 04-02 17:04:42.624: W/System.err(9887): at android.os.Handler.dispatchMessage(Handler.java:102) 04-02 17:04:42.624: W/System.err(9887): at android.os.Looper.loop(Looper.java:145) 04-02 17:04:42.624: W/System.err(9887): at android.app.ActivityThread.main(ActivityThread.java:6145) 04-02 17:04:42.624: W/System.err(9887): at java.lang.reflect.Method.invoke(Native Method) 04-02 17:04:42.624: W/System.err(9887): at java.lang.reflect.Method.invoke(Method.java:372) 04-02 17:04:42.624: W/System.err(9887): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller ... (more)

edit retag flag offensive close merge delete

Comments

which errors, exactly ?

berak gravatar imageberak ( 2016-04-02 10:13:41 -0600 )edit
1

i add the logout error and there is an other error cannot load opencv library I try this also it doesnt work http://stackoverflow.com/questions/17...

nadia gravatar imagenadia ( 2016-04-02 10:23:25 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-04-02 11:22:51 -0600

berak gravatar image

you're not loading the opencv c++ native libs, so your code can't run. also, you can't run any opencv code from onCreate, since you have to wait, until the (async)loading finished. you need to add something similar to this:

private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
    @Override
    public void onManagerConnected(int status) {
        if (status == LoaderCallbackInterface.SUCCESS ) {
            // now we can call opencv code !
            run(....); // some args
        } else {
            super.onManagerConnected(status);
        }
    }
};

@Override
public void onResume() {;
    super.onResume();
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_1,this, mLoaderCallback);
    // you may be tempted, to do something here, but it's *async*, and may take some time,
    // so any opencv call here will lead to unresolved native errors.
}
edit flag offensive delete link more

Comments

i am sorry but i add all the native libs to libs folder under my project and i put the 3 pictures under res /drawable-mdpi (the picture are png forms) and i run the app there no error but the app stopped

nadia gravatar imagenadia ( 2016-04-02 11:34:40 -0600 )edit
  • "i add all the native libs to libs folder under my project" -- this is not enough. you have to actively load the native so's (and have the opencv manager app installed on your device). that's what the code above does.

  • "and i put the 3 pictures under res /drawable-mdpi" -- imread can't read from inside your (zipped) apk, so please move them to sdcard

berak gravatar imageberak ( 2016-04-02 11:38:01 -0600 )edit

i am sorry but what you mean by " you have to actively load the native so's" and i have opencv manager app installed and where exactly i should move them .i am really sorry but i am a beginner in opencv and android

nadia gravatar imagenadia ( 2016-04-02 11:53:03 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-04-02 10:10:53 -0600

Seen: 1,009 times

Last updated: Apr 02 '16