Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

sigsegv on android jni using grabCut

Hi there

I've got this piece of code:

Mat src;
src = imread(argv[1]);
Rect rectangle(10, 10, src.cols - 5, src.rows - 5)
Mat result, fgModel, bgModel;
grabCut(src, result, rectangle, bgModel, fgModel, 2, GC_INIT_WITH_RECT);
compare(result, GC_PR_FGD,result,CMP_EQ);
Mat foreground(src.size(),CV_8UC3, Scalar(255,255,255));
src.copyTo(foreground, result);

which works fine except on Android, when it results in "signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad". It's called from jni method and looks pretty much the same as in my desktop app, where it doesn't crush. Any ideas?

sigsegv on android jni using grabCut

Hi there

I've got this piece of code:

Mat src;
src = imread(argv[1]);
Rect rectangle(10, 10, src.cols - 5, src.rows - 5)
Mat result, fgModel, bgModel;
grabCut(src, result, rectangle, bgModel, fgModel, 2, GC_INIT_WITH_RECT);
compare(result, GC_PR_FGD,result,CMP_EQ);
Mat foreground(src.size(),CV_8UC3, Scalar(255,255,255));
src.copyTo(foreground, result);

which works fine except on Android, when it results in "signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad". It's called from jni method and looks pretty much the same as in my desktop app, where it doesn't crush. Any ideas?

[edit] I was thinking maybe it has something to do with android RGBA format? What imread() opens is an image saved as a jpg file (a picture taken from camera) . Maybe its format is what grabCut doesn't accept as a source? I tried converting it to CV_8UC3 but the result is the same.