billmccord / OpenCV-Android

A project for porting and optimizing OpenCV for Google's Android OS
http://billmccord.github.com/OpenCV-Android/
444 stars 162 forks source link

simple OpenCVSample failed with segmentation fault #10

Open gymshoe opened 14 years ago

gymshoe commented 14 years ago

loaded the OpenCVSample using Eclipse (3.5) with ADT plugin 0.9.7, and using NDK-r4, and Android SDK1.6. With the new -r4 system of using "ndk-build", I wasn't sure what to do, so I put all of the jni files and the android.mk file into the jni folder of my project and ran ndk-build (like the new android-ndk-r4 directions tell you to) and the library libopencv.so appeared to build without problem...

I stripped the OpenCVSample code down, so all it does is call cv.findContours() of a Bitmap which I provide (only 50x50 in size) instead of pulling one from a camera. I get the following error:

05-27 19:31:39.696: INFO/DEBUG(31): Build fingerprint: 'generic/sdk/generic/:2.2/FRF42/36942:eng/test-keys' 05-27 19:31:39.706: INFO/DEBUG(31): pid: 17085, tid: 17085 >>> com.meetlocalfish <<< 05-27 19:31:39.706: INFO/DEBUG(31): signal 11 (SIGSEGV), fault addr 00000000 05-27 19:31:39.706: INFO/DEBUG(31): r0 00000001 r1 00000000 r2 80b3c2ec r3 00000000 05-27 19:31:39.706: INFO/DEBUG(31): r4 fffffffb r5 80a313e9 r6 80b0d384 r7 80b0d21c 05-27 19:31:39.736: INFO/DEBUG(31): r8 80b3c2ec r9 4104bc9c 10 4104bc84 fp 00000000 05-27 19:31:39.736: INFO/DEBUG(31): ip 80b3b568 sp bed627b8 lr afd15eeb pc 80a31188 cpsr 60000030 05-27 19:31:40.186: INFO/DEBUG(31): #00 pc 00031188 /data/data/com.meetlocalfish/lib/libopencv.so 05-27 19:31:40.186: INFO/DEBUG(31): #01 pc 0001f3a4 /data/data/com.meetlocalfish/lib/libopencv.so 05-27 19:31:40.208: INFO/DEBUG(31): #02 pc 0001e488 /data/data/com.meetlocalfish/lib/libopencv.so 05-27 19:31:40.301: INFO/DEBUG(31): #03 pc 00013974 /system/lib/libdvm.so 05-27 19:31:40.301: INFO/DEBUG(31): code around pc: 05-27 19:31:40.306: INFO/DEBUG(31): 80a31168 2b02686b 9b08d00d 46411c20 68eb9300

etc, etc...
Maybe, the bitmap is not acceptable, but it is an immutable bitmap, must like the one created by BitmapFactory.decodeByteArray() used in the original OpenCVSample code. I don't know.

I did notice that the JNI code seems to have the following parameters: Java_org_siprop_opencv_OpenCV_findContours(JNIEnv* env, jobject thiz, jint width, jint height) whereas the Java code passes: public native byte[] findContours(int[] data, int w, int h);

which seemed discordant (no array or matrix passed in the JNI code, but it is passed in the Java code), but I don't know too much about JNI (about to learn, lol).

Thanks, JIm

pflammertsma commented 14 years ago

You might find my resolution of issue #7 relevant. Let me know if it helps.