예제 #1
0
int main(int argc, char *argv[])
{
    br::Context::initialize(argc, argv);

    // Retrieve classes for enrolling and comparing templates using the FaceRecognition algorithm
    QSharedPointer<br::Transform> transform = br::Transform::fromAlgorithm("FaceRecognition");
    QSharedPointer<br::Distance> distance = br::Distance::fromAlgorithm("FaceRecognition");

    // Initialize templates
    br::Template queryA("../data/MEDS/img/S354-01-t10_01.jpg");
    br::Template queryB("../data/MEDS/img/S386-04-t10_01.jpg");
    br::Template target("../data/MEDS/img/S354-02-t10_01.jpg");

    // Enroll templates
    queryA >> *transform;
    queryB >> *transform;
    target >> *transform;

    printTemplate(queryA);
    printTemplate(queryB);
    printTemplate(target);

    // Compare templates
    float comparisonA = distance->compare(target, queryA);
    float comparisonB = distance->compare(target, queryB);

    // Scores range from 0 to 1 and represent match probability
    printf("Genuine match score: %.3f\n", comparisonA);
    printf("Impostor match score: %.3f\n", comparisonB);

    br::Context::finalize();
    return 0;
}
예제 #2
0
JNIEXPORT jdouble JNICALL Java_FaceDetectJNI_FaceDetectBR_compareResult(JNIEnv *env, jobject obj, jstring file1, jstring file2)
{
    
    const char* filepath1 = env->GetStringUTFChars(file1, NULL);
    const char* filepath2 = env->GetStringUTFChars(file2, NULL);

    double result;

    // Retrieve classes for enrolling and comparing templates using the FaceRecognition algorithm
    QSharedPointer<br::Transform> transform = br::Transform::fromAlgorithm("FaceRecognition");

    // Initialize templates
    br::Template queryA(filepath1);
    br::Template target(filepath2);
    
    // Enroll templates
    queryA >> *transform;
    target >> *transform;

    // Compare templates
    result = distance->compare(target, queryA);

    env->ReleaseStringUTFChars(file1,filepath1);
    env->ReleaseStringUTFChars(file2,filepath2);
    return result;
}
예제 #3
0
int main(int argc, char *argv[])
{
    br::Context::initialize(argc, argv);

    // Retrieve class for enrolling templates using the AgeEstimation algorithm
    QSharedPointer<br::Transform> transform = br::Transform::fromAlgorithm("AgeEstimation");

    // Initialize templates
    br::Template queryA("../data/MEDS/img/S354-01-t10_01.jpg");
    br::Template queryB("../data/MEDS/img/S001-01-t10_01.jpg");

    // Enroll templates
    queryA >> *transform;
    queryB >> *transform;

    printTemplate(queryA);
    printTemplate(queryB);

    br::Context::finalize();
    return 0;
}