我按照OpenCV网站上的教程:http://opencv.org/platforms/android.html 在eclipse IDE上为Android开发配置OpenCV,我已经编译了OpenCV附带的所有示例,它们编译得很好并带有一些警告。但是当我在模拟器上运行已编译的软件包时,它会向我显示一条错误消息,指出“OpenCV未正确初始化。应用程序将关闭”,例如当我运行“15 puzzle”时示例模拟器上显示以下内容:
编译器警告:
logcat输出
03-01 18:08:32.519: I/ActivityManager(61): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.opencv.samples.puzzle15/.Puzzle15Activity } from pid 136
03-01 18:08:32.710: I/WindowManager(61): Setting rotation to 1, animFlags=1
03-01 18:08:32.880: I/ActivityManager(61): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=1/1/2 nav=3/1 orien=2 layout=34 uiMode=17 seq=15}
03-01 18:08:33.069: D/CameraBridge(509): Attr count: 3
03-01 18:08:33.089: D/JavaCameraView(509): Java camera view ctor
03-01 18:08:33.120: I/ActivityManager(61): Start proc org.opencv.engine:OpenCVEngineProcess for service org.opencv.engine/.OpenCVEngineService: pid=525 uid=10042 gids={}
03-01 18:08:33.269: I/ActivityManager(61): Displayed org.opencv.samples.puzzle15/.Puzzle15Activity: +556ms
03-01 18:08:33.639: D/dalvikvm(33): GC_EXPLICIT freed 9K, 50% free 2719K/5379K, external 1625K/2137K, paused 503ms
03-01 18:08:33.858: D/CameraBridge(509): call surfaceChanged event
03-01 18:08:34.378: D/dalvikvm(33): GC_EXPLICIT freed <1K, 50% free 2719K/5379K, external 1625K/2137K, paused 741ms
03-01 18:08:34.588: I/OpenCVEngine/Service(525): Service starting
03-01 18:08:34.598: I/OpenCVEngine/Service(525): Engine binder component creating
03-01 18:08:34.618: D/dalvikvm(525): Trying to load lib /data/data/org.opencv.engine/lib/libOpenCVEngine.so 0x40515178
03-01 18:08:34.618: D/dalvikvm(33): GC_EXPLICIT freed <1K, 50% free 2719K/5379K, external 1625K/2137K, paused 229ms
03-01 18:08:34.648: D/OpenCVEngine(525): Using ARM HW detector
03-01 18:08:34.659: D/dalvikvm(525): Added shared lib /data/data/org.opencv.engine/lib/libOpenCVEngine.so 0x40515178
03-01 18:08:34.659: D/dalvikvm(525): No JNI_OnLoad found in /data/data/org.opencv.engine/lib/libOpenCVEngine.so 0x40515178, skipping init
03-01 18:08:34.659: D/dalvikvm(525): Trying to load lib /data/data/org.opencv.engine/lib/libOpenCVEngine_jni.so 0x40515178
03-01 18:08:34.668: D/dalvikvm(525): Added shared lib /data/data/org.opencv.engine/lib/libOpenCVEngine_jni.so 0x40515178
03-01 18:08:34.668: D/dalvikvm(525): No JNI_OnLoad found in /data/data/org.opencv.engine/lib/libOpenCVEngine_jni.so 0x40515178, skipping init
03-01 18:08:34.668: D/OpenCVEngine/JNI(525): Java_org_opencv_engine_BinderConnector_Init
03-01 18:08:34.668: I/OpenCVEngine/JNI(525): Creating new component
03-01 18:08:34.668: I/OpenCVEngine/JNI(525): New component created successfully
03-01 18:08:34.678: I/OpenCVEngine/Service(525): Service started successfully
03-01 18:08:34.678: I/OpenCVEngine/Service(525): Service onBind called for intent Intent { act=org.opencv.engine.BIND }
03-01 18:08:34.688: D/OpenCVManager/Helper(509): Service connection created
03-01 18:08:34.688: D/OpenCVEngine(525): OpenCVEngine::OnTransact(1,16)
03-01 18:08:34.688: D/OpenCVEngine(525): OpenCVEngine OCVE_GET_ENGINE_VERSION request
03-01 18:08:34.688: D/OpenCVEngine(525): OpenCVEngine::GetVersion()
03-01 18:08:34.688: D/OpenCVManager/Helper(509): Trying to get library path
03-01 18:08:34.688: D/OpenCVEngine(525): OpenCVEngine::OnTransact(2,16)
03-01 18:08:34.688: D/OpenCVEngine(525): OpenCVEngine OCVE_GET_LIB_PATH_BY_VERSION request
03-01 18:08:34.688: D/OpenCVEngine(525): OpenCVEngine::GetLibPathByVersion(2.4.3)
03-01 18:08:34.688: D/OpenCVEngine(525): OpenCVEngine::GetLibPathByVersion(2.4.3) impl
03-01 18:08:34.688: D/OpenCVEngine(525): PackageInfo::PackageInfo: package arch ARMv5
03-01 18:08:34.688: D/JavaBasedPackageManager(525): JavaBasedPackageManager::GetInstalledPackages() begin
03-01 18:08:34.688: D/JavaBasedPackageManager(525): GetObjectClass call
03-01 18:08:34.688: D/JavaBasedPackageManager(525): GetMethodID call
03-01 18:08:34.688: D/JavaBasedPackageManager(525): Java package manager call
03-01 18:08:34.908: D/JavaBasedPackageManager(525): Package info conversion
03-01 18:08:34.908: D/OpenCVEngine(525): PackageInfo::PackageInfo("org.opencv.engine", "/data/data/org.opencv.engine/lib", "2.5")
03-01 18:08:34.908: D/OpenCVEngine(525): Trying to load info library "/data/data/org.opencv.engine/lib/libopencv_info.so"
03-01 18:08:34.908: I/OpenCVEngine(525): OpenCV package "org.opencv.lib_v24_armv5" revision "4.1" found
03-01 18:08:34.918: W/dalvikvm(525): JNI WARNING: 0x40530680 is not a valid JNI reference
03-01 18:08:34.918: W/dalvikvm(525): in Ldalvik/system/NativeStart;.run ()V (DeleteLocalRef)
03-01 18:08:34.918: I/dalvikvm(525): "Binder Thread #1" prio=5 tid=7 RUNNABLE
03-01 18:08:34.918: I/dalvikvm(525): | group="main" sCount=0 dsCount=0 obj=0x40510908 self=0x116d20
03-01 18:08:34.918: I/dalvikvm(525): | sysTid=531 nice=0 sched=0/0 cgrp=default handle=1145392
03-01 18:08:34.918: I/dalvikvm(525): | schedstat=( 105702049 76397389 24 )
03-01 18:08:34.918: I/dalvikvm(525): at dalvik.system.NativeStart.run(Native Method)
03-01 18:08:34.918: E/dalvikvm(525): VM aborting
03-01 18:08:35.052: W/IInputConnectionWrapper(136): showStatusIcon on inactive InputConnection
03-01 18:08:35.058: I/DEBUG(31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-01 18:08:35.058: I/DEBUG(31): Build fingerprint: 'generic/google_sdk/generic:2.3.4/GINGERBREAD/123630:eng/test-keys'
03-01 18:08:35.058: I/DEBUG(31): pid: 525, tid: 531 >>> org.opencv.engine:OpenCVEngineProcess <<<
03-01 18:08:35.058: I/DEBUG(31): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadd00d
03-01 18:08:35.058: I/DEBUG(31): r0 fffffec4 r1 deadd00d r2 00000026 r3 00000000
03-01 18:08:35.058: I/DEBUG(31): r4 800a45c0 r5 800857c4 r6 800857c4 r7 43db2c10
03-01 18:08:35.058: I/DEBUG(31): r8 00000000 r9 40530680 10 00000020 fp 002987a8
03-01 18:08:35.058: I/DEBUG(31): ip 800a4720 sp 43db2a28 lr afd19375 pc 80045a4a cpsr 20000030
03-01 18:08:35.288: I/DEBUG(31): #00 pc 00045a4a /system/lib/libdvm.so
03-01 18:08:35.288: I/DEBUG(31): #01 pc 00037748 /system/lib/libdvm.so
03-01 18:08:35.288: I/DEBUG(31): #02 pc 000386ec /system/lib/libdvm.so
03-01 18:08:35.298: I/DEBUG(31): #03 pc 0003871e /system/lib/libdvm.so
03-01 18:08:35.298: I/DEBUG(31): #04 pc 00039236 /system/lib/libdvm.so
03-01 18:08:35.298: I/DEBUG(31): code around pc:
03-01 18:08:35.308: I/DEBUG(31): 80045a28 447a4479 ed0cf7d1 20004c09 ee34f7d1
03-01 18:08:35.308: I/DEBUG(31): 80045a38 447c4808 6bdb5823 d0002b00 49064798
03-01 18:08:35.308: I/DEBUG(31): 80045a48 700a2226 eea0f7d1 000436b7 00045275
03-01 18:08:35.308: I/DEBUG(31): 80045a58 0005eb82 fffffec4 deadd00d b510b40e
03-01 18:08:35.328: I/DEBUG(31): 80045a68 4c0a4b09 447bb083 aa05591b 6b5bca02
03-01 18:08:35.328: I/DEBUG(31): code around lr:
03-01 18:08:35.328: I/DEBUG(31): afd19354 b0834a0d 589c447b 26009001 686768a5
03-01 18:08:35.328: I/DEBUG(31): afd19364 220ce008 2b005eab 1c28d003 47889901
03-01 18:08:35.338: I/DEBUG(31): afd19374 35544306 d5f43f01 2c006824 b003d1ee
03-01 18:08:35.338: I/DEBUG(31): afd19384 bdf01c30 000281a8 ffffff88 1c0fb5f0
03-01 18:08:35.338: I/DEBUG(31): afd19394 43551c3d a904b087 1c16ac01 604d9004
03-01 18:08:35.338: I/DEBUG(31): stack:
03-01 18:08:35.338: I/DEBUG(31): 43db29e8 00000015
03-01 18:08:35.338: I/DEBUG(31): 43db29ec afd18407 /system/lib/libc.so
03-01 18:08:35.348: I/DEBUG(31): 43db29f0 afd4270c /system/lib/libc.so
03-01 18:08:35.348: I/DEBUG(31): 43db29f4 afd426b8 /system/lib/libc.so
03-01 18:08:35.348: I/DEBUG(31): 43db29f8 00000000
03-01 18:08:35.348: I/DEBUG(31): 43db29fc afd19375 /system/lib/libc.so
03-01 18:08:35.348: I/DEBUG(31): 43db2a00 00116d20 [heap]
03-01 18:08:35.358: I/DEBUG(31): 43db2a04 afd183d9 /system/lib/libc.so
03-01 18:08:35.358: I/DEBUG(31): 43db2a08 43db2c10
03-01 18:08:35.358: I/DEBUG(31): 43db2a0c 0005eb82 [heap]
03-01 18:08:35.358: I/DEBUG(31): 43db2a10 800857c4 /system/lib/libdvm.so
03-01 18:08:35.358: I/DEBUG(31): 43db2a14 800857c4 /system/lib/libdvm.so
03-01 18:08:35.358: I/DEBUG(31): 43db2a18 43db2c10
03-01 18:08:35.358: I/DEBUG(31): 43db2a1c afd18437 /system/lib/libc.so
03-01 18:08:35.358: I/DEBUG(31): 43db2a20 df002777
03-01 18:08:35.358: I/DEBUG(31): 43db2a24 e3a070ad
03-01 18:08:35.368: I/DEBUG(31): #00 43db2a28 40530680 /dev/ashmem/dalvik-heap (deleted)
03-01 18:08:35.368: I/DEBUG(31): 43db2a2c 8003774d /system/lib/libdvm.so
03-01 18:08:35.368: I/DEBUG(31): #01 43db2a30 40530680 /dev/ashmem/dalvik-heap (deleted)
03-01 18:08:35.368: I/DEBUG(31): 43db2a34 800386f1 /system/lib/libdvm.so
03-01 18:08:36.498: D/dalvikvm(61): GC_EXPLICIT freed 45K, 45% free 4987K/9031K, external 3897K/4867K, paused 196ms
03-01 18:08:37.318: I/BootReceiver(61): Copying /data/tombstones/tombstone_08 to DropBox (SYSTEM_TOMBSTONE)
03-01 18:08:37.378: D/Zygote(33): Process 525 terminated by signal (11)
03-01 18:08:37.419: I/ActivityManager(61): Process org.opencv.engine:OpenCVEngineProcess (pid 525) has died.
03-01 18:08:37.419: W/ActivityManager(61): Scheduling restart of crashed service org.opencv.engine/.OpenCVEngineService in 5000ms
03-01 18:08:37.428: W/System.err(509): android.os.DeadObjectException
03-01 18:08:37.428: W/System.err(509): at android.os.BinderProxy.transact(Native Method)
03-01 18:08:37.428: W/System.err(509): at org.opencv.engine.OpenCVEngineInterface$Stub$Proxy.getLibPathByVersion(OpenCVEngineInterface .java:137)
03-01 18:08:37.428: W/System.err(509): at org.opencv.android.AsyncServiceHelper$1.onServiceConnected(AsyncServiceHelper.java:182)
03-01 18:08:37.428: W/System.err(509): at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1064)
03-01 18:08:37.428: W/System.err(509): at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1081)
03-01 18:08:37.428: W/System.err(509): at android.os.Handler.handleCallback(Handler.java:587)
03-01 18:08:37.428: W/System.err(509): at android.os.Handler.dispatchMessage(Handler.java:92)
03-01 18:08:37.428: W/System.err(509): at android.os.Looper.loop(Looper.java:130)
03-01 18:08:37.428: W/System.err(509): at android.app.ActivityThread.main(ActivityThread.java:3683)
03-01 18:08:37.448: W/System.err(509): at java.lang.reflect.Method.invokeNative(Native Method)
03-01 18:08:37.448: W/System.err(509): at java.lang.reflect.Method.invoke(Method.java:507)
03-01 18:08:37.448: W/System.err(509): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-01 18:08:37.448: W/System.err(509): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-01 18:08:37.448: W/System.err(509): at dalvik.system.NativeStart.main(Native Method)
03-01 18:08:37.458: D/OpenCVManager/Helper(509): Init finished with status 255
03-01 18:08:37.458: D/OpenCVManager/Helper(509): Unbind from service
03-01 18:08:37.458: D/OpenCVManager/Helper(509): Calling using callback
03-01 18:08:37.458: E/OpenCVLoader/BaseLoaderCallback(509): OpenCV loading failed!
03-01 18:08:37.728: D/dalvikvm(509): GC_EXTERNAL_ALLOC freed 137K, 49% free 2785K/5379K, external 2050K/2137K, paused 183ms
03-01 18:08:43.148: I/WindowManager(61): Setting rotation to 0, animFlags=1
03-01 18:08:43.168: I/ActivityManager(61): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=1/1/2 nav=3/1 orien=1 layout=34 uiMode=17 seq=16}
03-01 18:08:45.288: W/IInputConnectionWrapper(509): showStatusIcon on inactive InputConnection
我使用 OpenCV 2.4.4 beta for android ,
eclipse 4.2.1 juno ,
Windows 6 x64位作为开发平台,
并且模拟器定位 Google API 11 ,这与iv'e构建示例项目时使用的相同
我还在模拟器上安装了android漫画 OpenCV_2.4.4_Manager_2.5_armeabi.apk 。
任何建议,谢谢
答案 0 :(得分:0)
尝试刚刚发布的2.4.4发行包。 (http://sourceforge.net/projects/opencvlibrary/files/opencv-android/2.4.4/OpenCV-2.4.4-android-sdk.zip/download)
答案 1 :(得分:0)
尝试安装上一个OpenCV Manager(2.6)。通常情况下,模拟器在真实设备上的工作方式并不完全......模拟器的配置是什么?
答案 2 :(得分:0)
对于OpenCV 2.4.4以后的OpenCv4Android,在运行任何OpenCv-Android应用程序之前,必须安装OpenCV Manager。