Unable to create DescriptorMatcher in openCV 3.2 - Android

梦想的初衷 提交于 2019-12-11 05:16:49

问题


I'm running the following openCV code in Android:

FeatureDetector detector = FeatureDetector.create(FeatureDetector.ORB);
DescriptorExtractor descriptor = DescriptorExtractor.create(DescriptorExtractor.ORB);
DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);

It works fine in openCV 2.4.1 In openCV 3.2 I'm getting the following exception:

java.lang.UnsatisfiedLinkError: No implementation found for long org.opencv.features2d.DescriptorMatcher.create_1(int) (tried Java_org_opencv_features2d_DescriptorMatcher_create_11 and Java_org_opencv_features2d_DescriptorMatcher_create_11__I)
                                                                                     at org.opencv.features2d.DescriptorMatcher.create_1(Native Method)
                                                                                     at org.opencv.features2d.DescriptorMatcher.create(DescriptorMatcher.java:76)

I checked it on 2 different Android devices. Am I doing something wrong or is this a bug in the new openCV version?


回答1:


Your code is right, i've tried it on my OpenCV 3.1 project and it's working flawlessly. I don't know about OpenCV 3.2 but it should be the same. Have you tried to enter the corresponding int value of your matcher ?

DescriptorMatcher matcher = DescriptorMatcher.create(4);

You can find the corresponding Int values here DescriptorMatcher OpenCV 3.2. It looks like DescriptorMatcher.BRUTEFORCE_HAMMING is considered as a long insted of int.




回答2:


There is currently a problem with the OpenCV Manager on Google Play. I doesn't support version 3.2 yet. To overcome the problem I copied the libs directory (sdk\native\libs) from the SDK to src/main/jniLibs of my application. Please note that I'm using Android Studio. In Eclipse it supposed to be located under the root of the app. see: Error while loading Native Library in Android



来源:https://stackoverflow.com/questions/41788433/unable-to-create-descriptormatcher-in-opencv-3-2-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!