【问题标题】:Unable to create DescriptorMatcher in openCV 3.2 - Android无法在 openCV 3.2 中创建 DescriptorMatcher - Android
【发布时间】:2017-06-06 21:43:36
【问题描述】:

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

【问题讨论】:

    标签: android opencv opencv3.0 opencv4android


    【解决方案1】:

    您的代码是正确的,我已经在我的 OpenCV 3.1 项目中尝试过它并且它运行完美。 我不知道 OpenCV 3.2 但应该是一样的。你试过输入你的matcher对应的int值吗?

    DescriptorMatcher matcher = DescriptorMatcher.create(4);
    

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

    【讨论】:

    • 是的,它适用于 3.1 但不适用于 3.2 新版本中有一个错误
    • 值是int,不是long
    【解决方案2】:

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

    【讨论】:

    • 更糟的是,3.1.0版本我还是有同样的问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-08
    相关资源
    最近更新 更多