Android的:如何从画廊的图像加载到OpenCV的垫变量?

我目前正在尝试运行一些OpenCV的过滤器(即找到EGDE,中位数,...)的存储在图片库文件夹的图像。

但我得到的错误加载图像。 我的设备是Galaxy Tab的10.1采用Android 3.2,我的OpenCV的 - API 8级。

我有一个按钮下面的源:

@Override public void onClick(View v) { Bitmap myBitmap = BitmapFactory.decodeFile("/sdcard/image1.jpg"); Bitmap myBitmap32 = myBitmap.copy(Bitmap.Config.ARGB_8888, true); Mat pic1 = Utils.bitmapToMat(myBitmap32); }

这里是LogCat中:

02-07 12:31:27.290: I/System.out(16522): Not a DRM File, opening notmally 02-07 12:31:27.290: I/System.out(16522): buffer returned 02-07 12:31:27.310: D/dalvikvm(16522): GC_FOR_ALLOC freed 11K, 21% free 6975K/8775K, paused 19ms 02-07 12:31:27.320: I/dalvikvm-heap(16522): Grow heap (frag case) to 12.918MB for 6291472-byte allocation 02-07 12:31:27.340: D/dalvikvm(16522): GC_FOR_ALLOC freed <1K, 13% free 13119K/14983K, paused 19ms 02-07 12:31:27.380: D/dalvikvm(16522): GC_CONCURRENT freed 0K, 13% free 13119K/14983K, paused 2ms+2ms 02-07 12:31:27.710: D/dalvikvm(16522): GC_FOR_ALLOC freed 55K, 13% free 13063K/14983K, paused 20ms 02-07 12:31:27.730: I/dalvikvm-heap(16522): Grow heap (frag case) to 24.864MB for 12582928-byte allocation 02-07 12:31:27.780: D/dalvikvm(16522): GC_FOR_ALLOC freed 0K, 8% free 25351K/27335K, paused 21ms 02-07 12:31:27.830: D/dalvikvm(16522): GC_CONCURRENT freed <1K, 8% free 25351K/27335K, paused 2ms+3ms 02-07 12:31:27.890: W/dalvikvm(16522): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/opencv/android/Utils; 02-07 12:31:27.890: D/AndroidRuntime(16522): Shutting down VM 02-07 12:31:27.890: W/dalvikvm(16522): threadid=1: thread exiting with uncaught exception (group=0x400fc760) 02-07 12:31:27.890: E/AndroidRuntime(16522): FATAL EXCEPTION: main 02-07 12:31:27.890: E/AndroidRuntime(16522): java.lang.ExceptionInInitializerError 02-07 12:31:27.890: E/AndroidRuntime(16522): at photo.klu.PhotoKLUActivity$1.onClick(PhotoKLUActivity.java:82) 02-07 12:31:27.890: E/AndroidRuntime(16522): at android.view.View.performClick(View.java:3127) 02-07 12:31:27.890: E/AndroidRuntime(16522): at android.view.View$PerformClick.run(View.java:12025) 02-07 12:31:27.890: E/AndroidRuntime(16522): at android.os.Handler.handleCallback(Handler.java:587) 02-07 12:31:27.890: E/AndroidRuntime(16522): at android.os.Handler.dispatchMessage(Handler.java:92) 02-07 12:31:27.890: E/AndroidRuntime(16522): at android.os.Looper.loop(Looper.java:132) 02-07 12:31:27.890: E/AndroidRuntime(16522): at android.app.ActivityThread.main(ActivityThread.java:4126) 02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.reflect.Method.invokeNative(Native Method) 02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.reflect.Method.invoke(Method.java:491) 02-07 12:31:27.890: E/AndroidRuntime(16522): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844) 02-07 12:31:27.890: E/AndroidRuntime(16522): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602) 02-07 12:31:27.890: E/AndroidRuntime(16522): at dalvik.system.NativeStart.main(Native Method) 02-07 12:31:27.890: E/AndroidRuntime(16522): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load opencv_java: findLibrary returned null 02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.Runtime.loadLibrary(Runtime.java:425) 02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.System.loadLibrary(System.java:554) 02-07 12:31:27.890: E/AndroidRuntime(16522): at org.opencv.android.Utils.<clinit>(Utils.java:86) 02-07 12:31:27.890: E/AndroidRuntime(16522): ... 12 more 02-07 12:31:30.010: I/dalvikvm(16522): threadid=4: reacting to signal 3 02-07 12:31:30.010: I/dalvikvm(16522): Wrote stack traces to '/data/anr/traces.txt' 02-07 12:31:37.470: I/Process(16522): Sending signal. PID: 16522 SIG: 9

有任何想法吗?

谢谢。

--------------解决方案-------------

OpenCV库没有连接到您的应用程序。 请执行下列步骤(假设我OpenCV库导入到您的工作空间)。 在包资源管理器>右键单击应用程序项目>属性>库下单击添加>选择的OpenCV确保Java的构建路径不必涉及到任何的OpenCV

分类:安卓 时间:2014-01-13 人气:1
分享到:

相关文章

Copyright (C) 55228885.com, All Rights Reserved.

55228885 版权所有 京ICP备15002868号

processed in 0.137 (s). 9 q(s)