Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problem with SVM predict on android

Hello everyone,

I am working on an application on android that uses SVM class of OpenCV. I tested the code on my mac without any problem and it provides quite good results. The training and the detection part work quite fine, I tested them on mac OS and I included it in iOS without any problem.

I spent several weeks trying to include it in an android application using the NDK. Without Success. I first tried some basic opencv examples on android and it worked fine. But when using SVM, I have a SIGSEGV (Segmentation Fault) when it enters the predict (CvSVM::predict). There is a std::bad_alloc log.

Here is the most relevant log I got : 01-01 04:51:08.863: I/stderr(10641): terminate called after throwing an instance of 'std::bad_alloc' 01-01 04:51:08.863: I/stderr(10641): what(): std::bad_alloc 01-01 04:51:08.867: A/libc(10641): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 10641 (mples.tutorial2) 01-01 04:51:09.004: I/DEBUG(91): * 01-01 04:51:09.582: I/DEBUG(91): becc40bc 53fb7451 /data/app-lib/org.opencv.samples.tutorial2-1/libopencv_java.so (CvSVM::predict(float const, int, bool) const)

What I already tried (among other things):

  • reducing image size to see if it is a memory problem
  • verify all the classifiers and dictionary
  • verify that there are actually detected key points

I really got our of ideas of what to try to make it work on android. I don't know if there is some restriction on android that makes it impossible to run. It works on iOS and on my Mac OS but not on android.

Thank you much for reading. Any help or suggestion is welcome.

Problem with SVM predict on android

Hello everyone,

I am working on an application on android that uses SVM CvSVM class of OpenCV. OpenCV. I tested the code on my mac without any problem and it provides quite good results. The training and the detection part work quite fine, I tested them on mac OS OS and I included it in iOS iOS without any problem.

I spent several weeks trying to include it in an android application using the NDK. Without Success. I first tried some basic opencv examples on android and it worked fine. But when using SVM, I have a SIGSEGV (Segmentation Fault) when it enters the predict (CvSVM::predict). There is a std::bad_alloc log.

Here is the most relevant log I got : :

01-01 04:51:08.863: I/stderr(10641): terminate called after throwing an instance of 'std::bad_alloc' 01-01 04:51:08.863: I/stderr(10641): what(): std::bad_alloc 01-01 04:51:08.867: A/libc(10641): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 10641 (mples.tutorial2) 01-01 04:51:09.004: I/DEBUG(91): * 01-01 04:51:09.582: I/DEBUG(91): becc40bc 53fb7451 /data/app-lib/org.opencv.samples.tutorial2-1/libopencv_java.so (CvSVM::predict(float const, int, bool) const)

What I already tried (among other things):

  • reducing image size to see if it is a memory problem
  • verify all the classifiers and dictionary
  • verify that there are actually detected key points

I really got our of ideas of what to try to make it work on android. I don't know if there is some restriction on android that makes it impossible to run. It works on iOS and on my Mac OS but not on android.

Thank you much for reading. Any help or suggestion is welcome.

Problem with SVM predict on android

Hello everyone,

I am working on an application on android that uses CvSVM class of OpenCV. I tested the code on my mac without any problem and it provides quite good results. The training and the detection part work quite fine, I tested them on mac OS and I included it in iOS without any problem.

I spent several weeks trying to include it in an android application using the NDK. Without Success. I first tried some basic opencv examples on android and it worked fine. But when using SVM, I have a SIGSEGV (Segmentation Fault) when it enters the predict (CvSVM::predict). There is a std::bad_alloc log.

Here is the most relevant log I got :

01-01 04:51:08.863: I/stderr(10641): terminate called after throwing an instance of 'std::bad_alloc'
01-01 04:51:08.863: I/stderr(10641): what(): std::bad_alloc **std::bad_alloc**
01-01 04:51:08.867: A/libc(10641): Fatal **Fatal signal 11 (SIGSEGV) (SIGSEGV)** at 0xdeadbaad (code=1), thread 10641 (mples.tutorial2)
01-01 04:51:09.004: I/DEBUG(91): *                *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-01 04:51:09.582: I/DEBUG(91): becc40bc 53fb7451 /data/app-lib/org.opencv.samples.tutorial2-1/libopencv_java.so /data/app-lib/org.opencv.samples.tutorial2-1/**libopencv_java.so (CvSVM::predict(float const, const*, int, bool) const)

const)**

What I already tried (among other things):

  • reducing image size to see if it is a memory problem
  • verify all the classifiers and dictionary
  • verify that there are actually detected key points

I really got our of ideas of what to try to make it work on android. I don't know if there is some restriction on android that makes it impossible to run. It works on iOS and on my Mac OS but not on android.

Thank you much for reading. Any help or suggestion is welcome.