0

这是我正在尝试使用的代码

File filePath = new File(Environment.getExternalStorageDirectory(), "/test.bmp");
String file = filePath.getAbsolutePath();
Mat input_mat = Highgui.imread(file);

当我将应用程序与最后一行一起使用时,它会崩溃。我不确定最后一行是错误还是我没有正确访问 test.bmp 文件。它保存在 sdcard 的根目录中。

它适用于 Eclipse 上的 android 应用程序。

编辑日志猫

01-11 22:38:50.288: E/AndroidRuntime(545): FATAL EXCEPTION: main
01-11 22:38:50.288: E/AndroidRuntime(545): java.lang.UnsatisfiedLinkError: imread_1
01-11 22:38:50.288: E/AndroidRuntime(545):  at org.opencv.highgui.Highgui.imread_1(Native Method)
01-11 22:38:50.288: E/AndroidRuntime(545):  at org.opencv.highgui.Highgui.imread(Highgui.java:324)
01-11 22:38:50.288: E/AndroidRuntime(545):  at com.example.android.photobyintent.PhotoIntentActivity.dispatchProcVideoIntent(PhotoIntentActivity.java:186)
01-11 22:38:50.288: E/AndroidRuntime(545):  at com.example.android.photobyintent.PhotoIntentActivity.access$2(PhotoIntentActivity.java:182)
01-11 22:38:50.288: E/AndroidRuntime(545):  at com.example.android.photobyintent.PhotoIntentActivity$4.onClick(PhotoIntentActivity.java:264)
01-11 22:38:50.288: E/AndroidRuntime(545):  at android.view.View.performClick(View.java:3480)
01-11 22:38:50.288: E/AndroidRuntime(545):  at android.view.View$PerformClick.run(View.java:13983)
01-11 22:38:50.288: E/AndroidRuntime(545):  at android.os.Handler.handleCallback(Handler.java:605)
01-11 22:38:50.288: E/AndroidRuntime(545):  at android.os.Handler.dispatchMessage(Handler.java:92)
01-11 22:38:50.288: E/AndroidRuntime(545):  at android.os.Looper.loop(Looper.java:137)
01-11 22:38:50.288: E/AndroidRuntime(545):  at android.app.ActivityThread.main(ActivityThread.java:4340)
01-11 22:38:50.288: E/AndroidRuntime(545):  at java.lang.reflect.Method.invokeNative(Native Method)
01-11 22:38:50.288: E/AndroidRuntime(545):  at java.lang.reflect.Method.invoke(Method.java:511)
01-11 22:38:50.288: E/AndroidRuntime(545):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-11 22:38:50.288: E/AndroidRuntime(545):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-11 22:38:50.288: E/AndroidRuntime(545):  at dalvik.system.NativeStart.main(Native Method)
4

1 回答 1

3

这与读取位图文件无关。UnsatisfiedLinkError意味着它无法找到.so实现该类的共享对象(文件)。这意味着您的项目配置有问题。您是否将所需文件复制到libs/armeabi和?libs/armeabi-v7alibs/x86

另见:

Android for OpenCV - 打开跟踪文件时出错,UnsatisfiedLinkError

于 2013-01-11T22:50:30.190 回答