help running opencv on android
I'm trying to run this opencv sample for android from here. http://code.google.com/p/android-opencv/
I've followed the instructions very closely and successfully built opencv and then CVCamera from the samples. I then setup opencv as an android library project and referenced it from CVCamera.
When I install the app on to the emulator and run it, I don't get any errors. The app focuses and immediately loses focus and seems to terminate. Here are the DDMS messages. Any idea why it might not be working?
01-09 07:36:32.503: INFO/ActivityManager(53): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.theveganrobot.cvcamera/.CVCamera }
01-09 07:36:32.593: INFO/ActivityManager(53): Start proc com.theveganrobot.cvcamera for activity com.theveganrobot.cvcamera/.CVCamera: pid=230 uid=10024 gids={1006, 1015}
01-09 07:36:32.913: DEBUG/ddm-heap(230): Got feature list request
01-09 07:36:32.983: INFO/WindowManager(53): Setting rotation to 1, animFlags=0
01-09 07:36:33.073: INFO/ActivityManager(53): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3/1 orien=2 layout=18}
01-09 07:36:33.363: DEBUG/dalvikvm(230): Trying to load lib /data/data/com.theveganrobot.cvcamera/lib/libandroid-opencv.so 0x43d0bb68
01-09 07:36:33.493: INFO/DEBUG(28): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-09 07:36:33.503: INFO/DEBUG(28): Build fingerprint: 'generic/sdk/generic/:2.1-update1/ECLAIR/35983:eng/test-keys'
01-09 07:36:33.503: INFO/DEBUG(28): pid: 230, tid: 230 >>> com.theveganrobot.cvcamera <<<
01-09 07:36:33.503: INFO/DEBUG(28): signal 4 (SIGILL), fault addr 80d763a4
01-09 07:36:33.503: INFO/DEBUG(28): r0 00000000 r1 80e0cbb8 r2 80ca9199 r3 80cb1839
01-09 07:36:33.503: INFO/DEBUG(28): r4 000efdf0 r5 80e6fa24 r6 00000004 r7 00000000
01-09 07:36:33.503: INFO/DEBUG(28): r8 ad00f380 r9 0000bd00 10 4104bbe8 fp 00000000
01-09 07:36:33.503: INFO/DEBUG(28): ip 80e66208 sp becb4600 lr 80ca94c7 pc 80d763a4 cpsr 60000030
01-09 07:36:33.603: INFO/DEBUG(28): #00 pc 001763a4 /data/data/com.theveganrobot.cvcamera/lib/libandroid-opencv.so
01-09 07:36:33.603: INFO/DEBUG(28): #01 pc 000a94c2 /data/data/com.theveganrobot.cvcamera/lib/libandroid-opencv.so
01-09 07:36:33.613: INFO/DEBUG(28): #02 pc b00001fc /system/bin/linker
01-09 07:36:33.613: INFO/DEBUG(28): #03 pc b00002bc /system/bin/linker
01-09 07:36:33.613: INFO/DEBUG(28): #04 pc b00018a4 /system/bin/linker
01-09 07:36:33.624: INFO/DEBUG(28): #05 pc b0001b70 /system/bin/linker
01-09 07:36:33.624: INFO/DEBUG(28): #06 pc b0001552 /system/bin/linker
01-09 07:36:33.624: INFO/DEBUG(28): #07 pc b0001cbc /system/bin/linker
01-09 07:36:33.624: INFO/DEBUG(28): #08 pc 0003cdfc /system/lib/libdvm.so
01-09 07:36:33.624: INFO/DEBUG(28): #09 pc 0005416a /system/lib/libdvm.so
01-09 07:36:33.634: INFO/DEBUG(28): #10 pc 00013f58 /system/lib/libdvm.so
01-09 07:36:33.644: INFO/DEBUG(28): #11 pc 00019888 /system/lib/libdvm.so
01-09 07:36:33.644: INFO/DEBUG(28): #12 pc 00018d5c /system/lib/libdvm.so
01-09 07:36:33.644: INFO/DEBUG(28): #13 pc 0004d6d0 /system/lib/libdvm.so
01-09 07:36:33.644: INFO/DEBUG(28): #14 pc 0004d702 /system/lib/libdvm.so
01-09 07:36:33.654: INFO/DEBUG(28): #15 pc 00058232 /system/lib/libdvm.so
01-09 07:36:33.654: INFO/DEBUG(28): #16 pc 00059ab4 /system/lib/libdvm.so
01-09 07:36:33.664: INFO/DEBUG(28): #17 pc 00010fe8 /system/lib/libdvm.so
01-09 07:36:33.674: INFO/DEBUG(28): #18 pc 00019888 /system/lib/libdvm.so
01-09 07:36:33.674: INFO/DEBUG(28): #19 pc 00018d5c /system/lib/libdvm.so
01-09 07:36:33.683: INFO/DEBUG(28): #20 pc 0004d6d0 /system/lib/libdvm.so
01-09 07:36:33.683: INFO/DEBUG(28): #21 pc 0004d702 /system/lib/libdvm.so
01-09 07:36:33.683: INFO/DEBUG(28): #22 pc 00053ce4 /system/lib/libdvm.so
01-09 07:36:33.694: INFO/DEBUG(28): #23 pc 00013f58 /system/lib/libdvm.so
01-09 07:36:33.694: INFO/DEBUG(28): #24 pc 00019888 /system/lib/libdvm.so
01-09 07:36:33.703: INFO/DEBUG(28): #25 pc 00018d5c /system/lib/libdvm.so
01-09 07:36:33.703: INFO/DEBUG(28): #26 pc 0004d3bc /system/lib/libdvm.so
01-09 07:36:33.703: INFO/DEBUG(28): #27 pc 00054e74 /system/lib/libdvm.so
01-09 07:36:33.703: INFO/DEBUG(28): #28 pc 00013f58 /system/lib/libdvm.so
01-09 07:36:33.703: INFO/DEBUG(28): #29 pc 00019888 /system/lib/libd开发者_JS百科vm.so
01-09 07:36:33.714: INFO/DEBUG(28): #30 pc 00018d5c /system/lib/libdvm.so
01-09 07:36:33.734: INFO/DEBUG(28): #31 pc 0004d6d0 /system/lib/libdvm.so
01-09 07:36:33.734: INFO/DEBUG(28): code around pc:
01-09 07:36:33.734: INFO/DEBUG(28): 80d76394 b08bb530 46054c10 20009306 bf009b10
01-09 07:36:33.734: INFO/DEBUG(28): 80d763a4 0c00f20f 44649000 f04f9003 93090c28
01-09 07:36:33.734: INFO/DEBUG(28): 80d763b4 90029b0e f8cd4668 9307c004 91049b0f
01-09 07:36:33.734: INFO/DEBUG(28): code around lr:
01-09 07:36:33.734: INFO/DEBUG(28): 80ca94b4 480f1861 58e318a2 90021820 f0cc4628
01-09 07:36:33.734: INFO/DEBUG(28): 80ca94c4 4b0cff67 58e14628 58e24b0b ec24f7b1
01-09 07:36:33.734: INFO/DEBUG(28): 80ca94d4 bd30b005 001bccfc ffe445c1 00000264
01-09 07:36:33.744: INFO/DEBUG(28): stack:
01-09 07:36:33.744: INFO/DEBUG(28): becb45c0 b000fd00 /system/bin/linker
01-09 07:36:33.744: INFO/DEBUG(28): becb45c4 80e660c0 /data/data/com.theveganrobot.cvcamera/lib/libandroid-opencv.so
01-09 07:36:33.744: INFO/DEBUG(28): becb45c8 00000000
01-09 07:36:33.780: INFO/DEBUG(28): becb45cc b0000559 /system/bin/linker
01-09 07:36:33.784: INFO/DEBUG(28): becb45d0 0000001b
01-09 07:36:33.784: INFO/DEBUG(28): becb45d4 aca01df2 /system/lib/libGLESv2.so
01-09 07:36:33.784: INFO/DEBUG(28): becb45d8 b00163f8
01-09 07:36:33.784: INFO/DEBUG(28): becb45dc b00032e8 /system/bin/linker
01-09 07:36:33.784: INFO/DEBUG(28): becb45e0 b00129d8
01-09 07:36:33.784: INFO/DEBUG(28): becb45e4 becb45fc [stack]
01-09 07:36:33.784: INFO/DEBUG(28): becb45e8 80c3b080 /data/data/com.theveganrobot.cvcamera/lib/libandroid-opencv.so
01-09 07:36:33.784: INFO/DEBUG(28): becb45ec b000fac4 /system/bin/linker
01-09 07:36:33.794: INFO/DEBUG(28): becb45f0 afe42c7c
01-09 07:36:33.794: INFO/DEBUG(28): becb45f4 afe0f3b0 /system/lib/libc.so
01-09 07:36:33.794: INFO/DEBUG(28): becb45f8 df002777
01-09 07:36:33.794: INFO/DEBUG(28): becb45fc e3a070ad
01-09 07:36:33.794: INFO/DEBUG(28): #00 becb4600 00000000
01-09 07:36:33.794: INFO/DEBUG(28): becb4604 afe0f2c0 /system/lib/libc.so
01-09 07:36:33.794: INFO/DEBUG(28): becb4608 00000000
01-09 07:36:33.794: INFO/DEBUG(28): becb460c 00000001
01-09 07:36:33.794: INFO/DEBUG(28): becb4610 00001000
01-09 07:36:33.804: INFO/DEBUG(28): becb4614 80c5bbdc /data/data/com.theveganrobot.cvcamera/lib/libandroid-opencv.so
01-09 07:36:33.804: INFO/DEBUG(28): becb4618 80caa5a1 /data/data/com.theveganrobot.cvcamera/lib/libandroid-opencv.so
01-09 07:36:33.804: INFO/DEBUG(28): becb461c afe23043 /system/lib/libc.so
01-09 07:36:33.804: INFO/DEBUG(28): becb4620 00000000
01-09 07:36:33.804: INFO/DEBUG(28): becb4624 afe179a5 /system/lib/libc.so
01-09 07:36:33.804: INFO/DEBUG(28): becb4628 00000000
01-09 07:36:33.804: INFO/DEBUG(28): becb462c 80e66198 /data/data/com.theveganrobot.cvcamera/lib/libandroid-opencv.so
01-09 07:36:33.804: INFO/DEBUG(28): becb4630 80e6fa24
01-09 07:36:33.804: INFO/DEBUG(28): becb4634 80ca94c7 /data/data/com.theveganrobot.cvcamera/lib/libandroid-opencv.so
01-09 07:36:33.804: INFO/DEBUG(28): #01 becb4638 80caa759 /data/data/com.theveganrobot.cvcamera/lib/libandroid-opencv.so
01-09 07:36:33.804: INFO/DEBUG(28): becb463c 80ca91bd /data/data/com.theveganrobot.cvcamera/lib/libandroid-opencv.so
01-09 07:36:33.804: INFO/DEBUG(28): becb4640 80cb1839 /data/data/com.theveganrobot.cvcamera/lib/libandroid-opencv.so
01-09 07:36:33.804: INFO/DEBUG(28): becb4644 80e63bf8 /data/data/com.theveganrobot.cvcamera/lib/libandroid-opencv.so
01-09 07:36:33.804: INFO/DEBUG(28): becb4648 00000004
01-09 07:36:33.804: INFO/DEBUG(28): becb464c 80e63bfc /data/data/com.theveganrobot.cvcamera/lib/libandroid-opencv.so
01-09 07:36:33.804: INFO/DEBUG(28): becb4650 00000003
01-09 07:36:33.804: INFO/DEBUG(28): becb4654 b00001ff /system/bin/linker
01-09 07:36:34.454: DEBUG/Zygote(30): Process 230 terminated by signal (4)
01-09 07:36:34.454: INFO/ActivityManager(53): Process com.theveganrobot.cvcamera (pid 230) has died.
01-09 07:36:34.514: INFO/ARMAssembler(53): generated scanline__00000077:03010104_00000004_00000000 [ 22 ipp] (41 ins) at [0x48c470:0x48c514] in 13459425 ns
01-09 07:36:34.644: DEBUG/dalvikvm(53): GC freed 4974 objects / 263544 bytes in 145ms
01-09 07:36:34.654: INFO/WindowManager(53): Setting rotation to 0, animFlags=0
01-09 07:36:34.704: INFO/ActivityManager(53): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3/1 orien=1 layout=18}
01-09 07:36:34.814: INFO/UsageStats(53): Unexpected resume of com.android.launcher while already resumed in com.theveganrobot.cvcamera
01-09 07:36:34.894: WARN/InputManagerService(53): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43cb43c8
01-09 07:36:37.094: DEBUG/dalvikvm(53): GC freed 1944 objects / 103176 bytes in 78ms
I'm having the same problem... it seems to be a bug. Here's the link to the ticket
https://code.ros.org/trac/opencv/ticket/789
The error occurs for me only when using the Emulator. If you try loading and running on the device directly, it might work
SIGILL means that your program is trying to execute illegal instructions. In this case, the problem is that the emulator (as well as older devices) can only execute instructions from the ARMv5 ISA, while to gain better performance, we usually want things like OpenCV to be compiled against the ARMv7 ISA, which comes with an FPU. More info about this issue in this thread:
http://groups.google.com/group/android-ndk/browse_thread/thread/a19fc6df3d661d79
To solve this, you need to recompile OpenCV without using any of the "v7" things from the NDK.
精彩评论