Android - OpenCV 模板匹配

Android - OpenCV Template Matching

所以我试图按照这个例子:OpenCV Template Matching example in Android

我正在尝试将它与我正在使用的更新的 OpenCV 示例一起使用。我在更新的示例中意识到的区别是如何添加 OpenCV 库。这些示例让您引入库项目而不是 jar。

我得到的错误是这个。

02-19 09:19:19.340: E/AndroidRuntime(390): FATAL EXCEPTION: main
02-19 09:19:19.340: E/AndroidRuntime(390): Process: com.example.opencv_templatematching, PID: 390
02-19 09:19:19.340: E/AndroidRuntime(390): java.lang.UnsatisfiedLinkError: No implementation found for long org.opencv.highgui.Highgui.imread_1(java.lang.String) (tried Java_org_opencv_highgui_Highgui_imread_11 and Java_org_opencv_highgui_Highgui_imread_11__Ljava_lang_String_2)
02-19 09:19:19.340: E/AndroidRuntime(390):  at org.opencv.highgui.Highgui.imread_1(Native Method)
02-19 09:19:19.340: E/AndroidRuntime(390):  at org.opencv.highgui.Highgui.imread(Highgui.java:362)
02-19 09:19:19.340: E/AndroidRuntime(390):  at com.example.opencv_templatematching.MatchingDemo.run(TemplateMatching.java:18)
02-19 09:19:19.340: E/AndroidRuntime(390):  at com.example.opencv_templatematching.TemplateMatching.main(TemplateMatching.java:58)

完整代码:
主要 - http://pastebin.com/UwYRN6gN
匹配模板 Class - http://pastebin.com/ankDA9MJ
控制台错误 - http://pastebin.com/MmbnntSD

提前致谢。

稍微谷歌一下,你会发现你在加载OpenCV库之前调用了模板匹配,在openCV forum中看到同样的错误:

you can only call opencv functions after the BaseLoaderCallback finished(the opencv dlls were loaded). so, if you put that code into your onCreate function, you'll get that error.

您可以在 openCV doc

中找到完整的 BaseLoaderCallback 文档

希望对您有所帮助^^