Ask Your Question

Revision history [back]

You can call flandmark methods using Java Native Interface (JNI).

For example:

c++ code to initialize flandmark

 // load flandmark model structure and initialize
 FLANDMARK_Model * model = flandmark_init("flandmark_model.dat");

java code to initialize flandmark

    private long mNatModel;
public FlandmarkLandmarkDetector(String modelFilename) {
    this.mNatModel = natInitLandmarkDetector(modelFilename);
            ..............
}

    //and the jni code:
    JNIEXPORT jlong JNICALL  Java_org_......_natInitLandmarkDetector(
    JNIEnv * jenv, jobject, jstring jModelFilename) {
         jlong result = 0;
         const char* modelFilename = jenv->GetStringUTFChars(jModelFilename, NULL);
         FLANDMARK_Model * model = flandmark_init(modelFilename);
         result = (jlong) model;

         return result;
    }