I am developing an Android application using Opencv for image processing.
The processing part is called in java through JNI functions.
I am sending to c++ two Opencv Mat objects to find matching points.
The problem is that sometimes the app works and sometimes it doesn't even while using the same images.
I already check if the images aren't empty and that they are valid before sending them to the native part.
Here is the stack trace is get in Log
2019-04-26 12:52:06.980 24955-25666/com.grimg.coffretpfe A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 25666 (Thread-10)
2019-04-26 12:52:07.078 25766-25766/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2019-04-26 12:52:07.078 25766-25766/? A/DEBUG: Build fingerprint: 'samsung/zeroltexx/zerolte:7.0/NRD90M/G925FXXU6ERF5:user/release-keys'
2019-04-26 12:52:07.078 25766-25766/? A/DEBUG: Revision: '10'
2019-04-26 12:52:07.078 25766-25766/? A/DEBUG: ABI: 'arm'
2019-04-26 12:52:07.078 25766-25766/? A/DEBUG: pid: 24955, tid: 25666, name: Thread-10  >>> com.grimg.coffretpfe <<<
2019-04-26 12:52:07.078 25766-25766/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
2019-04-26 12:52:07.078 25766-25766/? A/DEBUG:     r0 00000000  r1 00000000  r2 00000000  r3 b90a641c
2019-04-26 12:52:07.079 25766-25766/? A/DEBUG:     r4 ffffffff  r5 c09a4128  r6 b90a678c  r7 b90a6670
2019-04-26 12:52:07.079 25766-25766/? A/DEBUG:     r8 d33ee570  r9 97df7155  sl b90a6790  fp c06e3900
2019-04-26 12:52:07.079 25766-25766/? A/DEBUG:     ip c5ec4840  sp b90a6268  lr c5eb8043  pc c5eb8042  cpsr 600f0030
2019-04-26 12:52:07.081 25766-25766/? A/DEBUG: backtrace:
2019-04-26 12:52:07.081 25766-25766/? A/DEBUG:     #00 pc 00014042  /data/app/com.grimg.coffretpfe-2/lib/arm/libnative-lib.so (_Z6toGrayN2cv3MatES0_+1577)
2019-04-26 12:52:07.081 25766-25766/? A/DEBUG:     #01 pc 00014d65  /data/app/com.grimg.coffretpfe-2/lib/arm/libnative-lib.so (Java_com_grimg_coffretpfe_Activities_CompareActivity_detectFeatures+124)
2019-04-26 12:52:07.081 25766-25766/? A/DEBUG:     #02 pc 000adc99  /system/lib/libart.so (art_quick_generic_jni_trampoline+40)
2019-04-26 12:52:07.081 25766-25766/? A/DEBUG:     #03 pc 0000b0dd  /dev/ashmem/dalvik-jit-code-cache_24955_24955 (deleted)
I am running my app on a Samsung s6 edge, if this matters.
My native part contains two functions, toGray and here is the signature
double toGray(Mat captured, Mat target)
I didnt added the code because it's a lot of processing and operations
And the method I call in java is detectFeatures
extern "C" {
JNIEXPORT
jdouble
JNICALL Java_com_grimg_coffretpfe_Activities_CompareActivity_detectFeatures(
    JNIEnv *env,
    jobject instance,
    jlong addrRgba,
    jlong addrGray) {
 if (addrGray != NULL && addrRgba != NULL) {
    cv::Mat &mRgb = *(cv::Mat *) addrRgba;
    cv::Mat &mGray = *(cv::Mat *) addrGray;
    jdouble retVal;
    double conv = toGray(mRgb, mGray);
    retVal = (jdouble) conv;
    return retVal;
  }
   return -1;
 }
 }
I tried every available solution over here , but nothing works ,besides I don't really understand the problem so I don't know what to search for.
I hope you guys can help me solve this problem. Thanx in advance.
Aucun commentaire:
Enregistrer un commentaire