Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Android: Native Opencv - cvtColor segfault

I want to pass a newly taken picture by android camera app to my native part so i can run my object detector over it.

What i've done is, on java code, getting the picture through this: Mat original = Highgui.imread("data");

I've also created two more Mat to pass to the native code as well. I pass the Mat's getNativeObjAddr() and everything works.

The problem is, after i get the arguments (over to the cpp native code) i pass two Mat (original and gray) to cv::InputArray and cv::OutputArray, accordingly, but cvtColor(original(InputArra), gray(OutputArray), CV_BGR2GRAY, 0) gives a segfault and the app closes.

Is this NOT the best way to pass images to native part? Am i doing something wrong? Do you have any suggestion? Please, speak your mind :)

click to hide/show revision 2
retagged

Android: Native Opencv - cvtColor segfault

I want to pass a newly taken picture by android camera app to my native part so i can run my object detector over it.

What i've done is, on java code, getting the picture through this: Mat original = Highgui.imread("data");

I've also created two more Mat to pass to the native code as well. I pass the Mat's getNativeObjAddr() and everything works.

The problem is, after i get the arguments (over to the cpp native code) i pass two Mat (original and gray) to cv::InputArray and cv::OutputArray, accordingly, but cvtColor(original(InputArra), gray(OutputArray), CV_BGR2GRAY, 0) gives a segfault and the app closes.

Is this NOT the best way to pass images to native part? Am i doing something wrong? Do you have any suggestion? Please, speak your mind :)