3
我正在处理Android应用程序与OpenCV和JNI之间传递的参数。在Java中使用OpenCV库我在Android应用程序代码中使用了类似的东西。Android和JNI之间的参数传递
的Android OpenCV的Java代码:
Mat mat; //Mat object with data
Rect rect; //Rect object with data
//call to the native function
int resProc = Native.processImages_native(rect, mat);
C代码:
JNIEXPORT jint JNICALL Java_com_test_Native_processImages_1native
(JNIEnv*, jclass, CvRect, Mat);
...
jint Java_com_test_Native_processImages_1native
(JNIEnv* env, jclass jc, CvRect rect, Mat mat){
int res = processImages(rect, mat);
return (jint)res;
}
...
int processImages(CvRect rect, Mat mat)
{
IplImage *ipl_Img = &mat.operator IplImage(); // here FAILS
CvRect rect_value = rect;
}
但是,当我试图让从(MAT)去转换(IplImage结构*)在C代码我的应用程序失败。所以我的问题是关于如何将Android Java代码中的CvRect和Mat对象传递给JNI。有一个更好的方法吗?
非常感谢。
似乎工作,非常感谢! – brachialste 2014-10-02 20:48:17