无法在openCV 3.2 - Android中创建DescriptorMatcher

时间:2017-01-22 07:31:44

标签: android opencv opencv3.0 opencv4android

我在Android中运行以下openCV代码:

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版本中的错误?

2 个答案:

答案 0 :(得分:1)

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

DescriptorMatcher matcher = DescriptorMatcher.create(4);

您可以在DescriptorMatcher OpenCV 3.2找到相应的Int值。看起来DescriptorMatcher.BRUTEFORCE_HAMMING被视为int的长期内容。

答案 1 :(得分:0)

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

相关问题