Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 353

When I use 'cvtColor' with JNI, Console says: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xa4400000 in tid 3689

$
0
0
Recently, I try using OpenCV at Android.I write a native method,and use it at java. JNIEXPORT jintArray JNICALL Java_yu_myself_opencv_jni_OpenCVHelper_canny( JNIEnv *env, jclass obj, jintArray buf, int w, int h){ jint *cbuf; cbuf = env->GetIntArrayElements(buf, JNI_FALSE); if (cbuf == NULL) { return 0; } Mat srcImage(h, w, CV_8UC4, (unsigned char *) cbuf); Mat grayImage(srcImage.size(), srcImage.type()); LOGD("1"); cvtColor(srcImage, grayImage, COLOR_BGRA2GRAY); LOGD("2"); jint* ptr = (jint*)grayImage.ptr(0); LOGD("3"); int size = w * h; LOGD("4"); jintArray result = env->NewIntArray(size); LOGD("5"); env->SetIntArrayRegion(result, 0, size, ptr); LOGD("6"); env->ReleaseIntArrayElements(buf, cbuf, 0); LOGD("7"); return result; } But it crashed.I see the result of console: 07-05 17:32:16.721 3689-3689/yu.myself.opencv D/NDK/OpenCVHelper: 1 07-05 17:32:16.727 3689-3689/yu.myself.opencv D/NDK/OpenCVHelper: 2 07-05 17:32:16.728 3689-3689/yu.myself.opencv D/NDK/OpenCVHelper: 3 07-05 17:32:16.728 3689-3689/yu.myself.opencv D/NDK/OpenCVHelper: 4 07-05 17:32:16.739 3689-3689/yu.myself.opencv D/NDK/OpenCVHelper: 5 07-05 17:32:16.743 3689-3689/yu.myself.opencv A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xa4400000 in tid 3689 (u.myself.opencv) I don't know why there is such a problem. What should I do?

Viewing all articles
Browse latest Browse all 353

Trending Articles