Ask Your Question

Revision history [back]

Segfault when using add on Android

What I'm essentially trying to do is: L = (17.8824 * r) + (43.5161 * g) + (4.11935 * b)

The code I'm using for that is essentially:

Mat rgb = inputFrame.rgba();
List<Mat> rgbSplit = new ArrayList<Mat>(3);
Core.split(rgb, rgbSplit);
Mat r = rgbSplit.get(0);
Mat g = rgbSplit.get(1);
Mat b = rgbSplit.get(2);
Mat t1 = new Mat();
Mat t2 = new Mat();
Mat t3 = new Mat();
Mat L = new Mat();
Core.convertScaleAbs(r, t1, 17.8824, 0);
Core.convertScaleAbs(g, t2, 43.5161, 0);
Core.convertScaleAbs(b, t3, 4.11935, 0);
Core.add(t1, t2, L);
Core.add(L, t3, L);

However, if I have the add then I get:

A/libc: Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)

I am modifying tutorial-1-camera-preview, which works fine. I am using Android Studio on a Win 10 machine.