Passing InputArrayOfArrays from java class to JNI

asked 2017-09-08 03:31:13 -0600

gunas.idesign gravatar image

I have generated following method in JNI cpp file,

JNIEXPORT void JNICALL Java_com_idesign_opencvmaketest_MainActivity_train
        (JNIEnv *env, jobject thisObj, jobjectArray images, jobjectArray labels) {
    Ptr<LBPHFaceRecognizer> model = LBPHFaceRecognizer::create();

    /** make a call to 
    *   CV_WRAP virtual void train(InputArrayOfArrays src, InputArray labels) = 0;
    **/
    model->train(images, labels);
}

Now I am getting

Parameter type mismatch: Types 'const _InputArray' and 'jobjectArray' are not compatible

at images and labels in model->train(images, labels);

So what would be the parameter type for images and labels in MainActivity_train method.

And also may know how to call this JNI method from Java class with correct parameter type.

As I am new to OpenCv and JNI, already I have spent lot of time on this..

So any help will be highly appreciated.

edit retag flag offensive close merge delete