No implementation found for Canny on Android < 6

1.8k views Asked by At

Using openCVLibrary320 for Android I get in my Project the Error:

W/dalvikvm: No implementation found for native Lorg/opencv/imgproc/Imgproc;.Canny_2:(JJDDIZ)V
W/dalvikvm: threadid=12: thread exiting with uncaught exception (group=0x9cd7fb20)
E/AndroidRuntime: FATAL EXCEPTION: Thread-68
              Process: hantke.niklas.mnotes, PID: 2144
              java.lang.UnsatisfiedLinkError: Native method not found: org.opencv.imgproc.Imgproc.Canny_2:(JJDDIZ)V
                  at org.opencv.imgproc.Imgproc.Canny_2(Native Method)
                  at org.opencv.imgproc.Imgproc.Canny(Imgproc.java:1029)
                  at hantke.niklas.mnotes.MainActivity.detectStaffLines(MainActivity.java:121)
                  at hantke.niklas.mnotes.MainActivity.onCameraFrame(MainActivity.java:173)
                  at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:392)
                  at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:352)
                  at java.lang.Thread.run(Thread.java:841)

It's the first time I call the method canny but beforehand I call cvtColor and equalizeHist without any error.

Works fine on API 25 emulator but does neither work on API 19 emu nor on a Android-Phone with Android 5.1. The newest version of the openCV manager bundled with the SDK 3.20 is installed on every emulator and phone

1

There are 1 answers

0
Niklas Hantke On BEST ANSWER

I have found my error.

The problem was in the initialization of openCV: I had to write:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_2_0, this, mLoaderCallback);
}

instead of

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

since I use version 3.2.0. Strange though, that it worked on the Android 6 emulator.