无法在 openCV 3.2 中创建 DescriptorMatcher - Android

Unable to create DescriptorMatcher in openCV 3.2 - Android

我运行下面的openCV代码在Android:

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

它在 openCV 2.4.1 中工作正常 在 openCV 3.2 中,我遇到以下异常:

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)

我在 2 台不同的 Android 设备上进行了检查。我做错了什么或者这是新 openCV 版本中的错误?

你的代码是正确的,我已经在我的 OpenCV 3.1 项目上试过了,它运行得很好。 我不知道 OpenCV 3.2,但它应该是一样的。您是否尝试输入匹配器的相应 int 值?

DescriptorMatcher matcher = DescriptorMatcher.create(4);

您可以在此处找到相应的 Int 值 DescriptorMatcher OpenCV 3.2。看起来 DescriptorMatcher.BRUTEFORCE_HAMMING 被认为是一个 long insted of int.

目前 Google Play 上的 OpenCV 管理器存在问题。我还不支持 3.2 版。为了解决这个问题,我将 libs 目录 (sdk\native\libs) 从 SDK 复制到我的应用程序的 src/main/jniLibs。请注意,我使用的是 Android Studio。在 Eclipse 中,它应该位于应用程序的根目录下。参见:Error while loading Native Library in Android