简体   繁体   中英

Android - OpenCV Template Matching

So I'm attempting to follow this example: OpenCV Template Matching example in Android

I'm trying to use it with the updated OpenCV Examples which I have working. The difference I'm aware of in the updated examples is how the OpenCV libraries are added. The examples have you pull in a library project instead of a jar.

The error I'm getting is this.

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)

Full Code:
Main - http://pastebin.com/UwYRN6gN
Matching Template Class - http://pastebin.com/ankDA9MJ
Console Error - http://pastebin.com/MmbnntSD

Thanks in advance.

googling a little bit , you will found that you've called the template matching before loading the OpenCV library see the same error in 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.

you could find a complete BaseLoaderCallback documentation in openCV doc

Hope this could help you ^^

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM