Skip to content Skip to sidebar Skip to footer

Pass And Return Opencv Mat Object With Jni

I would like to write a function in JNI like this: JNIEXPORT jobject JNICALL Java_com_datumdroid_android_ocr_simple_HoughLine_nativeDetectLine (JNIEnv * jenv, jclass, jstring file

Solution 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 ...
}

Post a Comment for "Pass And Return Opencv Mat Object With Jni"