我想在JNI中编写一个函数,如下所示:
JNIEXPORT jobject JNICALL Java_com_datumdroid_android_ocr_simple_HoughLine_nativeDetectLine
(JNIEnv * jenv,jclass,jstring fileInput,jobject mat)
Java接口将是:
nativeDetectLine( String fileInput, Mat mat);
现在我想将Mat传递给JNI并更改其值。
有人可以给我一个教程或指南吗? 具体如何与jobjects一起工作。
答案 0 :(得分:1)
http://answers.opencv.org/question/12271/can-the-java-interface-pass-a-mat-to-opencvs-c/
JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial2_Tutorial2Activity_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba)
{
Mat& mGr = *(Mat*)addrGray;
Mat& mRgb = *(Mat*)addrRgba;
... do stuff with the Mat objects ...
}