Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Thank you very much for your answers. Actually, after this(in JNI function):

 FaceRecognizer* model = createLBPHFaceRecognizer();
int k=model->getInt("radius");  //error here

I get segfault but if I use Ptr<facerecognizer> model=createLBPHFaceRecognizer() then I don't. I still have issues with the pointer returned by createLBPHFaceRecognizer.

I have done this:

-First I call

 JNIEXPORT jlong JNICALL Java_org_opencv_samples_fd_LBPFaceRecognizer_nativeCreateObject (JNIEnv * jenv, jclass) { FaceRecognizer* model = createLBPHFaceRecognizer();
return (jlong)model; }

that returns jlong memory address and stored it in my wrapper object.

Then I call

JNIEXPORT int JNICALL Java_org_opencv_samples_fd_LBPFaceRecognizer_nativeGetNeighbor
(JNIEnv * jenv, jclass, jlong ptr) {
int neigh=((FaceRecognizer*)ptr)->getInt("radius"),
return neigh;
}

with ptr equal to model's address returned by the previous function (nativeCreateObject) I still get segfault.