OpenCV的Andr​​oid的 - 不能解析通讯功能JNI [英] OpenCV Android - Cannot Resolve Corresponding JNI Function

查看:1249
本文介绍了OpenCV的Andr​​oid的 - 不能解析通讯功能JNI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照这个教程这里概述试图安装Android的工作室用opencv实现/www.youtube.com/watch?v=OTw_GIQNbD8

I'm trying to setup Android Studio with Opencv by following this tutorial outlined here: https://www.youtube.com/watch?v=OTw_GIQNbD8

我可以通过给本教程的人得到的结果但在试图实际使用一些opencv实现的功能,我碰到一些麻烦。

I can get the result obtained by the person giving the tutorial but upon trying to actually use some of Opencv's functions I run into some trouble.

我能够加载OpenCV库但在尝试使用一些本地功能,比如图codecs.imread我的错误:.lang.UnsatisfiedLinkError:未找到长期org.opencv实施.IMG codecs.Img codecs.imread_1(java.lang.String中)

I am able to load the Opencv library but upon trying use some of the native functions such as "Imgcodecs.imread" I get the error: ".lang.UnsatisfiedLinkError: No implementation found for long org.opencv.imgcodecs.Imgcodecs.imread_1(java.lang.String)"

我相信我已经找到了问题如下:

I believe I have tracked down the issue to the following:

[![此处输入的形象描述] [1] [1]

[![enter image description here][1]][1]

看来,Android的工作室是无法检测到本地C ++ code,我猜应该从jiniLibs文件夹拾起我现在已经在app / src目录/主?

It seems that Android Studio is unable to detect the native C++ code which I'm guessing should be picked up from jiniLibs folder I now have in app/src/main?

我试过更新Android Studio将最新的稳定版本,我已经订好我的Andr​​oid SDK和NDK具有空格显然可以影响到本地code的运行我的文件路径。这个问题仍然存在。

I've tried updating Android Studio to the latest stable build and I have fixed my file paths for my android SDK and NDK as having white-space can apparently affect the running of native code. The issue still persists.

我一直在试图解决这一问题的最后4个小时,任何帮助将大大AP preciated!

I have been trying to fix this for the last 4 hours, any help would be greatly appreciated!

推荐答案

最后编辑:我做了一个教程,说明如何为Android与SIFT / SURF算法一起安装OpenCV - 的 https://www.youtube.com/watch?v=cLK9CjQ-pNI

FINAL I've made a tutorial explaining how to install Opencv for Android along with SIFT/SURF algorithms - https://www.youtube.com/watch?v=cLK9CjQ-pNI

看来,我已经解决了我的问题,使用以下文件结构和依赖性。我不能肯定地说我是如何得到它的工作,但我相信,如果你在这里复制我的结构,那么你应该工作了。

It appears that I have solved my issue with using the following file structure and dependencies. I can't say for sure how I got it to work but I believe if you copy my structure here then yours should work too.

确保有您的文件路径中没有空格present到您的Andr​​oid SDK或NDK。 Android Studio中警告说,装载本地code时,这可能会导致问题。

Ensure that there are no spaces present in your file path to your Android SDK or NDK. Android Studio warns that this may cause issue when loading native code.

将包含*的.so'文件到/ YOUR_PROJECT_ROOT /库(您可能必须手动创建此libs文件夹)的文件夹。
所有其他解决方案网上说明将其付诸应用程序/ src目录/主/ jniLibs没有为我工作。

Place the folders containing the '*.so' files into /YOUR_PROJECT_ROOT/libs (You'll probably have to manually create this libs folder). All the other solutions online stating to put them into app/src/main/jniLibs did not work for me.

要包括openCVLibrary300,我导入它作为使用文件 - >新建 - >导入模块一个模块,设置源目录像.. \\ OpenCV的,Android的SDK \\ SDK \\ java中

To include the openCVLibrary300, I imported it as a module using File->New->Import Module, the set the Source Directory to something like ..\OpenCV-android-sdk\sdk\java

确保在的build.gradle应用程序都与进口库共享相同的最小值和最大值SDK版本等文件。

Ensure build.gradle files in both the app and the imported library share the same min and max sdk version etc.

样品code - http://pastebin.com/2zzU5B9G

Sample code used to test - http://pastebin.com/2zzU5B9G

样品code我上面张贴确保了库使用opencv方法之前被加载。它采用了图codecs.imread()函数,使用本地code C ++中,这是previously给我.lang.UnsatisfiedLinkError:没有找到执行长org.opencv.img codecs.Img codecs.imread_1(java.lang.String中)的错误。

The sample code I've posted above ensures the libraries are loaded before using Opencv methods. It uses the Imgcodecs.imread() function that uses native code in C++ that was previously giving me the ".lang.UnsatisfiedLinkError: No implementation found for long org.opencv.imgcodecs.Imgcodecs.imread_1(java.lang.String)" error.

在这里输入的形象描述

在这里输入的形象描述

在这里输入的形象描述

这篇关于OpenCV的Andr​​oid的 - 不能解析通讯功能JNI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆