将 Java 代码移植到 Android
我有用于面部识别的Java代码,效果很好。但是,如果我将代码移植到 Android 应用程序中,就会出现问题。
我已将 Java 代码所需的 jama 和 jmf 包含到 Android 应用程序中。 Android 代码编译得很好,但是当我运行该应用程序时,它被强制关闭!
我在这里可能做错了什么?移植时需要注意哪些事项?
顺便说一句,Java 代码没有 GUI。
I have Java code for face recognition which works fine. There is a problem however if I port the code into an Android application.
I have included the necessary jama and jmf which is required by the Java code into the Android app. The Android code compiles fine, but when I run the app it's force closed!
What might I be doing wrong here? What are the things that I need to keep in mind when I do the porting?
By the way there is no GUI for the Java code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将 Java 代码移植到 Android 通常不起作用,您需要遵循创建 Android 应用程序的指南。
您应该从 Android 文档开始寻求帮助。
http://developer.android.com/guide/topics/fundamentals.html
Porting your java code to Android will usually not work, you need to foloow the guidelines for creating an Android application.
You should start at the Android documentation for help.
http://developer.android.com/guide/topics/fundamentals.html
我建议您查看 Android OpenCV 项目。在他们的 CVCamera 示例中,他们有一个很好的设置,可以进行实时图像处理以进行特征检测等。我之前已经对其进行了修改,以支持使用 OpenCV 库进行人脸检测。
如果您想使用自己的代码,我建议您删除所有 JNI/NDK 互操作代码并替换您自己的代码。无论如何,这是一个很好的起点。
I'd recommend you take a look at the Android OpenCV project. In their CVCamera sample, they have a nice setup for doing real-time image processing for feature detection etc. I've previously modified it to support face detection using the OpenCV library.
If you want to use your own code instead, I suggest you strip out all the JNI/NDK interop code and substitute your own. At any rate, it's a nice starting point.